From 0337f9c576cba15e02bd5d8af3d4be37e82df732 Mon Sep 17 00:00:00 2001 From: Yunjin Lee Date: Wed, 3 Jul 2019 14:01:39 +0900 Subject: [PATCH] [PrivacyPrivilegeManager][Non-ACR]Fix to run in wearable profile - Removed TestUI and modify it to run in wearable profile - Fixed pre/post condition description because menutree of settings app can be different between mobile and wearable Change-Id: Ic0f53a2eb40a59ec19affb0d3c1900aa1d259d15 Signed-off-by: Yunjin Lee --- .../testcase/TSCheckPermission.cs | 123 ++++-- .../testcase/TSCheckPermissions.cs | 59 +-- .../testcase/TSGetResponseContext.cs | 431 +++++++++------------ .../testcase/TSPermissionRequestResponse.cs | 11 +- .../testcase/TSRequestMultipleResponseEventArgs.cs | 11 +- .../testcase/TSRequestPermission.cs | 196 +++------- .../testcase/TSRequestPermissions.cs | 72 ++-- .../testcase/TSRequestResponseEventArgs.cs | 17 +- .../testcase/support/Constans.cs | 2 - .../testcase/support/TestBase.cs | 78 ++-- .../testcase/support/TestHelpers.cs | 180 --------- .../testcase/support/TestUI.cs | 196 ---------- 12 files changed, 442 insertions(+), 934 deletions(-) mode change 100644 => 100755 tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSCheckPermission.cs mode change 100644 => 100755 tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSCheckPermissions.cs mode change 100644 => 100755 tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSPermissionRequestResponse.cs mode change 100644 => 100755 tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestMultipleResponseEventArgs.cs mode change 100644 => 100755 tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestPermission.cs mode change 100644 => 100755 tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestResponseEventArgs.cs mode change 100644 => 100755 tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/Constans.cs mode change 100644 => 100755 tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/TestBase.cs delete mode 100644 tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/TestHelpers.cs delete mode 100644 tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/TestUI.cs diff --git a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSCheckPermission.cs b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSCheckPermission.cs old mode 100644 new mode 100755 index fe6b329..24abd1c --- a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSCheckPermission.cs +++ b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSCheckPermission.cs @@ -40,9 +40,9 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests private CheckResult _correctResult; /// - /// Holds information if ArgumentException is expected + /// Holds information about expected error status for testcase /// - private bool _expectedArgumentException; + private string _correctException; /// /// Initializes environment before TCT test runs. @@ -50,11 +50,11 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [SetUp] public void Init() { - if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0) + if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0 && Profile.GetProfile().CompareTo(Profile.WearableProfile) != 0) { Assert.Pass("Privacy privileges not supported"); } - + _correctException = ""; LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); } @@ -65,31 +65,57 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests { foreach (string privilege in _privileges) { - CheckResult result = CheckPermission(privilege, _expectedArgumentException); - Color backgroundColor = Color.Green; - string labelText = " Privilege: \n" + privilege + "\nStatus: " + result; - Assert.IsFalse(ErrorOccured, "Error occured during CheckPermission test: " + ErrorMessage); - Assert.AreEqual(result, _correctResult, "wrong result for privilege: " + privilege + " expected " + _correctResult + " and got: " + result); + CheckResult result = CheckPermission(privilege); + if (!(_correctException == null || _correctException == "")) + { + Assert.IsTrue(ErrorOccured, "Expected " + _correctException + " but not occurred "); + Assert.AreEqual(_correctException, ExceptionName, "Expected " + _correctException + " but " + ExceptionName + " occurred"); + } + else if (ErrorOccured) + { + Assert.Fail("Unexpected exception occured : " + ExceptionName); + } + Assert.AreEqual(result, _correctResult, "Wrong result for privilege: " + privilege + " expected " + _correctResult + " and got: " + result); } } [Test] [Category("P1")] - [Description("Test: Check if CheckPermission method works.")] + [Description("Test: Check if CheckPermission method works and can get status of allowed privilege.")] [Property("SPEC", "Tizen.Security.PrivacyPrivilegeManager.CheckPermission M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, " Open Settings")] - [Precondition(2, " Open \"Privacy and security\"")] - [Precondition(3, " Open \"Privacy settings\"")] - [Precondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Precondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] - [Step(1, " Click run TC")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] + [Precondition(1, " Open terminal and enter following commands:")] + [Precondition(2, " sdb root on")] + [Precondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t ALLOW")] + [Precondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t ALLOW")] + [Precondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t ALLOW")] + [Step(1, " Click Run button")] + [Postcondition(1, "NA")] + public void CheckPermission_REAL_PRIVILEGES_ALLOW() + { + _privileges = Constans.Privileges; + _correctResult = CheckResult.Allow; + Check(); + } + + [Test] + [Category("P1")] + [Description("Test: Check if CheckPermission method works and can get status of askable privilege.")] + [Property("SPEC", "Tizen.Security.PrivacyPrivilegeManager.CheckPermission M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] + [Precondition(1, " Open terminal and enter following commands:")] + [Precondition(2, " sdb root on")] + [Precondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Precondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Precondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] + [Step(1, " Click Run button")] [Postcondition(1, "NA")] - public void CheckPermission_REAL_PRIVILEGES() + public void CheckPermission_REAL_PRIVILEGES_ASK() { - _expectedArgumentException = false; _privileges = Constans.Privileges; _correctResult = CheckResult.Ask; Check(); @@ -97,35 +123,57 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Test] [Category("P1")] + [Description("Test: Check if CheckPermission method works and can get status of denied privilege.")] + [Property("SPEC", "Tizen.Security.PrivacyPrivilegeManager.CheckPermission M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] + [Precondition(1, " Open terminal and enter following commands:")] + [Precondition(2, " sdb root on")] + [Precondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t DENY")] + [Precondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t DENY")] + [Precondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t DENY")] + [Step(1, " Click Run button")] + [Postcondition(1, "NA")] + public void CheckPermission_REAL_PRIVILEGES_DENY() + { + _privileges = Constans.Privileges; + _correctResult = CheckResult.Deny; + Check(); + } + + [Test] + [Category("P1")] [Description("Test: Check if CheckPermission method works with long string.")] [Property("SPEC", "Tizen.Security.PrivacyPrivilegeManager.CheckPermission M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MAC")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void CheckPermission_LONG_STRING() { - _expectedArgumentException = false; _privileges = new string[] { Constans.LongString }; _correctResult = CheckResult.Deny; Check(); } [Test] - [Category("P1")] - [Description("Test: Check if CheckPermission method works with empty string.")] + [Category("P2")] + [Description("Test: Check if CheckPermission method throws ArgumentException when empty string is given.")] [Property("SPEC", "Tizen.Security.PrivacyPrivilegeManager.CheckPermission M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void CheckPermission_STRING_EMPTY() { - _expectedArgumentException = true; + _correctException = "ArgumentException"; _privileges = new string[] { Constans.Empty }; _correctResult = CheckResult.Deny; Check(); @@ -138,12 +186,12 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MAC")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void CheckPermission_NON_EXISTING() { - _expectedArgumentException = false; _privileges = new string[] { Constans.NoExisting }; _correctResult = CheckResult.Deny; Check(); @@ -156,12 +204,12 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MAC")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void CheckPermission_RANDOM_LETTER_CASE_PRIVILEGE() { - _expectedArgumentException = false; _privileges = new string[] { Constans.RandomLetterCasePrivilege }; _correctResult = CheckResult.Deny; Check(); @@ -174,30 +222,31 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MAC")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void CheckPermission_SPECIAL_CHARACTERS() { - _expectedArgumentException = false; _privileges = new string[] { Constans.SpecialCharacters }; _correctResult = CheckResult.Deny; Check(); } [Test] - [Category("P1")] - [Description("Test: Check if CheckPermission method works with string.null.")] + [Category("P2")] + [Description("Test: Check if CheckPermission method throws ArgumentException when null string is given.")] [Property("SPEC", "Tizen.Security.PrivacyPrivilegeManager.CheckPermission M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void CheckPermission_STRING_NULL() { - _expectedArgumentException = true; + _correctException = "ArgumentException"; _privileges = new string[] { Constans.Null }; _correctResult = CheckResult.Deny; Check(); @@ -210,12 +259,12 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MAC")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void CheckPermission_UPPER_LETTER_CASE_PRIVILEGE() { - _expectedArgumentException = false; _privileges = new string[] { Constans.UpperLetterCasePrivilege }; _correctResult = CheckResult.Deny; Check(); diff --git a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSCheckPermissions.cs b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSCheckPermissions.cs old mode 100644 new mode 100755 index eba37ed..42e84e7 --- a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSCheckPermissions.cs +++ b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSCheckPermissions.cs @@ -45,7 +45,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [SetUp] public void Init() { - if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0) + if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0 && Profile.GetProfile().CompareTo(Profile.WearableProfile) != 0) { Assert.Pass("Privacy privileges not supported"); } @@ -59,28 +59,11 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests private void Check() { CheckResult[] results = CheckPermissions(_privileges); - Color backgroundColor = Color.Green; - - string labelText = ""; - if (ErrorOccured) - { - labelText += "\n" + ErrorMessage; - backgroundColor = Color.Red; - Assert.Fail("Error occured during CheckPermissions test"); - } - else + Assert.IsFalse(ErrorOccured, "Unexpected error occurred: " + ExceptionName); + for (int it = 0; it < _privileges.Length; ++it) { - for (int it = 0; it < _privileges.Length; ++it) - { - if (results[it] != _correctResult) - { - backgroundColor = Color.Red; - Assert.Fail("Wrong CheckPermissions status:\nPrivilege: \n" + _privileges[it] + "\nStatus: " + results[it]); - } - labelText += "\n Privilege: \n" + _privileges[it] + "\nStatus: " + results[it]; - } + Assert.AreEqual(results[it], _correctResult, "Wrong CheckPermissions result for " + _privileges[it] + "\nExpected: " + _correctResult + " but " + results[it] + " returned"); } - } [Test] @@ -90,12 +73,13 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MR")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, " Open Settings")] - [Precondition(2, " Open \"Privacy and security\"")] - [Precondition(3, " Open \"Privacy settings\"")] - [Precondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Precondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] - [Step(1, " Click run TC")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] + [Precondition(1, " Open terminal and enter following commands:")] + [Precondition(2, " sdb root on")] + [Precondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Precondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Precondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] + [Step(1, " Click Run button")] public void CheckPermissions_REAL_PRIVILEGES() { _correctResult = CheckResult.Ask; @@ -110,12 +94,13 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MR")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, " Open Settings")] - [Precondition(2, " Open \"Privacy and security\"")] - [Precondition(3, " Open \"Privacy settings\"")] - [Precondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Precondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] - [Step(1, " Click run TC")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] + [Precondition(1, " Open terminal and enter following commands:")] + [Precondition(2, " sdb root on")] + [Precondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Precondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Precondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] + [Step(1, " Click Run button")] public void CheckPermissions_REAL_PRIVILEGES_WITH_DUPLICATES() { _correctResult = CheckResult.Ask; @@ -132,12 +117,8 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MR")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, " Open Settings")] - [Precondition(2, " Open \"Privacy and security\"")] - [Precondition(3, " Open \"Privacy settings\"")] - [Precondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Precondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] - [Step(1, " Click run TC")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] + [Step(1, " Click Run button")] public void CheckPermissions_FAKE_PRIVILEGES() { _correctResult = CheckResult.Deny; diff --git a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSGetResponseContext.cs b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSGetResponseContext.cs index d98340e..1bfcbf7 100755 --- a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSGetResponseContext.cs +++ b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSGetResponseContext.cs @@ -28,21 +28,31 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests /// [TestFixture] [Description("Tizen.PrivacyPrivilegeManager Manual test")] - public class TSGetResponseContext : TestHelpers + public class TSGetResponseContext : TestBase { + + private RequestResult _correctResponse; + private static bool _requestAdditionalPrivilegesInCallback = false; + private int _responseCount = 0; + + /// + /// Holds privilege that will be tested + /// + private string[] _privileges; + /// /// Initializes environment before TCT test runs. /// [SetUp] public void Init() { - if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0) + if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0 && Profile.GetProfile().CompareTo(Profile.WearableProfile) != 0) { Assert.Pass("Privacy privileges not supported"); } - + _requestAdditionalPrivilegesInCallback = false; + _responseCount = 0; LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); - executeCount = 1; } /// @@ -59,30 +69,39 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests } /// - /// Handles catching PrivilegeManager responses. + /// Handles catched PrivacyPrivilegeManager's single privilege request responses. /// /// Sender object /// Event arguments - private void PPM_RequestResponse(object sender, RequestResponseEventArgs e) + private void PPMRequestResponse(object sender, RequestResponseEventArgs e) { + _responseCount++; if (e.cause == CallCause.Answer) { - executeCount++; - LogPrivilegeRequestResponse(e.privilege, e.result); + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "For privilege: " + e.privilege + " expected " + _correctResponse + " and got: " + e.result); + if (e.result != _correctResponse) + { + ManualTest.ConfirmFail("Wrong result for privilege: " + e.privilege + " expected " + _correctResponse + " and got: " + e.result); + } + else + { + if (_responseCount == _privileges.Length) + ManualTest.Confirm(); + } } else { - LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "Error occured during requesting permission for " + e.privilege); + LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "Unexpected CallCause returned: " + e.cause); + ManualTest.ConfirmFail("Unexpected CallCause returned: " + e.cause); } DestroyPPMHandler(e.privilege); - ChangeButtonState(true); } /// - /// Setups event handler for catching PrivilegeManager responses. + /// Setups event handler for catching PrivacyPrivilegeManager's single privilege request responses. /// /// Privilege name - protected override void SetupPPMHandler(string privilege) + private void SetupPPMHandler(string privilege) { if (privilege == null) { @@ -90,31 +109,19 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests } if (PrivacyPrivilegeManager.GetResponseContext(privilege).TryGetTarget(out PrivacyPrivilegeManager.ResponseContext context)) { - context.ResponseFetched += PPM_RequestResponse; - context.ResponseFetched -= PPM_RequestResponse; - context.ResponseFetched += PPM_RequestResponse; - if (PrivacyPrivilegeManager.GetResponseContext(privilege).TryGetTarget(out PrivacyPrivilegeManager.ResponseContext context2)) - { - context.ResponseFetched -= PPM_RequestResponse; - context2.ResponseFetched += PPM_RequestResponse; - GC.Collect(); - GC.WaitForPendingFinalizers(); - } - else - { - LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "Error occured during Settuping second ppm handler permission for " + privilege); - } + context.ResponseFetched += PPMRequestResponse; } else { - LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "Error occured during Settuping ppm handler permission for " + privilege); + LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "Unexpected error occurred while setting up ppm handler for " + privilege); + ManualTest.ConfirmFail("Unexpected error occurred while setting up ppm handler for " + privilege); } GC.Collect(); GC.WaitForPendingFinalizers(); } /// - /// Destroys hander for PrivilegeManager single privilege request response + /// Destroys handler for PrivacyPrivilegeManager's single privilege request response /// /// Privilege with subscribled handler private void DestroyPPMHandler(string privilege) @@ -125,301 +132,241 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests } if (PrivacyPrivilegeManager.GetResponseContext(privilege).TryGetTarget(out PrivacyPrivilegeManager.ResponseContext context)) { - context.ResponseFetched -= PPM_RequestResponse; + context.ResponseFetched -= PPMRequestResponse; } } /// - /// Handles Buttons OnClick event. + /// Request permission for privilges one by one and set handler to check the user response for each privilege /// - /// Sender - /// Event arguments - private void OnClick(object sender, EventArgs e) + private void SRequest() { - ChangeButtonState(false); - Check(_privileges); + foreach (string privilege in _privileges) + { + SetupPPMHandler(privilege); + RequestPermission(privilege); + + if (ErrorOccured) + { + LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "error occurred : " + ErrorMessage); + ManualTest.ConfirmFail("Unexpected " + ExceptionName + " occurred while calling RequestPermission()"); + } + } } /// - /// Handles Buttons OnClickMultiple event. + /// Request permission for multiple privileges at once and check the user response value /// - /// Sender - /// Event arguments - private async void OnClickMultiple(object sender, EventArgs e) + protected async Task CheckMultiple(string[] privileges) + { + RequestMultipleResponseEventArgs request = null; + + try + { + int responseCount = 0; + request = await PrivacyPrivilegeManager.RequestPermissions(privileges); + if (request.Cause == CallCause.Error) + { + LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "Unexpected CallCause returned: " + request.Cause); + Assert.Fail("Unexpected CallCause returned: " + request.Cause); + } + responseCount = 0; + foreach (PermissionRequestResponse response in request.Responses) + { + responseCount++; + Assert.AreEqual(_correctResponse, response.Result, "Wrong result for privilege: " + response.Privilege + " expected " + _correctResponse + " and got: " + response.Result); + } + + Assert.AreNotEqual(0, responseCount, "There must be no asking popup and user response. Check whether the precondition of the test is properly set."); + + if (_requestAdditionalPrivilegesInCallback) + { + _privileges = Constans.SecondaryPrivileges; + _requestAdditionalPrivilegesInCallback = false; + await CheckMultiple(_privileges); + } + } + catch (Exception ex) + { + LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "error occurred : " + ex.Message); + Assert.Fail("Unexpected exception occured : " + ex.GetType().Name); + } + } + + private async Task MRequest() { - ChangeButtonState(false); await CheckMultiple(_privileges); } + private async Task MRequest_Async() + { + await CheckMultiple(Constans.Privileges); + await CheckMultiple(Constans.SecondaryPrivileges); + } [Test] [Category("P1")] - [Description("Test: Check if popup works.")] + [Description("Test: Check whether popup works and user response is properly received.")] [Property("SPEC", "Tizen.Security.PrivacyPrivilegeManager.ResponseContext.ResponseFetched E")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "EVL")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, " Open Settings")] - [Precondition(2, " Open \"Privacy and security\"")] - [Precondition(3, " Open \"Privacy settings\"")] - [Precondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Precondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] - [Step(1, " Click run TC")] - [Step(2, " Click button")] - [Step(3, " Allow Privileges")] - [Step(4, " Click button")] - [Step(5, " Check Logs output (inside program)")] - [Step(6, " Good output: Privilege:\nhttp://tizen.org/privilege/account.read\nStatus: Ask")] - [Step(7, " Good output: Privilege:\nhttp://tizen.org/privilege/account.write\nStatus: Ask")] - [Step(8, " Good output: Privilege:\nhttp://tizen.org/privilege/call\nStatus: Ask")] - [Step(9, " Good output: Privilege:\nhttp://tizen.org/privilege/account.read\nStatus: AllowForever")] - [Step(10, " Good output: Privilege:\nhttp://tizen.org/privilege/account.write\nStatus: AllowForever")] - [Step(11, " Good output: Privilege:\nhttp://tizen.org/privilege/call\nStatus: AllowForever")] - [Step(12, " Good output: Privilege:\nhttp://tizen.org/privilege/account.read\nStatus: Allow")] - [Step(13, " Good output: Privilege:\nhttp://tizen.org/privilege/account.write\nStatus: Allow")] - [Step(14, " Good output: Privilege:\nhttp://tizen.org/privilege/call\nStatus: Allow")] - [Postcondition(1, " Open Settings")] - [Postcondition(2, " Open \"Privacy and security\"")] - [Postcondition(3, " Open \"Privacy settings\"")] - [Postcondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Postcondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] + [Precondition(1, " Open terminal and enter following commands:")] + [Precondition(2, " sdb root on")] + [Precondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Precondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Precondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] + [Step(1, " Click Run button")] + [Step(2, " Click Allow button for 3 asking popups -2 Accounts and 1 Call-")] + [Postcondition(1, " Open terminal and enter following commands:")] + [Postcondition(2, " sdb root on")] + [Postcondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Postcondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Postcondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] public async Task ResponseFetched_GET_RESPONSE_CONTEXT() { - CreateLayout(); + _correctResponse = RequestResult.AllowForever; _privileges = Constans.Privileges; - _button.Clicked += OnClick; - //// Waits for user confirmation. + SRequest(); await ManualTest.WaitForConfirm(); - _button.Clicked -= OnClick; } [Test] [Category("P1")] - [Description("Test: Check if popup works.")] + [Description("Test: Check whether popup works and user response is properly received.")] [Property("SPEC", "Tizen.Security.PrivacyPrivilegeManager.MultipleResponseContext.ResponseFetched E")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "EVL")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, " Open Settings")] - [Precondition(2, " Open \"Privacy and security\"")] - [Precondition(3, " Open \"Privacy settings\"")] - [Precondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Precondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] - [Step(1, " Click run TC")] - [Step(2, " Click button")] - [Step(3, " Allow Privileges")] - [Step(4, " Click button")] - [Step(5, " Check Logs output (inside program)")] - [Step(6, " Good output: Privilege:\nhttp://tizen.org/privilege/account.read\nStatus: Ask")] - [Step(7, " Good output: Privilege:\nhttp://tizen.org/privilege/account.write\nStatus: Ask")] - [Step(8, " Good output: Privilege:\nhttp://tizen.org/privilege/call\nStatus: Ask")] - [Step(9, " Good output: Privilege:\nhttp://tizen.org/privilege/account.read\nStatus: AllowForever")] - [Step(10, " Good output: Privilege:\nhttp://tizen.org/privilege/account.write\nStatus: AllowForever")] - [Step(11, " Good output: Privilege:\nhttp://tizen.org/privilege/call\nStatus: AllowForever")] - [Step(12, " Good output: Privilege:\nhttp://tizen.org/privilege/account.read\nStatus: Allow")] - [Step(13, " Good output: Privilege:\nhttp://tizen.org/privilege/account.write\nStatus: Allow")] - [Step(14, " Good output: Privilege:\nhttp://tizen.org/privilege/call\nStatus: Allow")] - [Postcondition(1, " Open Settings")] - [Postcondition(2, " Open \"Privacy and security\"")] - [Postcondition(3, " Open \"Privacy settings\"")] - [Postcondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Postcondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] + [Precondition(1, " Open terminal and enter following commands:")] + [Precondition(2, " sdb root on")] + [Precondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Precondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Precondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] + [Step(1, " Click Run button")] + [Step(2, " Click Allow button for all asking popups")] + [Postcondition(1, " Open terminal and enter following commands:")] + [Postcondition(2, " sdb root on")] + [Postcondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Postcondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Postcondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] public async Task ResponseFetched_GET_MULTIPLE_RESPONSE_CONTEXT() { - CreateLayout(); + _correctResponse = RequestResult.AllowForever; _privileges = Constans.Privileges; - _button.Clicked += OnClickMultiple; - //// Waits for user confirmation. - await ManualTest.WaitForConfirm(); - _button.Clicked -= OnClickMultiple; + await MRequest(); } [Test] [Category("P1")] - [Description("Test: Check if popup works.")] + [Description("Test: Check whether popup works and user response is properly received.")] [Property("SPEC", "Tizen.Security.PrivacyPrivilegeManager.MultipleResponseContext.ResponseFetched E")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "EVL")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, " Open Settings")] - [Precondition(2, " Open \"Privacy and security\"")] - [Precondition(3, " Open \"Privacy settings\"")] - [Precondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Precondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] - [Precondition(6, "Open \"Location\" and uncheck Tizen.Security.PrivacyManager")] - [Precondition(7, "Open \"Contacts\" and uncheck Tizen.Security.PrivacyManager")] - [Step(1, " Click run TC")] - [Step(2, " Click button")] - [Step(3, " Allow Privileges")] - [Step(4, " Check Logs output (inside program)")] - [Step(5, " Good output: Privilege:\nhttp://tizen.org/privilege/account.read\nStatus: Ask")] - [Step(6, " Good output: Privilege:\nhttp://tizen.org/privilege/account.write\nStatus: Ask")] - [Step(7, " Good output: Privilege:\nhttp://tizen.org/privilege/call\nStatus: Ask")] - [Step(8, " Good output: Privilege:\nhttp://tizen.org/privilege/account.read\nStatus: AllowForever")] - [Step(9, " Good output: Privilege:\nhttp://tizen.org/privilege/account.write\nStatus: AllowForever")] - [Step(10, " Good output: Privilege:\nhttp://tizen.org/privilege/call\nStatus: AllowForever")] - [Step(11, " Good output: Privilege:\nhttp://tizen.org/privilege/contact.read\nStatus:Ask")] - [Step(12, " Good output: Privilege:\nhttp://tizen.org/privilege/contact.write\nStatus:Ask")] - [Step(13, " Good output: Privilege:\nhttp://tizen.org/privilege/download\nStatus:Allow")] - [Step(14, " Good output: Privilege:\nhttp://tizen.org/privilege/location\nStatus:Ask")] - [Step(15, " Good output: Privilege:\nhttp://tizen.org/privilege/contact.read\nStatus: AllowForever")] - [Step(16, " Good output: Privilege:\nhttp://tizen.org/privilege/contact.write\nStatus: AllowForever")] - [Step(17, " Good output: Privilege:\nhttp://tizen.org/privilege/location\nStatus: AllowForever")] - [Postcondition(1, " Open Settings")] - [Postcondition(2, " Open \"Privacy and security\"")] - [Postcondition(3, " Open \"Privacy settings\"")] - [Postcondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Postcondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] - [Postcondition(6, "Open \"Location\" and uncheck Tizen.Security.PrivacyManager")] - [Postcondition(7, "Open \"Contacts\" and uncheck Tizen.Security.PrivacyManager")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] + [Precondition(1, " Open terminal and enter following commands:")] + [Precondition(2, " sdb root on")] + [Precondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Precondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Precondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] + [Precondition(6, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/location -t 0xA")] + [Precondition(7, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/contact.read -t 0xA")] + [Step(1, " Click Run button")] + [Step(2, " Click Allow button for all asking popups")] + [Postcondition(1, " Open terminal and enter following commands:")] + [Postcondition(2, " sdb root on")] + [Postcondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Postcondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Postcondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] + [Postcondition(6, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/location -t 0xA")] + [Postcondition(7, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/contact.read -t 0xA")] public async Task ResponseFetched_GET_MULTIPLE_RESPONSE_CONTEXT_SECOND_REQUEST() { - requestAdditionalPrivilegesInCallback = true; - CreateLayout(); + _requestAdditionalPrivilegesInCallback = true; + _correctResponse = RequestResult.AllowForever; _privileges = Constans.Privileges; - _button.Clicked += OnClickMultiple; - //// Waits for user confirmation. - await ManualTest.WaitForConfirm(); - _button.Clicked -= OnClickMultiple; + await MRequest(); } [Test] [Category("P1")] - [Description("Test: Check if popup works.")] + [Description("Test: Check whether popup works and user response is properly received.")] [Property("SPEC", "Tizen.Security.PrivacyPrivilegeManager.MultipleResponseContext.ResponseFetched E")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "EVL")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, " Open Settings")] - [Precondition(2, " Open \"Privacy and security\"")] - [Precondition(3, " Open \"Privacy settings\"")] - [Precondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Precondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] - [Step(1, " Click run TC")] - [Step(2, " Click button")] - [Step(3, " Allow Privileges")] - [Step(4, " Click button")] - [Step(5, " Check Logs output (inside program)")] - [Step(6, " Good output: Privilege:\nhttp://tizen.org/privilege/account.read\nStatus: Ask")] - [Step(7, " Good output: privilege:\nhttp://tizen.org/privilege/account.write\nstatus: Ask")] - [Step(8, " Good output: privilege:\nhttp://tizen.org/privilege/call\nstatus: Ask")] - [Step(9, " Good output: Privilege:\nhttp://tizen.org/privilege/contact.read\nStatus: Ask")] - [Step(10, " Good output: privilege:\nhttp://tizen.org/privilege/contact.write\nstatus: Ask")] - [Step(11, " Good output: privilege:\nhttp://tizen.org/privilege/download\nstatus: Allow")] - [Step(12, " Good output: privilege:\nhttp://tizen.org/privilege/location\nstatus: Ask")] - [Step(13, " Good output: privilege:\nhttp://tizen.org/privilege/account.read\nstatus: AllowForever")] - [Step(14, " Good output: privilege:\nhttp://tizen.org/privilege/account.write\nstatus: AllowForever")] - [Step(15, " Good output: privilege:\nhttp://tizen.org/privilege/call\nstatus: AllowForever")] - [Step(16, " Good output: privilege:\nhttp://tizen.org/privilege/contact.read\nstatus: AllowForever")] - [Step(17, " Good output: privilege:\nhttp://tizen.org/privilege/contact.write\nstatus: AllowForever")] - [Step(18, " Good output: privilege:\nhttp://tizen.org/privilege/location\nstatus: AllowForever")] - [Step(19, " Good output: privilege:\nhttp://tizen.org/privilege/account.read\nstatus: Allow")] - [Step(20, " Good output: privilege:\nhttp://tizen.org/privilege/account.write\nstatus: Allow")] - [Step(21, " Good output: privilege:\nhttp://tizen.org/privilege/call\nstatus: Allow")] - [Step(22, " Good output: privilege:\nhttp://tizen.org/privilege/contact.read\nstatus: Allow")] - [Step(23, " Good output: privilege:\nhttp://tizen.org/privilege/contact.write\nstatus: Allow")] - [Step(24, " Good output: privilege:\nhttp://tizen.org/privilege/download\nstatus: Allow")] - [Step(25, " Good output: privilege:\nhttp://tizen.org/privilege/location\nstatus: Allow")] - [Postcondition(1, " Open Settings")] - [Postcondition(2, " Open \"Privacy and security\"")] - [Postcondition(3, " Open \"Privacy settings\"")] - [Postcondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Postcondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] + [Precondition(1, " Open terminal and enter following commands:")] + [Precondition(2, " sdb root on")] + [Precondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Precondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Precondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] + [Postcondition(1, " Open terminal and enter following commands:")] + [Postcondition(2, " sdb root on")] + [Postcondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Postcondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Postcondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] public async Task ResponseFetched_GET_MULTIPLE_RESPONSE_CONTEXT_MULTI_REQUESTS() { - CreateLayout(); - _button.Clicked += OnClickMultipleRequestsAsync; - //// Waits for user confirmation. - await ManualTest.WaitForConfirm(); - _button.Clicked -= OnClickMultipleRequestsAsync; - } - - /// - /// Executes multiple requests test case - /// - /// Sender - /// Event - private async void OnClickMultipleRequestsAsync(object sender, EventArgs e) - { - ChangeButtonState(false); - await CheckMultiple(Constans.Privileges); - await CheckMultiple(Constans.SecondaryPrivileges); + _correctResponse = RequestResult.AllowForever; + await MRequest_Async(); } [Test] [Category("P1")] - [Description("Test: Check if popup will appear again after DenyOnce.")] + [Description("Test: Check whether popup works and user response is properly received.")] [Property("SPEC", "Tizen.Security.PrivacyPrivilegeManager.GetResponseContext M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MR")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, " Open Settings")] - [Precondition(2, " Open \"Privacy and security\"")] - [Precondition(3, " Open \"Privacy settings\"")] - [Precondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Precondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] - [Step(1, " Click run TC")] - [Step(2, " Click button")] - [Step(3, " Deny forever Privileges (check \"Don`t repeat\" and click \"deny\" button)")] - [Step(4, " Click button")] - [Step(5, " Check Logs output (inside program)")] - [Step(6, " Good output: Privilege:\nhttp://tizen.org/privilege/account.read\nStatus: Ask")] - [Step(7, " Good output: Privilege:\nhttp://tizen.org/privilege/account.write\nStatus: Ask")] - [Step(8, " Good output: Privilege:\nhttp://tizen.org/privilege/call\nStatus: Ask")] - [Step(9, " Good output: Privilege:\nhttp://tizen.org/privilege/account.read\nStatus: DenyForever")] - [Step(10, " Good output: Privilege:\nhttp://tizen.org/privilege/account.write\nStatus: DenyForever")] - [Step(11, " Good output: Privilege:\nhttp://tizen.org/privilege/call\nStatus: DenyForever")] - [Postcondition(1, " Open Settings")] - [Postcondition(2, " Open \"Privacy and security\"")] - [Postcondition(3, " Open \"Privacy settings\"")] - [Postcondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Postcondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] + [Precondition(1, " This testcase doesn't support wearable profile. In wearable profile, just clicking Run button then it will pass.")] + [Precondition(2, " Open terminal and enter following commands:")] + [Precondition(3, " sdb root on")] + [Precondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Precondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Precondition(6, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] + [Step(1, " Click Run button")] + [Step(2, " Check 'Don't repeat' checkbox and click Deny button for 3 asking popups -2 Accounts and 1 Call-")] + [Postcondition(1, " Open terminal and enter following commands:")] + [Postcondition(2, " sdb root on")] + [Postcondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Postcondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Postcondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] public async Task GetResponseContext_DENY_FOREVER() { - CreateLayout(); + if (Profile.GetProfile().CompareTo(Profile.WearableProfile) == 0) + Assert.Pass("This testcase is not supported in wearable profile."); _privileges = Constans.Privileges; - _button.Clicked += OnClick; - //// Waits for user confirmation. + _correctResponse = RequestResult.DenyForever; + SRequest(); await ManualTest.WaitForConfirm(); - _button.Clicked -= OnClick; } [Test] [Category("P1")] - [Description("Test: Check if popup will appear again after DenyOnce.")] + [Description("Test: Check whether popup works and user response is properly received.")] [Property("SPEC", "Tizen.Security.PrivacyPrivilegeManager.GetResponseContext M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MR")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, " Open Settings")] - [Precondition(2, " Open \"Privacy and security\"")] - [Precondition(3, " Open \"Privacy settings\"")] - [Precondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Precondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] - [Step(1, " Click run TC")] - [Step(2, " Click button")] - [Step(3, " Deny once Privileges(do not check \"Don't repeat\" and click \"deny\" button)")] - [Step(4, " Click button")] - [Step(5, " Check Logs output (inside program)")] - [Step(6, " Good output: Privilege:\nhttp://tizen.org/privilege/account.read\nStatus: Ask")] - [Step(7, " Good output: Privilege:\nhttp://tizen.org/privilege/account.write\nStatus: Ask")] - [Step(8, " Good output: Privilege:\nhttp://tizen.org/privilege/call\nStatus: Ask")] - [Step(9, " Good output: Privilege:\nhttp://tizen.org/privilege/account.read\nStatus: DenyOnce")] - [Step(10, " Good output: Privilege:\nhttp://tizen.org/privilege/account.write\nStatus: DenyOnce")] - [Step(11, " Good output: Privilege:\nhttp://tizen.org/privilege/call\nStatus: DenyOnce")] - [Postcondition(1, " Open Settings")] - [Postcondition(2, " Open \"Privacy and security\"")] - [Postcondition(3, " Open \"Privacy settings\"")] - [Postcondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Postcondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] + [Precondition(1, " Open terminal and enter following commands:")] + [Precondition(2, " sdb root on")] + [Precondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Precondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Precondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] + [Step(1, " Click Run button")] + [Step(2, " Click Deny button for 3 asking popups -2 Accounts and 1 Call-")] public async Task GetResponseContext_DENY_ONCE() { - CreateLayout(); _privileges = Constans.Privileges; - _button.Clicked += OnClick; - //// Waits for user confirmation. + _correctResponse = RequestResult.DenyOnce; + SRequest(); await ManualTest.WaitForConfirm(); - _button.Clicked -= OnClick; } } } diff --git a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSPermissionRequestResponse.cs b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSPermissionRequestResponse.cs old mode 100644 new mode 100755 index eb4f75e..9d3c0a6 --- a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSPermissionRequestResponse.cs +++ b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSPermissionRequestResponse.cs @@ -30,7 +30,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [SetUp] public void Init() { - if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0) + if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0 && Profile.GetProfile().CompareTo(Profile.WearableProfile) != 0) { Assert.Pass("Privacy privileges not supported"); } @@ -46,8 +46,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("CRITERIA", "CONSTR")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void PermissionRequestResponse_CONSTRUCTOR() { @@ -71,8 +70,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("CRITERIA", "PRO")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void Result_READ_ONLY() { @@ -97,8 +95,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("CRITERIA", "PRO")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void Privilege_READ_ONLY() { diff --git a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestMultipleResponseEventArgs.cs b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestMultipleResponseEventArgs.cs old mode 100644 new mode 100755 index 781ef02..d1ba2c6 --- a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestMultipleResponseEventArgs.cs +++ b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestMultipleResponseEventArgs.cs @@ -35,7 +35,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [SetUp] public void Init() { - if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0) + if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0 && Profile.GetProfile().CompareTo(Profile.WearableProfile) != 0) { Assert.Pass("Privacy privileges not supported"); } @@ -51,8 +51,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("CRITERIA", "CONSTR")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void RequestMultipleResponseEventArgs_CONSTRUCTOR() { @@ -76,8 +75,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("CRITERIA", "PRO")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void Cause_READ_ONLY() { @@ -102,8 +100,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("CRITERIA", "PRO")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void Responses_READ_ONLY() { diff --git a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestPermission.cs b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestPermission.cs old mode 100644 new mode 100755 index e05ac0c..8a76be7 --- a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestPermission.cs +++ b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestPermission.cs @@ -23,6 +23,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests using NUnit.Framework.TUnit; + /// /// Contains class /// It is used test if works as expected. @@ -31,17 +32,15 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Description("Tizen.PrivacyPrivilegeManager Manual test")] public class TSRequestPermission : TestBase { - private readonly TestUI testUI = new TestUI(); - //private readonly TestBase testBase = new TestBase(); /// /// Holds privilege that will be tested /// private string[] _privileges; /// - /// Holds information about expected error status for testcase + /// Holds information about expected exception for testcase /// - protected bool _expectError = false; + private string _correctException; /// /// Initializes environment before TCT test runs. @@ -49,44 +48,29 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [SetUp] public void Init() { - if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0) + if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0 && Profile.GetProfile().CompareTo(Profile.WearableProfile) != 0) { Assert.Pass("Privacy privileges not supported"); } LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); - testUI.executeCount = 1; - _expectError = false; + _correctException = ""; } - /// - /// Handles Buttons OnClick event. - /// - /// Sender - /// Event arguments - private void OnClick(object sender, EventArgs e) - { - Request(); - } - - /// - /// Checks Privileges status and displays results. - /// - private void Request() + private void SRequest() { foreach (string privilege in _privileges) { - Color msgColor = Color.Green; - string labelText = "Sending request for privilege: " + privilege; RequestPermission(privilege); - - if (ErrorOccured) + if (!(_correctException == null || _correctException == "")) + { + Assert.IsTrue(ErrorOccured, "Expected " + _correctException + " but not occurred "); + Assert.AreEqual(_correctException, ExceptionName, "Expected " + _correctException + " but " + ExceptionName + " occurred"); + } + else if (ErrorOccured) { - labelText += "\nError occured: " + ErrorMessage; - if (!_expectError) - msgColor = Color.Red; + Assert.Fail("Unexpected exception occured : " + ExceptionName); } - testUI.AddNewLabel(labelText, msgColor); } } @@ -97,53 +81,38 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MR")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, " Open Settings")] - [Precondition(2, " Open \"Privacy and security\"")] - [Precondition(3, " Open \"Privacy settings\"")] - [Precondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Precondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] - [Step(1, " Click run TC")] - [Step(2, " Click button")] - [Step(3, " Allow Privileges")] - [Step(4, " Click button")] - [Step(5, " Check Logs output (inside program)")] - [Step(6, "Three popups should appear")] - [Postcondition(1, " Open Settings")] - [Postcondition(2, " Open \"Privacy and security\"")] - [Postcondition(3, " Open \"Privacy settings\"")] - [Postcondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Postcondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] - public async Task RequestPermission_REAL_PRIVILEGES() + [Precondition(1, " Open terminal and enter following commands:")] + [Precondition(2, " sdb root on")] + [Precondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Precondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Precondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] + [Step(1, " Click Run button")] + [Step(2, " Click Any(Deny/Allow) button for 3 asking popups -2 Accounts and 1 Call-")] + [Postcondition(1, " Open terminal and enter following commands:")] + [Postcondition(2, " sdb root on")] + [Postcondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Postcondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Postcondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] + public void RequestPermission_REAL_PRIVILEGES() { - testUI.CreateLayout(); _privileges = Constans.Privileges; - testUI._button.Clicked += OnClick; - await ManualTest.WaitForConfirm(); - testUI._button.Clicked -= OnClick; + SRequest(); } [Test] - [Category("P1")] - [Description("Test: Check if RequestPermission method works with empty string.")] + [Category("P2")] + [Description("Test: Check if RequestPermission method throws ArgumentException when empty string is given.")] [Property("SPEC", "Tizen.Security.PrivacyPrivilegeManager.RequestPermission M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] - [Step(3, " Check Logs output (inside program)")] - [Step(4, " Good output: Privilege:\n\nStatus: Deny\nCan not check permission for .\nException message: Invalid parameter")] - [Step(5, " Popup should not appear")] - [Postcondition(1, "NA")] - public async Task RequestPermission_STRING_EMPTY() + [Step(1, " Click Run button")] + [Step(2, " Popup should not appear")] + public void RequestPermission_STRING_EMPTY() { - _expectError = true; - testUI.CreateLayout(); + _correctException = "ArgumentException"; _privileges = new string[] { Constans.Empty }; - testUI._button.Clicked += OnClick; - await ManualTest.WaitForConfirm(); - testUI._button.Clicked -= OnClick; + SRequest(); } [Test] @@ -153,19 +122,12 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MAC")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] - [Step(3, " Check Logs output (inside program)")] - [Step(4, " Popup should not appear")] - [Postcondition(1, "NA")] - public async Task RequestPermission_LONG_STRING() + [Step(1, " Click Run button")] + [Step(2, " Popup should not appear")] + public void RequestPermission_LONG_STRING() { - testUI.CreateLayout(); _privileges = new string[] { Constans.LongString }; - testUI._button.Clicked += OnClick; - await ManualTest.WaitForConfirm(); - testUI._button.Clicked -= OnClick; + SRequest(); } [Test] @@ -175,19 +137,12 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MAC")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] - [Step(3, " Check Logs output (inside program)")] - [Step(4, " Popup should not appear")] - [Postcondition(1, "NA")] - public async Task RequestPermission_NON_EXISTING() + [Step(1, " Click Run button")] + [Step(2, " Popup should not appear")] + public void RequestPermission_NON_EXISTING() { - testUI.CreateLayout(); _privileges = new string[] { Constans.NoExisting }; - testUI._button.Clicked += OnClick; - await ManualTest.WaitForConfirm(); - testUI._button.Clicked -= OnClick; + SRequest(); } [Test] @@ -197,19 +152,12 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MAC")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] - [Step(3, " Check Logs output (inside program)")] - [Step(4, " Popup should not appear")] - [Postcondition(1, "NA")] - public async Task RequestPermission_RANDOM_LETTER_CASE_PRIVILEGE() + [Step(1, " Click Run button")] + [Step(2, " Popup should not appear")] + public void RequestPermission_RANDOM_LETTER_CASE_PRIVILEGE() { - testUI.CreateLayout(); _privileges = new string[] { Constans.RandomLetterCasePrivilege }; - testUI._button.Clicked += OnClick; - await ManualTest.WaitForConfirm(); - testUI._button.Clicked -= OnClick; + SRequest(); } [Test] @@ -219,43 +167,28 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MAC")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] - [Step(3, " Check Logs output (inside program)")] - [Step(4, " Popup should not appear")] - [Postcondition(1, "NA")] - public async Task RequestPermission_SPECIAL_CHARACTERS() + [Step(1, " Click Run button")] + [Step(2, " Popup should not appear")] + public void RequestPermission_SPECIAL_CHARACTERS() { - testUI.CreateLayout(); _privileges = new string[] { Constans.SpecialCharacters }; - testUI._button.Clicked += OnClick; - await ManualTest.WaitForConfirm(); - testUI._button.Clicked -= OnClick; + SRequest(); } [Test] - [Category("P1")] - [Description("Test: Check if RequestPermission method works with null string.")] + [Category("P2")] + [Description("Test: Check if RequestPermission method throws ArgumentException when null string is given.")] [Property("SPEC", "Tizen.Security.PrivacyPrivilegeManager.RequestPermission M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] - [Step(3, " Check Logs output (inside program)")] - [Step(4, " Good output: Error occured: Can not request permission for .\nException message: Invalid parameter")] - [Step(5, " Popup should not appear")] - [Postcondition(1, "NA")] - public async Task RequestPermission_STRING_NULL() + [Step(1, " Click Run button")] + [Step(2, " Popup should not appear")] + public void RequestPermission_STRING_NULL() { - _expectError = true; - testUI.CreateLayout(); + _correctException = "ArgumentException"; _privileges = new string[] { Constans.Null }; - testUI._button.Clicked += OnClick; - await ManualTest.WaitForConfirm(); - testUI._button.Clicked -= OnClick; + SRequest(); } [Test] @@ -265,19 +198,12 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MAC")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] - [Step(3, " Check Logs output (inside program)")] - [Step(4, " Popup should not appear")] - [Postcondition(1, "NA")] - public async Task RequestPermission_UPPER_LETTER_CASE_PRIVILEGE() + [Step(1, " Click Run button")] + [Step(2, " Popup should not appear")] + public void RequestPermission_UPPER_LETTER_CASE_PRIVILEGE() { - testUI.CreateLayout(); _privileges = new string[] { Constans.UpperLetterCasePrivilege }; - testUI._button.Clicked += OnClick; - await ManualTest.WaitForConfirm(); - testUI._button.Clicked -= OnClick; + SRequest(); } } } diff --git a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestPermissions.cs b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestPermissions.cs index e612300..69515f8 100755 --- a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestPermissions.cs +++ b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestPermissions.cs @@ -27,8 +27,12 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests /// [TestFixture] [Description("Tizen.PrivacyPrivilegeManager Manual test")] - class TSRequestPermissions : TestHelpers + class TSRequestPermissions : TestBase { + /// + /// Holds privilege that will be tested + /// + private string[] _privileges; /// /// Initializes environment before TCT test runs. @@ -36,24 +40,18 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [SetUp] public void Init() { - if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0) + if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0 && Profile.GetProfile().CompareTo(Profile.WearableProfile) != 0) { Assert.Pass("Privacy privileges not supported"); } LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); - executeCount = 1; } - /// - /// Handles Buttons OnClick event. - /// - /// Sender - /// Event arguments - private async void OnClickMultiplePrivileges(object sender, EventArgs e) + private async Task MRequest() { - ChangeButtonState(false); - await CheckMultiple(_privileges); + await RequestPermissions(_privileges); + Assert.IsFalse(ErrorOccured, "Unexpected error occurred: " + ExceptionName); } [Test] @@ -63,34 +61,23 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MR")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Precondition(1, " Open Settings")] - [Precondition(2, " Open \"Privacy and security\"")] - [Precondition(3, " Open \"Privacy settings\"")] - [Precondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Precondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] - [Step(1, " Click run TC")] - [Step(2, " Click button")] - [Step(3, " Allow Privileges")] - [Step(4, " Check Logs output (inside program)")] - [Step(5, " Good output(Can be printed at the end of the logs): Privileges with ask status:\n(name of 3 privileges)")] - [Step(6, " Good output: Privilege:\nhttp://tizen.org/privilege/account.read\nStatus: Ask")] - [Step(7, " Good output: Privilege:\nhttp://tizen.org/privilege/account.write\nStatus: Ask")] - [Step(8, " Good output: Privilege:\nhttp://tizen.org/privilege/call\nStatus: Ask")] - [Step(9, " Good output: Privilege:\nhttp://tizen.org/privilege/account.read\nStatus: AllowForever")] - [Step(10, " Good output: Privilege:\nhttp://tizen.org/privilege/account.write\nStatus: AllowForever")] - [Step(11, " Good output: Privilege:\nhttp://tizen.org/privilege/call\nStatus: AllowForever")] - [Postcondition(1, " Open Settings")] - [Postcondition(2, " Open \"Privacy and security\"")] - [Postcondition(3, " Open \"Privacy settings\"")] - [Postcondition(4, " Open \"Accounts\" and uncheck Tizen.Security.PrivacyManager")] - [Postcondition(5, " Open \"Call\" and uncheck Tizen.Security.PrivacyManager")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] + [Precondition(1, " Open terminal and enter following commands:")] + [Precondition(2, " sdb root on")] + [Precondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Precondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Precondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] + [Step(1, " Click Run button")] + [Step(2, " Click Any(Deny/Allow) button for asking messages for 2 privacies - Accounts and Call -")] + [Postcondition(1, " Open terminal and enter following commands:")] + [Postcondition(2, " sdb root on")] + [Postcondition(3, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.read -t 0xA")] + [Postcondition(4, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/account.write -t 0xA")] + [Postcondition(5, " sdb shell cyad -s -k \"\" -c User::Pkg::Tizen.PrivacyPrivilegeManager.Manual.Tests -u 5001 -p http://tizen.org/privilege/call -t 0xA")] public async Task RequestPermissions_REAL_PRIVILEGES() { - CreateLayout(); _privileges = Constans.Privileges; - _button.Clicked += OnClickMultiplePrivileges; - await ManualTest.WaitForConfirm(); - _button.Clicked -= OnClickMultiplePrivileges; + await MRequest(); } [Test] @@ -100,19 +87,14 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "MR")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] - [Step(1, " Click run TC")] - [Step(2, " Click button")] - [Step(3, " Check Logs output (inside program)")] - [Step(4, " Good output: No privileges with ask status!")] - [Step(5, " Popup should not appear")] + [Property("AUTHOR", "Yunjin Lee, yunjin-.lee@samsung.com")] + [Step(1, " Click Run button")] + [Step(2, " Popup should not appear")] public async Task RequestPermissions_FAKE_PRIVILEGES() { - CreateLayout(); _privileges = new string[] {Constans.LongString, Constans.NoExisting, Constans.RandomLetterCasePrivilege, Constans.SpecialCharacters, Constans.UpperLetterCasePrivilege}; - _button.Clicked += OnClickMultiplePrivileges; - await ManualTest.WaitForConfirm(); - _button.Clicked -= OnClickMultiplePrivileges; + await MRequest(); } } } diff --git a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestResponseEventArgs.cs b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestResponseEventArgs.cs old mode 100644 new mode 100755 index 0ae58c1..a7ea0c7 --- a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestResponseEventArgs.cs +++ b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/TSRequestResponseEventArgs.cs @@ -35,7 +35,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [SetUp] public void Init() { - if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0) + if (Profile.GetProfile().CompareTo(Profile.MobileProfile) != 0 && Profile.GetProfile().CompareTo(Profile.WearableProfile) != 0) { Assert.Pass("Privacy privileges not supported"); } @@ -51,8 +51,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("CRITERIA", "CONSTR")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void RequestResponseEventArgs_CONSTRUCTOR() { @@ -76,8 +75,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("CRITERIA", "PRO")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void cause_READ_ONLY() { @@ -102,8 +100,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("CRITERIA", "PRO")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void result_READ_ONLY() { @@ -128,8 +125,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("CRITERIA", "PRO")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void privilege_READ_ONLY() { @@ -154,8 +150,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests [Property("CRITERIA", "PRO")] [Property("AUTHOR", "Ernest Borowski, e.borowski@partner.samsung.com")] [Precondition(1, "NA")] - [Step(1, "Click run TC")] - [Step(2, "Click button")] + [Step(1, "Click Run button")] [Postcondition(1, "NA")] public void Response_READ_ONLY() { diff --git a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/Constans.cs b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/Constans.cs old mode 100644 new mode 100755 index 5845390..e9f7dd7 --- a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/Constans.cs +++ b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/Constans.cs @@ -73,8 +73,6 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests private static readonly string[] secondaryPrivileges = new string[] { "http://tizen.org/privilege/contact.read", - "http://tizen.org/privilege/contact.write", - "http://tizen.org/privilege/download", "http://tizen.org/privilege/location", }; diff --git a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/TestBase.cs b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/TestBase.cs old mode 100644 new mode 100755 index e4fcf42..de61d13 --- a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/TestBase.cs +++ b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/TestBase.cs @@ -18,6 +18,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests { using global::System; using global::System.Collections.Generic; + using global::System.Threading.Tasks; using global::System.Linq; using NUnit.Framework.TUnit; using Tizen.Security; @@ -31,7 +32,12 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests /// /// Contains error Message /// - private string errorMessage; + private string _errorMessage; + + /// + /// Contains exception name + /// + private string _exceptionName; /// /// Gets error Message if exception occurred @@ -40,12 +46,24 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests { get { - return errorMessage; + return _errorMessage; + } + + private set + { + _errorMessage = value; } + } + public string ExceptionName + { + get + { + return _exceptionName; + } private set { - errorMessage = value; + _exceptionName = value; } } @@ -56,7 +74,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests { get { - return !(errorMessage == null || errorMessage == ""); + return !(_errorMessage == null || _errorMessage == ""); } } @@ -66,32 +84,21 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests /// /// Privilege name /// CheckResult state - public CheckResult CheckPermission(string privilege, bool expectedArgumentException = false) + public CheckResult CheckPermission(string privilege) { ErrorMessage = ""; - CheckResult result; + ExceptionName = ""; + CheckResult result = CheckResult.Deny; + try { result = PrivacyPrivilegeManager.CheckPermission(privilege); } - catch (ArgumentException ex) - { - if (expectedArgumentException) - { - result = CheckResult.Deny; - } - else - { - ErrorMessage = "Can not check permission for " + privilege + ".\nException message:" + ex.Message; - LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, ErrorMessage); - result = CheckResult.Deny; - } - } catch (Exception ex) { ErrorMessage = "Can not check permission for " + privilege + ".\nException message:" + ex.Message; + ExceptionName = ex.GetType().Name; LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, ErrorMessage); - result = CheckResult.Deny; } return result; @@ -106,6 +113,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests public CheckResult[] CheckPermissions(string[] privileges) { ErrorMessage = ""; + ExceptionName = ""; CheckResult[] results = null; try { @@ -114,6 +122,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests catch (Exception ex) { ErrorMessage = "Can not check permission for " + string.Join(" ", privileges) + ".\nException message:" + ex.Message; + ExceptionName = ex.GetType().Name; LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, ErrorMessage); results = new CheckResult[privileges.Length]; for (int it = 0; it < privileges.Length; ++it) @@ -131,6 +140,7 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests public void RequestPermission(string privilege) { ErrorMessage = ""; + ExceptionName = ""; try { PrivacyPrivilegeManager.RequestPermission(privilege); @@ -138,28 +148,30 @@ namespace Tizen.PrivacyPrivilegeManager.Manual.Tests catch (Exception ex) { ErrorMessage = "Can not request permission for " + privilege + ".\nException message: " + ex.Message; + ExceptionName = ex.GetType().Name; LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, ErrorMessage); } } - /// - /// Returns priviliges array with ask status - /// - /// Privileges array - public List GetPrivilegesWithAskStatus(string[] privileges, CheckResult[] responses) + public async Task RequestPermissions(string[] privileges) { - List privilegesWithAskStatus = new List(); - string log = "GetPrivilegesWithAskStatus:\n"; - for (int it = 0; it < privileges.Length; it++) + Tizen.Security.RequestMultipleResponseEventArgs request = null; + try { - if (responses[it] == CheckResult.Ask) + request = await PrivacyPrivilegeManager.RequestPermissions(privileges); + if (request.Cause == Tizen.Security.CallCause.Error) { - privilegesWithAskStatus.Add(privileges[it]); + ErrorMessage = "request.Cause is CallCause.Error"; + ExceptionName = "CallCause.Error"; + LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, ErrorMessage); } - log += "Priv: " + privileges[it] + " response: " + responses[it]; } - LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, log); - return privilegesWithAskStatus; + catch (Exception ex) + { + ErrorMessage = "Exception message: " + ex.Message; + ExceptionName = ex.GetType().Name; + LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, ErrorMessage); + } } } } diff --git a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/TestHelpers.cs b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/TestHelpers.cs deleted file mode 100644 index 16625d0..0000000 --- a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/TestHelpers.cs +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2018 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 - */ - -namespace Tizen.PrivacyPrivilegeManager.Manual.Tests -{ - using global::NUnit.Framework.TUnit; - using global::System; - using global::System.Collections.Generic; - using global::System.Threading.Tasks; - using global::Xamarin.Forms; - using Tizen.Security; - - public abstract class TestHelpers : TestUI - { - private readonly TestBase testBase = new TestBase(); - /// - /// Contains privileges for current test case - /// - protected static string[] _privileges; - - /// - /// Contains privileges for current test case - /// - protected static bool requestAdditionalPrivilegesInCallback = false; - - /// - /// Logs Request result for privilege to system log and UI - /// - /// Privilege name - /// Privilege request result - protected void LogPrivilegeRequestResponse(string privilege, RequestResult result) - { - switch (result) - { - case RequestResult.AllowForever: - { - LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "User allowed usage of privilege " + privilege + " forever."); - break; - } - - case RequestResult.DenyForever: - { - LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "User denied usage of privilege " + privilege + " forever."); - break; - } - - case RequestResult.DenyOnce: - { - LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "User denied usage of privilege " + privilege + " once."); - break; - } - } - AddNewLabel("Execute number: " + executeCount + " Privilege: \n" + privilege + "\nStatus: " + result); - } - - /// - /// Checks Privileges status and displays results. - /// - protected void Check(string[] privileges) - { - bool gotCheckResult = false; - foreach (string privilege in privileges) - { - CheckResult result = testBase.CheckPermission(privilege); - Color backgroundColor = Color.Red; - string labelText = "Execute number: " + executeCount++ + "\nPrivilege: \n" + privilege + "\nStatus: " + result; - - if (testBase.ErrorOccured) - { - labelText += "\n" + testBase.ErrorMessage; - } - - if (result == CheckResult.Ask) - { - gotCheckResult = true; - backgroundColor = Color.Green; - SetupPPMHandler(privilege); - testBase.RequestPermission(privilege); - - if (testBase.ErrorOccured) - { - labelText += "\n" + testBase.ErrorMessage; - backgroundColor = Color.Red; - } - } - - if (!gotCheckResult) - { - ChangeButtonState(true); - } - AddNewLabel(labelText, backgroundColor); - } - } - - protected virtual void SetupPPMHandler(string privilege) { } - - /// - /// Checks Privileges status and displays results. - /// - protected async Task CheckMultiple(string[] privileges) - { - CheckResult[] results = testBase.CheckPermissions(privileges); - Color backgroundColor = Color.White; - - string labelText = "Execute number: " + executeCount++; - if (testBase.ErrorOccured) - { - labelText += "\n" + testBase.ErrorMessage; - backgroundColor = Color.Red; - } - for (int it = 0; it < privileges.Length; it++) - { - labelText += "\nPrivilege: \n" + privileges[it] + "\nStatus: " + results[it]; - } - AddNewLabel(labelText, backgroundColor); - backgroundColor = Color.Green; - List privilegesWithAskStatus = testBase.GetPrivilegesWithAskStatus(privileges, results); - if (privilegesWithAskStatus == null || privilegesWithAskStatus.Count == 0) - { - LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "NO Privileges with ask status! "); - AddNewLabel("No privileges with ask status!", Color.Red); - ChangeButtonState(true); - return; - } - - labelText = "Privileges with ask status: \n" + string.Join("\n", privilegesWithAskStatus); - LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, labelText); - bool errorOccured = false; - RequestMultipleResponseEventArgs request = null; - try - { - LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "before"); - request = await PrivacyPrivilegeManager.RequestPermissions(privilegesWithAskStatus); - LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "after"); - if (request.Cause == CallCause.Error) - { - errorOccured = true; - labelText += "\nRequestPermissions response returned error."; - } - foreach (PermissionRequestResponse response in request.Responses) - { - LogPrivilegeRequestResponse(response.Privilege, response.Result); - } - - if (requestAdditionalPrivilegesInCallback) - { - _privileges = Constans.SecondaryPrivileges; - requestAdditionalPrivilegesInCallback = false; - await CheckMultiple(_privileges); - } - } - catch (Exception ex) - { - errorOccured = true; - labelText += "\nEx_msg: " + ex.Message; - } - - if (errorOccured) - { - backgroundColor = Color.Red; - } - - ChangeButtonState(true); - AddNewLabel(labelText, backgroundColor); - } - } -} diff --git a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/TestUI.cs b/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/TestUI.cs deleted file mode 100644 index 25028d5..0000000 --- a/tct-suite-vs/Tizen.PrivacyPrivilegeManager.Manual.Tests/testcase/support/TestUI.cs +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 2017 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 - */ - -namespace Tizen.PrivacyPrivilegeManager.Manual.Tests -{ - using global::System.Collections.ObjectModel; - using global::System.Linq; - using global::Xamarin.Forms; - using NUnit.Framework; - - /// - /// Contains class - /// It is used to create UI for each test case separately - /// - public class TestUI - { - - /// - /// Provides locking mechanism for changing button state - /// - private readonly object _syncLock = new object(); - - /// - /// Holds TestPage instance - /// - protected TestPage _testPage = TestPage.GetInstance(); - - /// - /// Holds Buton - /// - public Button _button; - - /// - /// Holds ListView - /// - protected ListView _listView; - - /// - /// Holds list of Labels with logs - /// - protected ObservableCollection