Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
belle-sip
Commits
fdf3bac2
Commit
fdf3bac2
authored
Jul 04, 2015
by
Ghislain MARY
Browse files
Set the BelleSipTester class to be a singleton on Windows 10.
parent
935faa77
Changes
2
Hide whitespace changes
Inline
Side-by-side
tester/belle_sip_tester_windows.cpp
View file @
fdf3bac2
...
...
@@ -15,6 +15,8 @@ using namespace Windows::System::Threading;
static
OutputTraceListener
^
sTraceListener
;
static
belle_sip_object_pool_t
*
pool
;
BelleSipTester
^
BelleSipTester
::
_instance
=
ref
new
BelleSipTester
();
static
void
nativeOutputTraceHandler
(
int
lev
,
const
char
*
fmt
,
va_list
args
)
{
if
(
sTraceListener
)
{
...
...
@@ -34,7 +36,7 @@ static void belleSipNativeOutputTraceHandler(belle_sip_log_level lev, const char
}
BelleSipTester
::
BelleSipTester
(
bool
autoLaunch
)
BelleSipTester
::
BelleSipTester
()
{
char
writable_dir
[
MAX_WRITABLE_DIR_SIZE
];
StorageFolder
^
folder
=
ApplicationData
::
Current
->
LocalFolder
;
...
...
@@ -43,25 +45,7 @@ BelleSipTester::BelleSipTester(bool autoLaunch)
belle_sip_tester_init
(
nativeOutputTraceHandler
);
bc_tester_set_resource_dir_prefix
(
"Assets"
);
bc_tester_set_writable_dir_prefix
(
writable_dir
);
if
(
autoLaunch
)
{
auto
workItem
=
ref
new
WorkItemHandler
([
this
](
IAsyncAction
^
workItem
)
{
char
*
xmlFile
=
bc_tester_file
(
"BelleSipWindows10.xml"
);
char
*
logFile
=
bc_tester_file
(
"BelleSipWindows10.log"
);
char
*
args
[]
=
{
"--xml-file"
,
xmlFile
};
bc_tester_parse_args
(
2
,
args
,
0
);
init
(
true
);
FILE
*
f
=
fopen
(
logFile
,
"w"
);
belle_sip_set_log_file
(
f
);
bc_tester_start
();
bc_tester_uninit
();
fclose
(
f
);
free
(
xmlFile
);
free
(
logFile
);
});
asyncAction
=
ThreadPool
::
RunAsync
(
workItem
);
}
else
{
belle_sip_set_log_handler
(
belleSipNativeOutputTraceHandler
);
}
belle_sip_set_log_handler
(
belleSipNativeOutputTraceHandler
);
}
BelleSipTester
::~
BelleSipTester
()
...
...
@@ -74,6 +58,19 @@ void BelleSipTester::setOutputTraceListener(OutputTraceListener^ traceListener)
sTraceListener
=
traceListener
;
}
void
BelleSipTester
::
init
(
bool
verbose
)
{
if
(
verbose
)
{
belle_sip_set_log_level
(
BELLE_SIP_LOG_DEBUG
);
}
else
{
belle_sip_set_log_level
(
BELLE_SIP_LOG_ERROR
);
}
belle_sip_tester_set_root_ca_path
(
"Assets/rootca.pem"
);
pool
=
belle_sip_object_pool_push
();
}
void
BelleSipTester
::
run
(
Platform
::
String
^
suiteName
,
Platform
::
String
^
caseName
,
Platform
::
Boolean
verbose
)
{
std
::
wstring
all
(
L"ALL"
);
...
...
@@ -88,6 +85,26 @@ void BelleSipTester::run(Platform::String^ suiteName, Platform::String^ caseName
bc_tester_run_tests
(
wssuitename
==
all
?
0
:
csuitename
,
wscasename
==
all
?
0
:
ccasename
);
}
void
BelleSipTester
::
runAllToXml
()
{
init
(
true
);
auto
workItem
=
ref
new
WorkItemHandler
([
this
](
IAsyncAction
^
workItem
)
{
char
*
xmlFile
=
bc_tester_file
(
"BelleSipWindows10.xml"
);
char
*
logFile
=
bc_tester_file
(
"BelleSipWindows10.log"
);
char
*
args
[]
=
{
"--xml-file"
,
xmlFile
};
bc_tester_parse_args
(
2
,
args
,
0
);
init
(
true
);
FILE
*
f
=
fopen
(
logFile
,
"w"
);
belle_sip_set_log_file
(
f
);
bc_tester_start
();
bc_tester_uninit
();
fclose
(
f
);
free
(
xmlFile
);
free
(
logFile
);
});
_asyncAction
=
ThreadPool
::
RunAsync
(
workItem
);
}
unsigned
int
BelleSipTester
::
nbTestSuites
()
{
return
bc_tester_nb_suites
();
...
...
@@ -119,21 +136,3 @@ Platform::String^ BelleSipTester::testName(Platform::String^ suiteName, int test
mbstowcs
(
wcname
,
cname
,
sizeof
(
wcname
));
return
ref
new
String
(
wcname
);
}
IAsyncAction
^
BelleSipTester
::
AsyncAction
::
get
()
{
return
asyncAction
;
}
void
BelleSipTester
::
init
(
bool
verbose
)
{
if
(
verbose
)
{
belle_sip_set_log_level
(
BELLE_SIP_LOG_DEBUG
);
}
else
{
belle_sip_set_log_level
(
BELLE_SIP_LOG_ERROR
);
}
belle_sip_tester_set_root_ca_path
(
"Assets/rootca.pem"
);
pool
=
belle_sip_object_pool_push
();
}
tester/belle_sip_tester_windows.h
View file @
fdf3bac2
...
...
@@ -14,22 +14,28 @@ namespace belle_sip_tester_runtime_component
public
ref
class
BelleSipTester
sealed
{
public:
BelleSipTester
(
bool
autoLaunch
);
virtual
~
BelleSipTester
();
void
setOutputTraceListener
(
OutputTraceListener
^
traceListener
);
unsigned
int
nbTestSuites
();
unsigned
int
nbTests
(
Platform
::
String
^
suiteName
);
Platform
::
String
^
testSuiteName
(
int
index
);
Platform
::
String
^
testName
(
Platform
::
String
^
suiteName
,
int
testIndex
);
void
run
(
Platform
::
String
^
suiteName
,
Platform
::
String
^
caseName
,
Platform
::
Boolean
verbose
);
void
runAllToXml
();
static
property
BelleSipTester
^
Instance
{
BelleSipTester
^
get
()
{
return
_instance
;
}
}
property
Windows
::
Foundation
::
IAsyncAction
^
AsyncAction
{
Windows
::
Foundation
::
IAsyncAction
^
get
()
;
Windows
::
Foundation
::
IAsyncAction
^
get
()
{
return
_asyncAction
;
}
}
private:
BelleSipTester
();
~
BelleSipTester
();
void
init
(
bool
verbose
);
Windows
::
Foundation
::
IAsyncAction
^
asyncAction
;
static
BelleSipTester
^
_instance
;
Windows
::
Foundation
::
IAsyncAction
^
_asyncAction
;
};
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment