|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "Te_SimPhBkSmartCardUSimTest.h" |
|
17 |
|
18 #include "../../inc/utils.h" |
|
19 |
|
20 CSimPhBkSmartCardUSimTest::CSimPhBkSmartCardUSimTest() |
|
21 { |
|
22 SetTestStepName(_L("SmartCardUSimTest")); |
|
23 } |
|
24 |
|
25 TVerdict CSimPhBkSmartCardUSimTest::doTestStepL() |
|
26 { |
|
27 INFO_PRINTF1(_L("BeginPhBkSmartCardUSimTest")); |
|
28 |
|
29 CreateConfigFileL(_L("c:\\config3.txt")); |
|
30 SetTestNumberL(11); |
|
31 |
|
32 RMobilePhone::TAID activeAID; |
|
33 TInt count; |
|
34 TRequestStatus aReqStatus,stat0,stat1; |
|
35 |
|
36 TInt ret = iPhone.Open(iTelServer,KPhoneName); |
|
37 INFO_PRINTF2(_L("Result: %d"),ret); |
|
38 TESTL(ret == KErrNone); |
|
39 INFO_PRINTF1(_L("Opened phone object")); |
|
40 |
|
41 INFO_PRINTF1(_L("EnumerateUSimApplications test")); |
|
42 |
|
43 iPhone.EnumerateUSimApplications(aReqStatus, count, activeAID); |
|
44 User::WaitForRequest(aReqStatus); |
|
45 TESTL(activeAID.Compare(_L8("App2"))==0); |
|
46 TESTL(count == 3); |
|
47 CHECKPOINTL(aReqStatus, KErrNone, CHP_APPS_CASE("P.1")); |
|
48 |
|
49 //Test GetUSimApplicationInfo |
|
50 RMobilePhone::TUSimApplicationInfoV2 usimAppInfo; |
|
51 RMobilePhone::TUSimApplicationInfoV2Pckg usimAppInfoPckg(usimAppInfo); |
|
52 |
|
53 TInt index=0; |
|
54 |
|
55 INFO_PRINTF1(_L("GetUSimApplicationInfo test")); |
|
56 |
|
57 iPhone.GetUSimApplicationInfo(aReqStatus, index, usimAppInfoPckg); |
|
58 User::WaitForRequest(aReqStatus); |
|
59 CHECKPOINTL(aReqStatus, KErrNone, CHP_APPS_CASE("P.2")); |
|
60 TESTL(usimAppInfo.iAID.Compare(_L8("App2")) == KErrNone); |
|
61 TESTL(usimAppInfo.iLabel.Compare(_L8("PhoneApp2")) == KErrNone); |
|
62 |
|
63 index=5; |
|
64 iPhone.GetUSimApplicationInfo(aReqStatus, index, usimAppInfoPckg); |
|
65 User::WaitForRequest(aReqStatus); |
|
66 CHECKPOINT_EXL(aReqStatus==KErrNotFound, CHP_APPS_CASE("P.3")); |
|
67 TESTL(usimAppInfo.iAID.Compare(_L8("App2")) == KErrNone); |
|
68 TESTL(usimAppInfo.iLabel.Compare(_L8("PhoneApp2")) == KErrNone); |
|
69 |
|
70 INFO_PRINTF1(_L("NotifyUSimApplicationsInfoChange test")); |
|
71 count = 0; // Set count to some value different to that of the number of Apps. |
|
72 iPhone.NotifyUSimApplicationsInfoChange(aReqStatus, count, activeAID); |
|
73 User::WaitForRequest(aReqStatus); |
|
74 CHECKPOINTL(aReqStatus, KErrNone, CHP_APPS_CASE("P.4")); |
|
75 TESTL(activeAID.Compare(_L8("")) == 0); |
|
76 TESTL(count == 3); |
|
77 |
|
78 count = 0; // Set count to some value different to that of the number of Apps. |
|
79 iPhone.NotifyUSimApplicationsInfoChange(aReqStatus, count, activeAID); |
|
80 User::WaitForRequest(aReqStatus); |
|
81 CHECKPOINTL(aReqStatus, KErrNone, CHP_APPS_CASE("P.5")); |
|
82 TESTL(activeAID.Compare(_L8("App1")) == 0); |
|
83 TESTL(count == 3); |
|
84 |
|
85 iPhone.EnumerateUSimApplications(aReqStatus, count, activeAID); |
|
86 User::WaitForRequest(aReqStatus); |
|
87 TESTL(aReqStatus.Int() == KErrNone); |
|
88 TESTL(activeAID.Compare(_L8("App1"))==0); |
|
89 TESTL(count == 3); |
|
90 |
|
91 RMobilePhone::TUSimSelectionMode selectionMode; |
|
92 INFO_PRINTF1(_L("GetUSimAppsSelectionMode test")); |
|
93 ret = iPhone.GetUSimAppsSelectionMode(selectionMode); |
|
94 CHECKPOINTL(ret, KErrNone, CHP_APPS_CASE("P.6")); |
|
95 |
|
96 TESTL(selectionMode == RMobilePhone::EUSimSelectionAutomatic); |
|
97 |
|
98 INFO_PRINTF1(_L("NotifyUSimAppsSelectionModeChange test")); |
|
99 iPhone.NotifyUSimAppsSelectionModeChange(aReqStatus, selectionMode); |
|
100 INFO_PRINTF1(_L("SetUSimAppsSelectionMode test")); |
|
101 ret=iPhone.SetUSimAppsSelectionMode(RMobilePhone::EUSimSelectionManual); |
|
102 CHECKPOINTL(ret, KErrNone, CHP_APPS_CASE("P.7")); |
|
103 User::WaitForRequest(aReqStatus); |
|
104 CHECKPOINTL(aReqStatus, KErrNone, CHP_APPS_CASE("P.8")); |
|
105 TESTL(selectionMode == RMobilePhone::EUSimSelectionManual); |
|
106 |
|
107 iPhone.SetUSimApplicationStatus(aReqStatus, _L8("App2"), RMobilePhone::EUSimActivate); |
|
108 User::WaitForRequest(aReqStatus); |
|
109 |
|
110 RMobilePhone::TSmartCardApplicationEvent event; |
|
111 RMobilePhone::TAID smartCardAppID; |
|
112 iPhone.NotifySmartCardApplicationInfoChange(stat1, smartCardAppID, event); |
|
113 |
|
114 iPhone.NotifyUSimApplicationsInfoChange(aReqStatus, count, activeAID); |
|
115 iPhone.SetUSimApplicationStatus(stat0, _L8("App2"), RMobilePhone::EUSimTerminate); |
|
116 User::WaitForRequest(stat0); |
|
117 User::WaitForRequest(stat1); |
|
118 User::WaitForRequest(aReqStatus); |
|
119 |
|
120 CHECKPOINTL(stat0, KErrNone, CHP_APPS_CASE("P.9")); |
|
121 CHECKPOINTL(stat1, KErrNone, CHP_APPS_CASE("P.10")); |
|
122 CHECKPOINTL(aReqStatus, KErrNone, CHP_APPS_CASE("P.11")); |
|
123 |
|
124 iPhone.SetUSimApplicationStatus(stat0, _L8("App5"), RMobilePhone::EUSimTerminate); |
|
125 User::WaitForRequest(stat0); |
|
126 CHECKPOINTL(stat0, KErrNotFound, CHP_APPS_CASE("P.12")); |
|
127 |
|
128 iPhone.Close(); |
|
129 ASSERT(RThread().RequestCount()==0); |
|
130 |
|
131 return TestStepResult(); |
|
132 } |
|
133 |