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