using NUnit.Framework;
using NUnit.Framework.TUnit;
+using System.Linq.Expressions;
using System.Threading.Tasks;
namespace Tizen.Applications.Tests
private bool _needUnsubscribe;
private bool _isLaunched;
private string _argAppId;
- private const string AppId = "org.tizen.example.UIApp.Tizen";
+ private const string AppId = "org.tizen.ServiceAppTest.Tizen";
[SetUp]
public void Init()
[Property("AUTHOR", "Sangyoon Jang, s89.jang@samsung.com")]
public async Task ApplicationRunningContext_ATTR()
{
+ try
+ {
+ var runningContext = new ApplicationRunningContext(AppId);
+ if (runningContext != null)
+ ApplicationManager.TerminateBackgroundApplication(runningContext);
+ }
+ catch
+ {
+ Log.Debug("TCT", AppId + " is not running");
+ }
+
var IsRunning = false;
ApplicationManager.ApplicationLaunched += Eventlaunched;
_needUnsubscribe = true;
if (app.ApplicationId.Contains(AppId))
{
IsRunning = true;
+ ApplicationManager.TerminateBackgroundApplication(app);
break;
}
}
Assert.AreEqual(_argAppId, AppId, "Application ID launch is not correct");
Assert.Greater(_processId, 0, "Process ID is not correct");
Assert.True(_isLaunched, "Eventlaunched should be occurred");
-
- if (IsRunning)
- {
- AppControl.SendTerminateRequest(appControl);
- }
}
}
}
public void Eventlaunched(object sender, ApplicationLaunchedEventArgs Args)
{
- if (string.Equals(Args.ApplicationRunningContext.ApplicationId, AppId))\r
- {\r
- _argAppId = Args.ApplicationRunningContext.ApplicationId;\r
+ if (string.Equals(Args.ApplicationRunningContext.ApplicationId, AppServiceId))
+ {
+ _argAppId = Args.ApplicationRunningContext.ApplicationId;
_processId = Args.ApplicationRunningContext.ProcessId;
- _isLaunched = true;\r
+ _isLaunched = true;
}
}
ApplicationManager.ApplicationLaunched += Eventlaunched;
_needUnsubscribe1 = true;
AppControl appControl = new AppControl();
- appControl.ApplicationId = AppId;
- appControl.LaunchMode = AppControlLaunchMode.Group;
+ appControl.ApplicationId = AppServiceId;
_argAppId = "";
_processId = 0;
var _list = await ApplicationManager.GetAllRunningApplicationsAsync();
foreach (var app in _list)
{
- if (app.ApplicationId.Contains(AppId))
+ if (app.ApplicationId.Contains(AppServiceId))
{
IsRunning = true;
+ ApplicationManager.TerminateBackgroundApplication(app);
break;
}
}
* 4 Close Message App after this app lauched.
* 4 Check bFlag is true.
*/
- Assert.AreEqual(_argAppId, AppId, "Application ID launch is not correct");
+ Assert.AreEqual(_argAppId, AppServiceId, "Application ID launch is not correct");
Assert.Greater(_processId, 0, "Process ID is not correct");
Assert.True(_isLaunched, "Eventlaunched should be occurred");
-
- if (IsRunning)
- {
- AppControl.SendTerminateRequest(appControl);
- }
}
public void EventTerminated(object sender, ApplicationTerminatedEventArgs Args)