Updated wp test app

This commit is contained in:
Sylvain Berfini 2013-03-08 15:56:00 +01:00
parent 136586af8a
commit ff26494fac
9 changed files with 119 additions and 48 deletions

View file

@ -134,6 +134,7 @@
<Content Include="Assets\oldphone.wav" />
<Content Include="Assets\pauline_rc" />
<Content Include="Assets\multi_account_lrc" />
<Content Include="log.html" />
<None Include="Properties\AppManifest.xml" />
<None Include="Properties\WMAppManifest.xml">
<SubType>Designer</SubType>

View file

@ -31,10 +31,8 @@
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<ScrollViewer HorizontalScrollBarVisibility="Visible">
<TextBlock x:Name="TestResults" TextWrapping="Wrap" Style="{StaticResource PhoneTextNormalStyle}" FontFamily="Courier New" FontSize="16"/>
</ScrollViewer>
<Grid x:Name="ContentPanel" Grid.Row="2" Margin="12,0,12,0">
<phone:WebBrowser x:Name="Browser" IsScriptEnabled="True" LoadCompleted="Browser_LoadCompleted" Background="{StaticResource PhoneBackgroundBrush}"/>
</Grid>
</Grid>

View file

@ -12,40 +12,78 @@ using linphone_tester_native;
namespace LibLinphoneTester_wp8
{
public delegate void OutputDisplayDelegate(String msg);
public delegate void OutputDisplayDelegate(int level, String msg);
public partial class TestResultPage : PhoneApplicationPage
{
public TestResultPage()
{
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
string suiteName = NavigationContext.QueryString["SuiteName"];
string caseName;
if (NavigationContext.QueryString.ContainsKey("CaseName"))
{
caseName = NavigationContext.QueryString["CaseName"];
}
else
{
caseName = "ALL";
}
bool verbose = Convert.ToBoolean(NavigationContext.QueryString["Verbose"]);
var app = (Application.Current as App);
app.suite = new UnitTestSuite(suiteName, caseName, verbose, new OutputDisplayDelegate(OutputDisplay));
app.suite.run();
}
public void OutputDisplay(String msg)
{
this.Dispatcher.BeginInvoke(() =>
{
TestResults.Text += msg;
});
Browser.Navigate(new Uri("log.html", UriKind.Relative));
}
private void Browser_LoadCompleted(object sender, NavigationEventArgs e)
{
string suiteName = NavigationContext.QueryString["SuiteName"];
string caseName;
if (NavigationContext.QueryString.ContainsKey("CaseName"))
{
caseName = NavigationContext.QueryString["CaseName"];
}
else
{
caseName = "ALL";
}
bool verbose = Convert.ToBoolean(NavigationContext.QueryString["Verbose"]);
var app = (Application.Current as App);
app.suite = new UnitTestSuite(suiteName, caseName, verbose, new OutputDisplayDelegate(OutputDisplay));
app.suite.run();
}
public void OutputDisplay(int level, String msg)
{
this.Dispatcher.BeginInvoke(() =>
{
msg = msg.Replace("\r\n", "\n");
string[] lines = msg.Split('\n');
bool insertNewLine = false;
foreach (string line in lines)
{
if (line.Length == 0)
{
insertNewLine = false;
Browser.InvokeScript("append_nl");
}
else
{
if (insertNewLine == true)
{
Browser.InvokeScript("append_nl");
}
if (level == 0)
{
Browser.InvokeScript("append_trace", line, "debug");
}
else if (level == 1)
{
Browser.InvokeScript("append_trace", line, "message");
}
else if (level == 2)
{
Browser.InvokeScript("append_trace", line, "warning");
}
else if (level == 3)
{
Browser.InvokeScript("append_trace", line, "error");
}
else
{
Browser.InvokeScript("append_text", line);
}
insertNewLine = true;
}
}
});
}
}
@ -73,15 +111,15 @@ namespace LibLinphoneTester_wp8
}, tup);
await t;
Running = false;
}
public void outputTrace(String msg)
{
if (OutputDisplay != null)
{
OutputDisplay(msg);
}
System.Diagnostics.Debug.WriteLine(msg);
}
public void outputTrace(int level, String msg)
{
if (OutputDisplay != null)
{
OutputDisplay(level, msg);
}
System.Diagnostics.Debug.WriteLine(msg);
}
public bool running {

View file

@ -0,0 +1,34 @@
<html>
<head>
<style>
html { background-color: black; font-family:'Courier New'; font-size: 16pt; color: white; }
.debug { color: light-grey; }
.message { color: white; }
.warning { color: orange; }
.error { color: red; }
</style>
<script>
function append_text(msg) {
var content = document.getElementById("content");
var new_text = document.createTextNode(msg);
content.appendChild(new_text);
}
function append_trace(msg, level) {
var content = document.getElementById("content");
var span_elem = document.createElement('span');
span_elem.className = level;
var new_text = document.createTextNode(msg);
span_elem.appendChild(new_text);
content.appendChild(span_elem);
}
function append_nl() {
var content = document.getElementById("content");
var element = document.createElement('br');
content.appendChild(element);
}
</script>
</head>
<body>
<p><pre id="content"></pre></p>
</body>
</html>

View file

@ -22,7 +22,7 @@ static void nativeOutputTraceHandler(int lev, const char *fmt, va_list args)
vsnprintf((char *)str.c_str(), MAX_TRACE_SIZE, fmt, args);
mbstowcs(wstr, str.c_str(), sizeof(wstr));
String^ msg = ref new String(wstr);
sTraceListener->outputTrace(msg);
sTraceListener->outputTrace(lev, msg);
}
}

View file

@ -7,7 +7,7 @@ namespace linphone_tester_native
public interface class OutputTraceListener
{
public:
void outputTrace(Platform::String^ msg);
void outputTrace(int level, Platform::String^ msg);
};
public ref class LinphoneTesterNative sealed

View file

@ -604,18 +604,18 @@ static void call_transfer_existing_call_outgoing_call(void) {
test_t call_tests[] = {
{ "Early declined call", early_declined_call },
{ "Cancelled call", cancelled_call },
{ "Call with DNS timeout", call_with_dns_time_out },
//{ "Call with DNS timeout", call_with_dns_time_out },
{ "Cancelled ringing call", cancelled_ringing_call },
{ "Simple call", simple_call },
{ "Early-media call", early_media_call },
//{ "Early-media call", early_media_call },
{ "Call terminated by caller", call_terminated_by_caller },
{ "Call paused resumed", call_paused_resumed },
{ "Call paused resumed from callee", call_paused_resumed_from_callee },
{ "SRTP call", srtp_call },
//{ "SRTP call", srtp_call },
#ifdef VIDEO_ENABLED
{ "Call with video added", call_with_video_added },
#endif
{ "Simple conference", simple_conference },
//{ "Simple conference", simple_conference },
{ "Simple call transfer", simple_call_transfer },
{ "Call transfer existing call outgoing call", call_transfer_existing_call_outgoing_call }
};

View file

@ -314,7 +314,7 @@ test_t register_tests[] = {
{ "Simple register", simple_register },
{ "TCP register", simple_tcp_register },
#ifndef ANDROID
{ "TLS register", simple_tls_register },
//{ "TLS register", simple_tls_register },
#endif
{ "Simple authenticated register", simple_authenticated_register },
{ "Digest auth without initial credentials", authenticated_register_with_no_initial_credentials },