From: yeji kim Date: Fri, 8 Feb 2019 03:53:10 +0000 (+0900) Subject: [DevicePolicyManager][TCSACR-211][Add test cases for Tizen.Security.DevicePolicyManager] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=746b0f25d38b55a55ce1ded137dc26b611a4d143;p=test%2Ftct%2Fcsharp%2Fapi.git [DevicePolicyManager][TCSACR-211][Add test cases for Tizen.Security.DevicePolicyManager] Change-Id: Ife8bae5fff93154b189b0d8ace627de3c28d3ef1 Signed-off-by: yeji kim --- diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/Program.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/Program.cs new file mode 100755 index 0000000..722d7b8 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/Program.cs @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using NUnit.Framework; +using Xamarin.Forms; + +namespace XamarinApplication.Tizen +{ + class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication + { + private Application _app; + protected override void OnCreate() + { + Console.WriteLine("TCT : OnCreate()"); + base.OnCreate(); + if (ManualTest.IsWearable()) + { + _app = new WearableTemplate.MainPage(); + } + else + { + _app = new ManualTemplate.MainPage(); + } + LoadApplication(_app); + } + + static void Main(string[] args) + { + Console.WriteLine("TCT : Main()"); + var app = new Program(); + global::Xamarin.Forms.Platform.Tizen.Forms.Init(app); + app.Run(args); + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/Tizen.DevicePolicyManager.Manual.Tests.csproj b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/Tizen.DevicePolicyManager.Manual.Tests.csproj new file mode 100644 index 0000000..4667c1b --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/Tizen.DevicePolicyManager.Manual.Tests.csproj @@ -0,0 +1,44 @@ + + + + + Exe + tizen60 + + + + + true + + + + portable + + + None + + + + + + + + + + + Runtime + + + + + + + + + + + ..\..\..\TizenFX\src\Tizen.Security.DevicePolicyManager\bin\Release\netstandard2.0\Tizen.Security.DevicePolicyManager.dll + + + + diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/Tizen.DevicePolicyManager.Manual.Tests.sln b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/Tizen.DevicePolicyManager.Manual.Tests.sln new file mode 100755 index 0000000..4f7f20c --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/Tizen.DevicePolicyManager.Manual.Tests.sln @@ -0,0 +1,80 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.15 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.DevicePolicyManager.Manual.Tests", "Tizen.DevicePolicyManager.Manual.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManualTemplate", "..\Template\ManualTemplate\ManualTemplate.csproj", "{269F89A7-E648-4811-8421-844E00ACF5F0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManualTemplateForWearable", "..\Template\ManualTemplateForWearable\ManualTemplateForWearable.csproj", "{D36CED01-29BD-4EB3-8903-62E0BF2A822D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.NUI|Any CPU.ActiveCfg = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.NUI|Any CPU.Build.0 = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.Build.0 = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.NUI|Any CPU.ActiveCfg = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.NUI|Any CPU.Build.0 = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/shared/res/Tizen.DevicePolicyManager.Manual.Tests.png b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/shared/res/Tizen.DevicePolicyManager.Manual.Tests.png new file mode 100755 index 0000000..9765b1b Binary files /dev/null and b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/shared/res/Tizen.DevicePolicyManager.Manual.Tests.png differ diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSBluetoothPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSBluetoothPolicy.cs new file mode 100755 index 0000000..bc29942 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSBluetoothPolicy.cs @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Manual.Tests +{ + [TestFixture] + [Description("Manual Tests Tizen.Security.DevicePolicyManager.BluetoothPolicy class")] + public class BluetoothPolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private BluetoothPolicy _bluetoothPolicy; + private string _currentPolicyName; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _bluetoothPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _bluetoothPolicy, _dpm"); + _bluetoothPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("MANUAL TEST : Check whether BluetoothPolicyChanged is callable.")] + [Property("SPEC", " Tizen.Security.DevicePolicyManager.BluetoothPolicy.BluetoothPolicyChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + [Precondition(1, "Open terminal.")] + [Precondition(2, "Enter command \"sdb root on\"")] + [Step(1, "Click run TC")] + [Step(2, "Insert next command. sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.bluetooth string:\"allowed\"")] + [Postcondition(1, "Close the terminal")] + public async Task BluetoothPolicyChanged_CHECK_EVENT() + { + _currentPolicyName = BluetoothPolicy.BluetoothPolicyName; + _bluetoothPolicy.BluetoothPolicyChanged += TestCallback; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Added BluetoothPolicyChanged event"); + + /* + * TEST CODE - MANUAL TEST + * use command: sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.bluetooth string:"allowed" to raise event. + */ + await ManualTest.WaitForConfirm(); + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Removed BluetoothPolicyChanged event"); + _bluetoothPolicy.BluetoothPolicyChanged -= TestCallback; + } + + [Test] + [Category("P1")] + [Description("MANUAL TEST : Check whether BluetoothTetheringPolicyChanged is callable.")] + [Property("SPEC", " Tizen.Security.DevicePolicyManager.BluetoothPolicy.BluetoothTetheringPolicyChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + [Precondition(1, "Open terminal.")] + [Precondition(2, "Enter command \"sdb root on\"")] + [Step(1, "Click run TC")] + [Step(2, "Insert next command. sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.bluetooth_tethering string:\"allowed\"")] + [Postcondition(1, "Close the terminal")] + public async Task BluetoothTetheringPolicyChanged_CHECK_EVENT() + { + _currentPolicyName = BluetoothPolicy.BluetoothTetheringPolicyName; + _bluetoothPolicy.BluetoothTetheringPolicyChanged += TestCallback; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Added BluetoothTetheringPolicyChanged event"); + + /* + * TEST CODE - MANUAL TEST + * use command: sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.bluetooth_tethering string:"allowed" to raise event. + */ + await ManualTest.WaitForConfirm(); + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Removed BluetoothTetheringPolicyChanged event"); + _bluetoothPolicy.BluetoothTetheringPolicyChanged -= TestCallback; + } + + void TestCallback(Object Sender, PolicyChangedEventArgs args) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "[EventHandler]PolicyName: " + args.PolicyName + " State: " + args.IsAllowed); + if (args.PolicyName == _currentPolicyName && args.IsAllowed == true) + { + ManualTest.Confirm(); + } + else + { + ManualTest.ConfirmFail("It's not expected result. PolicyName:" + args.PolicyName + ", State:" + args.IsAllowed); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSBrowserPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSBrowserPolicy.cs new file mode 100755 index 0000000..d041d35 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSBrowserPolicy.cs @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Manual.Tests +{ + [TestFixture] + [Description("Manual Tests Tizen.Security.DevicePolicyManager.BrowserPolicy class")] + public class BrowserPolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private BrowserPolicy _browserPolicy; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _browserPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _browserPolicy, _dpm"); + _browserPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("MANUAL TEST : Check whether BrowserPolicyChanged is callable.")] + [Property("SPEC", " Tizen.Security.DevicePolicyManager.BrowserPolicy.BrowserPolicyChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + [Precondition(1, "Open terminal.")] + [Precondition(2, "Enter command \"sdb root on\"")] + [Step(1, "Click run TC")] + [Step(2, "Insert next command. sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.browser string:\"allowed\"")] + [Postcondition(1, "Close the terminal")] + public async Task BrowserPolicyChanged_CHECK_EVENT() + { + _browserPolicy.BrowserPolicyChanged += TestCallback; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Added BrowserPolicyChanged event"); + + /* + * TEST CODE - MANUAL TEST + * use command: sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.browser string:"allowed" to raise event. + */ + await ManualTest.WaitForConfirm(); + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Removed BrowserPolicyChanged event"); + _browserPolicy.BrowserPolicyChanged -= TestCallback; + } + + void TestCallback(Object Sender, PolicyChangedEventArgs args) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "[EventHandler]PolicyName: " + args.PolicyName + " State: " + args.IsAllowed); + if (args.PolicyName == BrowserPolicy.BrowserPolicyName && args.IsAllowed == true) + { + ManualTest.Confirm(); + } + else + { + ManualTest.ConfirmFail("It's not expected result. PolicyName:" + args.PolicyName + ", State:" + args.IsAllowed); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSEmailPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSEmailPolicy.cs new file mode 100755 index 0000000..b8b079e --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSEmailPolicy.cs @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Manual.Tests +{ + [TestFixture] + [Description("Manual Tests Tizen.Security.DevicePolicyManager.EmailPolicy class")] + public class EmailPolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private EmailPolicy _emailPolicy; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _emailPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _emailPolicy, _dpm"); + _emailPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("MANUAL TEST : Check whether PopImapPolicyChanged is callable.")] + [Property("SPEC", " Tizen.Security.DevicePolicyManager.EmailPolicy.PopImapPolicyChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + [Precondition(1, "Open terminal.")] + [Precondition(2, "Enter command \"sdb root on\"")] + [Step(1, "Click run TC")] + [Step(2, "Insert next command. sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.popimap_email string:\"allowed\"")] + [Postcondition(1, "Close the terminal")] + public async Task PopImapPolicyChanged_CHECK_EVENT() + { + _emailPolicy.PopImapPolicyChanged += TestCallback; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Added event"); + + /* + * TEST CODE - MANUAL TEST + * use command: sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.popimap_email string:"allowed" to raise event. + */ + await ManualTest.WaitForConfirm(); + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Removed event"); + _emailPolicy.PopImapPolicyChanged -= TestCallback; + } + + void TestCallback(Object Sender, PolicyChangedEventArgs args) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "[EventHandler]PolicyName: " + args.PolicyName + " State: " + args.IsAllowed); + if (args.PolicyName == EmailPolicy.PopImapEmailPolicyName && args.IsAllowed == true) + { + ManualTest.Confirm(); + } + else + { + ManualTest.ConfirmFail("It's not expected result. PolicyName:" + args.PolicyName + ", State:" + args.IsAllowed); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSLocationPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSLocationPolicy.cs new file mode 100755 index 0000000..836a913 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSLocationPolicy.cs @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Manual.Tests +{ + [TestFixture] + [Description("Manual Tests Tizen.Security.DevicePolicyManager.LocationPolicy class")] + public class LocationPolicyTests + { + static internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private LocationPolicy _locationPolicy; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _locationPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _locationPolicy, _dpm"); + _locationPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("MANUAL TEST : Check whether LocationPolicyChanged is callable.")] + [Property("SPEC", " Tizen.Security.DevicePolicyManager.LocationPolicy.LocationPolicyChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + [Precondition(1, "Open terminal.")] + [Precondition(2, "Enter command \"sdb root on\"")] + [Step(1, "Click run TC")] + [Step(2, "Insert next command. sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.location string:\"allowed\"")] + [Postcondition(1, "Close the terminal")] + public async Task LocationPolicyChanged_CHECK_EVENT() + { + _locationPolicy.LocationPolicyChanged += TestCallback; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Added LocationPolicyChanged event"); + + /* + * TEST CODE - MANUAL TEST + * use command: sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.location string:"allowed" to raise event. + */ + await ManualTest.WaitForConfirm(); + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Removed LocationPolicyChanged event"); + _locationPolicy.LocationPolicyChanged -= TestCallback; + } + + void TestCallback(Object Sender, PolicyChangedEventArgs args) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "[EventHandler]PolicyName: " + args.PolicyName + " State: " + args.IsAllowed); + if (args.PolicyName == LocationPolicy.LocationPolicyName && args.IsAllowed == true) + { + ManualTest.Confirm(); + } + else + { + ManualTest.ConfirmFail("It's not expected result. PolicyName:" + args.PolicyName + ", State:" + args.IsAllowed); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSMediaPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSMediaPolicy.cs new file mode 100755 index 0000000..2ea0741 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSMediaPolicy.cs @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Manual.Tests +{ + [TestFixture] + [Description("Manual Tests Tizen.Security.DevicePolicyManager.MediaPolicy class")] + public class MediaPolicyTests + { + static internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private MediaPolicy _mediaPolicy; + private string _currentPolicyName; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _mediaPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _mediaPolicy, _dpm"); + _mediaPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("MANUAL TEST : Check whether CameraPolicyChanged is callable.")] + [Property("SPEC", " Tizen.Security.DevicePolicyManager.MediaPolicy.CameraPolicyChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + [Precondition(1, "Open terminal.")] + [Precondition(2, "Enter command \"sdb root on\"")] + [Step(1, "Click run TC")] + [Step(2, "Insert next command. sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.camera string:\"allowed\"")] + [Postcondition(1, "Close the terminal")] + public async Task CameraPolicyChanged_CHECK_EVENT() + { + _currentPolicyName = MediaPolicy.CameraPolicyName; + _mediaPolicy.CameraPolicyChanged += TestCallback; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Added CameraPolicyChanged event"); + + /* + * TEST CODE - MANUAL TEST + * use command: sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.camera string:"allowed" to raise event. + */ + await ManualTest.WaitForConfirm(); + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Removed CameraPolicyChanged event"); + _mediaPolicy.CameraPolicyChanged -= TestCallback; + } + + [Test] + [Category("P1")] + [Description("MANUAL TEST : Check whether MicrophonePolicyChanged is callable.")] + [Property("SPEC", " Tizen.Security.DevicePolicyManager.MediaPolicy.MicrophonePolicyChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + [Precondition(1, "Open terminal to view logs.")] + [Precondition(2, "Enter command \"sdb root on\"")] + [Step(1, "Click run TC")] + [Step(2, "Insert next command. sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.microphone string:\"allowed\"")] + [Postcondition(1, "Close the terminal")] + public async Task MicrophonePolicyChanged_CHECK_EVENT() + { + _currentPolicyName = MediaPolicy.MicrophonePolicyName; + _mediaPolicy.MicrophonePolicyChanged += TestCallback; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Added MicrophonePolicyChanged event"); + + /* + * TEST CODE - MANUAL TEST + * use command: sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.microphone string:"allowed" to raise event. + */ + await ManualTest.WaitForConfirm(); + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Removed MicrophonePolicyChanged event"); + _mediaPolicy.MicrophonePolicyChanged -= TestCallback; + } + + void TestCallback(Object Sender, PolicyChangedEventArgs args) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "[EventHandler]PolicyName: " + args.PolicyName + " State: " + args.IsAllowed); + if (args.PolicyName == _currentPolicyName && args.IsAllowed == true) + { + ManualTest.Confirm(); + } + else + { + ManualTest.ConfirmFail("It's not expected result. PolicyName:" + args.PolicyName + ", State:" + args.IsAllowed); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSPolicyChangedEventArgs.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSPolicyChangedEventArgs.cs new file mode 100755 index 0000000..b68a570 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSPolicyChangedEventArgs.cs @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Manual.Tests +{ + + [TestFixture] + [Description("Manual Tests Tizen.Security.DevicePolicyManager.PolicyChangedEventArgs class")] + public class PolicyChangedEventArgsTests + { + static internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private BluetoothPolicy _bluetoothPolicy; + private bool _isSupported; + + private readonly string _testPollicyName = BluetoothPolicy.BluetoothPolicyName; + private bool _testStatus; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _bluetoothPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _bluetoothPolicy, _dpm."); + _bluetoothPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("MANUAL TEST : Check whether PolicyName returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.PolicyChangedEventArgs.PolicyName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + [Precondition(1, "Open terminal.")] + [Precondition(2, "Enter command \"sdb root on\"")] + [Step(1, "Click run TC")] + [Step(2, "Insert next command. \n>sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.bluetooth string:\"allowed\"")] + [Postcondition(1, "Close the terminal")] + public async Task PolicyName_READ_ONLY() + { + _bluetoothPolicy.BluetoothPolicyChanged += PolicyNameTestCallback; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Added BluetoothPolicyChanged event"); + + /* + * TEST CODE - MANUAL TEST + * use command: sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.bluetooth string:"allowed" to raise event. + */ + await ManualTest.WaitForConfirm(); + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Removed BluetoothPolicyChanged event"); + _bluetoothPolicy.BluetoothPolicyChanged -= PolicyNameTestCallback; + } + + [Test] + [Category("P1")] + [Description("MANUAL TEST : Check whether IsAllowed returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.PolicyChangedEventArgs.IsAllowed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + [Precondition(1, "Open terminal.")] + [Precondition(2, "Enter command \"sdb root on\"")] + [Step(1, "Click run TC")] + [Step(2, "Insert next command. \n>sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.bluetooth string:\"allowed\"")] + [Postcondition(1, "Close the terminal")] + public async Task IsAllowed_READ_ONLY_TRUE() + { + _testStatus = true; + _bluetoothPolicy.BluetoothPolicyChanged += IsAllowedTestCallback; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Added BluetoothPolicyChanged event"); + + /* + * TEST CODE - MANUAL TEST + * use command: sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.bluetooth string:"allowed" to raise event. + */ + await ManualTest.WaitForConfirm(); + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Removed BluetoothPolicyChanged event"); + _bluetoothPolicy.BluetoothPolicyChanged -= IsAllowedTestCallback; + } + + [Test] + [Category("P1")] + [Description("MANUAL TEST : Check whether IsAllowed returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.PolicyChangedEventArgs.IsAllowed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + [Precondition(1, "Open terminal.")] + [Precondition(2, "Enter command \"sdb root on\"")] + [Step(1, "Click run TC")] + [Step(2, "Insert next command. \n>sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.bluetooth string:\"disallowed\"")] + [Postcondition(1, "Close the terminal")] + public async Task IsAllowed_READ_ONLY_FALSE() + { + _testStatus = false; + _bluetoothPolicy.BluetoothPolicyChanged += IsAllowedTestCallback; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Added BluetoothPolicyChanged event"); + + /* + * TEST CODE - MANUAL TEST + * use command: sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.bluetooth_tethering string:"disallowed" to raise event. + */ + await ManualTest.WaitForConfirm(); + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Removed BluetoothPolicyChanged event"); + _bluetoothPolicy.BluetoothPolicyChanged -= IsAllowedTestCallback; + } + + void PolicyNameTestCallback(Object Sender, PolicyChangedEventArgs args) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "[EventHandler]PolicyName: " + args.PolicyName + " State: " + args.IsAllowed); + if (args.PolicyName == _testPollicyName) + { + ManualTest.Confirm(); + } + else + { + ManualTest.ConfirmFail("It's not expected result. PolicyName:" + args.PolicyName + ", State:" + args.IsAllowed); + } + } + + void IsAllowedTestCallback(Object Sender, PolicyChangedEventArgs args) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "[EventHandler]PolicyName: " + args.PolicyName + " State: " + args.IsAllowed); + if (args.IsAllowed == _testStatus) + { + ManualTest.Confirm(); + } + else + { + ManualTest.ConfirmFail("It's not expected result. PolicyName:" + args.PolicyName + ", State:" + args.IsAllowed); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSStoragePolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSStoragePolicy.cs new file mode 100755 index 0000000..4e6bcb8 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSStoragePolicy.cs @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Manual.Tests +{ + [TestFixture] + [Description("Manual Tests Tizen.Security.DevicePolicyManager.StoragePolicy class")] + public class StoragePolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private StoragePolicy _storagePolicy; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _storagePolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _storagePolicy, _dpm"); + _storagePolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("MANUAL TEST : Check whether ExternalStoragePolicyChanged is callable.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.StoragePolicy.ExternalStoragePolicyChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + [Precondition(1, "Open terminal.")] + [Precondition(2, "Enter command \"sdb root on\"")] + [Step(1, "Click run TC")] + [Step(2, "Insert next command. sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.external_storage string:\"allowed\"")] + [Postcondition(1, "Close the terminal")] + public async Task ExternalStoragePolicyChanged_CHECK_EVENT() + { + _storagePolicy.ExternalStoragePolicyChanged += TestCallback; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Added ExternalStoragePolicyChanged event"); + + /* + * TEST CODE - MANUAL TEST + * use command: sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.location string:"allowed" to raise event. + */ + await ManualTest.WaitForConfirm(); + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Removed ExternalStoragePolicyChanged event"); + _storagePolicy.ExternalStoragePolicyChanged -= TestCallback; + } + + void TestCallback(Object Sender, PolicyChangedEventArgs args) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "[EventHandler]PolicyName: " + args.PolicyName + " State: " + args.IsAllowed); + if (args.PolicyName == StoragePolicy.ExternalStoragePolicyName && args.IsAllowed == true) + { + ManualTest.Confirm(); + } + else + { + ManualTest.ConfirmFail("It's not expected result. PolicyName:" + args.PolicyName + ", State:" + args.IsAllowed); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSTelephonyPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSTelephonyPolicy.cs new file mode 100755 index 0000000..44526a5 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSTelephonyPolicy.cs @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Manual.Tests +{ + [TestFixture] + [Description("Manual Tests Tizen.Security.DevicePolicyManager.TelephonyPolicy class")] + public class TelephonyPolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private TelephonyPolicy _telephonyPolicy; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _telephonyPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _telephonyPolicy, _dpm"); + _telephonyPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("MANUAL TEST : Check whether MessagingPolicyChanged is callable.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.TelephonyPolicy.MessagingPolicyChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + [Precondition(1, "Open terminal to view logs.")] + [Precondition(2, "Enter command \"sdb root on\"")] + [Step(1, "Click run TC")] + [Step(2, "Insert next command. sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.messaging string:\"allowed\"")] + [Postcondition(1, "Close the terminal")] + public async Task MessagingPolicyChanged_CHECK_EVENT() + { + _telephonyPolicy.MessagingPolicyChanged += TestCallback; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Added MessagingPolicyChanged event"); + + /* + * TEST CODE - MANUAL TEST + * use command: sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.messaging string:"allowed" to raise event. + */ + await ManualTest.WaitForConfirm(); + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Removed MessagingPolicyChanged event"); + _telephonyPolicy.MessagingPolicyChanged -= TestCallback; + } + + void TestCallback(Object Sender, PolicyChangedEventArgs args) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "[EventHandler]PolicyName: " + args.PolicyName + " State: " + args.IsAllowed); + if (args.PolicyName == TelephonyPolicy.MessagingPolicyName && args.IsAllowed == true) + { + ManualTest.Confirm(); + } + else + { + ManualTest.ConfirmFail("It's not expected result. PolicyName:" + args.PolicyName + ", State:" + args.IsAllowed); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSUsbPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSUsbPolicy.cs new file mode 100755 index 0000000..ac42038 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSUsbPolicy.cs @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Manual.Tests +{ + [TestFixture] + [Description("Manual Tests Tizen.Security.DevicePolicyManager.UsbPolicy class")] + public class UsbPolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private UsbPolicy _usbPolicy; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _usbPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _usbPolicy, _dpm"); + _usbPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("MANUAL TEST : Check whether UsbTetheringPolicyChanged is callable.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.UsbPolicy.UsbTetheringPolicyChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + [Precondition(1, "Open terminal to view logs.")] + [Precondition(2, "Enter command \"sdb root on\"")] + [Step(1, "Click run TC")] + [Step(2, "Insert next command. sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.usb_tethering string:\"allowed\"")] + [Postcondition(1, "Close the terminal")] + public async Task UsbTetheringPolicyChanged_CHECK_EVENT() + { + _usbPolicy.UsbTetheringPolicyChanged += TestCallback; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Added UsbTetheringPolicyChanged event"); + + /* + * TEST CODE - MANUAL TEST + * use command: sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.usb_tethering string:"allowed" to raise event. + */ + await ManualTest.WaitForConfirm(); + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Removed UsbTetheringPolicyChanged event"); + _usbPolicy.UsbTetheringPolicyChanged -= TestCallback; + } + + void TestCallback(Object Sender, PolicyChangedEventArgs args) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "[EventHandler]PolicyName: " + args.PolicyName + " State: " + args.IsAllowed); + if (args.PolicyName == UsbPolicy.UsbTetheringPolicyName && args.IsAllowed == true) + { + ManualTest.Confirm(); + } + else + { + ManualTest.ConfirmFail("It's not expected result. PolicyName:" + args.PolicyName + ", State:" + args.IsAllowed); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSWifiPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSWifiPolicy.cs new file mode 100755 index 0000000..b79b8ac --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/testcase/TSWifiPolicy.cs @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Manual.Tests +{ + [TestFixture] + [Description("Manual Tests Tizen.Security.DevicePolicyManager.WifiPolicy class")] + public class WifiPolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private WifiPolicy _wifiPolicy; + private string _currentPolicyName; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _wifiPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _wifiPolicy, _dpm"); + _wifiPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("MANUAL TEST : Check whether WifiPolicyChanged is callable.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.WifiPolicy.WifiPolicyChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + [Precondition(1, "Open terminal to view logs.")] + [Precondition(2, "Enter command \"sdb root on\"")] + [Step(1, "Click run TC")] + [Step(2, "Insert next command. sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.wifi string:\"allowed\"")] + [Postcondition(1, "Close the terminal")] + public async Task WifiPolicyChanged_CHECK_EVENT() + { + _currentPolicyName = WifiPolicy.WifiPolicyName; + _wifiPolicy.WifiPolicyChanged += TestCallback; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Added WifiPolicyChanged event"); + + /* + * TEST CODE - MANUAL TEST + * use command: sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.wifi string:"allowed" to raise event. + */ + await ManualTest.WaitForConfirm(); + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Removed WifiPolicyChanged event"); + _wifiPolicy.WifiPolicyChanged -= TestCallback; + } + + [Test] + [Category("P1")] + [Description("MANUAL TEST : Check whether WifiHotspotPolicyChanged is callable.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.WifiPolicy.WifiHotspotPolicyChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + [Precondition(1, "Open terminal to view logs.")] + [Precondition(2, "Enter command \"sdb root on\"")] + [Step(1, "Click run TC")] + [Step(2, "Insert next command. sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.wifi_hotspot string:\"allowed\"")] + [Postcondition(1, "Close the terminal")] + public async Task WifiHotspotPolicyChanged_CHECK_EVENT() + { + _currentPolicyName = WifiPolicy.WifiHotspotPolicyName; + _wifiPolicy.WifiHotspotPolicyChanged += TestCallback; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Added WifiHotspotPolicyChanged event"); + + /* + * TEST CODE - MANUAL TEST + * use command: sdb shell dbus-send --system /org/tizen/DevicePolicyManger/PIL org.tizen.DevicePolicyManager.PIL.Event.wifi_hotspot string:"allowed" to raise event. + */ + await ManualTest.WaitForConfirm(); + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Removed WifiHotspotPolicyChanged event"); + _wifiPolicy.WifiHotspotPolicyChanged -= TestCallback; + } + + void TestCallback(Object Sender, PolicyChangedEventArgs args) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "[EventHandler]PolicyName: " + args.PolicyName + " State: " + args.IsAllowed); + if (args.PolicyName == _currentPolicyName && args.IsAllowed == true) + { + ManualTest.Confirm(); + } + else + { + ManualTest.ConfirmFail("It's not expected result. PolicyName:" + args.PolicyName + ", State:" + args.IsAllowed); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/tizen-manifest.xml new file mode 100644 index 0000000..2614846 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Manual.Tests/tizen-manifest.xml @@ -0,0 +1,16 @@ + + + + + Tizen.DevicePolicyManager.Manual.Tests.png + + + + http://tizen.org/privilege/appmanager.launch + + diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/Program.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/Program.cs new file mode 100755 index 0000000..e0f15eb --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/Program.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using NUnitLite.TUnit; +using AutoTemplate; + +namespace XamarinForTizen.Tizen +{ + + class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication + { + private static App _app; + protected override void OnCreate() + { + base.OnCreate(); + + Console.WriteLine("TCT : OnCreate()"); + _app = new App(); + LoadApplication(_app); + + TRunner t = new TRunner(); + t.LoadTestsuite(); + t.Execute(); + } + + public static App getApp() + { + return _app; + } + static void Main(string[] args) + { + Console.WriteLine("TCT : Main()"); + var app = new Program(); + global::Xamarin.Forms.Platform.Tizen.Forms.Init(app); + app.Run(args); + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/Tizen.DevicePolicyManager.Tests.csproj b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/Tizen.DevicePolicyManager.Tests.csproj new file mode 100644 index 0000000..9f41755 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/Tizen.DevicePolicyManager.Tests.csproj @@ -0,0 +1,47 @@ + + + + + Exe + tizen60 + + + + + true + + + + portable + + + None + + + + + + + + + + + + + + Runtime + + + + + + + + + + + ..\..\..\TizenFX\src\Tizen.Security.DevicePolicyManager\bin\Release\netstandard2.0\Tizen.Security.DevicePolicyManager.dll + + + + diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/Tizen.DevicePolicyManager.Tests.sln b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/Tizen.DevicePolicyManager.Tests.sln new file mode 100755 index 0000000..83feffe --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/Tizen.DevicePolicyManager.Tests.sln @@ -0,0 +1,72 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.15 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.DevicePolicyManager.Tests", "Tizen.DevicePolicyManager.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.NUI|Any CPU.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.NUI|Any CPU.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/shared/res/Tizen.DevicePolicyManager.Tests.png b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/shared/res/Tizen.DevicePolicyManager.Tests.png new file mode 100755 index 0000000..9765b1b Binary files /dev/null and b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/shared/res/Tizen.DevicePolicyManager.Tests.png differ diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSBluetoothPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSBluetoothPolicy.cs new file mode 100755 index 0000000..ce2dad3 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSBluetoothPolicy.cs @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Tests +{ + [TestFixture] + [Description("Tests Tizen.Security.DevicePolicyManager.BluetoothPolicy class")] + class BluetoothPolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private BluetoothPolicy _bluetoothPolicy; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _bluetoothPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _bluetoothPolicy, _dpm"); + _bluetoothPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Check whether BluetoothPolicyName returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.BluetoothPolicy.BluetoothPolicyName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void BluetoothPolicyName_READ_ONLY() + { + Assert.IsInstanceOf(BluetoothPolicy.BluetoothPolicyName); + Assert.AreEqual(BluetoothPolicy.BluetoothPolicyName, "Bluetooth"); + } + + [Test] + [Category("P1")] + [Description("Check whether BluetoothTetheringPolicyName returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.BluetoothPolicy.BluetoothTetheringPolicyName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void BluetoothTetheringPolicyName_READ_ONLY() + { + Assert.IsInstanceOf(BluetoothPolicy.BluetoothTetheringPolicyName); + Assert.AreEqual(BluetoothPolicy.BluetoothTetheringPolicyName, "BluetoothTethering"); + } + + [Test] + [Category("P1")] + [Description("Check whether IsBluetoothAllowed returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.BluetoothPolicy.IsBluetoothAllowed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void IsBluetoothAllowed_READ_ONLY() + { + Assert.IsInstanceOf(_bluetoothPolicy.IsBluetoothAllowed); + Assert.True(_bluetoothPolicy.IsBluetoothAllowed, "IsBluetoothAllowed return true"); + } + + [Test] + [Category("P1")] + [Description("Check whether IsBluetoothTetheringAllowed returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.BluetoothPolicy.IsBluetoothTetheringAllowed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void IsBluetoothTetheringAllowed_READ_ONLY() + { + Assert.IsInstanceOf(_bluetoothPolicy.IsBluetoothTetheringAllowed); + Assert.True(_bluetoothPolicy.IsBluetoothTetheringAllowed, "IsBluetoothTetheringAllowed return true"); + } + + [Test] + [Category("P1")] + [Description("Check whether Dispose method not throw exception.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.BluetoothPolicy.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void Dispose_TEST() + { + try + { + DevicePolicyManager dpm = new DevicePolicyManager(); + BluetoothPolicy bluetoothPolicy = dpm.GetPolicy(); + bluetoothPolicy.Dispose(); + dpm.Dispose(); + } + catch (Exception e) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, e.Message + " occured"); + Assert.Fail("Should not throw Exception"); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSBrowserPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSBrowserPolicy.cs new file mode 100755 index 0000000..e90b1bb --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSBrowserPolicy.cs @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Linq; +using System.Threading.Tasks; +using System.Runtime.InteropServices; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Tests +{ + [TestFixture] + [Description("Tests Tizen.Security.DevicePolicyManager.BrowserPolicy class")] + class BrowserPolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private BrowserPolicy _browserPolicy; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _browserPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _browserPolicy, _dpm"); + _browserPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Check whether BrowserPolicyName returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.BrowserPolicy.BrowserPolicyName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void BrowserPolicyName_READ_ONLY() + { + Assert.IsInstanceOf(BrowserPolicy.BrowserPolicyName); + Assert.AreEqual(BrowserPolicy.BrowserPolicyName, "Browser"); + } + + [Test] + [Category("P1")] + [Description("Check whether IsBrowserAllowed returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.BrowserPolicy.IsBrowserAllowed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void IsBrowserAllowed_READ_ONLY() + { + Assert.IsInstanceOf(_browserPolicy.IsBrowserAllowed); + Assert.True(_browserPolicy.IsBrowserAllowed, "IsBrowserAllowed return true"); + } + + [Test] + [Category("P1")] + [Description("Check whether Dispose method not throw exception.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.BrowserPolicy.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void Dispose_TEST() + { + try + { + DevicePolicyManager dpm = new DevicePolicyManager(); + BrowserPolicy browserPolicy = dpm.GetPolicy(); + browserPolicy.Dispose(); + dpm.Dispose(); + } + catch (Exception e) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, e.Message + " occured"); + Assert.Fail("Should not throw Exception"); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSDevicePolicyManager.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSDevicePolicyManager.cs new file mode 100755 index 0000000..19e3e10 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSDevicePolicyManager.cs @@ -0,0 +1,239 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Tests +{ + [TestFixture] + [Description("Tests Tizen.Security.DevicePolicyManager.DevicePolicyManager class")] + public class DevicePolicyManagerTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _dpm"); + _dpm.Dispose(); + } + } + + [Test] + [Category("P0")] + [Description("Create a DevicePolicyManager Instance")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.DevicePolicyManager.DevicePolicyManager C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void DevicePolicyManager_INIT() + { + var dpm = new DevicePolicyManager(); + Assert.IsInstanceOf(dpm, "Should return DevicePolicyManager instance"); + + dpm.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Get a BluetoothPolicy Instance")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.DevicePolicyManager.GetPolicy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void GetPolicy_RETURN_VALUE_BLUETHOOTHPOLICY() + { + var bluetoothPolicy = _dpm.GetPolicy(); + Assert.IsInstanceOf(bluetoothPolicy, "Should return BluetoothPolicy instance"); + bluetoothPolicy.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Get a BrowserPolicy Instance")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.DevicePolicyManager.GetPolicy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void GetPolicy_RETURN_VALUE_BROWSERPOLICY() + { + var browserPolicy = _dpm.GetPolicy(); + Assert.IsInstanceOf(browserPolicy, "Should return BrowserPolicy instance"); + browserPolicy.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Get a EmailPolicy Instance")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.DevicePolicyManager.GetPolicy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void GetPolicy_RETURN_VALUE_EMAILPOLICY() + { + var emailPolicy = _dpm.GetPolicy(); + Assert.IsInstanceOf(emailPolicy, "Should return EmailPolicy instance"); + emailPolicy.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Get a LocationPolicy Instance")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.DevicePolicyManager.GetPolicy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void GetPolicy_RETURN_VALUE_LOCATIONPOLICY() + { + var locationPolicy = _dpm.GetPolicy(); + Assert.IsInstanceOf(locationPolicy, "Should return LocationPolicy instance"); + locationPolicy.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Get a MediaPolicy Instance")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.DevicePolicyManager.GetPolicy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void GetPolicy_RETURN_VALUE_MEDIAPOLICY() + { + var mediaPolicy = _dpm.GetPolicy(); + Assert.IsInstanceOf(mediaPolicy, "Should return MediaPolicy instance"); + mediaPolicy.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Get a PasswordPolicy Instance")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.DevicePolicyManager.GetPolicy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void GetPolicy_RETURN_VALUE_PASSWORDPOLICY() + { + var passwordPolicy = _dpm.GetPolicy(); + Assert.IsInstanceOf(passwordPolicy, "Should return PasswordPolicy instance"); + } + + [Test] + [Category("P1")] + [Description("Get a StoragePolicy Instance")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.DevicePolicyManager.GetPolicy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void GetPolicy_RETURN_VALUE_STORAGEPOLICY() + { + var storagePolicy = _dpm.GetPolicy(); + Assert.IsInstanceOf(storagePolicy, "Should return StoragePolicy instance"); + storagePolicy.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Get a TelephonyPolicy Instance")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.DevicePolicyManager.GetPolicy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void GetPolicy_RETURN_VALUE_TELEPHONYPOLICY() + { + var telephonyPolicy = _dpm.GetPolicy(); + Assert.IsInstanceOf(telephonyPolicy, "Should return TelephonyPolicy instance"); + telephonyPolicy.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Get a UsbPolicy Instance")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.DevicePolicyManager.GetPolicy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void GetPolicy_RETURN_VALUE_USBPOLICY() + { + var usbPolicy = _dpm.GetPolicy(); + Assert.IsInstanceOf(usbPolicy, "Should return UsbPolicy instance"); + usbPolicy.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Get a WifiPolicy Instance")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.DevicePolicyManager.GetPolicy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void GetPolicy_RETURN_VALUE_WIFIPOLICY() + { + var wifiPolicy = _dpm.GetPolicy(); + Assert.IsInstanceOf(wifiPolicy, "Should return WifiPolicy instance"); + wifiPolicy.Dispose(); + } + + [Test] + [Category("P1")] + [Description("Check whether Dispose method not throw exception.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.DevicePolicyManager.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void Dispose_TEST() + { + try + { + DevicePolicyManager dpm = new DevicePolicyManager(); + dpm.Dispose(); + } + catch (Exception e) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, e.Message + " occured"); + Assert.Fail("Should not throw Exception"); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSEmailPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSEmailPolicy.cs new file mode 100755 index 0000000..476de7c --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSEmailPolicy.cs @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Tests +{ + [TestFixture] + [Description("Tests Tizen.Security.DevicePolicy.EmailPolicy class")] + class EmailPolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private EmailPolicy _emailPolicy; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _emailPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _emailPolicy, _dpm"); + _emailPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Check whether PopImapEmailPolicyName returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.EmailPolicy.PopImapEmailPolicyName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void PopImapEmailPolicyName_READ_ONLY() + { + Assert.IsInstanceOf(EmailPolicy.PopImapEmailPolicyName); + Assert.AreEqual(EmailPolicy.PopImapEmailPolicyName, "PopImapEmail"); + } + + [Test] + [Category("P1")] + [Description("Check whether IsPopImapAllowed returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.EmailPolicy.IsPopImapAllowed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void IsPopImapAllowed_READ_ONLY() + { + Assert.IsInstanceOf(_emailPolicy.IsPopImapAllowed); + Assert.True(_emailPolicy.IsPopImapAllowed, "IsPopImapAllowed return true"); + } + + [Test] + [Category("P1")] + [Description("Check whether Dispose method not throw exception.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.EmailPolicy.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void Dispose_TEST() + { + try + { + DevicePolicyManager dpm = new DevicePolicyManager(); + EmailPolicy emailPolicy = dpm.GetPolicy(); + emailPolicy.Dispose(); + dpm.Dispose(); + } + catch (Exception e) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, e.Message + " occured"); + Assert.Fail("Should not throw Exception"); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSLocationPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSLocationPolicy.cs new file mode 100755 index 0000000..2dc2f1b --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSLocationPolicy.cs @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Tests +{ + [TestFixture] + [Description("Tests Tizen.Security.DevicePolicy.LocationPolicy class")] + class LocationPolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private LocationPolicy _locationPolicy; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _locationPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _locationPolicy, _dpm"); + _locationPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Check whether LocationPolicyName returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.LocationPolicy.LocationPolicyName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void LocationPolicyName_READ_ONLY() + { + Assert.IsInstanceOf(LocationPolicy.LocationPolicyName); + Assert.AreEqual(LocationPolicy.LocationPolicyName, "Location"); + } + + [Test] + [Category("P1")] + [Description("Check whether IsLocationAllowed returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.LocationPolicy.IsLocationAllowed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void IsLocationAllowed_READ_ONLY() + { + Assert.IsInstanceOf(_locationPolicy.IsLocationAllowed); + Assert.True(_locationPolicy.IsLocationAllowed, "IsLocationAllowed return true"); + } + + [Test] + [Category("P1")] + [Description("Check whether Dispose method not throw exception.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.LocationPolicy.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void Dispose_TEST() + { + try + { + DevicePolicyManager dpm = new DevicePolicyManager(); + LocationPolicy locationPolicy = dpm.GetPolicy(); + locationPolicy.Dispose(); + dpm.Dispose(); + } + catch (Exception e) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, e.Message + " occured"); + Assert.Fail("Should not throw Exception"); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSMediaPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSMediaPolicy.cs new file mode 100755 index 0000000..9983747 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSMediaPolicy.cs @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Tests +{ + [TestFixture] + [Description("Tests Tizen.Security.DevicePolicy.MediaPolicy class")] + class MediaPolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private MediaPolicy _mediaPolicy; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _mediaPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _mediaPolicy, _dpm"); + _mediaPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Check whether CameraPolicyName returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.MediaPolicy.CameraPolicyName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void CameraPolicyName_READ_ONLY() + { + Assert.IsInstanceOf(MediaPolicy.CameraPolicyName); + Assert.AreEqual(MediaPolicy.CameraPolicyName, "Camera"); + } + + [Test] + [Category("P1")] + [Description("Check whether MicrophonePolicyName returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.MediaPolicy.MicrophonePolicyName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void MicrophonePolicyName_READ_ONLY() + { + Assert.IsInstanceOf(MediaPolicy.MicrophonePolicyName); + Assert.AreEqual(MediaPolicy.MicrophonePolicyName, "Microphone"); + } + + [Test] + [Category("P1")] + [Description("Check whether IsCameraAllowed returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.MediaPolicy.IsCameraAllowed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void IsCameraAllowed_READ_ONLY() + { + Assert.IsInstanceOf(_mediaPolicy.IsCameraAllowed); + Assert.True(_mediaPolicy.IsCameraAllowed, "IsCameraAllowed return true"); + } + + [Test] + [Category("P1")] + [Description("Check whether IsMicrophoneAllowed returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.MediaPolicy.IsMicrophoneAllowed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void IsMicrophoneAllowed_READ_ONLY() + { + Assert.IsInstanceOf(_mediaPolicy.IsMicrophoneAllowed); + Assert.True(_mediaPolicy.IsMicrophoneAllowed, "IsMicrophoneAllowed return true"); + } + + [Test] + [Category("P1")] + [Description("Check whether Dispose method not throw exception.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.MediaPolicy.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void Dispose_TEST() + { + try + { + DevicePolicyManager dpm = new DevicePolicyManager(); + MediaPolicy mediaPolicy = dpm.GetPolicy(); + mediaPolicy.Dispose(); + dpm.Dispose(); + } + catch (Exception e) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, e.Message + " occured"); + Assert.Fail("Should not throw Exception"); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSPasswordPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSPasswordPolicy.cs new file mode 100755 index 0000000..61750a4 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSPasswordPolicy.cs @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Tests +{ + [TestFixture] + [Description("Tests Tizen.Security.DevicePolicy.PasswordPolicy class")] + class PasswordPolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private PasswordPolicy _passwordPolicy; + private bool isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + isSupported = true; + _dpm = new DevicePolicyManager(); + _passwordPolicy = _dpm.GetPolicy(); + } + else + { + isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _dpm"); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Check whether ExpireDay returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.PasswordPolicy.DaysToExpiration A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void DaysToExpiration_READ_ONLY() + { + Assert.IsInstanceOf(_passwordPolicy.DaysToExpiration); + Assert.IsTrue(_passwordPolicy.DaysToExpiration == int.MaxValue || _passwordPolicy.DaysToExpiration == 0, + "The value of DaysToExpiration property should match value from getter"); + } + + [Test] + [Category("P1")] + [Description("Check whether MinimumPreviousHistory returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.PasswordPolicy.MinimumPreviousHistory A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void MinimumPreviousHistory_READ_ONLY() + { + Assert.IsInstanceOf(_passwordPolicy.MinimumPreviousHistory); + Assert.IsTrue(_passwordPolicy.MinimumPreviousHistory == 0, + "The value of MinimumPreviousHistory property should match value from getter"); + } + + [Test] + [Category("P1")] + [Description("Check whether MaxInactivityTimeDeviceLock returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.PasswordPolicy.MaxInactivityTimeDeviceLock A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void MaxInactivityTimeDeviceLock_READ_ONLY() + { + Assert.IsInstanceOf(_passwordPolicy.MaxInactivityTimeDeviceLock); + Assert.IsTrue(_passwordPolicy.MaxInactivityTimeDeviceLock == int.MaxValue || _passwordPolicy.MaxInactivityTimeDeviceLock == 0, + "The value of MaxInactivityTimeDeviceLock property should match value from getter"); + } + + [Test] + [Category("P1")] + [Description("Check whether MaximumFailedAttemptsForWipe returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.PasswordPolicy.MaximumFailedAttemptsForWipe A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void MaximumFailedAttemptsForWipe_READ_ONLY() + { + Assert.IsInstanceOf(_passwordPolicy.MaximumFailedAttemptsForWipe); + Assert.IsTrue(_passwordPolicy.MaximumFailedAttemptsForWipe == int.MaxValue || _passwordPolicy.MaximumFailedAttemptsForWipe == 0, + "The value of MaximumFailedAttemptsForWife property should match value from getter"); + } + + [Test] + [Category("P1")] + [Description("Check whether MinimumRequiredComplexChars returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.PasswordPolicy.MinimumRequiredComplexChars A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void MinimumRequiredComplexChars_READ_ONLY() + { + Assert.IsInstanceOf(_passwordPolicy.MinimumRequiredComplexChars); + Assert.IsTrue(_passwordPolicy.MinimumRequiredComplexChars == 0, + "The value of MinimumRequiredComplexChars property should match value from getter"); + } + + [Test] + [Category("P1")] + [Description("Check whether MinimunLength returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.PasswordPolicy.MinimunLength A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void MinimunLength_READ_ONLY() + { + Assert.IsInstanceOf(_passwordPolicy.MinimumRequiredComplexChars); + Assert.IsTrue(_passwordPolicy.MinimumRequiredComplexChars == 0, + "The value of MinimunLength property should match value from getter"); + } + + [Test] + [Category("P1")] + [Description("Check whether Quality returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.PasswordPolicy.Quality A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void Quality_READ_ONLY() + { + Assert.IsInstanceOf(_passwordPolicy.Quality); + Assert.IsTrue(_passwordPolicy.Quality == PasswordQuality.Unspecified, + "The value of password quality property should match value from getter"); + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSStoragePolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSStoragePolicy.cs new file mode 100755 index 0000000..c03c773 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSStoragePolicy.cs @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Tests +{ + [TestFixture] + [Description("Tests Tizen.Security.DevicePolicy.StoragePolicy class")] + class StoragePolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private StoragePolicy _storagePolicy; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _storagePolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _storagePolicy, _dpm"); + _storagePolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Check whether ExternalStoragePolicyName returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.StoragePolicy.ExternalStoragePolicyName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void ExternalStoragePolicyName_READ_ONLY() + { + Assert.IsInstanceOf(StoragePolicy.ExternalStoragePolicyName); + Assert.AreEqual("ExternalStorage", StoragePolicy.ExternalStoragePolicyName); + } + + [Test] + [Category("P1")] + [Description("Check whether IsExternalStorageAllowed returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.StoragePolicy.IsExternalStorageAllowed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void IsExternalStorageAllowed_READ_ONLY() + { + Assert.IsInstanceOf(_storagePolicy.IsExternalStorageAllowed); + Assert.True(_storagePolicy.IsExternalStorageAllowed, "IsExternalStorageAllowed return true"); + } + + [Test] + [Category("P1")] + [Description("Check whether Dispose method not throw exception.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.StoragePolicy.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void Dispose_TEST() + { + try + { + DevicePolicyManager dpm = new DevicePolicyManager(); + StoragePolicy storagePolicy = dpm.GetPolicy(); + storagePolicy.Dispose(); + dpm.Dispose(); + } + catch (Exception e) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, e.Message + " occured"); + Assert.Fail("Should not throw Exception"); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSTelephonyPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSTelephonyPolicy.cs new file mode 100755 index 0000000..f38cd9d --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSTelephonyPolicy.cs @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Tests +{ + [TestFixture] + [Description("Tests Tizen.Security.DevicePolicy.TelephonyPolicy class")] + class TelephonyPolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private TelephonyPolicy _telephonyPolicy; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _telephonyPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _telephonyPolicy, _dpm"); + _telephonyPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Check whether MessagingPolicyName returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.TelephonyPolicy.MessagingPolicyName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void MessagingPolicyName_READ_ONLY() + { + Assert.IsInstanceOf(TelephonyPolicy.MessagingPolicyName); + Assert.AreEqual("Messaging", TelephonyPolicy.MessagingPolicyName); + } + + [Test] + [Category("P1")] + [Description("Check whether IsMessagingAllowed returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.TelephonyPolicy.IsMessagingAllowed M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void IsMessagingAllowed_READ_ONLY() + { + string testSim = "sim1"; + bool currentState = _telephonyPolicy.IsMessagingAllowed(testSim); + Assert.True(currentState, "IsMessagingAllowed return true"); + } + + [Test] + [Category("P2")] + [Description("Check whether IsMessagingAllowed throws expected exception or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.TelephonyPolicy.IsMessagingAllowed M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void IsMessagingAllowed_CHECK_ARGUMENT_EXCEPTION() + { + Assert.Throws(() => _telephonyPolicy.IsMessagingAllowed(null)); + } + + [Test] + [Category("P1")] + [Description("Check whether Dispose method not throw exception.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.TelephonyPolicy.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void Dispose_TEST() + { + try + { + DevicePolicyManager dpm = new DevicePolicyManager(); + TelephonyPolicy telephonyPolicy = dpm.GetPolicy(); + telephonyPolicy.Dispose(); + dpm.Dispose(); + } + catch (Exception e) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, e.Message + " occured"); + Assert.Fail("Should not throw Exception"); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSUsbPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSUsbPolicy.cs new file mode 100755 index 0000000..e0d072a --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSUsbPolicy.cs @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Tests +{ + [TestFixture] + [Description("Tests Tizen.Security.DevicePolicy.UsbPolicy class")] + class UsbPolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private UsbPolicy _usbPolicy; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _usbPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _usbPolicy, _dpm"); + _usbPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Check whether UsbTetheringPolicyName returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.UsbPolicy.UsbTetheringPolicyName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void UsbTetheringPolicyName_READ_ONLY() + { + Assert.IsInstanceOf(UsbPolicy.UsbTetheringPolicyName); + Assert.AreEqual("UsbTethering", UsbPolicy.UsbTetheringPolicyName); + } + + [Test] + [Category("P1")] + [Description("Check whether IsUsbTetheringAllowed returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.UsbPolicy.IsUsbTetheringAllowed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void IsUsbTetheringAllowed_READ_ONLY() + { + Assert.IsInstanceOf(_usbPolicy.IsUsbTetheringAllowed); + Assert.True(_usbPolicy.IsUsbTetheringAllowed, "IsLocationAllowed return true"); + } + + [Test] + [Category("P1")] + [Description("Check whether Dispose method not throw exception.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.UsbPolicy.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void Dispose_TEST() + { + try + { + DevicePolicyManager dpm = new DevicePolicyManager(); + UsbPolicy usbPolicy = dpm.GetPolicy(); + usbPolicy.Dispose(); + dpm.Dispose(); + } + catch (Exception e) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, e.Message + " occured"); + Assert.Fail("Should not throw Exception"); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSWifiPolicy.cs b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSWifiPolicy.cs new file mode 100755 index 0000000..f9e5f73 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/testcase/TSWifiPolicy.cs @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using Tizen.System; + +namespace Tizen.Security.DevicePolicyManager.Tests +{ + [TestFixture] + [Description("Tests Tizen.Security.DevicePolicy.WifiPolicy class")] + class WifiPolicyTests + { + internal class Globals + { + internal const string LogTag = "DPMTC"; + } + + private DevicePolicyManager _dpm; + private WifiPolicy _wifiPolicy; + private bool _isSupported; + + [SetUp] + public void Init() + { + string profile; + Information.TryGetValue("http://tizen.org/feature/profile", out profile); + if (String.Compare(profile, "mobile", true) == 0 || String.Compare(profile, "wearable", true) == 0) + { + _isSupported = true; + _dpm = new DevicePolicyManager(); + _wifiPolicy = _dpm.GetPolicy(); + } + else + { + _isSupported = false; + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "The DevicePolicyManager is not supported."); + Assert.Pass("The DevicePolicyManager is not supported."); + } + } + + [TearDown] + public void Destroy() + { + if (_isSupported) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, "Dispose _wifiPolicy, _dpm"); + _wifiPolicy.Dispose(); + _dpm.Dispose(); + } + } + + [Test] + [Category("P1")] + [Description("Check whether WifiPolicyName returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.WifiPolicy.WifiPolicyName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void WifiPolicyName_READ_ONLY() + { + Assert.IsInstanceOf(WifiPolicy.WifiPolicyName); + Assert.AreEqual("Wifi", WifiPolicy.WifiPolicyName); + } + + [Test] + [Category("P1")] + [Description("Check whether WifiHotspotPolicyName returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.WifiPolicy.WifiHotspotPolicyName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void WifiHotspotPolicyName_READ_ONLY() + { + Assert.IsInstanceOf(WifiPolicy.WifiHotspotPolicyName); + Assert.AreEqual("WifiHotspot", WifiPolicy.WifiHotspotPolicyName); + } + + [Test] + [Category("P1")] + [Description("Check whether IsWifiAllowed returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.WifiPolicy.IsWifiAllowed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void IsWifiAllowed_READ_ONLY() + { + Assert.IsInstanceOf(_wifiPolicy.IsWifiAllowed); + Assert.True(_wifiPolicy.IsWifiAllowed, "IsWifiAllowed return true"); + } + + [Test] + [Category("P1")] + [Description("Check whether IsWifiHotspotAllowed returns expected value or not.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.WifiPolicy.IsWifiHotspotAllowed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void IsWifiHotspotAllowed_READ_ONLY() + { + Assert.IsInstanceOf(_wifiPolicy.IsWifiHotspotAllowed); + Assert.True(_wifiPolicy.IsWifiHotspotAllowed, "IsLocationAllowed return true"); + } + + [Test] + [Category("P1")] + [Description("Check whether Dispose method not throw exception.")] + [Property("SPEC", "Tizen.Security.DevicePolicyManager.WifiPolicy.Dispose M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Yeji Kim, yeji01.kim@samsung.com")] + public void Dispose_TEST() + { + try + { + DevicePolicyManager dpm = new DevicePolicyManager(); + WifiPolicy wifiPolicy = dpm.GetPolicy(); + wifiPolicy.Dispose(); + dpm.Dispose(); + } + catch (Exception e) + { + LogUtils.Write(LogUtils.DEBUG, Globals.LogTag, e.Message + " occured"); + Assert.Fail("Should not throw Exception"); + } + } + } +} diff --git a/tct-suite-vs/Tizen.DevicePolicyManager.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/tizen-manifest.xml new file mode 100644 index 0000000..24ca937 --- /dev/null +++ b/tct-suite-vs/Tizen.DevicePolicyManager.Tests/tizen-manifest.xml @@ -0,0 +1,16 @@ + + + + + Tizen.DevicePolicyManager.Tests.png + + + + http://tizen.org/privilege/appmanager.launch + +