private CheckResult _correctResult;
/// <summary>
- /// Holds information if ArgumentException is expected
+ /// Holds information about expected error status for testcase
/// </summary>
- private bool _expectedArgumentException;
+ private string _correctException;
/// <summary>
/// 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");
}
-
+ _correctException = "";
LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST");
}
{
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();
[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();
[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();
[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();
[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();
[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();
[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");
}
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]
[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;
[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;
[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;
/// </summary>
[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;
+
+ /// <summary>
+ /// Holds privilege that will be tested
+ /// </summary>
+ private string[] _privileges;
+
/// <summary>
/// Initializes environment before TCT test runs.
/// </summary>
[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;
}
/// <summary>
}
/// <summary>
- /// Handles catching PrivilegeManager responses.
+ /// Handles catched PrivacyPrivilegeManager's single privilege request responses.
/// </summary>
/// <param name="sender">Sender object</param>
/// <param name="e">Event arguments</param>
- 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);
}
/// <summary>
- /// Setups event handler for catching PrivilegeManager responses.
+ /// Setups event handler for catching PrivacyPrivilegeManager's single privilege request responses.
/// </summary>
/// <param name="privilege">Privilege name</param>
- protected override void SetupPPMHandler(string privilege)
+ private void SetupPPMHandler(string privilege)
{
if (privilege == null)
{
}
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();
}
/// <summary>
- /// Destroys hander for PrivilegeManager single privilege request response
+ /// Destroys handler for PrivacyPrivilegeManager's single privilege request response
/// </summary>
/// <param name="privilege">Privilege with subscribled handler</param>
private void DestroyPPMHandler(string privilege)
}
if (PrivacyPrivilegeManager.GetResponseContext(privilege).TryGetTarget(out PrivacyPrivilegeManager.ResponseContext context))
{
- context.ResponseFetched -= PPM_RequestResponse;
+ context.ResponseFetched -= PPMRequestResponse;
}
}
/// <summary>
- /// Handles Buttons OnClick event.
+ /// Request permission for privilges one by one and set handler to check the user response for each privilege
/// </summary>
- /// <param name="sender">Sender</param>
- /// <param name="e">Event arguments</param>
- 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()");
+ }
+ }
}
/// <summary>
- /// Handles Buttons OnClickMultiple event.
+ /// Request permission for multiple privileges at once and check the user response value
/// </summary>
- /// <param name="sender">Sender</param>
- /// <param name="e">Event arguments</param>
- 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;
- }
-
- /// <summary>
- /// Executes multiple requests test case
- /// </summary>
- /// <param name="sender">Sender</param>
- /// <param name="e">Event</param>
- 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;
}
}
}
[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");
}
[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()
{
[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()
{
[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()
{
[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");
}
[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()
{
[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()
{
[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()
{
using NUnit.Framework.TUnit;
+
/// <summary>
/// Contains <see cref="TSRequestPermission"/> class
/// <para>It is used test if <see cref="Tizen.Security.PrivacyPrivilegeManager.RequestPermission(string)" /> works as expected.</para>
[Description("Tizen.PrivacyPrivilegeManager Manual test")]
public class TSRequestPermission : TestBase
{
- private readonly TestUI testUI = new TestUI();
- //private readonly TestBase testBase = new TestBase();
/// <summary>
/// Holds privilege that will be tested
/// </summary>
private string[] _privileges;
/// <summary>
- /// Holds information about expected error status for testcase
+ /// Holds information about expected exception for testcase
/// </summary>
- protected bool _expectError = false;
+ private string _correctException;
/// <summary>
/// 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");
}
LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST");
- testUI.executeCount = 1;
- _expectError = false;
+ _correctException = "";
}
- /// <summary>
- /// Handles Buttons OnClick event.
- /// </summary>
- /// <param name="sender">Sender</param>
- /// <param name="e">Event arguments</param>
- private void OnClick(object sender, EventArgs e)
- {
- Request();
- }
-
- /// <summary>
- /// Checks Privileges status and displays results.
- /// </summary>
- 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);
}
}
[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]
[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]
[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]
[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]
[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]
[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();
}
}
}
/// </summary>
[TestFixture]
[Description("Tizen.PrivacyPrivilegeManager Manual test")]
- class TSRequestPermissions : TestHelpers
+ class TSRequestPermissions : TestBase
{
+ /// <summary>
+ /// Holds privilege that will be tested
+ /// </summary>
+ private string[] _privileges;
/// <summary>
/// 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");
}
LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST");
- executeCount = 1;
}
- /// <summary>
- /// Handles Buttons OnClick event.
- /// </summary>
- /// <param name="sender">Sender</param>
- /// <param name="e">Event arguments</param>
- 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]
[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]
[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();
}
}
}
[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");
}
[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()
{
[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()
{
[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()
{
[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()
{
[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()
{
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",
};
{
using global::System;
using global::System.Collections.Generic;
+ using global::System.Threading.Tasks;
using global::System.Linq;
using NUnit.Framework.TUnit;
using Tizen.Security;
/// <summary>
/// Contains error Message
/// </summary>
- private string errorMessage;
+ private string _errorMessage;
+
+ /// <summary>
+ /// Contains exception name
+ /// </summary>
+ private string _exceptionName;
/// <summary>
/// Gets error Message if exception occurred
{
get
{
- return errorMessage;
+ return _errorMessage;
+ }
+
+ private set
+ {
+ _errorMessage = value;
}
+ }
+ public string ExceptionName
+ {
+ get
+ {
+ return _exceptionName;
+ }
private set
{
- errorMessage = value;
+ _exceptionName = value;
}
}
{
get
{
- return !(errorMessage == null || errorMessage == "");
+ return !(_errorMessage == null || _errorMessage == "");
}
}
/// </summary>
/// <param name="privilege">Privilege name</param>
/// <returns>CheckResult state</returns>
- 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;
public CheckResult[] CheckPermissions(string[] privileges)
{
ErrorMessage = "";
+ ExceptionName = "";
CheckResult[] results = null;
try
{
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)
public void RequestPermission(string privilege)
{
ErrorMessage = "";
+ ExceptionName = "";
try
{
PrivacyPrivilegeManager.RequestPermission(privilege);
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);
}
}
- /// <summary>
- /// Returns priviliges array with ask status
- /// </summary>
- /// <returns>Privileges array</returns>
- public List<string> GetPrivilegesWithAskStatus(string[] privileges, CheckResult[] responses)
+ public async Task RequestPermissions(string[] privileges)
{
- List<string> privilegesWithAskStatus = new List<string>();
- 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);
+ }
}
}
}
+++ /dev/null
-/*
- * 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();
- /// <summary>
- /// Contains privileges for current test case
- /// </summary>
- protected static string[] _privileges;
-
- /// <summary>
- /// Contains privileges for current test case
- /// </summary>
- protected static bool requestAdditionalPrivilegesInCallback = false;
-
- /// <summary>
- /// Logs Request result for privilege to system log and UI
- /// </summary>
- /// <param name="privilege">Privilege name</param>
- /// <param name="result">Privilege request result</param>
- 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);
- }
-
- /// <summary>
- /// Checks Privileges status and displays results.
- /// </summary>
- 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) { }
-
- /// <summary>
- /// Checks Privileges status and displays results.
- /// </summary>
- 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<string> 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);
- }
- }
-}
+++ /dev/null
-/*
- * 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;
-
- /// <summary>
- /// Contains <see cref="TestUI"/> class
- /// <para>It is used to create UI for each test case separately</para>
- /// </summary>
- public class TestUI
- {
-
- /// <summary>
- /// Provides locking mechanism for changing button state
- /// </summary>
- private readonly object _syncLock = new object();
-
- /// <summary>
- /// Holds TestPage instance
- /// </summary>
- protected TestPage _testPage = TestPage.GetInstance();
-
- /// <summary>
- /// Holds Buton
- /// </summary>
- public Button _button;
-
- /// <summary>
- /// Holds ListView
- /// </summary>
- protected ListView _listView;
-
- /// <summary>
- /// Holds list of Labels with logs
- /// </summary>
- protected ObservableCollection<Label> _UIlist;
-
- /// <summary>
- /// Holds execute number, enumerates every time user clicks button
- /// </summary>
- public int executeCount = 1;
-
- /// <summary>
- /// Adds lablel with application logs
- /// </summary>
- /// <param name="labelText">text that will be logged inside <see cref="Label"/></param>
- /// <param name="backgroundColor"><see cref="Label"/> background color</param>
- public void AddNewLabel(string labelText, Color backgroundColor)
- {
- //Can not declare default parameters value because they have to be compile-time constant
- if (backgroundColor != Color.White)
- {
- AddNewLabel(labelText, backgroundColor, Color.White);
- }
- else
- {
- AddNewLabel(labelText, backgroundColor, Color.Black);
- }
- }
-
- /// <summary>
- /// Adds lablel with application logs
- /// </summary>
- /// <param name="labelText">text that will be logged inside <see cref="Label"/></param>
- public void AddNewLabel(string labelText)
- {
- //Can not declare default parameters value because they have to be compile-time constant
- AddNewLabel(labelText, Color.White, Color.Black);
- }
-
- /// <summary>
- /// Adds lablel with application logs
- /// </summary>
- /// <param name="labelText">text that will be logged inside <see cref="Label"/></param>
- /// <param name="backgroundColor"><see cref="Label"/> background color</param>
- /// <param name="textColor">text background color</param>
- public void AddNewLabel(string labelText, Color backgroundColor, Color textColor)
- {
- _UIlist.Add(new Label()
- {
- Text = labelText,
- BackgroundColor = backgroundColor,
- TextColor = textColor,
- });
-
- _listView.ScrollTo(_listView.ItemsSource.OfType<Label>().Last(), ScrollToPosition.End, true);
- }
-
- /// <summary>
- /// Changes button state
- /// </summary>
- /// <param name="isEnabled">Desired button state</param>
- public void ChangeButtonState(bool isEnabled)
- {
- lock (_syncLock)
- {
- _button.IsEnabled = isEnabled;
- }
- }
-
- /// <summary>
- /// Creates UI for test case.
- /// </summary>
- public void CreateLayout()
- {
- executeCount = 1;
-
- ////Main grid will hold all UI inside, works with horizontal and vertical layout
- Grid layout = new Grid()
- {
- IsVisible = true,
- HorizontalOptions = LayoutOptions.FillAndExpand,
- VerticalOptions = LayoutOptions.FillAndExpand,
- };
-
- // Defining Grid childs size
- RowDefinition row = new RowDefinition();
- RowDefinition row2 = new RowDefinition();
- row.Height = new GridLength(1.0, GridUnitType.Star);
- layout.RowDefinitions.Add(row);
- row2.Height = new GridLength(5.0, GridUnitType.Star);
- layout.RowDefinitions.Add(row2);
- layout.BackgroundColor = Color.White;
-
- // Defining listView, it will hold Labels with program logs
- _listView = new ListView()
- {
- HorizontalOptions = LayoutOptions.FillAndExpand,
- VerticalOptions = LayoutOptions.FillAndExpand,
- BackgroundColor = Color.White,
- };
-
- //// Template for displaying Labels Text (Logs) in ListView
- DataTemplate template = new DataTemplate(() =>
- {
- Label display = new Label();
- display.SetBinding(Label.TextProperty, new Binding("Text"));
- display.SetBinding(Label.BackgroundColorProperty, new Binding("BackgroundColor"));
- display.SetBinding(Label.TextColorProperty, new Binding("TextColor"));
- display.LineBreakMode = LineBreakMode.CharacterWrap;
- display.Margin = new Thickness(0, 10);
- return new ViewCell
- {
- View = new StackLayout
- {
- Children =
- {
- display
- },
- },
- };
- });
-
- // Binding ObservableCollection of Labels so ListView will automatically update itself when new Label is added
- _UIlist = new ObservableCollection<Label>();
- _listView.ItemsSource = _UIlist;
- _listView.ItemTemplate = template;
-
- // Defining button, which will execute TestCase method
- _button = new Button()
- {
- Text = "Click to Execute",
- FontSize = 20,
- VerticalOptions = LayoutOptions.FillAndExpand,
- HorizontalOptions = LayoutOptions.FillAndExpand,
- };
-
- // Adding childs to Main Grid
- layout.Children.Add(_listView, 0, 1);
- layout.Children.Add(_button, 0, 0);
- ContentPage contentPage = new ContentPage
- {
- Content = layout
- };
- _testPage.ExecuteTC(contentPage);
- }
- }
-}