24
|
1 |
// Copyright (c) 2008-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 |
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file The TEFUnit test suite for SecurityControl in the Common TSY.
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include <etel.h>
|
|
23 |
#include <etelmm.h>
|
|
24 |
#include <et_clsvr.h>
|
|
25 |
#include <ctsy/mmtsy_names.h>
|
|
26 |
#include <ctsy/serviceapi/mmtsy_ipcdefs.h>
|
|
27 |
#include <test/tmockltsydata.h>
|
|
28 |
#include <ctsy/serviceapi/gsmerror.h>
|
|
29 |
#include <ctsy/ltsy/mltsydispatchsecurityinterface.h>
|
|
30 |
#include "mockltsyindicatorids.h"
|
|
31 |
#include <ctsy/ltsy/mltsydispatchsiminterface.h>
|
|
32 |
#include <ctsy/rmmcustomapi.h>
|
|
33 |
#include <ctsy/serviceapi/cmmcustomsecuritytsyconstants.h>
|
|
34 |
#include <ctsy/ltsy/mltsydispatchcallcontrolinterface.h>
|
|
35 |
#include "cctsysecurityfu.h"
|
|
36 |
|
|
37 |
CTestSuite* CCTsySecurityFU::CreateSuiteL(const TDesC& aName)
|
|
38 |
{
|
|
39 |
SUB_SUITE;
|
|
40 |
|
|
41 |
//add use-case tests
|
|
42 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUseCase0001L);
|
|
43 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUseCase0002L);
|
|
44 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUseCase0003L);
|
|
45 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUseCase0004L);
|
|
46 |
|
|
47 |
//add other unit tests
|
|
48 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0001L);
|
|
49 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0002L);
|
|
50 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0003L);
|
|
51 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0004L);
|
|
52 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0005L);
|
|
53 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0006L);
|
|
54 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0007L);
|
|
55 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0008L);
|
|
56 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0009L);
|
|
57 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0010L);
|
|
58 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0011L);
|
|
59 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0012L);
|
|
60 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0013L);
|
|
61 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0014L);
|
|
62 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0015L);
|
|
63 |
ADD_TEST_STEP_ISO_CPP(CCTsySecurityFU, TestUnit0016L);
|
|
64 |
|
|
65 |
END_SUITE;
|
|
66 |
}
|
|
67 |
|
|
68 |
//
|
|
69 |
// Use-case tests
|
|
70 |
//
|
|
71 |
|
|
72 |
/**
|
|
73 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UC0001
|
|
74 |
@SYMComponent telephony_ctsy
|
|
75 |
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetFdnSetting, RMobilePhone::VerifySecurityCode
|
|
76 |
@SYMTestPriority High
|
|
77 |
@SYMTestActions Invokes RMobilePhone::SetFdnSetting
|
|
78 |
@SYMTestExpectedResults Pass
|
|
79 |
@SYMTestType CT
|
|
80 |
*/
|
|
81 |
void CCTsySecurityFU::TestUseCase0001L()
|
|
82 |
{
|
|
83 |
/*
|
|
84 |
* This test uses VerifySecurityCode with SetFdnSetting to get the SetFdnSetting sent to the LTSY
|
|
85 |
*/
|
|
86 |
|
|
87 |
OpenEtelServerL(EUseExtendedError);
|
|
88 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
89 |
OpenPhoneL();
|
|
90 |
|
|
91 |
RBuf8 data;
|
|
92 |
CleanupClosePushL(data);
|
|
93 |
|
|
94 |
TRequestStatus reqStatus, reqStatusNotif, reqStatusVerify;
|
|
95 |
|
|
96 |
// Prepare data for mockLtsy for the VerifySecurityCode.
|
|
97 |
// This mimics the scenario that Pin2 code is required to make SetFdnSetting complete successfully.
|
|
98 |
// Therefore we use VerifySecurityCode to supply the Pin2 code.
|
|
99 |
RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePin2;
|
|
100 |
|
|
101 |
_LIT(KPwd,"pwd");
|
|
102 |
_LIT(KUnblockPwd, "unblockPwd");
|
|
103 |
RMobilePhone::TMobilePassword pwd;
|
|
104 |
RMobilePhone::TMobilePassword unblockPwd;
|
|
105 |
pwd.Copy(KPwd);
|
|
106 |
unblockPwd.Copy(KUnblockPwd);
|
|
107 |
|
|
108 |
RMobilePhone::TCodeAndUnblockCode twoCodes;
|
|
109 |
twoCodes.iCode.Copy(KPwd);
|
|
110 |
twoCodes.iUnblockCode.Copy(KUnblockPwd);
|
|
111 |
TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode, twoCodes);
|
|
112 |
verifyData.SerialiseL(data);
|
|
113 |
|
|
114 |
TRequestStatus reqStatus2;
|
|
115 |
RMobilePhone::TMobilePhoneSecurityEvent secEventRes;
|
|
116 |
iMockLTSY.ExpectL(MLtsyDispatchSimGetActiveIccApplicationType::KLtsyDispatchSimGetActiveIccApplicationTypeApiId);
|
|
117 |
iPhone.NotifySecurityEvent(reqStatus2, secEventRes);
|
|
118 |
|
|
119 |
// Call the ipc for SetFdnSetting.
|
|
120 |
// Also call NotifyFdnStatusChange as this is triggered by CTSY when SetFdnSetting completes
|
|
121 |
RMobilePhone::TMobilePhoneFdnStatus fdnStatus(RMobilePhone::EFdnUnknown);
|
|
122 |
iPhone.NotifyFdnStatusChange(reqStatusNotif, fdnStatus);
|
|
123 |
RMobilePhone::TMobilePhoneFdnSetting fdnSetting(RMobilePhone::EFdnSetOff);
|
|
124 |
iPhone.SetFdnSetting(reqStatus, fdnSetting);
|
|
125 |
|
|
126 |
User::WaitForRequest(reqStatus2);
|
|
127 |
ASSERT_EQUALS(KErrNone, reqStatus2.Int())
|
|
128 |
|
|
129 |
// Send the ExpectL and CompleteL for VerifySecurityCode
|
|
130 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, data, KErrNone);
|
|
131 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, KErrGeneral);
|
|
132 |
|
|
133 |
// Call ipc for VerifySecurityCode
|
|
134 |
iPhone.VerifySecurityCode(reqStatusVerify, secCode, pwd, unblockPwd);
|
|
135 |
|
|
136 |
// Wait for VerifySecurityCode...
|
|
137 |
User::WaitForRequest(reqStatusVerify);
|
|
138 |
ASSERT_EQUALS(KErrGeneral, reqStatusVerify.Int());
|
|
139 |
AssertMockLtsyStatusL();
|
|
140 |
|
|
141 |
// Wait for SetFdnSetting...
|
|
142 |
User::WaitForRequest(reqStatus);
|
|
143 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
144 |
AssertMockLtsyStatusL();
|
|
145 |
|
|
146 |
iPhone.NotifySecurityEvent(reqStatus2, secEventRes);
|
|
147 |
|
|
148 |
iPhone.SetFdnSetting(reqStatus, fdnSetting);
|
|
149 |
|
|
150 |
User::WaitForRequest(reqStatus2);
|
|
151 |
ASSERT_EQUALS(KErrNone, reqStatus2.Int())
|
|
152 |
|
|
153 |
// Send the ExpectL and CompleteL for VerifySecurityCode
|
|
154 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, data, KErrNone);
|
|
155 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, KErrNone);
|
|
156 |
|
|
157 |
// Send ExpectL for SetFdnSetting
|
|
158 |
data.Close();
|
|
159 |
TMockLtsyData1<RMobilePhone::TMobilePhoneFdnSetting> setData(fdnSetting);
|
|
160 |
data.Close();
|
|
161 |
setData.SerialiseL(data);
|
|
162 |
iMockLTSY.ExpectL(MLtsyDispatchSimSetFdnSetting::KLtsyDispatchSimSetFdnSettingApiId, data, KErrNone);
|
|
163 |
|
|
164 |
// Call ipc for VerifySecurityCode
|
|
165 |
iPhone.VerifySecurityCode(reqStatusVerify, secCode, pwd, unblockPwd);
|
|
166 |
|
|
167 |
// Wait for VerifySecurityCode...
|
|
168 |
User::WaitForRequest(reqStatusVerify);
|
|
169 |
ASSERT_EQUALS(KErrNone, reqStatusVerify.Int());
|
|
170 |
AssertMockLtsyStatusL();
|
|
171 |
|
|
172 |
// Now send the CompleteL for SetFdnSetting since CTSY sends this ipc down to LTSY after completing VerifySecurityCode.
|
|
173 |
iMockLTSY.CompleteL(MLtsyDispatchSimSetFdnSetting::KLtsyDispatchSimSetFdnSettingApiId, KErrNone);
|
|
174 |
|
|
175 |
// Wait for SetFdnSetting...
|
|
176 |
User::WaitForRequest(reqStatus);
|
|
177 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
178 |
AssertMockLtsyStatusL();
|
|
179 |
|
|
180 |
User::WaitForRequest(reqStatusNotif);
|
|
181 |
ASSERT_EQUALS(KErrNone, reqStatusNotif.Int());
|
|
182 |
ASSERT_EQUALS(fdnStatus, RMobilePhone::EFdnNotActive);
|
|
183 |
|
|
184 |
AssertMockLtsyStatusL();
|
|
185 |
CleanupStack::PopAndDestroy(2, this); // data, this
|
|
186 |
}
|
|
187 |
|
|
188 |
/**
|
|
189 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UC0002
|
|
190 |
@SYMComponent telephony_ctsy
|
|
191 |
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifyLockInfoChange, RMobilePhone::SetLockSetting
|
|
192 |
@SYMTestPriority High
|
|
193 |
@SYMTestActions Invokes RMobilePhone::SetLockSetting
|
|
194 |
@SYMTestExpectedResults Pass
|
|
195 |
@SYMTestType CT
|
|
196 |
*/
|
|
197 |
void CCTsySecurityFU::TestUseCase0002L()
|
|
198 |
{
|
|
199 |
OpenEtelServerL(EUseExtendedError);
|
|
200 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
201 |
OpenPhoneL();
|
|
202 |
|
|
203 |
RBuf8 data;
|
|
204 |
CleanupClosePushL(data);
|
|
205 |
|
|
206 |
TRequestStatus reqStatus;
|
|
207 |
RMobilePhone::TMobilePhoneLock lock = RMobilePhone::ELockPhoneDevice;
|
|
208 |
RMobilePhone::TMobilePhoneLockInfoV1 lockInfoV1;
|
|
209 |
lockInfoV1.iSetting = RMobilePhone::ELockSetEnabled;
|
|
210 |
lockInfoV1.iStatus = RMobilePhone::EStatusLocked;
|
|
211 |
RMobilePhone::TMobilePhoneLockInfoV1Pckg pckgData(lockInfoV1);
|
|
212 |
iPhone.NotifyLockInfoChange(reqStatus, lock, pckgData);
|
|
213 |
|
|
214 |
TRequestStatus status;
|
|
215 |
|
|
216 |
RMobilePhone::TMobilePhoneLock lock2 = RMobilePhone::ELockHiddenKey;//ELockUSimApp;
|
|
217 |
RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled;
|
|
218 |
TDesC* passwordPtr = const_cast<TDesC*>(&KNullDesC);
|
|
219 |
|
|
220 |
TMockLtsyData3<RMobilePhone::TMobilePhoneLock,RMobilePhone::TMobilePhoneLockSetting,TDesC*> phoneLockData(lock2,lockSetting,passwordPtr);
|
|
221 |
phoneLockData.SerialiseL(data);
|
|
222 |
|
|
223 |
iMockLTSY.ExpectL(MLtsyDispatchSecuritySetLockSetting::KLtsyDispatchSecuritySetLockSettingApiId, data);
|
|
224 |
iMockLTSY.CompleteL(MLtsyDispatchSecuritySetLockSetting::KLtsyDispatchSecuritySetLockSettingApiId, KErrNone);
|
|
225 |
|
|
226 |
iPhone.SetLockSetting(status, lock2, lockSetting);
|
|
227 |
User::WaitForRequest(status);
|
|
228 |
AssertMockLtsyStatusL();
|
|
229 |
ASSERT_EQUALS(KErrNone, status.Int());
|
|
230 |
|
|
231 |
TMockLtsyData3<RMobilePhone::TMobilePhoneLockStatus, RMobilePhone::TMobilePhoneLockSetting,
|
|
232 |
RMobilePhone::TMobilePhoneLock> lockInfoData(lockInfoV1.iStatus, lockInfoV1.iSetting, lock);
|
|
233 |
data.Close();
|
|
234 |
lockInfoData.SerialiseL(data);
|
|
235 |
|
|
236 |
iMockLTSY.CompleteL(KMockLtsyDispatchSecurityNotifyLockInfoChangeIndId, KErrNone, data);
|
|
237 |
|
|
238 |
User::WaitForRequest(reqStatus);
|
|
239 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
240 |
AssertMockLtsyStatusL();
|
|
241 |
|
|
242 |
//now test case where SetLockSetting() has a password send down, this involves doing a VerifySecurityCode(), thus
|
|
243 |
//the password is set to "\0" (this is for dispatcher coverage).
|
|
244 |
|
|
245 |
RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePin2;
|
|
246 |
|
|
247 |
_LIT(KPwd,"pwd");
|
|
248 |
_LIT(KUnblockPwd, "unblockPwd");
|
|
249 |
RMobilePhone::TMobilePassword pwd(KPwd);
|
|
250 |
RMobilePhone::TMobilePassword unblockPwd(KUnblockPwd);
|
|
251 |
|
|
252 |
|
|
253 |
RMobilePhone::TCodeAndUnblockCode twoCodes;
|
|
254 |
twoCodes.iCode.Copy(KPwd);
|
|
255 |
twoCodes.iUnblockCode.Copy(KUnblockPwd);
|
|
256 |
TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode, twoCodes);
|
|
257 |
data.Close();
|
|
258 |
verifyData.SerialiseL(data);
|
|
259 |
|
|
260 |
|
|
261 |
// Send the ExpectL and CompleteL for VerifySecurityCode
|
|
262 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, data, KErrNone);
|
|
263 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, KErrNone);
|
|
264 |
|
|
265 |
// Call ipc for VerifySecurityCode
|
|
266 |
iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
|
|
267 |
|
|
268 |
// Wait for VerifySecurityCode...
|
|
269 |
User::WaitForRequest(reqStatus);
|
|
270 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
271 |
AssertMockLtsyStatusL();
|
|
272 |
|
|
273 |
|
|
274 |
|
|
275 |
data.Close();
|
|
276 |
_LIT( KNullCharacter, "\0" );
|
|
277 |
passwordPtr = const_cast<TDesC*>(&KNullCharacter);
|
|
278 |
phoneLockData.SerialiseL(data);
|
|
279 |
|
|
280 |
iMockLTSY.ExpectL(MLtsyDispatchSecuritySetLockSetting::KLtsyDispatchSecuritySetLockSettingApiId, data);
|
|
281 |
iMockLTSY.CompleteL(MLtsyDispatchSecuritySetLockSetting::KLtsyDispatchSecuritySetLockSettingApiId, KErrNone);
|
|
282 |
|
|
283 |
iPhone.SetLockSetting(status, lock2, lockSetting);
|
|
284 |
User::WaitForRequest(status);
|
|
285 |
AssertMockLtsyStatusL();
|
|
286 |
ASSERT_EQUALS(KErrNone, status.Int());
|
|
287 |
|
|
288 |
CleanupStack::PopAndDestroy(2, this); // data, this
|
|
289 |
}
|
|
290 |
|
|
291 |
/**
|
|
292 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UC0003
|
|
293 |
@SYMComponent telephony_ctsy
|
|
294 |
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetLockSetting
|
|
295 |
@SYMTestPriority High
|
|
296 |
@SYMTestActions Invokes RMobilePhone::SetLockSetting
|
|
297 |
@SYMTestExpectedResults Pass
|
|
298 |
@SYMTestType CT
|
|
299 |
*/
|
|
300 |
void CCTsySecurityFU::TestUseCase0003L()
|
|
301 |
{
|
|
302 |
OpenEtelServerL(EUseExtendedError);
|
|
303 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
304 |
OpenPhoneL();
|
|
305 |
|
|
306 |
RBuf8 data;
|
|
307 |
CleanupClosePushL(data);
|
|
308 |
|
|
309 |
TRequestStatus reqStatus, reqStatus2, reqStatusVerify;
|
|
310 |
RMobilePhone::TMobilePhoneSecurityEvent secEventRes;
|
|
311 |
iMockLTSY.ExpectL(MLtsyDispatchSimGetActiveIccApplicationType::KLtsyDispatchSimGetActiveIccApplicationTypeApiId);
|
|
312 |
iPhone.NotifySecurityEvent(reqStatus, secEventRes);
|
|
313 |
|
|
314 |
RMobilePhone::TMobilePhoneLock lock = RMobilePhone::ELockICC;
|
|
315 |
RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled;
|
|
316 |
iPhone.SetLockSetting(reqStatus2, lock, lockSetting);
|
|
317 |
|
|
318 |
User::WaitForRequest(reqStatus);
|
|
319 |
ASSERT_EQUALS(KErrNone, reqStatus.Int())
|
|
320 |
|
|
321 |
RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePin2;
|
|
322 |
|
|
323 |
_LIT(KPwd,"pwd");
|
|
324 |
_LIT(KUnblockPwd, "unblockPwd");
|
|
325 |
RMobilePhone::TMobilePassword pwd;
|
|
326 |
RMobilePhone::TMobilePassword unblockPwd;
|
|
327 |
pwd.Copy(KPwd);
|
|
328 |
unblockPwd.Copy(KUnblockPwd);
|
|
329 |
|
|
330 |
RMobilePhone::TCodeAndUnblockCode twoCodes;
|
|
331 |
twoCodes.iCode.Copy(KPwd);
|
|
332 |
twoCodes.iUnblockCode.Copy(KUnblockPwd);
|
|
333 |
TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode, twoCodes);
|
|
334 |
verifyData.SerialiseL(data);
|
|
335 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, data, KErrNone);
|
|
336 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, KErrAccessDenied);
|
|
337 |
|
|
338 |
iPhone.VerifySecurityCode(reqStatusVerify, secCode, pwd, unblockPwd);
|
|
339 |
|
|
340 |
User::WaitForRequest(reqStatusVerify);
|
|
341 |
ASSERT_EQUALS(KErrAccessDenied, reqStatusVerify.Int());
|
|
342 |
|
|
343 |
User::WaitForRequest(reqStatus2);
|
|
344 |
ASSERT_EQUALS(KErrAccessDenied, reqStatus2.Int());
|
|
345 |
|
|
346 |
iPhone.NotifySecurityEvent(reqStatus, secEventRes);
|
|
347 |
|
|
348 |
iPhone.SetLockSetting(reqStatus2, lock, lockSetting);
|
|
349 |
|
|
350 |
User::WaitForRequest(reqStatus);
|
|
351 |
ASSERT_EQUALS(KErrNone, reqStatus.Int())
|
|
352 |
|
|
353 |
data.Close();
|
|
354 |
verifyData.SerialiseL(data);
|
|
355 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, data, KErrNone);
|
|
356 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, KErrNone);
|
|
357 |
|
|
358 |
RMobilePhone::TMobilePhoneLock lock2 = RMobilePhone::ELockICC;
|
|
359 |
RMobilePhone::TMobilePhoneLockSetting lockSetting2 = RMobilePhone::ELockSetEnabled;
|
|
360 |
TDesC* passwordPtr = const_cast<TDesC*>(&KPwd);
|
|
361 |
TMockLtsyData3<RMobilePhone::TMobilePhoneLock,RMobilePhone::TMobilePhoneLockSetting,TDesC*> phoneLockData(lock2,lockSetting2,passwordPtr);
|
|
362 |
data.Close();
|
|
363 |
phoneLockData.SerialiseL(data);
|
|
364 |
iMockLTSY.ExpectL(MLtsyDispatchSecuritySetLockSetting::KLtsyDispatchSecuritySetLockSettingApiId, data);
|
|
365 |
|
|
366 |
iPhone.VerifySecurityCode(reqStatusVerify, secCode, pwd, unblockPwd);
|
|
367 |
|
|
368 |
User::WaitForRequest(reqStatusVerify);
|
|
369 |
ASSERT_EQUALS(KErrNone, reqStatusVerify.Int());
|
|
370 |
|
|
371 |
iMockLTSY.CompleteL(MLtsyDispatchSecuritySetLockSetting::KLtsyDispatchSecuritySetLockSettingApiId, KErrNone);
|
|
372 |
|
|
373 |
User::WaitForRequest(reqStatus2);
|
|
374 |
ASSERT_EQUALS(KErrNone, reqStatus2.Int());
|
|
375 |
|
|
376 |
AssertMockLtsyStatusL();
|
|
377 |
CleanupStack::PopAndDestroy(2, this); // data, this
|
|
378 |
}
|
|
379 |
|
|
380 |
/**
|
|
381 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UC0004
|
|
382 |
@SYMComponent telephony_ctsy
|
|
383 |
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::AbortSecurityCode
|
|
384 |
@SYMTestPriority High
|
|
385 |
@SYMTestActions Invokes RMobilePhone::AbortSecurityCode
|
|
386 |
@SYMTestExpectedResults Pass
|
|
387 |
@SYMTestType CT
|
|
388 |
*/
|
|
389 |
void CCTsySecurityFU::TestUseCase0004L()
|
|
390 |
{
|
|
391 |
OpenEtelServerL(EUseExtendedError);
|
|
392 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
393 |
OpenPhoneL();
|
|
394 |
|
|
395 |
RBuf8 data;
|
|
396 |
CleanupClosePushL(data);
|
|
397 |
|
|
398 |
TRequestStatus status;
|
|
399 |
RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePin2;
|
|
400 |
|
|
401 |
_LIT(KPwd,"pwd");
|
|
402 |
_LIT(KUnblockPwd, "unblockPwd");
|
|
403 |
RMobilePhone::TMobilePassword pwd;
|
|
404 |
RMobilePhone::TMobilePassword unblockPwd;
|
|
405 |
pwd.Copy(KPwd);
|
|
406 |
unblockPwd.Copy(KUnblockPwd);
|
|
407 |
|
|
408 |
RMobilePhone::TCodeAndUnblockCode twoCodes;
|
|
409 |
twoCodes.iCode.Copy(KPwd);
|
|
410 |
twoCodes.iUnblockCode.Copy(KUnblockPwd);
|
|
411 |
TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode, twoCodes);
|
|
412 |
verifyData.SerialiseL(data);
|
|
413 |
|
|
414 |
// Send the ExpectL and CompleteL for VerifySecurityCode
|
|
415 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, data, KErrNone);
|
|
416 |
|
|
417 |
// Call ipc for VerifySecurityCode
|
|
418 |
iPhone.VerifySecurityCode(status, secCode, pwd, unblockPwd);
|
|
419 |
|
|
420 |
TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> secCodeData(secCode);
|
|
421 |
data.Close();
|
|
422 |
secCodeData.SerialiseL(data);
|
|
423 |
|
|
424 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityAbortSecurityCode::KLtsyDispatchSecurityAbortSecurityCodeApiId, data);
|
|
425 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityAbortSecurityCode::KLtsyDispatchSecurityAbortSecurityCodeApiId, KErrNone);
|
|
426 |
|
|
427 |
TInt res = iPhone.AbortSecurityCode(secCode);
|
|
428 |
ASSERT_EQUALS(KErrNone, res)
|
|
429 |
AssertMockLtsyStatusL();
|
|
430 |
|
|
431 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, KErrAbort);
|
|
432 |
User::WaitForRequest(status);
|
|
433 |
ASSERT_EQUALS(KErrAbort, status.Int());
|
|
434 |
AssertMockLtsyStatusL();
|
|
435 |
|
|
436 |
// aborting SetLockSetting():
|
|
437 |
_LIT( KNullCharacter, "\0" );
|
|
438 |
RMobilePhone::TMobilePhoneLock lock = RMobilePhone::ELockHiddenKey;
|
|
439 |
RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled;
|
|
440 |
TDesC* passwordPtr = const_cast<TDesC*>(&KNullCharacter);
|
|
441 |
TMockLtsyData3<RMobilePhone::TMobilePhoneLock,RMobilePhone::TMobilePhoneLockSetting,TDesC*> phoneLockData(lock,lockSetting,passwordPtr);
|
|
442 |
data.Close();
|
|
443 |
phoneLockData.SerialiseL(data);
|
|
444 |
|
|
445 |
iMockLTSY.ExpectL(MLtsyDispatchSecuritySetLockSetting::KLtsyDispatchSecuritySetLockSettingApiId, data);
|
|
446 |
|
|
447 |
iPhone.SetLockSetting(status, lock, lockSetting);
|
|
448 |
|
|
449 |
res = iPhone.AbortSecurityCode(secCode);
|
|
450 |
ASSERT_EQUALS(KErrNone, res)
|
|
451 |
|
|
452 |
User::WaitForRequest(status);
|
|
453 |
ASSERT_EQUALS(KErrAbort, status.Int());
|
|
454 |
AssertMockLtsyStatusL();
|
|
455 |
|
|
456 |
// aborting SetFdnSetting():
|
|
457 |
|
|
458 |
RMobilePhone::TMobilePhoneFdnSetting fdnSetting(RMobilePhone::EFdnSetOff);
|
|
459 |
iPhone.SetFdnSetting(status, fdnSetting);
|
|
460 |
|
|
461 |
res = iPhone.AbortSecurityCode(secCode);
|
|
462 |
ASSERT_EQUALS(KErrNone, res)
|
|
463 |
|
|
464 |
User::WaitForRequest(status);
|
|
465 |
ASSERT_EQUALS(KErrAbort, status.Int());
|
|
466 |
AssertMockLtsyStatusL();
|
|
467 |
|
|
468 |
CleanupStack::PopAndDestroy(2, this); // data, this
|
|
469 |
}
|
|
470 |
|
|
471 |
//
|
|
472 |
// Other unit tests
|
|
473 |
//
|
|
474 |
|
|
475 |
/**
|
|
476 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0001
|
|
477 |
@SYMComponent telephony_ctsy
|
|
478 |
@SYMTestCaseDesc Test support in CTSY for VerifySecurityCode()
|
|
479 |
@SYMTestPriority High
|
|
480 |
@SYMTestActions Invokes RMobilePhone::VerifySecurityCode()
|
|
481 |
@SYMTestExpectedResults Pass
|
|
482 |
@SYMTestType UT
|
|
483 |
*/
|
|
484 |
void CCTsySecurityFU::TestUnit0001L()
|
|
485 |
{
|
|
486 |
OpenEtelServerL(EUseExtendedError);
|
|
487 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
488 |
OpenPhoneL();
|
|
489 |
|
|
490 |
RBuf8 data;
|
|
491 |
CleanupClosePushL(data);
|
|
492 |
|
|
493 |
_LIT(KPwd,"pwd");
|
|
494 |
_LIT(KUnblockPwd, "unblock");
|
|
495 |
|
|
496 |
TRequestStatus reqStatus;
|
|
497 |
RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
|
|
498 |
RMobilePhone::TMobilePassword pwd;
|
|
499 |
RMobilePhone::TMobilePassword unblockPwd;
|
|
500 |
|
|
501 |
pwd.Copy(KPwd);
|
|
502 |
unblockPwd.Copy(KUnblockPwd);
|
|
503 |
|
|
504 |
RMobilePhone::TCodeAndUnblockCode twoCodes;
|
|
505 |
twoCodes.iCode.Copy(KPwd);
|
|
506 |
twoCodes.iUnblockCode.Copy(KUnblockPwd);
|
|
507 |
|
|
508 |
TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode,twoCodes);
|
|
509 |
verifyData.SerialiseL(data);
|
|
510 |
|
|
511 |
//-------------------------------------------------------------------------
|
|
512 |
// TEST A: failure to dispatch request to LTSY
|
|
513 |
//-------------------------------------------------------------------------
|
|
514 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, data, KErrNotSupported);
|
|
515 |
iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
|
|
516 |
User::WaitForRequest(reqStatus);
|
|
517 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
|
|
518 |
AssertMockLtsyStatusL();
|
|
519 |
|
|
520 |
//-------------------------------------------------------------------------
|
|
521 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
522 |
//-------------------------------------------------------------------------
|
|
523 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, data);
|
|
524 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, KErrGeneral);
|
|
525 |
iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
|
|
526 |
User::WaitForRequest(reqStatus);
|
|
527 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int())
|
|
528 |
AssertMockLtsyStatusL();
|
|
529 |
|
|
530 |
//-------------------------------------------------------------------------
|
|
531 |
// TEST C: Successful completion request of
|
|
532 |
// RMobilePhone::VerifySecurityCode when result is not cached.
|
|
533 |
//-------------------------------------------------------------------------
|
|
534 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, data);
|
|
535 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, KErrNone);
|
|
536 |
iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
|
|
537 |
User::WaitForRequest(reqStatus);
|
|
538 |
ASSERT_EQUALS(KErrNone, reqStatus.Int())
|
|
539 |
AssertMockLtsyStatusL();
|
|
540 |
|
|
541 |
//-------------------------------------------------------------------------
|
|
542 |
// TEST E: Unsolicited completion of RMobilePhone::VerifySecurityCode
|
|
543 |
// from LTSY.
|
|
544 |
//-------------------------------------------------------------------------
|
|
545 |
iMockLTSY.NotifyTerminated(reqStatus);
|
|
546 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, KErrNone);
|
|
547 |
User::WaitForRequest(reqStatus);
|
|
548 |
ASSERT_EQUALS(KErrNone, reqStatus.Int())
|
|
549 |
|
|
550 |
AssertMockLtsyStatusL();
|
|
551 |
CleanupStack::PopAndDestroy(2, this); // data, this
|
|
552 |
|
|
553 |
}
|
|
554 |
|
|
555 |
/**
|
|
556 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0002
|
|
557 |
@SYMComponent telephony_ctsy
|
|
558 |
@SYMTestCaseDesc Test support in CTSY for SetPin1DisableNotSupported()
|
|
559 |
@SYMTestPriority High
|
|
560 |
@SYMTestActions Invokes SetPin1DisableNotSupported()
|
|
561 |
@SYMTestExpectedResults Pass
|
|
562 |
@SYMTestType UT
|
|
563 |
*/
|
|
564 |
void CCTsySecurityFU::TestUnit0002L()
|
|
565 |
{
|
|
566 |
OpenEtelServerL(EUseExtendedError);
|
|
567 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
568 |
OpenPhoneL();
|
|
569 |
|
|
570 |
RBuf8 dataComplete;
|
|
571 |
CleanupClosePushL(dataComplete);
|
|
572 |
|
|
573 |
TBool supported = EFalse;
|
|
574 |
TMockLtsyData1<TBool> ltsyData(supported);
|
|
575 |
dataComplete.Close();
|
|
576 |
ltsyData.SerialiseL(dataComplete);
|
|
577 |
|
|
578 |
TRequestStatus mockLtsyStatus;
|
|
579 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
580 |
// send completion for calling SetPin1DisableNotSupported
|
|
581 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityGetPin1DisableSupported::KLtsyDispatchSecurityGetPin1DisableSupportedApiId, KErrNone, dataComplete);
|
|
582 |
User::WaitForRequest(mockLtsyStatus);
|
|
583 |
|
|
584 |
// SetLockSetting() should return an error now:
|
|
585 |
TRequestStatus status;
|
|
586 |
RMobilePhone::TMobilePhoneLock lock = RMobilePhone::ELockICC;
|
|
587 |
RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetDisabled;
|
|
588 |
iPhone.SetLockSetting(status, lock, lockSetting);
|
|
589 |
User::WaitForRequest(status);
|
|
590 |
ASSERT_EQUALS(KErrGsm0707OperationNotAllowed, status.Int());
|
|
591 |
|
|
592 |
AssertMockLtsyStatusL();
|
|
593 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
594 |
|
|
595 |
CleanupStack::PopAndDestroy(2, this); // dataComplete, this
|
|
596 |
}
|
|
597 |
|
|
598 |
/**
|
|
599 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0003
|
|
600 |
@SYMComponent telephony_ctsy
|
|
601 |
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::AbortSecurityCode()
|
|
602 |
@SYMTestPriority High
|
|
603 |
@SYMTestActions Invokes RMobilePhone::AbortSecurityCode()
|
|
604 |
@SYMTestExpectedResults Pass
|
|
605 |
@SYMTestType UT
|
|
606 |
*/
|
|
607 |
void CCTsySecurityFU::TestUnit0003L()
|
|
608 |
{
|
|
609 |
OpenEtelServerL(EUseExtendedError);
|
|
610 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
611 |
OpenPhoneL();
|
|
612 |
|
|
613 |
RBuf8 data;
|
|
614 |
CleanupClosePushL(data);
|
|
615 |
|
|
616 |
RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
|
|
617 |
TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> secCodeData(secCode);
|
|
618 |
secCodeData.SerialiseL(data);
|
|
619 |
|
|
620 |
//-------------------------------------------------------------------------
|
|
621 |
// TEST A: failure to dispatch request to LTSY
|
|
622 |
//-------------------------------------------------------------------------
|
|
623 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityAbortSecurityCode::KLtsyDispatchSecurityAbortSecurityCodeApiId, data, KErrNotSupported);
|
|
624 |
TInt res = iPhone.AbortSecurityCode(secCode);
|
|
625 |
|
|
626 |
ASSERT_EQUALS(KErrNotSupported, res)
|
|
627 |
AssertMockLtsyStatusL();
|
|
628 |
|
|
629 |
//-------------------------------------------------------------------------
|
|
630 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
631 |
//-------------------------------------------------------------------------
|
|
632 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityAbortSecurityCode::KLtsyDispatchSecurityAbortSecurityCodeApiId, data);
|
|
633 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityAbortSecurityCode::KLtsyDispatchSecurityAbortSecurityCodeApiId, KErrGeneral);
|
|
634 |
|
|
635 |
res = iPhone.AbortSecurityCode(secCode);
|
|
636 |
ASSERT_EQUALS(KErrGeneral, res)
|
|
637 |
AssertMockLtsyStatusL();
|
|
638 |
|
|
639 |
//-------------------------------------------------------------------------
|
|
640 |
// TEST C: Successful completion request of
|
|
641 |
// RMobilePhone::AbortSecurityCode when result is not cached.
|
|
642 |
//-------------------------------------------------------------------------
|
|
643 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityAbortSecurityCode::KLtsyDispatchSecurityAbortSecurityCodeApiId, data);
|
|
644 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityAbortSecurityCode::KLtsyDispatchSecurityAbortSecurityCodeApiId, KErrNone);
|
|
645 |
|
|
646 |
res = iPhone.AbortSecurityCode(secCode);
|
|
647 |
ASSERT_EQUALS(KErrNone, res)
|
|
648 |
AssertMockLtsyStatusL();
|
|
649 |
|
|
650 |
//-------------------------------------------------------------------------
|
|
651 |
// TEST E: Unsolicited completion of RMobilePhone::AbortSecurityCode
|
|
652 |
// from LTSY.
|
|
653 |
//-------------------------------------------------------------------------
|
|
654 |
TRequestStatus mockLtsyStatus;
|
|
655 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
656 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityAbortSecurityCode::KLtsyDispatchSecurityAbortSecurityCodeApiId, KErrNone);
|
|
657 |
User::WaitForRequest(mockLtsyStatus);
|
|
658 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int())
|
|
659 |
|
|
660 |
AssertMockLtsyStatusL();
|
|
661 |
CleanupStack::PopAndDestroy(2, this); // data, this
|
|
662 |
}
|
|
663 |
|
|
664 |
/**
|
|
665 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0004
|
|
666 |
@SYMComponent telephony_ctsy
|
|
667 |
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetLockInfo()
|
|
668 |
@SYMTestPriority High
|
|
669 |
@SYMTestActions Invokes RMobilePhone::GetLockInfo()
|
|
670 |
@SYMTestExpectedResults Pass
|
|
671 |
@SYMTestType UT
|
|
672 |
*/
|
|
673 |
void CCTsySecurityFU::TestUnit0004L()
|
|
674 |
{
|
|
675 |
OpenEtelServerL();
|
|
676 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
677 |
OpenPhoneL();
|
|
678 |
|
|
679 |
RBuf8 dataExpect;
|
|
680 |
CleanupClosePushL(dataExpect);
|
|
681 |
RBuf8 dataComplete;
|
|
682 |
CleanupClosePushL(dataComplete);
|
|
683 |
|
|
684 |
//-------------------------------------------------------------------------
|
|
685 |
// TEST A: failure to dispatch request to LTSY
|
|
686 |
//-------------------------------------------------------------------------
|
|
687 |
RMobilePhone::TMobilePhoneLock currentLock = RMobilePhone::ELockICC;
|
|
688 |
TMockLtsyData1<RMobilePhone::TMobilePhoneLock> phoneLockType(currentLock);
|
|
689 |
phoneLockType.SerialiseL(dataExpect);
|
|
690 |
|
|
691 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityGetLockInfo::KLtsyDispatchSecurityGetLockInfoApiId, dataExpect, KErrNotSupported);
|
|
692 |
|
|
693 |
TRequestStatus reqStatus;
|
|
694 |
RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
|
|
695 |
RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPckg(lockInfo);
|
|
696 |
iPhone.GetLockInfo(reqStatus, currentLock, lockInfoPckg);
|
|
697 |
User::WaitForRequest(reqStatus);
|
|
698 |
AssertMockLtsyStatusL();
|
|
699 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
700 |
|
|
701 |
//-------------------------------------------------------------------------
|
|
702 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
703 |
//-------------------------------------------------------------------------
|
|
704 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityGetLockInfo::KLtsyDispatchSecurityGetLockInfoApiId, dataExpect);
|
|
705 |
|
|
706 |
RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled;
|
|
707 |
RMobilePhone::TMobilePhoneLockStatus lockStatus = RMobilePhone::EStatusLocked;
|
|
708 |
|
|
709 |
TMockLtsyData2<RMobilePhone::TMobilePhoneLockStatus, RMobilePhone::TMobilePhoneLockSetting> phoneLockData(lockStatus, lockSetting);
|
|
710 |
phoneLockData.SerialiseL(dataComplete);
|
|
711 |
|
|
712 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityGetLockInfo::KLtsyDispatchSecurityGetLockInfoApiId, KErrGeneral , dataComplete);
|
|
713 |
iPhone.GetLockInfo(reqStatus, currentLock, lockInfoPckg);
|
|
714 |
User::WaitForRequest(reqStatus);
|
|
715 |
AssertMockLtsyStatusL();
|
|
716 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
717 |
|
|
718 |
//-------------------------------------------------------------------------
|
|
719 |
// TEST C: Successful completion request of
|
|
720 |
// RMobilePhone::GetLockInfo when result is not cached.
|
|
721 |
//-------------------------------------------------------------------------
|
|
722 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityGetLockInfo::KLtsyDispatchSecurityGetLockInfoApiId, dataExpect);
|
|
723 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityGetLockInfo::KLtsyDispatchSecurityGetLockInfoApiId, KErrNone, dataComplete);
|
|
724 |
|
|
725 |
iPhone.GetLockInfo(reqStatus, currentLock, lockInfoPckg);
|
|
726 |
User::WaitForRequest(reqStatus);
|
|
727 |
|
|
728 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
729 |
ASSERT_EQUALS(lockInfo.iSetting, lockSetting);
|
|
730 |
ASSERT_EQUALS(lockInfo.iStatus, lockStatus);
|
|
731 |
AssertMockLtsyStatusL();
|
|
732 |
|
|
733 |
//-------------------------------------------------------------------------
|
|
734 |
// TEST E:
|
|
735 |
//-------------------------------------------------------------------------
|
|
736 |
TRequestStatus mockLtsyStatus;
|
|
737 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
738 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityGetLockInfo::KLtsyDispatchSecurityGetLockInfoApiId, KErrNone, dataComplete);
|
|
739 |
User::WaitForRequest(mockLtsyStatus);
|
|
740 |
AssertMockLtsyStatusL();
|
|
741 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
742 |
|
|
743 |
CleanupStack::PopAndDestroy(3); // dataComplete, dataExpect, this
|
|
744 |
}
|
|
745 |
|
|
746 |
/**
|
|
747 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0005
|
|
748 |
@SYMComponent telephony_ctsy
|
|
749 |
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetSecurityCodeInfo()
|
|
750 |
@SYMTestPriority High
|
|
751 |
@SYMTestActions Invokes RMobilePhone::GetSecurityCodeInfo()
|
|
752 |
@SYMTestExpectedResults Pass
|
|
753 |
@SYMTestType UT
|
|
754 |
*/
|
|
755 |
void CCTsySecurityFU::TestUnit0005L()
|
|
756 |
{
|
|
757 |
OpenEtelServerL(EUseExtendedError);
|
|
758 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
759 |
OpenPhoneL();
|
|
760 |
|
|
761 |
RBuf8 data;
|
|
762 |
CleanupClosePushL(data);
|
|
763 |
|
|
764 |
RBuf8 dataExpect;
|
|
765 |
CleanupClosePushL(dataExpect);
|
|
766 |
|
|
767 |
TRequestStatus reqStatus;
|
|
768 |
RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
|
|
769 |
TInt remainingEntryAttempts = 4;
|
|
770 |
RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeV5;
|
|
771 |
TPckg<RMobilePhone::TMobilePhoneSecurityCodeInfoV5> pckgData(codeV5);
|
|
772 |
|
|
773 |
TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> codeData(secCode);
|
|
774 |
codeData.SerialiseL(dataExpect);
|
|
775 |
|
|
776 |
TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, TInt> codeInfoData(secCode, remainingEntryAttempts);
|
|
777 |
codeInfoData.SerialiseL(data);
|
|
778 |
|
|
779 |
//-------------------------------------------------------------------------
|
|
780 |
// TEST A: failure to dispatch request to LTSY
|
|
781 |
//-------------------------------------------------------------------------
|
|
782 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityGetSecurityCodeInfo::KLtsyDispatchSecurityGetSecurityCodeInfoApiId, dataExpect, KErrNotSupported);
|
|
783 |
iPhone.GetSecurityCodeInfo(reqStatus, secCode, pckgData);
|
|
784 |
User::WaitForRequest(reqStatus);
|
|
785 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
|
|
786 |
AssertMockLtsyStatusL();
|
|
787 |
|
|
788 |
//-------------------------------------------------------------------------
|
|
789 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
790 |
//-------------------------------------------------------------------------
|
|
791 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityGetSecurityCodeInfo::KLtsyDispatchSecurityGetSecurityCodeInfoApiId, dataExpect);
|
|
792 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityGetSecurityCodeInfo::KLtsyDispatchSecurityGetSecurityCodeInfoApiId, KErrGeneral, data);
|
|
793 |
iPhone.GetSecurityCodeInfo(reqStatus, secCode, pckgData);
|
|
794 |
User::WaitForRequest(reqStatus);
|
|
795 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int())
|
|
796 |
AssertMockLtsyStatusL();
|
|
797 |
|
|
798 |
//-------------------------------------------------------------------------
|
|
799 |
// TEST C: Successful completion request of
|
|
800 |
// RMobilePhone::GetSecurityCodeInfo when result is not cached.
|
|
801 |
//-------------------------------------------------------------------------
|
|
802 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityGetSecurityCodeInfo::KLtsyDispatchSecurityGetSecurityCodeInfoApiId, dataExpect);
|
|
803 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityGetSecurityCodeInfo::KLtsyDispatchSecurityGetSecurityCodeInfoApiId, KErrNone, data);
|
|
804 |
iPhone.GetSecurityCodeInfo(reqStatus, secCode, pckgData);
|
|
805 |
User::WaitForRequest(reqStatus);
|
|
806 |
ASSERT_EQUALS(KErrNone, reqStatus.Int())
|
|
807 |
ASSERT_EQUALS(remainingEntryAttempts, pckgData().iRemainingEntryAttempts)
|
|
808 |
AssertMockLtsyStatusL();
|
|
809 |
|
|
810 |
//-------------------------------------------------------------------------
|
|
811 |
// TEST E: Unsolicited completion of RMobilePhone::GetSecurityCodeInfo
|
|
812 |
// from LTSY.
|
|
813 |
//-------------------------------------------------------------------------
|
|
814 |
TRequestStatus mockLtsyStatus;
|
|
815 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
816 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityGetSecurityCodeInfo::KLtsyDispatchSecurityGetSecurityCodeInfoApiId, KErrNone, data);
|
|
817 |
User::WaitForRequest(mockLtsyStatus);
|
|
818 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int())
|
|
819 |
|
|
820 |
AssertMockLtsyStatusL();
|
|
821 |
CleanupStack::PopAndDestroy(3, this); // dataExpect, data, this
|
|
822 |
|
|
823 |
}
|
|
824 |
|
|
825 |
/**
|
|
826 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0006
|
|
827 |
@SYMComponent telephony_ctsy
|
|
828 |
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifyLockInfoChange()
|
|
829 |
@SYMTestPriority High
|
|
830 |
@SYMTestActions Invokes RMobilePhone::NotifyLockInfoChange()
|
|
831 |
@SYMTestExpectedResults Pass
|
|
832 |
@SYMTestType UT
|
|
833 |
*/
|
|
834 |
void CCTsySecurityFU::TestUnit0006L()
|
|
835 |
{
|
|
836 |
OpenEtelServerL(EUseExtendedError);
|
|
837 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
838 |
OpenPhoneL();
|
|
839 |
|
|
840 |
RBuf8 data;
|
|
841 |
CleanupClosePushL(data);
|
|
842 |
|
|
843 |
TRequestStatus reqStatus;
|
|
844 |
RMobilePhone::TMobilePhoneLock lock = RMobilePhone::ELockPhoneDevice;
|
|
845 |
RMobilePhone::TMobilePhoneLockInfoV1 lockInfoV1;
|
|
846 |
lockInfoV1.iSetting = RMobilePhone::ELockSetEnabled;
|
|
847 |
lockInfoV1.iStatus = RMobilePhone::EStatusLocked;
|
|
848 |
|
|
849 |
RMobilePhone::TMobilePhoneLockInfoV1Pckg pckgData(lockInfoV1);
|
|
850 |
|
|
851 |
TMockLtsyData3<RMobilePhone::TMobilePhoneLockStatus, RMobilePhone::TMobilePhoneLockSetting,
|
|
852 |
RMobilePhone::TMobilePhoneLock> lockInfoData(lockInfoV1.iStatus, lockInfoV1.iSetting, lock);
|
|
853 |
lockInfoData.SerialiseL(data);
|
|
854 |
|
|
855 |
//-------------------------------------------------------------------------
|
|
856 |
// TEST C: Successful completion request of
|
|
857 |
// RMobilePhone::NotifyLockInfoChange when result is not cached.
|
|
858 |
//-------------------------------------------------------------------------
|
|
859 |
iPhone.NotifyLockInfoChange(reqStatus, lock, pckgData);
|
|
860 |
iMockLTSY.CompleteL(KMockLtsyDispatchSecurityNotifyLockInfoChangeIndId, KErrNone, data);
|
|
861 |
User::WaitForRequest(reqStatus);
|
|
862 |
ASSERT_EQUALS(KErrNone, reqStatus.Int())
|
|
863 |
ASSERT_EQUALS(lockInfoV1.iSetting,pckgData().iSetting)
|
|
864 |
ASSERT_EQUALS(lockInfoV1.iStatus,pckgData().iStatus)
|
|
865 |
AssertMockLtsyStatusL();
|
|
866 |
|
|
867 |
CleanupStack::PopAndDestroy(2, this); // data, this
|
|
868 |
}
|
|
869 |
|
|
870 |
/**
|
|
871 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0007
|
|
872 |
@SYMComponent telephony_ctsy
|
|
873 |
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifySecurityEvent()
|
|
874 |
@SYMTestPriority High
|
|
875 |
@SYMTestActions Invokes RMobilePhone::NotifySecurityEvent()
|
|
876 |
@SYMTestExpectedResults Pass
|
|
877 |
@SYMTestType UT
|
|
878 |
*/
|
|
879 |
void CCTsySecurityFU::TestUnit0007L()
|
|
880 |
{
|
|
881 |
OpenEtelServerL(EUseExtendedError);
|
|
882 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
883 |
OpenPhoneL();
|
|
884 |
|
|
885 |
RBuf8 data;
|
|
886 |
CleanupClosePushL(data);
|
|
887 |
|
|
888 |
TRequestStatus mockLtsyStatus;
|
|
889 |
|
|
890 |
TRequestStatus reqStatus;
|
|
891 |
RMobilePhone::TMobilePhoneSecurityEvent secEventRes;
|
|
892 |
RMobilePhone::TMobilePhoneSecurityEvent secEvent = RMobilePhone::EPhonePasswordRequired;
|
|
893 |
|
|
894 |
TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityEvent> eventData(secEvent);
|
|
895 |
eventData.SerialiseL(data);
|
|
896 |
|
|
897 |
//-------------------------------------------------------------------------
|
|
898 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
899 |
//-------------------------------------------------------------------------
|
|
900 |
iMockLTSY.ExpectL(MLtsyDispatchSimGetActiveIccApplicationType::KLtsyDispatchSimGetActiveIccApplicationTypeApiId);
|
|
901 |
iPhone.NotifySecurityEvent(reqStatus, secEventRes);
|
|
902 |
iMockLTSY.CompleteL(KMockLtsyDispatchSecurityNotifySecurityEventIndId, KErrGeneral, data);
|
|
903 |
User::WaitForRequest(reqStatus);
|
|
904 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int())
|
|
905 |
AssertMockLtsyStatusL();
|
|
906 |
|
|
907 |
//-------------------------------------------------------------------------
|
|
908 |
// TEST C: Successful completion request of
|
|
909 |
// RMobilePhone::NotifySecurityEvent when result is not cached.
|
|
910 |
//-------------------------------------------------------------------------
|
|
911 |
iPhone.NotifySecurityEvent(reqStatus, secEventRes);
|
|
912 |
iMockLTSY.CompleteL(KMockLtsyDispatchSecurityNotifySecurityEventIndId, KErrNone, data);
|
|
913 |
User::WaitForRequest(reqStatus);
|
|
914 |
ASSERT_EQUALS(KErrNone, reqStatus.Int())
|
|
915 |
ASSERT_EQUALS(secEvent, secEventRes)
|
|
916 |
AssertMockLtsyStatusL();
|
|
917 |
|
|
918 |
|
|
919 |
//-------------------------------------------------------------------------
|
|
920 |
// TEST E: Unsolicited completion of RMobilePhone::NotifySecurityEvent
|
|
921 |
// from LTSY.
|
|
922 |
//-------------------------------------------------------------------------
|
|
923 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
924 |
iMockLTSY.CompleteL(KMockLtsyDispatchSecurityNotifySecurityEventIndId, KErrNone, data);
|
|
925 |
User::WaitForRequest(mockLtsyStatus);
|
|
926 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int())
|
|
927 |
AssertMockLtsyStatusL();
|
|
928 |
|
|
929 |
//-------------------------------------------------------------------------
|
|
930 |
// TEST D: RMobilePhone::NotifySecurityEvent again, this time CTSY
|
|
931 |
// will get result from the cache.
|
|
932 |
//-------------------------------------------------------------------------
|
|
933 |
secEventRes = RMobilePhone::EPhonePasswordVerified; //change the value to make shure that NotifySecurityEvent will write the correct value to secEventRes.
|
|
934 |
iPhone.NotifySecurityEvent(reqStatus, secEventRes);
|
|
935 |
User::WaitForRequest(reqStatus);
|
|
936 |
ASSERT_EQUALS(KErrNone, reqStatus.Int())
|
|
937 |
ASSERT_EQUALS(secEvent, secEventRes)
|
|
938 |
|
|
939 |
AssertMockLtsyStatusL();
|
|
940 |
CleanupStack::PopAndDestroy(2, this); // data, this
|
|
941 |
}
|
|
942 |
|
|
943 |
/**
|
|
944 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0008
|
|
945 |
@SYMComponent telephony_ctsy
|
|
946 |
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetLockSetting()
|
|
947 |
@SYMTestPriority High
|
|
948 |
@SYMTestActions Invokes RMobilePhone::SetLockSetting()
|
|
949 |
@SYMTestExpectedResults Pass
|
|
950 |
@SYMTestType UT
|
|
951 |
*/
|
|
952 |
void CCTsySecurityFU::TestUnit0008L()
|
|
953 |
{
|
|
954 |
OpenEtelServerL(EUseExtendedError);
|
|
955 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
956 |
OpenPhoneL();
|
|
957 |
|
|
958 |
RBuf8 data;
|
|
959 |
CleanupClosePushL(data);
|
|
960 |
|
|
961 |
TRequestStatus status;
|
|
962 |
|
|
963 |
RMobilePhone::TMobilePhoneLock lockB = RMobilePhone::ELockPhoneDevice;
|
|
964 |
RMobilePhone::TMobilePhoneLockSetting lockSettingB = RMobilePhone::ELockSetEnabled;
|
|
965 |
|
|
966 |
//-------------------------------------------------------------------------
|
|
967 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
968 |
//-------------------------------------------------------------------------
|
|
969 |
iPhone.SetLockSetting(status, lockB, lockSettingB);
|
|
970 |
iMockLTSY.CompleteL(MLtsyDispatchSecuritySetLockSetting::KLtsyDispatchSecuritySetLockSettingApiId, KErrGeneral);
|
|
971 |
User::WaitForRequest(status);
|
|
972 |
ASSERT_EQUALS(KErrGeneral, status.Int());
|
|
973 |
AssertMockLtsyStatusL();
|
|
974 |
|
|
975 |
//-------------------------------------------------------------------------
|
|
976 |
// TEST E: Unsolicited completion of RMobilePhone::SetLockSetting
|
|
977 |
// from LTSY.
|
|
978 |
//-------------------------------------------------------------------------
|
|
979 |
TRequestStatus mockLtsyStatus;
|
|
980 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
981 |
iMockLTSY.CompleteL(MLtsyDispatchSecuritySetLockSetting::KLtsyDispatchSecuritySetLockSettingApiId, KErrNone);
|
|
982 |
User::WaitForRequest(mockLtsyStatus);
|
|
983 |
AssertMockLtsyStatusL();
|
|
984 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
985 |
|
|
986 |
//-------------------------------------------------------------------------
|
|
987 |
// TEST C: Successful completion request of
|
|
988 |
// RMobilePhone::SetLockSetting when result is not cached.
|
|
989 |
//-------------------------------------------------------------------------
|
|
990 |
// data for ExpectL
|
|
991 |
|
|
992 |
|
|
993 |
RMobilePhone::TMobilePhoneLock lock = RMobilePhone::ELockHiddenKey;//ELockUSimApp;
|
|
994 |
RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled;
|
|
995 |
TDesC* passwordPtr = const_cast<TDesC*>(&KNullDesC);
|
|
996 |
|
|
997 |
TMockLtsyData3<RMobilePhone::TMobilePhoneLock,RMobilePhone::TMobilePhoneLockSetting,TDesC*> phoneLockData(lock,lockSetting,passwordPtr);
|
|
998 |
phoneLockData.SerialiseL(data);
|
|
999 |
|
|
1000 |
iMockLTSY.ExpectL(MLtsyDispatchSecuritySetLockSetting::KLtsyDispatchSecuritySetLockSettingApiId, data);
|
|
1001 |
iMockLTSY.CompleteL(MLtsyDispatchSecuritySetLockSetting::KLtsyDispatchSecuritySetLockSettingApiId, KErrNone);
|
|
1002 |
|
|
1003 |
iPhone.SetLockSetting(status, lock, lockSetting);
|
|
1004 |
User::WaitForRequest(status);
|
|
1005 |
AssertMockLtsyStatusL();
|
|
1006 |
ASSERT_EQUALS(KErrNone, status.Int());
|
|
1007 |
|
|
1008 |
CleanupStack::PopAndDestroy(2, this); // data, this
|
|
1009 |
}
|
|
1010 |
|
|
1011 |
/**
|
|
1012 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0009
|
|
1013 |
@SYMComponent telephony_ctsy
|
|
1014 |
@SYMTestCaseDesc Test support in CTSY for SetActivePin()
|
|
1015 |
@SYMTestPriority High
|
|
1016 |
@SYMTestActions Invokes SetActivePin()
|
|
1017 |
@SYMTestExpectedResults Pass
|
|
1018 |
@SYMTestType UT
|
|
1019 |
*/
|
|
1020 |
void CCTsySecurityFU::TestUnit0009L()
|
|
1021 |
{
|
|
1022 |
OpenEtelServerL(EUseExtendedError);
|
|
1023 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
1024 |
OpenPhoneL();
|
|
1025 |
|
|
1026 |
RMmCustomAPI customAPI;
|
|
1027 |
OpenCustomApiLC(customAPI);
|
|
1028 |
|
|
1029 |
RBuf8 data;
|
|
1030 |
CleanupClosePushL(data);
|
|
1031 |
|
|
1032 |
TRequestStatus mockLtsyStatus;
|
|
1033 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
1034 |
|
|
1035 |
MLtsyDispatchSimGetActiveIccApplicationType::TIccType type = MLtsyDispatchSimGetActiveIccApplicationType::EIccTypeSim3G;
|
|
1036 |
|
|
1037 |
TMockLtsyData1<MLtsyDispatchSimGetActiveIccApplicationType::TIccType> iccData(type);
|
|
1038 |
data.Close();
|
|
1039 |
iccData.SerialiseL(data);
|
|
1040 |
iMockLTSY.CompleteL(MLtsyDispatchSimGetActiveIccApplicationType::KLtsyDispatchSimGetActiveIccApplicationTypeApiId, KErrNone, data);
|
|
1041 |
|
|
1042 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityGetCurrentActivePin::KLtsyDispatchSecurityGetCurrentActivePinApiId);
|
|
1043 |
|
|
1044 |
RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePin1;
|
|
1045 |
TMockLtsyData1<RMobilePhone::TMobilePhoneSecurityCode> secCodeData(secCode);
|
|
1046 |
data.Close();
|
|
1047 |
secCodeData.SerialiseL(data);
|
|
1048 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityGetCurrentActivePin::KLtsyDispatchSecurityGetCurrentActivePinApiId, KErrNone, data);
|
|
1049 |
|
|
1050 |
// Wait for completion of iMockLTSY.NotifyTerminated
|
|
1051 |
User::WaitForRequest(mockLtsyStatus);
|
|
1052 |
|
|
1053 |
// verify currently active PIN:
|
|
1054 |
RMobilePhone::TMobilePhoneSecurityCode code;
|
|
1055 |
customAPI.GetActivePin(code);
|
|
1056 |
ASSERT_EQUALS(RMobilePhone::ESecurityCodePin1, code);
|
|
1057 |
|
|
1058 |
AssertMockLtsyStatusL();
|
|
1059 |
|
|
1060 |
CleanupStack::PopAndDestroy(3, this); // data, customAPI, this
|
|
1061 |
}
|
|
1062 |
|
|
1063 |
/**
|
|
1064 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0010
|
|
1065 |
@SYMComponent telephony_ctsy
|
|
1066 |
@SYMTestCaseDesc Test support in CTSY for RMmCustomAPI::CheckSecurityCode()
|
|
1067 |
@SYMTestPriority High
|
|
1068 |
@SYMTestActions Invokes RMmCustomAPI::CheckSecurityCode()
|
|
1069 |
@SYMTestExpectedResults Pass
|
|
1070 |
@SYMTestType UT
|
|
1071 |
*/
|
|
1072 |
void CCTsySecurityFU::TestUnit0010L()
|
|
1073 |
{
|
|
1074 |
OpenEtelServerL(EUseExtendedError);
|
|
1075 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
1076 |
OpenPhoneL();
|
|
1077 |
|
|
1078 |
RMmCustomAPI customAPI;
|
|
1079 |
OpenCustomApiLC(customAPI);
|
|
1080 |
|
|
1081 |
RBuf8 data;
|
|
1082 |
CleanupClosePushL(data);
|
|
1083 |
|
|
1084 |
RBuf8 data2;
|
|
1085 |
CleanupClosePushL(data2);
|
|
1086 |
|
|
1087 |
TRequestStatus requestStatus;
|
|
1088 |
RMmCustomAPI::TSecurityCodeType type(RMmCustomAPI::ESecurityCodePin1);
|
|
1089 |
DispatcherSecurity::TSecurityCodeId secCodeID = DispatcherSecurity::ESecCodePin;
|
|
1090 |
RMobilePhone::TMobilePassword secCode;
|
|
1091 |
|
|
1092 |
//-------------------------------------------------------------------------
|
|
1093 |
// TEST A: failure to dispatch request to LTSY
|
|
1094 |
//-------------------------------------------------------------------------
|
|
1095 |
|
|
1096 |
TMockLtsyData2 <DispatcherSecurity::TSecurityCodeId, RMobilePhone::TMobilePassword> ltsyData(secCodeID, secCode);
|
|
1097 |
ltsyData.SerialiseL(data);
|
|
1098 |
|
|
1099 |
iMockLTSY.ExpectL( MLtsyDispatchSecurityCheckSecurityCode::KLtsyDispatchSecurityCheckSecurityCodeApiId, data, KErrNotSupported);
|
|
1100 |
|
|
1101 |
customAPI.CheckSecurityCode(requestStatus, type);
|
|
1102 |
|
|
1103 |
User::WaitForRequest(requestStatus);
|
|
1104 |
ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
|
|
1105 |
|
|
1106 |
AssertMockLtsyStatusL();
|
|
1107 |
|
|
1108 |
//-------------------------------------------------------------------------
|
|
1109 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
1110 |
//-------------------------------------------------------------------------
|
|
1111 |
|
|
1112 |
iMockLTSY.ExpectL( MLtsyDispatchSecurityCheckSecurityCode::KLtsyDispatchSecurityCheckSecurityCodeApiId, data);
|
|
1113 |
iMockLTSY.CompleteL( MLtsyDispatchSecurityCheckSecurityCode::KLtsyDispatchSecurityCheckSecurityCodeApiId, KErrGeneral);
|
|
1114 |
|
|
1115 |
TMockLtsyData1 <DispatcherSecurity::TSecurityCodeId > ltsyData2(secCodeID);
|
|
1116 |
ltsyData2.SerialiseL(data2);
|
|
1117 |
|
|
1118 |
// this is because HandleRequest(ECustomCheckSecurityCodeCancelIPC) is called when completing by error
|
|
1119 |
iMockLTSY.ExpectL( MLtsyDispatchSecurityCheckSecurityCodeCancel::KLtsyDispatchSecurityCheckSecurityCodeCancelApiId, data2);
|
|
1120 |
|
|
1121 |
customAPI.CheckSecurityCode(requestStatus, type);
|
|
1122 |
|
|
1123 |
User::WaitForRequest(requestStatus);
|
|
1124 |
ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
|
|
1125 |
|
|
1126 |
AssertMockLtsyStatusL();
|
|
1127 |
|
|
1128 |
//-------------------------------------------------------------------------
|
|
1129 |
// TEST C: Successful completion request of
|
|
1130 |
// RMmCustomAPI::CheckSecurityCode when result is not cached.
|
|
1131 |
//-------------------------------------------------------------------------
|
|
1132 |
|
|
1133 |
iMockLTSY.ExpectL( MLtsyDispatchSecurityCheckSecurityCode::KLtsyDispatchSecurityCheckSecurityCodeApiId, data);
|
|
1134 |
iMockLTSY.CompleteL( MLtsyDispatchSecurityCheckSecurityCode::KLtsyDispatchSecurityCheckSecurityCodeApiId, KErrNone);
|
|
1135 |
|
|
1136 |
customAPI.CheckSecurityCode(requestStatus, type);
|
|
1137 |
|
|
1138 |
User::WaitForRequest(requestStatus);
|
|
1139 |
ASSERT_EQUALS(KErrNone, requestStatus.Int());
|
|
1140 |
|
|
1141 |
AssertMockLtsyStatusL();
|
|
1142 |
|
|
1143 |
//-------------------------------------------------------------------------
|
|
1144 |
// TEST E: Unsolicited completion of RMmCustomAPI::CheckSecurityCode
|
|
1145 |
// from LTSY.
|
|
1146 |
//-------------------------------------------------------------------------
|
|
1147 |
|
|
1148 |
TRequestStatus mockLtsyStatus;
|
|
1149 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
1150 |
|
|
1151 |
iMockLTSY.CompleteL( MLtsyDispatchSecurityCheckSecurityCode::KLtsyDispatchSecurityCheckSecurityCodeApiId, KErrNone);
|
|
1152 |
|
|
1153 |
User::WaitForRequest(mockLtsyStatus);
|
|
1154 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
1155 |
|
|
1156 |
AssertMockLtsyStatusL();
|
|
1157 |
|
|
1158 |
CleanupStack::PopAndDestroy(4, this); // data2, data, customAPI, this
|
|
1159 |
}
|
|
1160 |
|
|
1161 |
/**
|
|
1162 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0011
|
|
1163 |
@SYMComponent telephony_ctsy
|
|
1164 |
@SYMTestCaseDesc Test support in CTSY for RMmCustomAPI::DisablePhoneLock()
|
|
1165 |
@SYMTestPriority High
|
|
1166 |
@SYMTestActions Invokes RMmCustomAPI::DisablePhoneLock()
|
|
1167 |
@SYMTestExpectedResults Pass
|
|
1168 |
@SYMTestType UT
|
|
1169 |
*/
|
|
1170 |
void CCTsySecurityFU::TestUnit0011L()
|
|
1171 |
{
|
|
1172 |
OpenEtelServerL(EUseExtendedError);
|
|
1173 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
1174 |
OpenPhoneL();
|
|
1175 |
|
|
1176 |
RMmCustomAPI customAPI;
|
|
1177 |
OpenCustomApiLC(customAPI);
|
|
1178 |
|
|
1179 |
_LIT(KPassword, "password");
|
|
1180 |
|
|
1181 |
TRequestStatus requestStatus;
|
|
1182 |
RMobilePhone::TMobilePassword pswd(KPassword);
|
|
1183 |
|
|
1184 |
RBuf8 expectData;
|
|
1185 |
CleanupClosePushL(expectData);
|
|
1186 |
|
|
1187 |
TMockLtsyData1< RMobilePhone::TMobilePassword > ltsyData(pswd);
|
|
1188 |
ltsyData.SerialiseL(expectData);
|
|
1189 |
|
|
1190 |
//-------------------------------------------------------------------------
|
|
1191 |
// TEST A: failure to dispatch request to LTSY
|
|
1192 |
//-------------------------------------------------------------------------
|
|
1193 |
|
|
1194 |
iMockLTSY.ExpectL( MLtsyDispatchSecurityDisablePhoneLock::KLtsyDispatchSecurityDisablePhoneLockApiId, expectData, KErrNotSupported);
|
|
1195 |
|
|
1196 |
customAPI.DisablePhoneLock(requestStatus, pswd);
|
|
1197 |
|
|
1198 |
User::WaitForRequest(requestStatus);
|
|
1199 |
ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
|
|
1200 |
|
|
1201 |
AssertMockLtsyStatusL();
|
|
1202 |
|
|
1203 |
//-------------------------------------------------------------------------
|
|
1204 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
1205 |
//-------------------------------------------------------------------------
|
|
1206 |
|
|
1207 |
iMockLTSY.ExpectL( MLtsyDispatchSecurityDisablePhoneLock::KLtsyDispatchSecurityDisablePhoneLockApiId, expectData);
|
|
1208 |
iMockLTSY.CompleteL( MLtsyDispatchSecurityDisablePhoneLock::KLtsyDispatchSecurityDisablePhoneLockApiId, KErrGeneral);
|
|
1209 |
|
|
1210 |
customAPI.DisablePhoneLock(requestStatus, pswd);
|
|
1211 |
|
|
1212 |
User::WaitForRequest(requestStatus);
|
|
1213 |
ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
|
|
1214 |
|
|
1215 |
AssertMockLtsyStatusL();
|
|
1216 |
|
|
1217 |
//-------------------------------------------------------------------------
|
|
1218 |
// TEST C: Successful completion request of
|
|
1219 |
// RMmCustomAPI::DisablePhoneLock when result is not cached.
|
|
1220 |
//-------------------------------------------------------------------------
|
|
1221 |
|
|
1222 |
iMockLTSY.ExpectL( MLtsyDispatchSecurityDisablePhoneLock::KLtsyDispatchSecurityDisablePhoneLockApiId, expectData);
|
|
1223 |
iMockLTSY.CompleteL( MLtsyDispatchSecurityDisablePhoneLock::KLtsyDispatchSecurityDisablePhoneLockApiId, KErrNone);
|
|
1224 |
|
|
1225 |
customAPI.DisablePhoneLock(requestStatus, pswd);
|
|
1226 |
|
|
1227 |
User::WaitForRequest(requestStatus);
|
|
1228 |
ASSERT_EQUALS(KErrNone, requestStatus.Int());
|
|
1229 |
|
|
1230 |
AssertMockLtsyStatusL();
|
|
1231 |
|
|
1232 |
//-------------------------------------------------------------------------
|
|
1233 |
// TEST E: Unsolicited completion of RMmCustomAPI::DisablePhoneLock
|
|
1234 |
// from LTSY.
|
|
1235 |
//-------------------------------------------------------------------------
|
|
1236 |
|
|
1237 |
TRequestStatus mockLtsyStatus;
|
|
1238 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
1239 |
|
|
1240 |
iMockLTSY.CompleteL( MLtsyDispatchSecurityDisablePhoneLock::KLtsyDispatchSecurityDisablePhoneLockApiId, KErrNone);
|
|
1241 |
|
|
1242 |
User::WaitForRequest(mockLtsyStatus);
|
|
1243 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
1244 |
|
|
1245 |
AssertMockLtsyStatusL();
|
|
1246 |
CleanupStack::PopAndDestroy(3, this); // expectData, customAPI, this
|
|
1247 |
}
|
|
1248 |
|
|
1249 |
/**
|
|
1250 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0012
|
|
1251 |
@SYMComponent telephony_ctsy
|
|
1252 |
@SYMTestCaseDesc Test support in CTSY for RMmCustomAPI::NotifyCipheringInfoChange()
|
|
1253 |
@SYMTestPriority High
|
|
1254 |
@SYMTestActions Invokes RMmCustomAPI::NotifyCipheringInfoChange()
|
|
1255 |
@SYMTestExpectedResults Pass
|
|
1256 |
@SYMTestType UT
|
|
1257 |
*/
|
|
1258 |
void CCTsySecurityFU::TestUnit0012L()
|
|
1259 |
{
|
|
1260 |
OpenEtelServerL(EUseExtendedError);
|
|
1261 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
1262 |
OpenPhoneL();
|
|
1263 |
|
|
1264 |
RMmCustomAPI customAPI;
|
|
1265 |
OpenCustomApiLC(customAPI);
|
|
1266 |
|
|
1267 |
RBuf8 completeData;
|
|
1268 |
CleanupClosePushL(completeData);
|
|
1269 |
|
|
1270 |
TRequestStatus requestStatus;
|
|
1271 |
TRequestStatus mockLtsyStatus;
|
|
1272 |
|
|
1273 |
RMmCustomAPI::TCipheringInfo info;
|
|
1274 |
RMmCustomAPI::TCipheringInfo completeInfo;
|
|
1275 |
completeInfo.iIndStatus = ETrue;
|
|
1276 |
completeInfo.iCiphStatus = ETrue;
|
|
1277 |
|
|
1278 |
TMockLtsyData1<RMmCustomAPI::TCipheringInfo > ltsyData(completeInfo);
|
|
1279 |
ltsyData.SerialiseL(completeData);
|
|
1280 |
|
|
1281 |
//-------------------------------------------------------------------------
|
|
1282 |
// TEST C: Successful completion request of
|
|
1283 |
// RMmCustomAPI::NotifyCipheringInfoChange when result is not cached.
|
|
1284 |
//-------------------------------------------------------------------------
|
|
1285 |
customAPI.NotifyCipheringInfoChange(requestStatus, info);
|
|
1286 |
iMockLTSY.CompleteL(KLtsyDispatchSecurityNotifyCipheringInfoChangeApiId, KErrNone, completeData);
|
|
1287 |
User::WaitForRequest(requestStatus);
|
|
1288 |
AssertMockLtsyStatusL();
|
|
1289 |
ASSERT_EQUALS(KErrNone, requestStatus.Int());
|
|
1290 |
|
|
1291 |
ASSERT_EQUALS(completeInfo.iIndStatus, info.iIndStatus);
|
|
1292 |
ASSERT_EQUALS(completeInfo.iCiphStatus, info.iCiphStatus);
|
|
1293 |
|
|
1294 |
//-------------------------------------------------------------------------
|
|
1295 |
// TEST E: Unsolicited completion of RMmCustomAPI::NotifyCipheringInfoChange
|
|
1296 |
// from LTSY.
|
|
1297 |
//-------------------------------------------------------------------------
|
|
1298 |
|
|
1299 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
1300 |
iMockLTSY.CompleteL(KLtsyDispatchSecurityNotifyCipheringInfoChangeApiId, KErrNone, completeData);
|
|
1301 |
User::WaitForRequest(mockLtsyStatus);
|
|
1302 |
AssertMockLtsyStatusL();
|
|
1303 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
1304 |
|
|
1305 |
CleanupStack::PopAndDestroy(3, this); // completeData, customAPI, this
|
|
1306 |
}
|
|
1307 |
|
|
1308 |
/**
|
|
1309 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0013
|
|
1310 |
@SYMComponent telephony_ctsy
|
|
1311 |
@SYMTestCaseDesc Test support in CTSY for RMmCustomAPI::GetCipheringInfo()
|
|
1312 |
@SYMTestPriority High
|
|
1313 |
@SYMTestActions Invokes RMmCustomAPI::GetCipheringInfo()
|
|
1314 |
@SYMTestExpectedResults Pass
|
|
1315 |
@SYMTestType UT
|
|
1316 |
*/
|
|
1317 |
void CCTsySecurityFU::TestUnit0013L()
|
|
1318 |
{
|
|
1319 |
OpenEtelServerL(EUseExtendedError);
|
|
1320 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
1321 |
OpenPhoneL();
|
|
1322 |
|
|
1323 |
RMmCustomAPI customAPI;
|
|
1324 |
OpenCustomApiLC(customAPI);
|
|
1325 |
|
|
1326 |
RBuf8 completeData;
|
|
1327 |
CleanupClosePushL(completeData);
|
|
1328 |
|
|
1329 |
RBuf8 completeData2;
|
|
1330 |
CleanupClosePushL(completeData2);
|
|
1331 |
|
|
1332 |
TRequestStatus requestStatus;
|
|
1333 |
TRequestStatus mockLtsyStatus;
|
|
1334 |
RMmCustomAPI::TCipheringInfo info;
|
|
1335 |
|
|
1336 |
TBool indReq(ETrue);
|
|
1337 |
TMockLtsyData1<TBool > ltsyData(indReq);
|
|
1338 |
ltsyData.SerialiseL(completeData);
|
|
1339 |
|
|
1340 |
//-------------------------------------------------------------------------
|
|
1341 |
// TEST A: failure to dispatch request to LTSY
|
|
1342 |
//-------------------------------------------------------------------------
|
|
1343 |
|
|
1344 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityGetCipheringInfo::KLtsyDispatchSecurityGetCipheringInfoApiId, KErrNotSupported);
|
|
1345 |
customAPI.GetCipheringInfo(requestStatus, info);
|
|
1346 |
|
|
1347 |
User::WaitForRequest(requestStatus);
|
|
1348 |
AssertMockLtsyStatusL();
|
|
1349 |
ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
|
|
1350 |
|
|
1351 |
//-------------------------------------------------------------------------
|
|
1352 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
1353 |
//-------------------------------------------------------------------------
|
|
1354 |
|
|
1355 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityGetCipheringInfo::KLtsyDispatchSecurityGetCipheringInfoApiId);
|
|
1356 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityGetCipheringInfo::KLtsyDispatchSecurityGetCipheringInfoApiId, KErrGeneral, completeData);
|
|
1357 |
customAPI.GetCipheringInfo(requestStatus, info);
|
|
1358 |
|
|
1359 |
User::WaitForRequest(requestStatus);
|
|
1360 |
AssertMockLtsyStatusL();
|
|
1361 |
ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
|
|
1362 |
|
|
1363 |
//-------------------------------------------------------------------------
|
|
1364 |
// TEST C: Successful completion request of
|
|
1365 |
// RMmCustomAPI::GetCipheringInfo when result is not cached.
|
|
1366 |
//-------------------------------------------------------------------------
|
|
1367 |
|
|
1368 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
1369 |
RMmCustomAPI::TCipheringInfo ciphInfo;
|
|
1370 |
ciphInfo.iCiphStatus = ETrue;
|
|
1371 |
|
|
1372 |
TMockLtsyData1<RMmCustomAPI::TCipheringInfo > ltsyData2(ciphInfo);
|
|
1373 |
ltsyData2.SerialiseL(completeData2);
|
|
1374 |
|
|
1375 |
iMockLTSY.CompleteL(KLtsyDispatchSecurityNotifyCipheringInfoChangeApiId, KErrNone, completeData2);
|
|
1376 |
User::WaitForRequest(mockLtsyStatus);
|
|
1377 |
AssertMockLtsyStatusL();
|
|
1378 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
1379 |
|
|
1380 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityGetCipheringInfo::KLtsyDispatchSecurityGetCipheringInfoApiId);
|
|
1381 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityGetCipheringInfo::KLtsyDispatchSecurityGetCipheringInfoApiId, KErrNone, completeData);
|
|
1382 |
customAPI.GetCipheringInfo(requestStatus, info);
|
|
1383 |
|
|
1384 |
User::WaitForRequest(requestStatus);
|
|
1385 |
AssertMockLtsyStatusL();
|
|
1386 |
ASSERT_EQUALS(KErrNone, requestStatus.Int());
|
|
1387 |
|
|
1388 |
ASSERT_EQUALS(indReq, info.iIndStatus);
|
|
1389 |
ASSERT_EQUALS(ciphInfo.iCiphStatus, info.iCiphStatus);
|
|
1390 |
|
|
1391 |
//-------------------------------------------------------------------------
|
|
1392 |
// TEST E: Unsolicited completion of RMmCustomAPI::GetCipheringInfo
|
|
1393 |
// from LTSY.
|
|
1394 |
//-------------------------------------------------------------------------
|
|
1395 |
|
|
1396 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
1397 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityGetCipheringInfo::KLtsyDispatchSecurityGetCipheringInfoApiId, KErrNone, completeData);
|
|
1398 |
User::WaitForRequest(mockLtsyStatus);
|
|
1399 |
AssertMockLtsyStatusL();
|
|
1400 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
1401 |
|
|
1402 |
CleanupStack::PopAndDestroy(4, this); // completeData2, completeData, customAPI, this
|
|
1403 |
}
|
|
1404 |
|
|
1405 |
/**
|
|
1406 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0014
|
|
1407 |
@SYMComponent telephony_ctsy
|
|
1408 |
@SYMTestCaseDesc Test support in CTSY for RMmCustomAPI::IsBlocked()
|
|
1409 |
@SYMTestPriority High
|
|
1410 |
@SYMTestActions Invokes RMmCustomAPI::IsBlocked()
|
|
1411 |
@SYMTestExpectedResults Pass
|
|
1412 |
@SYMTestType UT
|
|
1413 |
*/
|
|
1414 |
void CCTsySecurityFU::TestUnit0014L()
|
|
1415 |
{
|
|
1416 |
OpenEtelServerL(EUseExtendedError);
|
|
1417 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
1418 |
OpenPhoneL();
|
|
1419 |
|
|
1420 |
RMmCustomAPI customAPI;
|
|
1421 |
OpenCustomApiLC(customAPI);
|
|
1422 |
|
|
1423 |
RBuf8 data;
|
|
1424 |
CleanupClosePushL(data);
|
|
1425 |
|
|
1426 |
RBuf8 completeData;
|
|
1427 |
CleanupClosePushL(completeData);
|
|
1428 |
|
|
1429 |
RMmCustomAPI::TSecurityCodeType type(RMmCustomAPI::ESecurityCodePin1);
|
|
1430 |
TBool result;
|
|
1431 |
|
|
1432 |
DispatcherSecurity::TSecurityCodeId secCodeID = DispatcherSecurity::ESecCodePin;
|
|
1433 |
|
|
1434 |
TMockLtsyData1 <DispatcherSecurity::TSecurityCodeId > ltsyData(secCodeID);
|
|
1435 |
ltsyData.SerialiseL(data);
|
|
1436 |
|
|
1437 |
//-------------------------------------------------------------------------
|
|
1438 |
// TEST A: failure to dispatch request to LTSY
|
|
1439 |
//-------------------------------------------------------------------------
|
|
1440 |
|
|
1441 |
iMockLTSY.ExpectL( MLtsyDispatchSecurityIsSecurityCodeBlocked::KLtsyDispatchSecurityIsSecurityCodeBlockedApiId, data, KErrNotSupported);
|
|
1442 |
|
|
1443 |
TInt ret = customAPI.IsBlocked(type, result);
|
|
1444 |
|
|
1445 |
ASSERT_EQUALS(KErrNotSupported, ret);
|
|
1446 |
|
|
1447 |
AssertMockLtsyStatusL();
|
|
1448 |
|
|
1449 |
//-------------------------------------------------------------------------
|
|
1450 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
1451 |
//-------------------------------------------------------------------------
|
|
1452 |
TBool compResult(ETrue);
|
|
1453 |
TMockLtsyData1 <TBool> ltsyData2(compResult);
|
|
1454 |
ltsyData2.SerialiseL(completeData);
|
|
1455 |
|
|
1456 |
iMockLTSY.ExpectL( MLtsyDispatchSecurityIsSecurityCodeBlocked::KLtsyDispatchSecurityIsSecurityCodeBlockedApiId, data);
|
|
1457 |
iMockLTSY.CompleteL( MLtsyDispatchSecurityIsSecurityCodeBlocked::KLtsyDispatchSecurityIsSecurityCodeBlockedApiId, KErrGeneral, completeData);
|
|
1458 |
|
|
1459 |
ret = customAPI.IsBlocked(type, result);
|
|
1460 |
|
|
1461 |
ASSERT_EQUALS(KErrGeneral, ret);
|
|
1462 |
|
|
1463 |
AssertMockLtsyStatusL();
|
|
1464 |
|
|
1465 |
//-------------------------------------------------------------------------
|
|
1466 |
// TEST C: Successful completion request of
|
|
1467 |
// RMmCustomAPI::IsBlocked when result is not cached.
|
|
1468 |
//-------------------------------------------------------------------------
|
|
1469 |
|
|
1470 |
iMockLTSY.ExpectL( MLtsyDispatchSecurityIsSecurityCodeBlocked::KLtsyDispatchSecurityIsSecurityCodeBlockedApiId, data);
|
|
1471 |
iMockLTSY.CompleteL( MLtsyDispatchSecurityIsSecurityCodeBlocked::KLtsyDispatchSecurityIsSecurityCodeBlockedApiId, KErrNone, completeData);
|
|
1472 |
|
|
1473 |
ret = customAPI.IsBlocked(type, result);
|
|
1474 |
|
|
1475 |
ASSERT_EQUALS(KErrNone, ret);
|
|
1476 |
ASSERT_EQUALS(compResult, result);
|
|
1477 |
|
|
1478 |
AssertMockLtsyStatusL();
|
|
1479 |
|
|
1480 |
//-------------------------------------------------------------------------
|
|
1481 |
// TEST E: Unsolicited completion of RMmCustomAPI::IsBlocked
|
|
1482 |
// from LTSY.
|
|
1483 |
//-------------------------------------------------------------------------
|
|
1484 |
TRequestStatus mockLtsyStatus;
|
|
1485 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
1486 |
|
|
1487 |
iMockLTSY.CompleteL( MLtsyDispatchSecurityIsSecurityCodeBlocked::KLtsyDispatchSecurityIsSecurityCodeBlockedApiId, KErrNone, completeData);
|
|
1488 |
|
|
1489 |
User::WaitForRequest(mockLtsyStatus);
|
|
1490 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
1491 |
|
|
1492 |
AssertMockLtsyStatusL();
|
|
1493 |
CleanupStack::PopAndDestroy(4, this); // completeData, data, customAPI, this
|
|
1494 |
|
|
1495 |
}
|
|
1496 |
|
|
1497 |
/**
|
|
1498 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0015
|
|
1499 |
@SYMComponent telephony_ctsy
|
|
1500 |
@SYMTestCaseDesc Test support in CTSY for CompleteNotifySecurityReady()
|
|
1501 |
@SYMTestPriority High
|
|
1502 |
@SYMTestActions Invokes CompleteNotifySecurityReady()
|
|
1503 |
@SYMTestExpectedResults Pass
|
|
1504 |
@SYMTestType CT
|
|
1505 |
*/
|
|
1506 |
void CCTsySecurityFU::TestUnit0015L()
|
|
1507 |
{
|
|
1508 |
OpenEtelServerL(EUseExtendedError);
|
|
1509 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
1510 |
OpenPhoneL();
|
|
1511 |
|
|
1512 |
RBuf8 data;
|
|
1513 |
CleanupClosePushL(data);
|
|
1514 |
|
|
1515 |
_LIT(KPwd,"12345");
|
|
1516 |
_LIT(KUnblockPwd, "54321");
|
|
1517 |
|
|
1518 |
// Initialize data for VerifySecurityEvent
|
|
1519 |
|
|
1520 |
TRequestStatus reqStatus;
|
|
1521 |
RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePin1;
|
|
1522 |
RMobilePhone::TMobilePassword pwd;
|
|
1523 |
RMobilePhone::TMobilePassword unblockPwd;
|
|
1524 |
|
|
1525 |
pwd.Copy(KPwd);
|
|
1526 |
unblockPwd.Copy(KUnblockPwd);
|
|
1527 |
|
|
1528 |
RMobilePhone::TCodeAndUnblockCode twoCodes;
|
|
1529 |
twoCodes.iCode.Copy(KPwd);
|
|
1530 |
twoCodes.iUnblockCode.Copy(KUnblockPwd);
|
|
1531 |
|
|
1532 |
TMockLtsyData2<RMobilePhone::TMobilePhoneSecurityCode, RMobilePhone::TCodeAndUnblockCode> verifyData(secCode,twoCodes);
|
|
1533 |
verifyData.SerialiseL(data);
|
|
1534 |
|
|
1535 |
//-------------------------------------------------------------------------
|
|
1536 |
//
|
|
1537 |
// RMobilePhone::VerifySecurityCode
|
|
1538 |
//-------------------------------------------------------------------------
|
|
1539 |
TRequestStatus mockLtsyStatus;
|
|
1540 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
1541 |
|
|
1542 |
iMockLTSY.CompleteL(KMockLtsyDispatchSecurityBootNotifySecurityReadyIndId, KErrNone);
|
|
1543 |
User::WaitForRequest(mockLtsyStatus);
|
|
1544 |
|
|
1545 |
iMockLTSY.ExpectL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, data);
|
|
1546 |
iMockLTSY.CompleteL(MLtsyDispatchSecurityVerifySecurityCode::KLtsyDispatchSecurityVerifySecurityCodeApiId, KErrNone);
|
|
1547 |
iPhone.VerifySecurityCode(reqStatus, secCode, pwd, unblockPwd);
|
|
1548 |
|
|
1549 |
User::WaitForRequest(reqStatus);
|
|
1550 |
ASSERT_EQUALS(KErrNone, reqStatus.Int())
|
|
1551 |
|
|
1552 |
AssertMockLtsyStatusL();
|
|
1553 |
CleanupStack::PopAndDestroy(2, this); // data, this
|
|
1554 |
}
|
|
1555 |
|
|
1556 |
/**
|
|
1557 |
@SYMTestCaseID BA-CTSYD-DIS-SECURITY-UN0016
|
|
1558 |
@SYMComponent telephony_ctsy
|
|
1559 |
@SYMTestCaseDesc Test support in CTSY for cancelling of RMmCustomAPI::CheckSecurityCode
|
|
1560 |
@SYMTestPriority High
|
|
1561 |
@SYMTestActions Invokes cancelling of RMmCustomAPI::CheckSecurityCode
|
|
1562 |
@SYMTestExpectedResults Pass
|
|
1563 |
@SYMTestType CT
|
|
1564 |
*/
|
|
1565 |
void CCTsySecurityFU::TestUnit0016L()
|
|
1566 |
{
|
|
1567 |
|
|
1568 |
OpenEtelServerL(EUseExtendedError);
|
|
1569 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
1570 |
OpenPhoneL();
|
|
1571 |
|
|
1572 |
RMmCustomAPI customAPI;
|
|
1573 |
OpenCustomAPILC(customAPI, iPhone);
|
|
1574 |
|
|
1575 |
RBuf8 data;
|
|
1576 |
CleanupClosePushL(data);
|
|
1577 |
|
|
1578 |
RBuf8 data2;
|
|
1579 |
CleanupClosePushL(data2);
|
|
1580 |
|
|
1581 |
TRequestStatus requestStatus;
|
|
1582 |
RMmCustomAPI::TSecurityCodeType type(RMmCustomAPI::ESecurityCodePin1);
|
|
1583 |
DispatcherSecurity::TSecurityCodeId secCodeID = DispatcherSecurity::ESecCodePin;
|
|
1584 |
RMobilePhone::TMobilePassword secCode;
|
|
1585 |
|
|
1586 |
TMockLtsyData2 <DispatcherSecurity::TSecurityCodeId, RMobilePhone::TMobilePassword> ltsyData(secCodeID, secCode);
|
|
1587 |
ltsyData.SerialiseL(data);
|
|
1588 |
|
|
1589 |
//-------------------------------------------------------------------------
|
|
1590 |
// Test A: Cancelling of RMmCustomAPI::CheckSecurityCode
|
|
1591 |
//-------------------------------------------------------------------------
|
|
1592 |
|
|
1593 |
iMockLTSY.ExpectL( MLtsyDispatchSecurityCheckSecurityCode::KLtsyDispatchSecurityCheckSecurityCodeApiId, data);
|
|
1594 |
customAPI.CheckSecurityCode(requestStatus, type);
|
|
1595 |
|
|
1596 |
TMockLtsyData1 <DispatcherSecurity::TSecurityCodeId > ltsyData2(secCodeID);
|
|
1597 |
ltsyData2.SerialiseL(data2);
|
|
1598 |
|
|
1599 |
iMockLTSY.ExpectL( MLtsyDispatchSecurityCheckSecurityCodeCancel::KLtsyDispatchSecurityCheckSecurityCodeCancelApiId, data2);
|
|
1600 |
iMockLTSY.CompleteL( MLtsyDispatchSecurityCheckSecurityCodeCancel::KLtsyDispatchSecurityCheckSecurityCodeCancelApiId, KErrNone);
|
|
1601 |
iMockLTSY.CompleteL( MLtsyDispatchSecurityCheckSecurityCode::KLtsyDispatchSecurityCheckSecurityCodeApiId, KErrCancel);
|
|
1602 |
|
|
1603 |
customAPI.CancelAsyncRequest(ECustomCheckSecurityCodeIPC);
|
|
1604 |
|
|
1605 |
User::WaitForRequest(requestStatus);
|
|
1606 |
ASSERT_EQUALS(KErrCancel, requestStatus.Int());
|
|
1607 |
|
|
1608 |
AssertMockLtsyStatusL();
|
|
1609 |
|
|
1610 |
CleanupStack::PopAndDestroy(4, this);
|
|
1611 |
|
|
1612 |
}
|
|
1613 |
|
|
1614 |
// Helper methods
|
|
1615 |
void CCTsySecurityFU::OpenCustomAPILC(RMmCustomAPI& aCustomAPI, RMobilePhone& aPhone, TBool aExpectNeeded)
|
|
1616 |
{
|
|
1617 |
RBuf8 data;
|
|
1618 |
CleanupClosePushL(data);
|
|
1619 |
|
|
1620 |
if(aExpectNeeded)
|
|
1621 |
{
|
|
1622 |
iMockLTSY.ExpectL(MLtsyDispatchCallControlGetCallForwardingIndicator::KLtsyDispatchCallControlGetCallForwardingIndicatorApiId);
|
|
1623 |
}
|
|
1624 |
|
|
1625 |
TInt errorCode = aCustomAPI.Open(aPhone);
|
|
1626 |
ASSERT_EQUALS(KErrNone, errorCode);
|
|
1627 |
CleanupStack::PopAndDestroy (&data);
|
|
1628 |
CleanupClosePushL(aCustomAPI);
|
|
1629 |
|
|
1630 |
}
|