Assert.AreEqual (_directoryInfo.Cache, _cachePath, "DirectoryInfo Cache path not correct");
Assert.AreEqual (_directoryInfo.Data, _dataPath, "DirectoryInfo Data path not correct");
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: Name property")]
+ [Property("SPEC", "Tizen.Applications.Application.Name A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")]
+ public void Name_GET()
+ {
+ var name = Application.Current.Name;
+ Assert.IsNotNull(name, "Object should not null");
+ Assert.IsInstanceOf<string>(name);
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: Version property")]
+ [Property("SPEC", "Tizen.Applications.Application.Version A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")]
+ public void Version_GET()
+ {
+ var version = Application.Current.Version;
+ Assert.IsNotNull(version, "Object should not null");
+ Assert.IsInstanceOf<string>(version);
+ }
}
public class SubApplication : Application
private static bool _flag;
private static bool _needUnsubscribe1;
private static bool _needUnsubscribe2;
+ private static bool _needUnsubscribe3;
private static bool _isLaunched;
private static bool _isTerminated;
private static string _argAppId;
_flag = false;
_needUnsubscribe1 = false;
_needUnsubscribe2 = false;
+ _needUnsubscribe3 = false;
LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST");
}
ApplicationManager.ApplicationLaunched -= Eventlaunched;
if (_needUnsubscribe2 == true)
ApplicationManager.ApplicationTerminated -= EventTerminated;
+ if (_needUnsubscribe3 == true)
+ ApplicationManager.ApplicationTerminated -= EventServiceAppTerminated;
LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
}
Assert.True(IsRunning, "MyApp should be included in RecentApplications");
}
+
+ public static void EventServiceAppTerminated(object sender, ApplicationTerminatedEventArgs Args)
+ {
+ Log.Debug("TCT", Args.ApplicationRunningContext.ApplicationId + " Terminated");
+ if (string.Equals(Args.ApplicationRunningContext.ApplicationId, AppServiceId))
+ _isTerminated = true;
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: Terminate a service application in the background.")]
+ [Property("SPEC", "Tizen.Applications.ApplicationManager.TerminateBackgroundApplication M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")]
+ public async Task TerminateBackgroundApplication_TERMINATE_BG_APP()
+ {
+ /*
+ * PRECONDITION
+ * 1. Launch a service-application
+ */
+ AppControl MyAppControl = new AppControl();
+ MyAppControl.ApplicationId = AppServiceId;
+ AppControl.SendLaunchRequest(MyAppControl);
+ ApplicationManager.ApplicationTerminated += EventServiceAppTerminated;
+ _needUnsubscribe3 = true;
+
+ await Task.Delay(5000);
+
+ var _list = await ApplicationManager.GetAllRunningApplicationsAsync();
+ foreach (var app in _list)
+ {
+ if (app.ApplicationId.Contains(AppServiceId))
+ {
+ _isTerminated = false;
+ ApplicationManager.TerminateBackgroundApplication(app);
+ break;
+ }
+ }
+
+ await Task.Delay(5000);
+
+ /* TEST CODE
+ * 1 Add function EventServiceAppTerminated to event ApplicationTerminated.
+ * 2 Set _isTerminated is true in EventServiceAppTerminated.
+ */
+
+ Assert.True(_isTerminated, AppServiceId + " should be terminated");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test: Gets the application ID by running process ID.")]
+ [Property("SPEC", "Tizen.Applications.ApplicationManager.GetAppId M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")]
+ public void GetAppId_GET_APPID()
+ {
+ ApplicationRunningContext runningContext = new ApplicationRunningContext(Application.Current.ApplicationInfo.ApplicationId);
+ var appId = ApplicationManager.GetAppId(runningContext.ProcessId);
+ Assert.AreEqual(appId, Application.Current.ApplicationInfo.ApplicationId, "The appId should be equal to ApplicationId of ApplicationRunningContext");
+ }
}
}
using NUnit.Framework;
using NUnit.Framework.TUnit;
using System.Threading;
+using System.Threading.Tasks;
namespace Tizen.Applications.Tests
{
private const string AppId = "org.tizen.example.UIApp.Tizen";
private const string PackgeId = "UIApp.Tizen";
private const int ProcessId = 0;
+ private const string AppServiceId = "org.tizen.ServiceAppTest.Tizen";
[SetUp]
public static void Init()
Assert.Fail("The application should be resumed");
}
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Test property IsTerminated of ApplicationRunningContext.")]
+ [Property("SPEC", "Tizen.Applications.ApplicationRunningContext.IsTerminated A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")]
+ public void IsTerminated_GET_PROPERTY_FALSE()
+ {
+ Assert.AreEqual(false, _context.IsTerminated, "IsTerminated of " + AppId + " is not correct");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Test property IsTerminated of ApplicationRunningContext.")]
+ [Property("SPEC", "Tizen.Applications.ApplicationRunningContext.IsTerminated A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ [Property("AUTHOR", "Hwankyu Jhun, h.jhun@samsung.com")]
+ public async Task IsTerminated_GET_PROPERTY_TRUE()
+ {
+ /*
+ * PRECONDITION
+ * 1. Launch a service-application
+ * 2. Terminate the running service-application
+ */
+ AppControl MyAppControl = new AppControl();
+ MyAppControl.ApplicationId = AppServiceId;
+ AppControl.SendLaunchRequest(MyAppControl);
+
+ await Task.Delay(5000);
+
+ ApplicationRunningContext runningContext = new ApplicationRunningContext(AppServiceId);
+ ApplicationManager.TerminateBackgroundApplication(runningContext);
+
+ await Task.Delay(5000);
+
+ Assert.AreEqual(true, runningContext.IsTerminated, "IsTerminated of " + AppId + " is not correct");
+ }
}
}
<privilege>http://tizen.org/privilege/appmanager.launch</privilege>\r
<privilege>http://tizen.org/privilege/appdir.shareddata</privilege>\r
<privilege>http://tizen.org/privilege/datasharing</privilege>\r
+ <privilege>http://tizen.org/privilege/appmanager.kill.bgapp</privilege>\r
</privileges>\r
<provides-appdefined-privileges />\r
</manifest>\r