Commit 80eba0f6 authored by Ghislain MARY's avatar Ghislain MARY

Allow ms2-tester for Windows 10 to be launch with the ms2-tester: URI scheme.

parent 4a3c65ad
......@@ -112,5 +112,23 @@ namespace ms2_tester
//TODO: Save application state and stop any background activity
deferral.Complete();
}
protected override void OnActivated(IActivatedEventArgs args)
{
if (args.Kind == ActivationKind.Protocol)
{
var protocolArgs = (ProtocolActivatedEventArgs)args;
var uri = protocolArgs.Uri;
Frame rootFrame = Window.Current.Content as Frame;
if (rootFrame == null)
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
rootFrame.Navigate(typeof(MainPage), uri);
Window.Current.Content = rootFrame;
Window.Current.Activate();
}
base.OnActivated(args);
}
}
}
......@@ -39,7 +39,10 @@ namespace ms2_tester
base.OnNavigatedTo(e);
MS2Tester.Instance.setWritableDirectory(ApplicationData.Current.LocalFolder);
_suites = UnitTestDataSource.GetSuites(MS2Tester.Instance);
TryAutoLaunch();
if ((e.Parameter is Uri) && (e.Parameter.ToString().Equals("ms2-tester:autolaunch")))
{
AutoLaunch();
}
}
public IEnumerable<UnitTestSuite> Suites
......@@ -173,24 +176,19 @@ namespace ms2_tester
});
}
private async void TryAutoLaunch()
private void AutoLaunch()
{
try
CommandBar.IsEnabled = false;
ProgressIndicator.IsIndeterminate = true;
ProgressIndicator.IsEnabled = true;
MS2Tester.Instance.runAllToXml();
if (MS2Tester.Instance.AsyncAction != null)
{
await ApplicationData.Current.LocalFolder.GetFileAsync("autolaunch");
CommandBar.IsEnabled = false;
ProgressIndicator.IsIndeterminate = true;
ProgressIndicator.IsEnabled = true;
MS2Tester.Instance.runAllToXml();
if (MS2Tester.Instance.AsyncAction != null)
MS2Tester.Instance.AsyncAction.Completed += (asyncInfo, asyncStatus) =>
{
MS2Tester.Instance.AsyncAction.Completed += (asyncInfo, asyncStatus) =>
{
App.Current.Exit();
};
}
App.Current.Exit();
};
}
catch (Exception) { }
}
private UnitTestCase RunningTestCase;
......
......@@ -23,6 +23,11 @@
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
<Extensions>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="ms2-tester" />
</uap:Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>
......
......@@ -119,7 +119,7 @@ void MS2Tester::runAllToXml()
init(true);
FILE *f = fopen(logFile, "w");
ortp_set_log_file(f);
bc_tester_start("ms2-tester");
bc_tester_start(NULL);
bc_tester_uninit();
fclose(f);
free(xmlFile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment