From 11a75651f7fcb1825dd3a9b7cb0596d69158ba26 Mon Sep 17 00:00:00 2001 From: Jung Jihoon Date: Tue, 6 Aug 2019 11:34:17 +0900 Subject: [PATCH] [Non-ACR][NFC][Add Exception case in NFC auto/manual TC] - It is known issue in NFC Native TC. - Becuase of the "Access Control" method in MCD feature, the opearations return "Security Restricted" Error. - but It is normal operation in MCD, so we add to the new pass condition. Change-Id: I9fa850ebd8ace13d1ac975e4634dbef15aa435e5 Signed-off-by: Jung Jihoon --- .../testcase/TSNfcCardEmulationAdapter.cs | 42 ++++++++++++++-------- .../Tizen.Nfc.Tests/testcase/TSNfcManager.cs | 13 +++++++ 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcCardEmulationAdapter.cs b/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcCardEmulationAdapter.cs index 906a323..fc4af1f 100755 --- a/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcCardEmulationAdapter.cs +++ b/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcCardEmulationAdapter.cs @@ -104,6 +104,10 @@ namespace Tizen.Network.Nfc.Tests { Assert.IsTrue(isNfcSupported == false || isCeSupported == false, "Method throw the NotSupportedException, but Tizen support the Nfc opearation"); } + catch (InvalidOperationException e) + { + Assert.IsTrue(e.Message.Equals("SecurityRestrictedError"), "It is normal operation because the application should have the platform certification"); + } } [Test] @@ -129,6 +133,10 @@ namespace Tizen.Network.Nfc.Tests { Assert.IsTrue(isNfcSupported == false || isCeSupported == false, "Method throw the NotSupportedException, but Tizen support the Nfc opearation"); } + catch (InvalidOperationException e) + { + Assert.IsTrue(e.Message.Equals("SecurityRestrictedError"), "It is normal operation because the application should have the platform certification"); + } } [Test] @@ -192,6 +200,10 @@ namespace Tizen.Network.Nfc.Tests { Assert.IsTrue(isNfcSupported == false || isCeSupported == false, "Method throw the NotSupportedException, but Tizen support the Nfc opearation"); } + catch (InvalidOperationException e) + { + Assert.IsTrue(e.Message.Equals("SecurityRestrictedError"), "It is normal operation because the application should have the platform certification"); + } } [Test] @@ -380,12 +392,12 @@ namespace Tizen.Network.Nfc.Tests [Test] [Category("P2")] - [Description("Register Aid with null value on AID param, and check Null Reference Exception.")] + [Description("Register Aid with null value on AID param, and check occur Argument Exception.")] [Property("SPEC", "Tizen.Network.Nfc.NfcCardEmulationAdapter.RegisterAid M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Jihoon Jung, jh8801.jung@samsung.com")] - public void RegisterAid_CHECK_NULL_REFERENCE_EXCEPTION() + public void RegisterAid_CHECK_ARGUEMENT_EXCEPTION() { /* * TEST CODE @@ -398,26 +410,26 @@ namespace Tizen.Network.Nfc.Tests /* TEST CODE */ ceAdapter.RegisterAid(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Other, aid); - Assert.Fail( "RegisterAid method should be make the Null Reference Exception"); + Assert.Fail( "RegisterAid method should be make the Argument Exception"); } catch (NotSupportedException) { Assert.IsTrue(isNfcSupported == false || isHceSupported == false, "Method throw the NotSupportedException, but Tizen support the Nfc opearation"); } - catch (Exception ex) + catch (ArgumentException ex) { - Assert.True(true, "Null Reference Exception occurs. Msg : " + ex.ToString()); + Assert.True(true, "Argument Exception occurs. Msg : " + ex.ToString()); } } [Test] [Category("P2")] - [Description("Unregister Aid with null value on AID param, and check Null Reference Exception.")] + [Description("Unregister Aid with null value on AID param, and check occur Argument Exception.")] [Property("SPEC", "Tizen.Network.Nfc.NfcCardEmulationAdapter.UnregisterAid M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Jihoon Jung, jh8801.jung@samsung.com")] - public void UnregisterAid_CHECK_NULL_REFERENCE_EXCEPTION() + public void UnregisterAid_CHECK_ARGUMENT_EXCEPTION() { /* * TEST CODE @@ -430,15 +442,15 @@ namespace Tizen.Network.Nfc.Tests /* TEST CODE */ ceAdapter.UnregisterAid(NfcSecureElementType.Hce, NfcCardEmulationCategoryType.Other, aid); - Assert.Fail( "UnregisterAid method should be make the Null Reference Exception"); + Assert.Fail( "UnregisterAid method should be make the Argument Exception"); } catch (NotSupportedException) { Assert.IsTrue(isNfcSupported == false || isHceSupported == false, "Method throw the NotSupportedException, but Tizen support the Nfc opearation"); } - catch (Exception ex) + catch (ArgumentException ex) { - Assert.True(true, "Null Reference Exception occurs. Msg : " + ex.ToString()); + Assert.True(true, "Argument Exception occurs. Msg : " + ex.ToString()); } } @@ -583,12 +595,12 @@ namespace Tizen.Network.Nfc.Tests [Test] [Category("P2")] - [Description("Call GetRegisteredAidInformation method with null value on AID param, and check Null Reference Exception.")] + [Description("Call GetRegisteredAidInformation method with null value on AID param, and check Argument Exception.")] [Property("SPEC", "Tizen.Network.Nfc.NfcCardEmulationAdapter.GetRegisteredAidInformation M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] [Property("AUTHOR", "Jihoon Jung, jh8801.jung@samsung.com")] - public void ForeachRegisteredAidInformations_CHECK_EXCEPTION() + public void ForeachRegisteredAidInformations_CHECK_ARGUMENT_EXCEPTION() { /* * TEST CODE @@ -599,15 +611,15 @@ namespace Tizen.Network.Nfc.Tests /* TEST CODE */ ceAdapter.GetRegisteredAidInformation(0, 0); - Assert.Fail("ForeachRegisteredAidInformations method should be make the exception"); + Assert.Fail("ForeachRegisteredAidInformations method should be make the argument exception"); } catch (NotSupportedException) { Assert.IsTrue(isNfcSupported == false || isHceSupported == false, "Method throw the NotSupportedException, but Tizen support the Nfc opearation"); } - catch (Exception ex) + catch (ArgumentException ex) { - Assert.True(true, "Null Reference Exception occurs. Msg : " + ex.ToString()); + Assert.True(true, "Argument Exception occurs. Msg : " + ex.ToString()); } } } diff --git a/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcManager.cs b/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcManager.cs index e087aaa..a5a439b 100755 --- a/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcManager.cs +++ b/tct-suite-vs/Tizen.Nfc.Tests/testcase/TSNfcManager.cs @@ -114,6 +114,15 @@ namespace Tizen.Network.Nfc.Tests try { /* TEST CODE */ + NfcCardEmulationAdapter ceAdapter = NfcManager.GetCardEmulationAdapter(); + + if (ceAdapter.GetCardEmulationMode() == NfcSecureElementCardEmulationMode.On) + { + ceAdapter.DisableCardEmulation(); + } + + ceAdapter.EnableCardEmulation(); + Array s_SETypeEnums = Enum.GetValues(typeof(NfcSecureElementType)); NfcSecureElementType seType1 = NfcManager.SecureElementType; @@ -128,6 +137,10 @@ namespace Tizen.Network.Nfc.Tests { Assert.IsTrue(isNfcSupported == false || isCeSupported == false, "Test code throw the NotSupportedException, but Tizen support the Nfc Ce operation"); } + catch (InvalidOperationException e) + { + Assert.IsTrue(e.Message.Equals("SecurityRestrictedError"), "It is normal operation because the application should have the platform certification"); + } } [Test] -- 2.7.4