1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
38 _LIT (KExeToDefineEmergencyCallPS, "\\sys\\bin\\defineemergencycallps.exe"); |
38 _LIT (KExeToDefineEmergencyCallPS, "\\sys\\bin\\defineemergencycallps.exe"); |
39 |
39 |
40 // Use to write the PIN Check Security test case nos. |
40 // Use to write the PIN Check Security test case nos. |
41 _LIT(KTestCmdSecurityCheckTestFile, "c:\\cmdsecuritychecktest\\pinchecksecuritycaseno.txt"); |
41 _LIT(KTestCmdSecurityCheckTestFile, "c:\\cmdsecuritychecktest\\pinchecksecuritycaseno.txt"); |
42 |
42 |
|
43 const TUid KPropertyCategory={0x2000D75B}; |
|
44 const TUint32 KMiscPluginPropertyKey = 0x2000E658; |
|
45 |
43 static TInt CallBack2L(TAny* aCCustomCmdTestSecurityCheck); |
46 static TInt CallBack2L(TAny* aCCustomCmdTestSecurityCheck); |
44 |
47 |
45 CCustomCmdTestSimSecurityCheck::~CCustomCmdTestSimSecurityCheck() |
48 CCustomCmdTestSimSecurityCheck::~CCustomCmdTestSimSecurityCheck() |
46 { |
49 { |
47 delete iAsyncStopScheduler; |
50 delete iAsyncStopScheduler; |
63 CActiveScheduler::Install (iActiveScheduler); |
66 CActiveScheduler::Install (iActiveScheduler); |
64 iActiveSchedulerWait = new(ELeave) CActiveSchedulerWait; |
67 iActiveSchedulerWait = new(ELeave) CActiveSchedulerWait; |
65 |
68 |
66 //Needed fro calling calback for stopping active scheduler |
69 //Needed fro calling calback for stopping active scheduler |
67 iAsyncStopScheduler = new(ELeave) CAsyncCallBack(CActive::EPriorityIdle); |
70 iAsyncStopScheduler = new(ELeave) CAsyncCallBack(CActive::EPriorityIdle); |
|
71 |
|
72 TInt err = RProperty::Define(KPropertyCategory, KMiscPluginPropertyKey, RProperty::EInt); |
|
73 INFO_PRINTF2(_L("Define Test Property returns : %d "), err); |
|
74 TEST(KErrNone == err || KErrAlreadyExists == err); |
|
75 err = RProperty::Set(KPropertyCategory, KMiscPluginPropertyKey, 1); |
|
76 INFO_PRINTF2(_L("Set Test Property returns : %d "), err); |
|
77 TEST(KErrNone == err); |
|
78 |
68 |
79 |
69 RProcess processHandle; |
80 RProcess processHandle; |
70 CleanupClosePushL(processHandle); |
81 CleanupClosePushL(processHandle); |
71 //Start the test exe which defines startup related property keys |
82 //Start the test exe which defines startup related property keys |
72 processHandle.Create(KExeToDefineStartUpPS, KNullDesC); |
83 processHandle.Create(KExeToDefineStartUpPS, KNullDesC); |
96 //This test case uses scenario 1 to test custom command. |
107 //This test case uses scenario 1 to test custom command. |
97 _LIT(KDirNameOfTestCasesNumFile, "c:\\cmdsecuritychecktest\\"); |
108 _LIT(KDirNameOfTestCasesNumFile, "c:\\cmdsecuritychecktest\\"); |
98 |
109 |
99 //connect to file server |
110 //connect to file server |
100 User::LeaveIfError(iFs.Connect()); |
111 User::LeaveIfError(iFs.Connect()); |
101 TInt err = iFs.MkDirAll(KDirNameOfTestCasesNumFile); |
112 err = iFs.MkDirAll(KDirNameOfTestCasesNumFile); |
102 if (KErrAlreadyExists != err && KErrNone != err) |
113 if (KErrAlreadyExists != err && KErrNone != err) |
103 { |
114 { |
104 INFO_PRINTF1(_L("Leaving as it could not create directory")); |
115 INFO_PRINTF1(_L("Leaving as it could not create directory")); |
105 User::Leave(err); |
116 User::Leave(err); |
106 } |
117 } |
123 |
134 |
124 TVerdict CCustomCmdTestSimSecurityCheck::doTestStepPostambleL() |
135 TVerdict CCustomCmdTestSimSecurityCheck::doTestStepPostambleL() |
125 { |
136 { |
126 iFs.Delete(KTestCmdSecurityCheckTestFile); |
137 iFs.Delete(KTestCmdSecurityCheckTestFile); |
127 iFs.Close(); |
138 iFs.Close(); |
|
139 TInt err = RProperty::Delete(KPropertyCategory, KMiscPluginPropertyKey); |
|
140 TEST(KErrNone == err); |
128 return CTestStep::doTestStepPostambleL(); |
141 return CTestStep::doTestStepPostambleL(); |
129 } |
142 } |
130 |
143 |
131 // CCustomCmdTestSimSecurityCheck::RegisterSimSecurityStatus() |
144 // CCustomCmdTestSimSecurityCheck::RegisterSimSecurityStatus() |
132 // This method is used to define the SIM status proeprty with SSM's secure ID |
145 // This method is used to define the SIM status proeprty with SSM's secure ID |
168 const TUid KPSStartupUid = {0x2000E65E}; |
181 const TUid KPSStartupUid = {0x2000E65E}; |
169 const TUid KSecurityPinNotifierUid = {0x2000E667}; |
182 const TUid KSecurityPinNotifierUid = {0x2000E667}; |
170 |
183 |
171 TUid uid1 = CSsmUiSpecific::StartupPSUid(); |
184 TUid uid1 = CSsmUiSpecific::StartupPSUid(); |
172 TEST(KPSStartupUid == uid1); |
185 TEST(KPSStartupUid == uid1); |
|
186 INFO_PRINTF3(_L("Test GeneralL : KPSStartupUid = %d ; Got from CSsmUiSpecific::StartupPSUid = %d "), KPSStartupUid, uid1); |
173 |
187 |
174 TUid uid2 = CSsmUiSpecific::SecurityPinNotifierUid(); |
188 TUid uid2 = CSsmUiSpecific::SecurityPinNotifierUid(); |
175 TEST(KSecurityPinNotifierUid == uid2); |
189 TEST(KSecurityPinNotifierUid == uid2); |
|
190 INFO_PRINTF3(_L("Test GeneralL : KSecurityPinNotifierUid = %d ; Got from CSsmUiSpecific::SecurityPinNotifierUid = %d "), KPSStartupUid, uid2); |
176 |
191 |
177 TEST( CSsmUiSpecific::IsSimlessOfflineSupported() ); |
192 TEST( CSsmUiSpecific::IsSimlessOfflineSupported() ); |
178 |
193 |
179 TEST( CSsmUiSpecific::IsNormalBoot() ); |
194 TEST( CSsmUiSpecific::IsNormalBoot() ); |
180 |
195 |
951 return KErrNone; |
966 return KErrNone; |
952 } |
967 } |
953 |
968 |
954 void CCustomCmdTestSimSecurityCheck::SimulatePasswordEntry() |
969 void CCustomCmdTestSimSecurityCheck::SimulatePasswordEntry() |
955 { |
970 { |
|
971 const TInt okButtonPos1 = 60; //the position of ok button |
|
972 const TInt okButtonPos2 = 600; //the position of ok button |
956 TRawEvent eventDown; |
973 TRawEvent eventDown; |
957 TRawEvent eventUp; |
974 TRawEvent eventUp; |
958 |
975 |
959 //Simulate the key press ,(comma) in to pin notifier dialogue |
976 //Simulate the key press ,(comma) in to pin notifier dialogue |
960 eventDown.Set(TRawEvent::EKeyDown, EStdKeyComma); |
977 eventDown.Set(TRawEvent::EKeyDown, EStdKeyComma); |
961 UserSvr::AddEvent(eventDown); |
978 UserSvr::AddEvent(eventDown); |
962 eventUp.Set(TRawEvent::EKeyUp, EStdKeyComma); |
979 eventUp.Set(TRawEvent::EKeyUp, EStdKeyComma); |
963 UserSvr::AddEvent(eventUp); |
980 UserSvr::AddEvent(eventUp); |
964 User::After(100000); |
981 User::After(100000); |
965 |
982 |
966 eventDown.Set(TRawEvent::EKeyDown, EStdKeyEnter); |
983 eventDown.Set(TRawEvent::EButton1Down, okButtonPos1,okButtonPos2); |
967 UserSvr::AddEvent(eventDown); |
984 UserSvr::AddEvent(eventDown); |
968 eventUp.Set(TRawEvent::EKeyUp, EStdKeyEnter); |
985 eventUp.Set(TRawEvent::EButton1Up, okButtonPos1, okButtonPos2); |
969 UserSvr::AddEvent(eventUp); |
986 UserSvr::AddEvent(eventUp); |
970 User::After(100000); |
987 User::After(100000); |
971 } |
988 } |
972 |
989 |
973 void CCustomCmdTestSimSecurityCheck::CallBack3RunL() |
990 void CCustomCmdTestSimSecurityCheck::CallBack3RunL() |
974 { |
991 { |
975 if(iRequest != KRequestPending) |
992 if(iRequest != KRequestPending) |