Allow belle-sip-tester for Windows 10 to be launched with the liblinphone-tester URI scheme.

This commit is contained in:
Ghislain MARY 2015-09-25 17:15:48 +02:00
parent 86dab4733d
commit eb22c29a1d
4 changed files with 37 additions and 16 deletions

View file

@ -110,5 +110,23 @@ namespace liblinphone_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);
}
}
}

View file

@ -39,7 +39,10 @@ namespace liblinphone_tester
base.OnNavigatedTo(e);
LibLinphoneTester.Instance.setWritableDirectory(ApplicationData.Current.LocalFolder);
_suites = UnitTestDataSource.GetSuites(LibLinphoneTester.Instance);
TryAutoLaunch();
if ((e.Parameter is Uri) && (e.Parameter.ToString().Equals("liblinphone-tester:autolaunch")))
{
AutoLaunch();
}
}
public IEnumerable<UnitTestSuite> Suites
@ -173,23 +176,18 @@ namespace liblinphone_tester
});
}
private async void TryAutoLaunch()
private void AutoLaunch()
{
try
CommandBar.IsEnabled = false;
ProgressIndicator.IsIndeterminate = true;
ProgressIndicator.IsEnabled = true;
LibLinphoneTester.Instance.runAllToXml();
if (LibLinphoneTester.Instance.AsyncAction != null)
{
await ApplicationData.Current.LocalFolder.GetFileAsync("autolaunch");
CommandBar.IsEnabled = false;
ProgressIndicator.IsIndeterminate = true;
ProgressIndicator.IsEnabled = true;
LibLinphoneTester.Instance.runAllToXml();
if (LibLinphoneTester.Instance.AsyncAction != null)
{
LibLinphoneTester.Instance.AsyncAction.Completed += (asyncInfo, asyncStatus) => {
App.Current.Exit();
};
}
LibLinphoneTester.Instance.AsyncAction.Completed += (asyncInfo, asyncStatus) => {
App.Current.Exit();
};
}
catch (Exception) { }
}
private UnitTestCase RunningTestCase;

View file

@ -23,6 +23,11 @@
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
<Extensions>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="liblinphone-tester" />
</uap:Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>

View file

@ -110,7 +110,7 @@ void LibLinphoneTester::runAllToXml()
init(true);
FILE *f = fopen(logFile, "w");
ortp_set_log_file(f);
bc_tester_start("liblinphone-tester");
bc_tester_start(NULL);
bc_tester_uninit();
fclose(f);
free(xmlFile);