From: Yunjin Lee Date: Wed, 2 May 2018 08:30:01 +0000 (+0900) Subject: [Security/Privilege][ACR-142][Add exception handling for new feature] X-Git-Tag: public_m1_final~46^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F177628%2F3;p=test%2Ftct%2Fcsharp%2Fapi.git [Security/Privilege][ACR-142][Add exception handling for new feature] Change-Id: I7a56a19d4c820a03af6dbf5485197a4691f0c50f Signed-off-by: Yunjin Lee --- diff --git a/tct-suite-vs/Tizen.Privilege.Tests/testcase/TSPrivilege.cs b/tct-suite-vs/Tizen.Privilege.Tests/testcase/TSPrivilege.cs index f9ffde9..c9c53d6 100755 --- a/tct-suite-vs/Tizen.Privilege.Tests/testcase/TSPrivilege.cs +++ b/tct-suite-vs/Tizen.Privilege.Tests/testcase/TSPrivilege.cs @@ -2,6 +2,7 @@ using NUnit.Framework; using NUnit.Framework.TUnit; using System; using Tizen.Applications; +using Tizen.System; namespace Tizen.Security.Tests { @@ -26,10 +27,13 @@ namespace Tizen.Security.Tests private static PackageType tpk = PackageType.TPK; private static PackageType wgt = PackageType.WGT; + static bool isPrivacyPrivilegeSupported = true; + [SetUp] public static void Init() { LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Preconditions for each TEST"); + Information.TryGetValue("http://tizen.org/feature/security.privacy_privilege", out isPrivacyPrivilegeSupported); } [TearDown] @@ -322,6 +326,10 @@ namespace Tizen.Security.Tests Assert.IsNotNull(ret, "Privacy display name should not be null."); Assert.IsTrue(ret.Length >= 0, "Length of Privacy display name should be greater than 0."); } + catch (NotSupportedException) + { + Assert.IsTrue(isPrivacyPrivilegeSupported == false, "Invalid NotSupportedException"); + } catch (Exception e) { Assert.Fail("Privilege.GetPrivacyDisplayName: " + e.ToString()); @@ -342,6 +350,10 @@ namespace Tizen.Security.Tests var ret = Privilege.GetPrivacyDisplayName(internetPrivilege); Assert.Fail("Expects to throw ArgumentException exception when privilege param is not-privacy related, but exception not thrown"); } + catch (NotSupportedException) + { + Assert.IsTrue(isPrivacyPrivilegeSupported == false, "Invalid NotSupportedException"); + } catch (Exception e) { Assert.IsTrue(e.GetType().Name.Equals("ArgumentException"), "GetPrivacyDisplayName does not accept non-privacy related privilege."); @@ -363,6 +375,10 @@ namespace Tizen.Security.Tests var ret = Privilege.GetPrivacyDisplayName(null); Assert.Fail("Expects to throw ArgumentException exception when null inputted for privilege param, but exception not thrown"); } + catch (NotSupportedException) + { + Assert.IsTrue(isPrivacyPrivilegeSupported == false, "Invalid NotSupportedException"); + } catch (Exception e) { Assert.IsTrue(e.GetType().Name.Equals("ArgumentNullException"), "GetPrivacyDisplayName does not accept null input."); @@ -385,6 +401,10 @@ namespace Tizen.Security.Tests Assert.IsInstanceOf(ret, "Object should be bool type."); Assert.IsTrue(ret, "Object is not equal"); } + catch (NotSupportedException) + { + Assert.IsTrue(isPrivacyPrivilegeSupported == false, "Invalid NotSupportedException"); + } catch (Exception e) { Assert.Fail("Privilege.GetPrivacyPrivilegeStatus: " + e.ToString()); @@ -406,6 +426,10 @@ namespace Tizen.Security.Tests Assert.IsInstanceOf(ret, "Object should be bool type."); Assert.IsFalse(ret, "Object is not equal"); } + catch (NotSupportedException) + { + Assert.IsTrue(isPrivacyPrivilegeSupported == false, "Invalid NotSupportedException"); + } catch (Exception e) { Assert.Fail("Privilege.GetPrivacyPrivilegeStatus: " + e.ToString()); @@ -426,6 +450,10 @@ namespace Tizen.Security.Tests var ret = Privilege.GetPrivacyPrivilegeStatus(internetPrivilege); Assert.Fail("Expects to throw ArgumentException exception when privilege param is not-privacy related, but exception not thrown"); } + catch (NotSupportedException) + { + Assert.IsTrue(isPrivacyPrivilegeSupported == false, "Invalid NotSupportedException"); + } catch (Exception e) { Assert.IsTrue(e.GetType().Name.Equals("ArgumentException"), "GetPrivacyPrivilegeStatus does not accept non-privacy related privilege."); @@ -446,6 +474,10 @@ namespace Tizen.Security.Tests var ret = Privilege.GetPrivacyPrivilegeStatus(null); Assert.Fail("Expects to throw ArgumentException exception when null inputted for version param, but exception not thrown"); } + catch (NotSupportedException) + { + Assert.IsTrue(isPrivacyPrivilegeSupported == false, "Invalid NotSupportedException"); + } catch (Exception e) { Assert.IsTrue(e.GetType().Name.Equals("ArgumentNullException"), "GetPrivacyPrivilegeStatus does not accept null input parameter.");