|
1 // Copyright (c) 2007-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 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 #include <ssm/ssmstates.hrh> |
|
23 #include <ssm/ssmsubstates.hrh> |
|
24 #include <ssm/ssmstatemanager.h> |
|
25 #include <ssm/startupadaptation.h> |
|
26 #include <ssm/startupadaptationcommands.h> |
|
27 #include <ssm/startupadaptationevents.h> |
|
28 |
|
29 // Include the header file for the class under test |
|
30 #include "saastateadaptation.h" |
|
31 #include "saartcadaptation.h" |
|
32 #include "saasimadaptation.h" |
|
33 #include "saaemergencycallrfadaptation.h" |
|
34 #include "saamiscadaptation.h" |
|
35 #include "startupadaptationadapter.h" |
|
36 |
|
37 |
|
38 #include "ssmclayer.h" |
|
39 |
|
40 #include "ssmdebug.h" |
|
41 |
|
42 #include "tclayer_step_startupadaptationadapter.h" |
|
43 |
|
44 //Include the test wrappers |
|
45 #include "startupadaptationwrapper.h" |
|
46 |
|
47 #include <s32mem.h> |
|
48 |
|
49 /** |
|
50 * Helper class that stops the active scheduler when it's iStatus is complete |
|
51 * |
|
52 * @internalComponent |
|
53 * @test |
|
54 */ |
|
55 class CRequestWaiter : public CActive |
|
56 { |
|
57 public: |
|
58 /** |
|
59 * Starts the activescheduler, stopping it when iStatus on this object is complete. |
|
60 * Equivalent to User::WaitForRequest(iStatus) but uses the activescheduler. |
|
61 */ |
|
62 void StartWait() |
|
63 { |
|
64 if(!IsActive()) |
|
65 { |
|
66 SetActive(); |
|
67 } |
|
68 CActiveScheduler::Start(); |
|
69 } |
|
70 |
|
71 // Make iStatus public for ease of use. |
|
72 using CActive::iStatus; |
|
73 // Make SetActive public for ease of use |
|
74 void SetActive() |
|
75 { |
|
76 CActive::SetActive(); |
|
77 } |
|
78 |
|
79 CRequestWaiter() : CActive(EPriorityNormal) |
|
80 { |
|
81 CActiveScheduler::Add(this); |
|
82 } |
|
83 protected: |
|
84 // From CActive |
|
85 void RunL() |
|
86 { |
|
87 // Ignore the completion value and just stop the active scheduler |
|
88 CActiveScheduler::Stop(); |
|
89 } |
|
90 |
|
91 TInt RunError(TInt aError) |
|
92 { |
|
93 return aError; |
|
94 } |
|
95 |
|
96 void DoCancel() |
|
97 { |
|
98 // Do nothing |
|
99 } |
|
100 }; |
|
101 |
|
102 /** |
|
103 * Constructs a complete CCLayerTestStartupAdaptationAdapter object |
|
104 * @internalComponent |
|
105 */ |
|
106 CCLayerTestStartupAdaptationAdapter::CCLayerTestStartupAdaptationAdapter() |
|
107 { |
|
108 |
|
109 } |
|
110 |
|
111 /** |
|
112 * Releases any resources associated with this test |
|
113 * @internalComponent |
|
114 */ |
|
115 CCLayerTestStartupAdaptationAdapter::~CCLayerTestStartupAdaptationAdapter() |
|
116 { |
|
117 |
|
118 } |
|
119 |
|
120 /** |
|
121 * Test step preamble |
|
122 * @internalComponent |
|
123 */ |
|
124 TVerdict CCLayerTestStartupAdaptationAdapter::doTestStepPreambleL() |
|
125 { |
|
126 return CTestStep::doTestStepPreambleL(); |
|
127 } |
|
128 |
|
129 /** |
|
130 * Test step - a single test step performs a series of tests. |
|
131 * |
|
132 * See the individual doTest... methods on this class for details of the tests. |
|
133 * |
|
134 * @internalComponent |
|
135 */ |
|
136 TVerdict CCLayerTestStartupAdaptationAdapter::doTestStepL() |
|
137 { |
|
138 INFO_PRINTF1(_L("Entering test for compatibility layer startup adaptation adapter")); |
|
139 __UHEAP_MARK; |
|
140 |
|
141 CActiveScheduler* as = new (ELeave) CActiveScheduler(); |
|
142 CleanupStack::PushL(as); |
|
143 CActiveScheduler::Install(as); |
|
144 |
|
145 TRAPD(err, doTestOnDemandL()); |
|
146 TEST(err == KErrNone); |
|
147 |
|
148 TRAP(err, doTestStateAdaptationL()); |
|
149 TEST(err == KErrNone); |
|
150 |
|
151 TRAP(err, doTestSimAdaptationL()); |
|
152 TEST(err == KErrNone); |
|
153 |
|
154 TRAP(err, doTestRtcAdaptationL()); |
|
155 TEST(err == KErrNone); |
|
156 |
|
157 TRAP(err, doTestEmergencyCallRfAdaptationL()); |
|
158 TEST(err == KErrNone); |
|
159 |
|
160 TRAP(err, doTestMiscAdaptationL()); |
|
161 TEST(err == KErrNone); |
|
162 |
|
163 TRAP(err, doTestConcurrentRequestsL()); |
|
164 TEST(err == KErrNone); |
|
165 |
|
166 TRAP(err, doTestMultipleRequestsL()); |
|
167 TEST(err == KErrNone); |
|
168 |
|
169 TRAP(err, doTestCreationAndDestructionL()); |
|
170 TEST(err == KErrNone); |
|
171 |
|
172 CleanupStack::PopAndDestroy(as); |
|
173 |
|
174 __UHEAP_MARKEND; |
|
175 INFO_PRINTF1(_L("Leaving test for compatibility layer startup adaptation adapter")); |
|
176 return TestStepResult(); |
|
177 } |
|
178 |
|
179 /** |
|
180 * Test step postamble |
|
181 * @internalComponent |
|
182 */ |
|
183 TVerdict CCLayerTestStartupAdaptationAdapter::doTestStepPostambleL() |
|
184 { |
|
185 return CTestStep::doTestStepPostambleL(); |
|
186 } |
|
187 |
|
188 /** |
|
189 Old Test CaseID AFSS-CLAYER-0012 |
|
190 New Test CaseID DEVSRVS-SSREFPLUGINS-CLAYER-0012 |
|
191 */ |
|
192 |
|
193 void CCLayerTestStartupAdaptationAdapter::doTestStateAdaptationL() |
|
194 { |
|
195 __UHEAP_MARK; |
|
196 INFO_PRINTF1(_L("Enterting doTestStateAdaptationL()")); |
|
197 |
|
198 INFO_PRINTF1(_L("Creating state adaptation")); |
|
199 MStateAdaptation* stateAdaptation = CStartupAdaptationAdapter::NewStateAdaptationL(); |
|
200 TEST(stateAdaptation != NULL); |
|
201 if(stateAdaptation == NULL) |
|
202 { |
|
203 INFO_PRINTF1(_L("Failed to create state adaptation")); |
|
204 return; |
|
205 } |
|
206 |
|
207 CRequestWaiter* request = new (ELeave) CRequestWaiter(); |
|
208 CleanupStack::PushL(request); |
|
209 |
|
210 INFO_PRINTF1(_L("Testing coop state change mapping")); |
|
211 doTestStateChangeMappingsL(stateAdaptation); |
|
212 |
|
213 INFO_PRINTF1(_L("Testing coop self test")); |
|
214 stateAdaptation->RequestCoopSysSelfTest(request->iStatus); |
|
215 StartupAdaptation::TResponsePckg okResponse(KErrNone); |
|
216 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteSelftests); |
|
217 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EExecuteSelftests, okResponse); |
|
218 request->StartWait(); |
|
219 TEST(request->iStatus == KErrNone); |
|
220 |
|
221 INFO_PRINTF1(_L("Testing coop self test fail")); |
|
222 stateAdaptation->RequestCoopSysSelfTest(request->iStatus); |
|
223 StartupAdaptation::TResponsePckg failResponse(KErrGeneral); |
|
224 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteSelftests); |
|
225 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EExecuteSelftests, failResponse); |
|
226 request->StartWait(); |
|
227 TEST(request->iStatus == KErrGeneral); |
|
228 |
|
229 INFO_PRINTF1(_L("Testing coop self test cancel")); |
|
230 stateAdaptation->RequestCoopSysSelfTest(request->iStatus); |
|
231 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteSelftests); |
|
232 TEST(request->iStatus == KRequestPending); |
|
233 stateAdaptation->RequestCancel(); |
|
234 request->StartWait(); |
|
235 TEST(request->iStatus == KErrCancel); |
|
236 |
|
237 INFO_PRINTF1(_L("Testing coop perform shutdown actions")); |
|
238 TInt reason = 0; |
|
239 stateAdaptation->RequestCoopSysPerformShutdownActions(reason, request->iStatus); |
|
240 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteShutdown); |
|
241 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EExecuteShutdown, okResponse); |
|
242 request->StartWait(); |
|
243 TEST(request->iStatus == KErrNone); |
|
244 |
|
245 INFO_PRINTF1(_L("Testing coop perform shutdown actions fail")); |
|
246 reason = 0; |
|
247 stateAdaptation->RequestCoopSysPerformShutdownActions(reason, request->iStatus); |
|
248 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteShutdown); |
|
249 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EExecuteShutdown, failResponse); |
|
250 request->StartWait(); |
|
251 TEST(request->iStatus == KErrGeneral); |
|
252 |
|
253 INFO_PRINTF1(_L("Testing coop perform RFS actions")); |
|
254 INFO_PRINTF1(_L("Testing shallow RFS")); |
|
255 stateAdaptation->RequestCoopSysPerformRfsActions(ESsmShallowRfs, request->iStatus); |
|
256 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteDOSRfs); |
|
257 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EExecuteDOSRfs, okResponse); |
|
258 request->StartWait(); |
|
259 TEST(request->iStatus == KErrNone); |
|
260 TPckgBuf<StartupAdaptation::TRFSReason> rfsReasonBuf; |
|
261 rfsReasonBuf.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
262 TEST(rfsReasonBuf() == StartupAdaptation::ENormalRFS); |
|
263 |
|
264 INFO_PRINTF1(_L("Testing shallow RFS fail")); |
|
265 stateAdaptation->RequestCoopSysPerformRfsActions(ESsmShallowRfs, request->iStatus); |
|
266 TEST(request->iStatus == KRequestPending); |
|
267 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteDOSRfs); |
|
268 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EExecuteDOSRfs, failResponse); |
|
269 request->StartWait(); |
|
270 TEST(request->iStatus == KErrGeneral); |
|
271 rfsReasonBuf.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
272 TEST(rfsReasonBuf() == StartupAdaptation::ENormalRFS); |
|
273 |
|
274 INFO_PRINTF1(_L("Testing deep RFS")); |
|
275 stateAdaptation->RequestCoopSysPerformRfsActions(ESsmDeepRfs, request->iStatus); |
|
276 TEST(request->iStatus == KRequestPending); |
|
277 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteDOSRfs); |
|
278 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EExecuteDOSRfs, okResponse); |
|
279 request->StartWait(); |
|
280 TEST(request->iStatus == KErrNone); |
|
281 rfsReasonBuf.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
282 TEST(rfsReasonBuf() == StartupAdaptation::EDeepRFS); |
|
283 |
|
284 INFO_PRINTF1(_L("Testing deep RFS failure")); |
|
285 stateAdaptation->RequestCoopSysPerformRfsActions(ESsmDeepRfs, request->iStatus); |
|
286 TEST(request->iStatus == KRequestPending); |
|
287 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteDOSRfs); |
|
288 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EExecuteDOSRfs, failResponse); |
|
289 request->StartWait(); |
|
290 TEST(request->iStatus == KErrGeneral); |
|
291 rfsReasonBuf.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
292 TEST(rfsReasonBuf() == StartupAdaptation::EDeepRFS); |
|
293 |
|
294 INFO_PRINTF1(_L("Testing coop perform restart actions")); |
|
295 reason = StartupAdaptation::ELanguageSwitchReset; |
|
296 stateAdaptation->RequestCoopSysPerformRestartActions(reason, request->iStatus); |
|
297 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteReset); |
|
298 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EExecuteReset, okResponse); |
|
299 request->StartWait(); |
|
300 TEST(request->iStatus == KErrNone); |
|
301 TPckgBuf<StartupAdaptation::TResetReason> restartReasonBuf; |
|
302 restartReasonBuf.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
303 TEST(restartReasonBuf() == reason); |
|
304 |
|
305 INFO_PRINTF1(_L("Testing coop perform restart actions fail")); |
|
306 reason = StartupAdaptation::ELanguageSwitchReset; |
|
307 stateAdaptation->RequestCoopSysPerformRestartActions(reason, request->iStatus); |
|
308 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteReset); |
|
309 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EExecuteReset, failResponse); |
|
310 request->StartWait(); |
|
311 TEST(request->iStatus == KErrGeneral); |
|
312 restartReasonBuf.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
313 TEST(restartReasonBuf() == reason); |
|
314 |
|
315 INFO_PRINTF1(_L("Testing alternative coop perform restart actions")); |
|
316 reason = StartupAdaptation::ESIMStatusChangeReset; |
|
317 stateAdaptation->RequestCoopSysPerformRestartActions(reason, request->iStatus); |
|
318 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteReset); |
|
319 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EExecuteReset, okResponse); |
|
320 request->StartWait(); |
|
321 TEST(request->iStatus == KErrNone); |
|
322 restartReasonBuf.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
323 TEST(restartReasonBuf() == reason); |
|
324 |
|
325 INFO_PRINTF1(_L("Testing coop notify sys event fatal event")); |
|
326 TPckgBuf<TSsmCoopSysEventType> eventBuf; |
|
327 stateAdaptation->NotifyCoopSysEvent(eventBuf, request->iStatus); |
|
328 TEST(request->iStatus == KRequestPending); |
|
329 StartupAdaptation::TFatalErrorTypePckg fatalErrorPckg(StartupAdaptation::EUnclassifiedError); |
|
330 CStartupAdaptationWrapper::TriggerObserverEventCallbackL(StartupAdaptation::EFatalError, fatalErrorPckg); |
|
331 TEST(request->iStatus == KErrNone); |
|
332 TEST(eventBuf() == ESsmFatalCoopSysError); |
|
333 |
|
334 INFO_PRINTF1(_L("Testing coop notify sys event non-fatal event")); |
|
335 stateAdaptation->NotifyCoopSysEvent(eventBuf, request->iStatus); |
|
336 TEST(request->iStatus == KRequestPending); |
|
337 fatalErrorPckg() = StartupAdaptation::ESimRemoved; |
|
338 CStartupAdaptationWrapper::TriggerObserverEventCallbackL(StartupAdaptation::EFatalError, fatalErrorPckg); |
|
339 //Should still be pending as SIM removed goes via the SIM adaptation |
|
340 TEST(request->iStatus == KRequestPending); |
|
341 |
|
342 INFO_PRINTF1(_L("Testing coop notify sys event cancel")); |
|
343 stateAdaptation->NotifyCancel(); |
|
344 request->StartWait(); |
|
345 TEST(request->iStatus == KErrCancel); |
|
346 |
|
347 INFO_PRINTF1(_L("Testing coop notify sys shutdown event")); |
|
348 stateAdaptation->NotifyCoopSysEvent(eventBuf, request->iStatus); |
|
349 TEST(request->iStatus == KRequestPending); |
|
350 TBuf8<1> emptyBuf; |
|
351 CStartupAdaptationWrapper::TriggerObserverEventCallbackL(StartupAdaptation::EDOSOriginatedShutdown, emptyBuf); |
|
352 request->StartWait(); |
|
353 TEST(request->iStatus == KErrNone); |
|
354 TEST(eventBuf() == ESsmShutdownDevice); |
|
355 |
|
356 INFO_PRINTF1(_L("Testing coop notify sys restart event")); |
|
357 stateAdaptation->NotifyCoopSysEvent(eventBuf, request->iStatus); |
|
358 TEST(request->iStatus == KRequestPending); |
|
359 CStartupAdaptationWrapper::TriggerObserverEventCallbackL(StartupAdaptation::EDOSOriginatedReset, emptyBuf); |
|
360 request->StartWait(); |
|
361 TEST(request->iStatus == KErrNone); |
|
362 TEST(eventBuf() == ESsmRestartDevice); |
|
363 |
|
364 INFO_PRINTF1(_L("Releasing state adaptation")); |
|
365 stateAdaptation->Release(); |
|
366 stateAdaptation = NULL; |
|
367 |
|
368 CleanupStack::PopAndDestroy(request); |
|
369 |
|
370 INFO_PRINTF1(_L("Heap check macro end")); |
|
371 // Delete the test data buffer |
|
372 CStartupAdaptationWrapper::DeleteLastCommandData(); |
|
373 __UHEAP_MARKEND; |
|
374 |
|
375 INFO_PRINTF1(_L("Returning from doTestStateAdaptationL()")); |
|
376 } |
|
377 |
|
378 /** |
|
379 Old Test CaseID AFSS-CLAYER-0013 |
|
380 New Test CaseID DEVSRVS-SSREFPLUGINS-CLAYER-0012 |
|
381 */ |
|
382 |
|
383 void CCLayerTestStartupAdaptationAdapter::doTestSimAdaptationL() |
|
384 { |
|
385 __UHEAP_MARK; |
|
386 INFO_PRINTF1(_L("Enterting doTestSimAdaptationL()")); |
|
387 |
|
388 INFO_PRINTF1(_L("Creating SIM adaptation")); |
|
389 MSimAdaptation* simAdaptation = CStartupAdaptationAdapter::NewSimAdaptationL(); |
|
390 TEST(simAdaptation != NULL); |
|
391 if(simAdaptation == NULL) |
|
392 { |
|
393 INFO_PRINTF1(_L("Failed to create SIM adaptation")); |
|
394 return; |
|
395 } |
|
396 |
|
397 INFO_PRINTF1(_L("Testing get SIM changed true")); |
|
398 CRequestWaiter* request = new (ELeave) CRequestWaiter(); |
|
399 CleanupStack::PushL(request); |
|
400 |
|
401 TPckgBuf<TBool> boolPckg; |
|
402 StartupAdaptation::TBooleanResponsePckg booleanResponsePckg; |
|
403 |
|
404 INFO_PRINTF1(_L("Testing get SIM owned true")); |
|
405 simAdaptation->GetSimOwned(boolPckg, request->iStatus); |
|
406 TEST(request->iStatus == KRequestPending); |
|
407 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetSimOwned); |
|
408 booleanResponsePckg().iErrorCode = KErrNone; |
|
409 booleanResponsePckg().iValue = ETrue; |
|
410 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetSimOwned, booleanResponsePckg); |
|
411 request->StartWait(); |
|
412 TEST(request->iStatus == KErrNone); |
|
413 TEST(boolPckg()); |
|
414 |
|
415 |
|
416 INFO_PRINTF1(_L("Testing get SIM owned false")); |
|
417 simAdaptation->GetSimOwned(boolPckg, request->iStatus); |
|
418 TEST(request->iStatus == KRequestPending); |
|
419 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetSimOwned); |
|
420 booleanResponsePckg().iErrorCode = KErrNone; |
|
421 booleanResponsePckg().iValue = EFalse; |
|
422 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetSimOwned, booleanResponsePckg); |
|
423 request->StartWait(); |
|
424 TEST(request->iStatus == KErrNone); |
|
425 TEST(!boolPckg()); |
|
426 |
|
427 INFO_PRINTF1(_L("Testing get SIM owned fail")); |
|
428 simAdaptation->GetSimOwned(boolPckg, request->iStatus); |
|
429 TEST(request->iStatus == KRequestPending); |
|
430 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetSimOwned); |
|
431 booleanResponsePckg().iErrorCode = KErrGeneral; |
|
432 booleanResponsePckg().iValue = ETrue; |
|
433 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetSimOwned, booleanResponsePckg); |
|
434 request->StartWait(); |
|
435 TEST(request->iStatus == KErrGeneral); |
|
436 |
|
437 INFO_PRINTF1(_L("Testing get SIM owned cancel")); |
|
438 simAdaptation->GetSimOwned(boolPckg, request->iStatus); |
|
439 TEST(request->iStatus == KRequestPending); |
|
440 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetSimOwned); |
|
441 // Cancel instead of responding |
|
442 simAdaptation->GetCancel(); |
|
443 request->StartWait(); |
|
444 TEST(request->iStatus == KErrCancel); |
|
445 |
|
446 |
|
447 INFO_PRINTF1(_L("Testing notify SIM event: SIM removed remembered from state test")); |
|
448 TPckgBuf<TSsmSimEventType> simEventPckg; |
|
449 StartupAdaptation::TFatalErrorTypePckg fatalErrorTypePckg; |
|
450 simAdaptation->NotifySimEvent(simEventPckg, request->iStatus); |
|
451 request->StartWait(); |
|
452 TEST(request->iStatus == KErrNone); |
|
453 TEST(simEventPckg() == ESsmSimRemoved); |
|
454 |
|
455 INFO_PRINTF1(_L("Testing notify SIM event: SIM removed")); |
|
456 simAdaptation->NotifySimEvent(simEventPckg, request->iStatus); |
|
457 TEST(request->iStatus == KRequestPending); |
|
458 fatalErrorTypePckg() = StartupAdaptation::ESimRemoved; |
|
459 CStartupAdaptationWrapper::TriggerObserverEventCallbackL(StartupAdaptation::EFatalError, fatalErrorTypePckg); |
|
460 request->StartWait(); |
|
461 TEST(request->iStatus == KErrNone); |
|
462 TEST(simEventPckg() == ESsmSimRemoved); |
|
463 |
|
464 INFO_PRINTF1(_L("Testing notify SIM event: SIM usable")); |
|
465 StartupAdaptation::TSimEventTypePckg simEventTypePckg; |
|
466 simAdaptation->NotifySimEvent(simEventPckg, request->iStatus); |
|
467 TEST(request->iStatus == KRequestPending); |
|
468 simEventTypePckg() = StartupAdaptation::ESimUsable; |
|
469 CStartupAdaptationWrapper::TriggerObserverEventCallbackL(StartupAdaptation::ESimEvent, simEventTypePckg); |
|
470 request->StartWait(); |
|
471 TEST(request->iStatus == KErrNone); |
|
472 TEST(simEventPckg() == ESsmSimUsable); |
|
473 |
|
474 INFO_PRINTF1(_L("Testing notify SIM event: SIM not ready")); |
|
475 simAdaptation->NotifySimEvent(simEventPckg, request->iStatus); |
|
476 TEST(request->iStatus == KRequestPending); |
|
477 simEventTypePckg() = StartupAdaptation::ESimNotReady; |
|
478 CStartupAdaptationWrapper::TriggerObserverEventCallbackL(StartupAdaptation::ESimEvent, simEventTypePckg); |
|
479 request->StartWait(); |
|
480 TEST(request->iStatus == KErrNone); |
|
481 TEST(simEventPckg() == ESsmSimNotReady); |
|
482 |
|
483 INFO_PRINTF1(_L("Testing notify SIM event: SIM readable")); |
|
484 simAdaptation->NotifySimEvent(simEventPckg, request->iStatus); |
|
485 TEST(request->iStatus == KRequestPending); |
|
486 simEventTypePckg() = StartupAdaptation::ESimReadable; |
|
487 CStartupAdaptationWrapper::TriggerObserverEventCallbackL(StartupAdaptation::ESimEvent, simEventTypePckg); |
|
488 request->StartWait(); |
|
489 TEST(request->iStatus == KErrNone); |
|
490 TEST(simEventPckg() == ESsmSimReadable); |
|
491 |
|
492 INFO_PRINTF1(_L("Testing notify SIM event ignores state events")); |
|
493 simAdaptation->NotifySimEvent(simEventPckg, request->iStatus); |
|
494 TEST(request->iStatus == KRequestPending); |
|
495 fatalErrorTypePckg() = StartupAdaptation::EUnclassifiedError; |
|
496 CStartupAdaptationWrapper::TriggerObserverEventCallbackL(StartupAdaptation::EFatalError, fatalErrorTypePckg); |
|
497 TEST(request->iStatus == KRequestPending); |
|
498 |
|
499 INFO_PRINTF1(_L("Testing notify SIM event cancel")); |
|
500 simAdaptation->NotifyCancel(); |
|
501 request->StartWait(); |
|
502 TEST(request->iStatus == KErrCancel); |
|
503 |
|
504 CleanupStack::PopAndDestroy(request); |
|
505 |
|
506 INFO_PRINTF1(_L("Releasing SIM adaptation")); |
|
507 simAdaptation->Release(); |
|
508 simAdaptation = NULL; |
|
509 |
|
510 INFO_PRINTF1(_L("Heap check macro end")); |
|
511 // Delete the test data buffer |
|
512 CStartupAdaptationWrapper::DeleteLastCommandData(); |
|
513 __UHEAP_MARKEND; |
|
514 |
|
515 INFO_PRINTF1(_L("Returning from doTestSimAdaptationL()")); |
|
516 } |
|
517 |
|
518 /** |
|
519 Old Test CaseID AFSS-CLAYER-0014 |
|
520 New Test CaseID DEVSRVS-SSREFPLUGINS-CLAYER-0012 |
|
521 */ |
|
522 void CCLayerTestStartupAdaptationAdapter::doTestRtcAdaptationL() |
|
523 { |
|
524 __UHEAP_MARK; |
|
525 INFO_PRINTF1(_L("Enterting doTestRtcAdaptationL()")); |
|
526 |
|
527 INFO_PRINTF1(_L("Creating RTC adaptation")); |
|
528 MRtcAdaptation* rtcAdaptation = CStartupAdaptationAdapter::NewRtcAdaptationL(); |
|
529 TEST(rtcAdaptation != NULL); |
|
530 if(rtcAdaptation == NULL) |
|
531 { |
|
532 INFO_PRINTF1(_L("Failed to create RTC adaptation")); |
|
533 return; |
|
534 } |
|
535 |
|
536 CRequestWaiter* request = new (ELeave) CRequestWaiter(); |
|
537 CleanupStack::PushL(request); |
|
538 |
|
539 INFO_PRINTF1(_L("Testing RTC validity true")); |
|
540 TPckgBuf<TBool> boolPckg; |
|
541 StartupAdaptation::TResponsePckg responsePckg; |
|
542 rtcAdaptation->ValidateRtc(boolPckg, request->iStatus); |
|
543 TEST(request->iStatus == KRequestPending); |
|
544 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EValidateRTCTime); |
|
545 // KErrNone means the RTC is valid |
|
546 responsePckg() = KErrNone; |
|
547 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EValidateRTCTime, responsePckg); |
|
548 request->StartWait(); |
|
549 TEST(request->iStatus == KErrNone); |
|
550 TEST(boolPckg()); |
|
551 |
|
552 INFO_PRINTF1(_L("Testing RTC validity false/failure - KErrGeneral")); |
|
553 rtcAdaptation->ValidateRtc(boolPckg, request->iStatus); |
|
554 TEST(request->iStatus == KRequestPending); |
|
555 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EValidateRTCTime); |
|
556 // KErrGeneral means the RTC is not valid |
|
557 responsePckg() = KErrGeneral; |
|
558 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EValidateRTCTime, responsePckg); |
|
559 request->StartWait(); |
|
560 TEST(request->iStatus == KErrNone); |
|
561 TEST(!boolPckg()); |
|
562 |
|
563 |
|
564 INFO_PRINTF1(_L("Testing RTC validity false/failure - KErrNotFound")); |
|
565 rtcAdaptation->ValidateRtc(boolPckg, request->iStatus); |
|
566 TEST(request->iStatus == KRequestPending); |
|
567 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EValidateRTCTime); |
|
568 // KErrNotFound means the RTC is invalid |
|
569 responsePckg() = KErrNotFound; |
|
570 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EValidateRTCTime, responsePckg); |
|
571 request->StartWait(); |
|
572 TEST(request->iStatus == KErrNone); |
|
573 TEST(!boolPckg()); |
|
574 |
|
575 INFO_PRINTF1(_L("Testing RTC validity cancelling")); |
|
576 rtcAdaptation->ValidateRtc(boolPckg, request->iStatus); |
|
577 TEST(request->iStatus == KRequestPending); |
|
578 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EValidateRTCTime); |
|
579 rtcAdaptation->Cancel(); |
|
580 request->StartWait(); |
|
581 TEST(request->iStatus == KErrCancel); |
|
582 |
|
583 INFO_PRINTF1(_L("Testing setting RTC wakeup")); |
|
584 TInt64 testTime64 = 0x6677445599226600LL; |
|
585 TTime testTime(testTime64); |
|
586 TPckgC<TTime> timePckg(testTime); |
|
587 rtcAdaptation->SetWakeupAlarm(timePckg, request->iStatus); |
|
588 TEST(request->iStatus == KRequestPending); |
|
589 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::ESetWakeupAlarm); |
|
590 StartupAdaptation::TWakeupAlarmPckg alarmPckg; |
|
591 alarmPckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
592 TEST(alarmPckg().iTime.Int64() == timePckg().Int64()); |
|
593 TEST(alarmPckg().iUniversalTimeOffset.Int() == 0); |
|
594 TEST(alarmPckg().iDaylightSavingOffset.Int() == 0); |
|
595 responsePckg() = KErrNone; |
|
596 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::ESetWakeupAlarm, responsePckg); |
|
597 request->StartWait(); |
|
598 TEST(request->iStatus == KErrNone); |
|
599 |
|
600 INFO_PRINTF1(_L("Testing setting RTC wakeup failure")); |
|
601 TInt64 test2Time64 = 0x5577112299338844LL; |
|
602 TTime test2Time(test2Time64); |
|
603 TPckgC<TTime> time2Pckg(test2Time); |
|
604 rtcAdaptation->SetWakeupAlarm(time2Pckg, request->iStatus); |
|
605 TEST(request->iStatus == KRequestPending); |
|
606 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::ESetWakeupAlarm); |
|
607 alarmPckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
608 TEST(alarmPckg().iTime.Int64() == time2Pckg().Int64()); |
|
609 TEST(alarmPckg().iUniversalTimeOffset.Int() == 0); |
|
610 TEST(alarmPckg().iDaylightSavingOffset.Int() == 0); |
|
611 responsePckg() = KErrGeneral; |
|
612 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::ESetWakeupAlarm, responsePckg); |
|
613 request->StartWait(); |
|
614 TEST(request->iStatus == KErrGeneral); |
|
615 |
|
616 INFO_PRINTF1(_L("Testing unsetting RTC wakeup")); |
|
617 rtcAdaptation->UnsetWakeupAlarm(request->iStatus); |
|
618 TEST(request->iStatus == KRequestPending); |
|
619 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::ECancelWakeupAlarm); |
|
620 TBuf8<1> nullBuf; |
|
621 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::ECancelWakeupAlarm, nullBuf); |
|
622 request->StartWait(); |
|
623 TEST(request->iStatus == KErrNone); |
|
624 |
|
625 INFO_PRINTF1(_L("Testing unsetting RTC wakeup cancel")); |
|
626 rtcAdaptation->UnsetWakeupAlarm(request->iStatus); |
|
627 TEST(request->iStatus == KRequestPending); |
|
628 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::ECancelWakeupAlarm); |
|
629 rtcAdaptation->Cancel(); |
|
630 request->StartWait(); |
|
631 TEST(request->iStatus == KErrCancel); |
|
632 |
|
633 INFO_PRINTF1(_L("Releasing RTC adaptation")); |
|
634 rtcAdaptation->Release(); |
|
635 rtcAdaptation = NULL; |
|
636 |
|
637 CleanupStack::PopAndDestroy(request); |
|
638 |
|
639 INFO_PRINTF1(_L("Heap check macro end")); |
|
640 // Delete the test data buffer |
|
641 CStartupAdaptationWrapper::DeleteLastCommandData(); |
|
642 __UHEAP_MARKEND; |
|
643 |
|
644 INFO_PRINTF1(_L("Returning from doTestRtcAdaptationL()")); |
|
645 } |
|
646 |
|
647 /** |
|
648 Old Test CaseID AFSS-CLAYER-0015 |
|
649 New Test CaseID DEVSRVS-SSREFPLUGINS-CLAYER-0012 |
|
650 */ |
|
651 |
|
652 void CCLayerTestStartupAdaptationAdapter::doTestEmergencyCallRfAdaptationL() |
|
653 { |
|
654 __UHEAP_MARK; |
|
655 INFO_PRINTF1(_L("Enterting doTestEmergencyCallRfAdaptationL()")); |
|
656 |
|
657 INFO_PRINTF1(_L("Creating emergency call rf adaptation")); |
|
658 MEmergencyCallRfAdaptation* ecrfAdaptation = CStartupAdaptationAdapter::NewEmergencyCallRfAdaptationL(); |
|
659 TEST(ecrfAdaptation != NULL); |
|
660 if(ecrfAdaptation == NULL) |
|
661 { |
|
662 INFO_PRINTF1(_L("Failed to create emergency call rf adaptation")); |
|
663 return; |
|
664 } |
|
665 |
|
666 CRequestWaiter* request = new (ELeave) CRequestWaiter(); |
|
667 CleanupStack::PushL(request); |
|
668 |
|
669 INFO_PRINTF1(_L("Test emergency RF activation success")); |
|
670 StartupAdaptation::TResponsePckg responsePckg; |
|
671 ecrfAdaptation->ActivateRfForEmergencyCall(request->iStatus); |
|
672 TEST(request->iStatus == KRequestPending); |
|
673 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EActivateRfForEmergencyCall); |
|
674 responsePckg() = KErrNone; |
|
675 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EActivateRfForEmergencyCall, responsePckg); |
|
676 request->StartWait(); |
|
677 TEST(request->iStatus == KErrNone); |
|
678 |
|
679 INFO_PRINTF1(_L("Test emergency RF activation failure")); |
|
680 ecrfAdaptation->ActivateRfForEmergencyCall(request->iStatus); |
|
681 TEST(request->iStatus == KRequestPending); |
|
682 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EActivateRfForEmergencyCall); |
|
683 responsePckg() = KErrGeneral; |
|
684 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EActivateRfForEmergencyCall, responsePckg); |
|
685 request->StartWait(); |
|
686 TEST(request->iStatus == KErrGeneral); |
|
687 |
|
688 INFO_PRINTF1(_L("Test emergency RF deactivation success")); |
|
689 ecrfAdaptation->DeactivateRfForEmergencyCall(request->iStatus); |
|
690 TEST(request->iStatus == KRequestPending); |
|
691 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EDeactivateRfAfterEmergencyCall); |
|
692 responsePckg() = KErrNone; |
|
693 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EDeactivateRfAfterEmergencyCall, responsePckg); |
|
694 request->StartWait(); |
|
695 TEST(request->iStatus == KErrNone); |
|
696 |
|
697 INFO_PRINTF1(_L("Test emergency RF deactivation failure")); |
|
698 ecrfAdaptation->DeactivateRfForEmergencyCall(request->iStatus); |
|
699 TEST(request->iStatus == KRequestPending); |
|
700 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EDeactivateRfAfterEmergencyCall); |
|
701 responsePckg() = KErrGeneral; |
|
702 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EDeactivateRfAfterEmergencyCall, responsePckg); |
|
703 request->StartWait(); |
|
704 TEST(request->iStatus == KErrGeneral); |
|
705 |
|
706 INFO_PRINTF1(_L("Test emergency RF activation cancel")); |
|
707 ecrfAdaptation->ActivateRfForEmergencyCall(request->iStatus); |
|
708 TEST(request->iStatus == KRequestPending); |
|
709 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EActivateRfForEmergencyCall); |
|
710 ecrfAdaptation->Cancel(); |
|
711 request->StartWait(); |
|
712 TEST(request->iStatus == KErrCancel); |
|
713 |
|
714 |
|
715 INFO_PRINTF1(_L("Releasing emergency call rf adaptation")); |
|
716 ecrfAdaptation->Release(); |
|
717 ecrfAdaptation = NULL; |
|
718 |
|
719 CleanupStack::PopAndDestroy(request); |
|
720 |
|
721 INFO_PRINTF1(_L("Heap check macro end")); |
|
722 // Delete the test data buffer |
|
723 CStartupAdaptationWrapper::DeleteLastCommandData(); |
|
724 __UHEAP_MARKEND; |
|
725 |
|
726 INFO_PRINTF1(_L("Returning from doTestEmergencyCallRfAdaptationL()")); |
|
727 } |
|
728 |
|
729 /** |
|
730 Old Test CaseID AFSS-CLAYER-0016 |
|
731 New Test CaseID DEVSRVS-SSREFPLUGINS-CLAYER-0012 |
|
732 */ |
|
733 |
|
734 |
|
735 void CCLayerTestStartupAdaptationAdapter::doTestMiscAdaptationL() |
|
736 { |
|
737 __UHEAP_MARK; |
|
738 INFO_PRINTF1(_L("Enterting doTestMiscAdaptationL()")); |
|
739 |
|
740 INFO_PRINTF1(_L("Creating misc. adaptation")); |
|
741 MMiscAdaptation* miscAdaptation = CStartupAdaptationAdapter::NewMiscAdaptationL(); |
|
742 TEST(miscAdaptation != NULL); |
|
743 if(miscAdaptation == NULL) |
|
744 { |
|
745 INFO_PRINTF1(_L("Failed to create misc. adaptation")); |
|
746 return; |
|
747 } |
|
748 |
|
749 |
|
750 CRequestWaiter* request = new (ELeave) CRequestWaiter(); |
|
751 CleanupStack::PushL(request); |
|
752 |
|
753 INFO_PRINTF1(_L("Testing get global startup mode success")); |
|
754 TPckgBuf<TInt> startupModePckg; |
|
755 StartupAdaptation::TGlobalStartupModeResponsePckg startupModeResponsePckg; |
|
756 miscAdaptation->GetGlobalStartupMode(startupModePckg, request->iStatus); |
|
757 TEST(request->iStatus == KRequestPending); |
|
758 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetGlobalStartupMode); |
|
759 startupModeResponsePckg().iErrorCode = KErrNone; |
|
760 startupModeResponsePckg().iValue = StartupAdaptation::EAlarm; |
|
761 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetGlobalStartupMode, startupModeResponsePckg); |
|
762 request->StartWait(); |
|
763 TEST(request->iStatus == KErrNone); |
|
764 TEST(startupModePckg() == StartupAdaptation::EAlarm); |
|
765 |
|
766 INFO_PRINTF1(_L("Testing get global startup mode failure")); |
|
767 miscAdaptation->GetGlobalStartupMode(startupModePckg, request->iStatus); |
|
768 TEST(request->iStatus == KRequestPending); |
|
769 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetGlobalStartupMode); |
|
770 startupModeResponsePckg().iErrorCode = KErrGeneral; |
|
771 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetGlobalStartupMode, startupModeResponsePckg); |
|
772 request->StartWait(); |
|
773 TEST(request->iStatus == KErrGeneral); |
|
774 |
|
775 INFO_PRINTF1(_L("Testing get global startup mode cancel")); |
|
776 miscAdaptation->GetGlobalStartupMode(startupModePckg, request->iStatus); |
|
777 TEST(request->iStatus == KRequestPending); |
|
778 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetGlobalStartupMode); |
|
779 miscAdaptation->Cancel(); |
|
780 request->StartWait(); |
|
781 TEST(request->iStatus == KErrCancel); |
|
782 |
|
783 INFO_PRINTF1(_L("Testing get hidden reset success")); |
|
784 TPckgBuf <TBool> hiddenResetPckg; |
|
785 StartupAdaptation::TBooleanResponsePckg hiddenResetResponsePckg; |
|
786 miscAdaptation->GetHiddenReset(hiddenResetPckg, request->iStatus); |
|
787 TEST(request->iStatus == KRequestPending); |
|
788 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetHiddenReset); |
|
789 hiddenResetResponsePckg().iErrorCode = KErrNone; |
|
790 hiddenResetResponsePckg().iValue = ETrue; |
|
791 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetHiddenReset, hiddenResetResponsePckg); |
|
792 request->StartWait(); |
|
793 TInt expectedErr = KErrNone; |
|
794 TEST(request->iStatus == expectedErr); |
|
795 INFO_PRINTF3(_L("Get hidden reset success status : %d Expected Status : %d"), request->iStatus.Int(), expectedErr); |
|
796 TEST(hiddenResetPckg() == 1); |
|
797 INFO_PRINTF2(_L("Get hidden reset package : %d"), hiddenResetPckg()); |
|
798 |
|
799 INFO_PRINTF1(_L("Testing get hidden reset failure")); |
|
800 miscAdaptation->GetHiddenReset(hiddenResetPckg, request->iStatus); |
|
801 TEST(request->iStatus == KRequestPending); |
|
802 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetHiddenReset); |
|
803 hiddenResetResponsePckg().iErrorCode = KErrGeneral; |
|
804 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetHiddenReset, hiddenResetResponsePckg); |
|
805 request->StartWait(); |
|
806 expectedErr = KErrGeneral; |
|
807 TEST(request->iStatus == expectedErr); |
|
808 INFO_PRINTF3(_L("Get hidden reset failure status : %d Expected Status : %d"), request->iStatus.Int(), expectedErr); |
|
809 |
|
810 INFO_PRINTF1(_L("Testing get hidden reset cancel")); |
|
811 miscAdaptation->GetHiddenReset(hiddenResetPckg, request->iStatus); |
|
812 TEST(request->iStatus == KRequestPending); |
|
813 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetHiddenReset); |
|
814 miscAdaptation->Cancel(); |
|
815 request->StartWait(); |
|
816 expectedErr = KErrCancel; |
|
817 TEST(request->iStatus == expectedErr); |
|
818 INFO_PRINTF3(_L("Get hidden reset cancel status : %d Expected Status : %d"), request->iStatus.Int(), expectedErr); |
|
819 |
|
820 INFO_PRINTF1(_L("Testing security state change success, EAskPIN")); |
|
821 TPckgBuf<TInt> clientResponsePckg; |
|
822 StartupAdaptation::TSecurityStateResponsePckg adaptationResponsePckg; |
|
823 StartupAdaptation::TSecurityStateChangePckg statePckg; |
|
824 miscAdaptation->SecurityStateChange(StartupAdaptation::EAskPIN, clientResponsePckg, request->iStatus); |
|
825 TEST(request->iStatus == KRequestPending); |
|
826 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::ESecurityStateChange); |
|
827 statePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
828 TEST(statePckg() == StartupAdaptation::EAskPIN); |
|
829 adaptationResponsePckg().iErrorCode = KErrNone; |
|
830 adaptationResponsePckg().iValue = StartupAdaptation::ENoValue; |
|
831 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::ESecurityStateChange, adaptationResponsePckg); |
|
832 request->StartWait(); |
|
833 TEST(request->iStatus == KErrNone); |
|
834 TEST(clientResponsePckg() == adaptationResponsePckg().iValue); |
|
835 |
|
836 INFO_PRINTF1(_L("Testing security state change success, ESIMRejected")); |
|
837 miscAdaptation->SecurityStateChange(StartupAdaptation::ESIMRejected, clientResponsePckg, request->iStatus); |
|
838 TEST(request->iStatus == KRequestPending); |
|
839 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::ESecurityStateChange); |
|
840 statePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
841 TEST(statePckg() == StartupAdaptation::ESIMRejected); |
|
842 adaptationResponsePckg().iErrorCode = KErrNone; |
|
843 adaptationResponsePckg().iValue = StartupAdaptation::EYes; |
|
844 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::ESecurityStateChange, adaptationResponsePckg); |
|
845 request->StartWait(); |
|
846 TEST(request->iStatus == KErrNone); |
|
847 TEST(clientResponsePckg() == adaptationResponsePckg().iValue); |
|
848 |
|
849 INFO_PRINTF1(_L("Testing security state change failure")); |
|
850 miscAdaptation->SecurityStateChange(StartupAdaptation::ESIMBlocked, clientResponsePckg, request->iStatus); |
|
851 TEST(request->iStatus == KRequestPending); |
|
852 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::ESecurityStateChange); |
|
853 statePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
854 TEST(statePckg() == StartupAdaptation::ESIMBlocked); |
|
855 adaptationResponsePckg().iErrorCode = KErrGeneral; |
|
856 adaptationResponsePckg().iValue = StartupAdaptation::ENo; |
|
857 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::ESecurityStateChange, adaptationResponsePckg); |
|
858 request->StartWait(); |
|
859 TEST(request->iStatus == KErrGeneral); |
|
860 |
|
861 INFO_PRINTF1(_L("Testing security state change cancel")); |
|
862 miscAdaptation->SecurityStateChange(StartupAdaptation::ESIMLock, clientResponsePckg, request->iStatus); |
|
863 TEST(request->iStatus == KRequestPending); |
|
864 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::ESecurityStateChange); |
|
865 statePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
866 TEST(statePckg() == StartupAdaptation::ESIMLock); |
|
867 miscAdaptation->Cancel(); |
|
868 request->StartWait(); |
|
869 TEST(request->iStatus == KErrCancel); |
|
870 |
|
871 |
|
872 INFO_PRINTF1(_L("Testing prepare and get SIM languages success, size 2")); |
|
873 TPckgBuf<TInt> sizePckg; |
|
874 StartupAdaptation::TLanguageListPriorityPckg languagePriorityPckg; |
|
875 StartupAdaptation::RLanguageListResponse languageListResponse; |
|
876 StartupAdaptation::TLanguageListResponsePckg languageResponsePckg(languageListResponse); |
|
877 miscAdaptation->PrepareSimLanguages(EPrimaryLanguages, sizePckg, request->iStatus); |
|
878 TEST(request->iStatus == KRequestPending); |
|
879 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetSIMLanguages); |
|
880 languagePriorityPckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
881 TEST(languagePriorityPckg() == StartupAdaptation::EPrimaryLanguages); |
|
882 languageListResponse.iErrorCode = KErrNone; |
|
883 languageListResponse.iLanguages.AppendL(StartupAdaptation::EPrefLangEnglish); |
|
884 languageListResponse.iLanguages.AppendL(StartupAdaptation::EPrefLangFinnish); |
|
885 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetSIMLanguages, languageResponsePckg); |
|
886 request->StartWait(); |
|
887 TEST(request->iStatus == KErrNone); |
|
888 TEST(sizePckg() == 2); |
|
889 |
|
890 //Getting the Sim Languages using the flat storage dynamic buffer |
|
891 CBufFlat* writeBuffer=CBufFlat::NewL(2); |
|
892 CleanupStack::PushL(writeBuffer); |
|
893 writeBuffer->ExpandL(0,2 * sizeof(TInt32)); |
|
894 TRAPD(res,miscAdaptation->GetSimLanguagesL(writeBuffer, 2)); |
|
895 TEST(res == KErrNone); |
|
896 |
|
897 //Reading the languages using the read stream from the buffer |
|
898 RBufReadStream readBuffer; |
|
899 readBuffer.Open(*writeBuffer,0); |
|
900 CleanupClosePushL(readBuffer); |
|
901 TInt32 language = readBuffer.ReadInt32L(); |
|
902 TEST(language == StartupAdaptation::EPrefLangEnglish); |
|
903 language = readBuffer.ReadInt32L(); |
|
904 TEST(language == StartupAdaptation::EPrefLangFinnish); |
|
905 |
|
906 //Reset the write Buffer |
|
907 writeBuffer->Reset(); |
|
908 |
|
909 INFO_PRINTF1(_L("Testing prepare and get SIM languages success, size 1")); |
|
910 miscAdaptation->PrepareSimLanguages(EPrimaryLanguages, sizePckg, request->iStatus); |
|
911 TEST(request->iStatus == KRequestPending); |
|
912 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetSIMLanguages); |
|
913 languagePriorityPckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
914 TEST(languagePriorityPckg() == StartupAdaptation::EPrimaryLanguages); |
|
915 languageListResponse.iErrorCode = KErrNone; |
|
916 languageListResponse.iLanguages.Remove(1); // Remove EPrefLangFinnish |
|
917 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetSIMLanguages, languageResponsePckg); |
|
918 request->StartWait(); |
|
919 TEST(request->iStatus == KErrNone); |
|
920 TEST(sizePckg() == 1); |
|
921 |
|
922 //Getting the Sim Languages using the flat storage dynamic buffer |
|
923 writeBuffer->ResizeL(sizeof(TInt32)); |
|
924 TRAP(res,miscAdaptation->GetSimLanguagesL(writeBuffer, 1)); |
|
925 TEST(res == KErrNone); |
|
926 |
|
927 //Reading the languages using the read stream from the buffer |
|
928 readBuffer.Open(*writeBuffer,0); |
|
929 language = readBuffer.ReadInt32L(); |
|
930 TEST(language == StartupAdaptation::EPrefLangEnglish); |
|
931 |
|
932 INFO_PRINTF1(_L("Testing get SIM languages failure, prepared sim languages count 1, size 0")); |
|
933 miscAdaptation->PrepareSimLanguages(EPrimaryLanguages, sizePckg, request->iStatus); |
|
934 TEST(request->iStatus == KRequestPending); |
|
935 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetSIMLanguages); |
|
936 languagePriorityPckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
937 TEST(languagePriorityPckg() == StartupAdaptation::EPrimaryLanguages); |
|
938 languageListResponse.iErrorCode = KErrNone; |
|
939 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetSIMLanguages, languageResponsePckg); |
|
940 request->StartWait(); |
|
941 TEST(request->iStatus == KErrNone); |
|
942 TEST(sizePckg() == 1); |
|
943 |
|
944 writeBuffer->ResizeL(0); |
|
945 TRAP(res,miscAdaptation->GetSimLanguagesL(writeBuffer, 0)); |
|
946 TEST(res == KErrArgument); |
|
947 |
|
948 INFO_PRINTF1(_L("Testing prepare and get SIM languages success, size 0")); |
|
949 miscAdaptation->PrepareSimLanguages(EPrimaryLanguages, sizePckg, request->iStatus); |
|
950 TEST(request->iStatus == KRequestPending); |
|
951 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetSIMLanguages); |
|
952 languagePriorityPckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
953 TEST(languagePriorityPckg() == StartupAdaptation::EPrimaryLanguages); |
|
954 languageListResponse.iErrorCode = KErrNone; |
|
955 languageListResponse.iLanguages.Remove(0); // Remove EPrefLangEnglish from the array |
|
956 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetSIMLanguages, languageResponsePckg); |
|
957 request->StartWait(); |
|
958 TEST(request->iStatus == KErrNone); |
|
959 TEST(sizePckg() == 0); |
|
960 |
|
961 //Getting the Sim Languages using the flat storage dynamic buffer |
|
962 TRAP(res,miscAdaptation->GetSimLanguagesL(writeBuffer, 0)); |
|
963 TEST(res == KErrNone); |
|
964 |
|
965 INFO_PRINTF1(_L("Testing prepare twice and get SIM languages success, size 0")); |
|
966 miscAdaptation->PrepareSimLanguages(EPrimaryLanguages, sizePckg, request->iStatus); |
|
967 TEST(request->iStatus == KRequestPending); |
|
968 request->SetActive(); |
|
969 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetSIMLanguages); |
|
970 languagePriorityPckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
971 TEST(languagePriorityPckg() == StartupAdaptation::EPrimaryLanguages); |
|
972 //Try preparing the list again while outstanding request |
|
973 CRequestWaiter* request2 = new (ELeave) CRequestWaiter(); |
|
974 CleanupStack::PushL(request2); |
|
975 miscAdaptation->PrepareSimLanguages(EPrimaryLanguages, sizePckg, request2->iStatus); |
|
976 request2->StartWait(); |
|
977 TEST(request2->iStatus == KErrInUse); |
|
978 languageListResponse.iErrorCode = KErrNone; |
|
979 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetSIMLanguages, languageResponsePckg); |
|
980 request->StartWait(); |
|
981 TEST(request->iStatus == KErrNone); |
|
982 TEST(sizePckg() == 0); |
|
983 |
|
984 //Getting the Sim Languages using the flat storage dynamic buffer |
|
985 TRAP(res,miscAdaptation->GetSimLanguagesL(writeBuffer, 0)); |
|
986 TEST(res == KErrNone); |
|
987 |
|
988 INFO_PRINTF1(_L("Testing prepare get SIM languages failure")); |
|
989 miscAdaptation->PrepareSimLanguages(EPrimaryLanguages, sizePckg, request->iStatus); |
|
990 TEST(request->iStatus == KRequestPending); |
|
991 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetSIMLanguages); |
|
992 languagePriorityPckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
993 TEST(languagePriorityPckg() == StartupAdaptation::EPrimaryLanguages); |
|
994 languageListResponse.iErrorCode = KErrGeneral; |
|
995 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetSIMLanguages, languageResponsePckg); |
|
996 request->StartWait(); |
|
997 TEST(request->iStatus == KErrGeneral); |
|
998 |
|
999 INFO_PRINTF1(_L("Testing prepare SIM lanuages and then cancel")); |
|
1000 miscAdaptation->PrepareSimLanguages(EPrimaryLanguages, sizePckg, request->iStatus); |
|
1001 TEST(request->iStatus == KRequestPending); |
|
1002 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetSIMLanguages); |
|
1003 languagePriorityPckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1004 TEST(languagePriorityPckg() == StartupAdaptation::EPrimaryLanguages); |
|
1005 languageListResponse.iErrorCode = KErrNone; |
|
1006 // Try to cancel |
|
1007 miscAdaptation->Cancel(); |
|
1008 request->StartWait(); |
|
1009 TEST(request->iStatus == KErrCancel); |
|
1010 |
|
1011 INFO_PRINTF1(_L("Releasing misc. adaptation")); |
|
1012 miscAdaptation->Release(); |
|
1013 miscAdaptation = NULL; |
|
1014 |
|
1015 CleanupStack::PopAndDestroy(request2); |
|
1016 CleanupStack::PopAndDestroy(3); //readBuffer, writeBuffer, request |
|
1017 |
|
1018 INFO_PRINTF1(_L("Heap check macro end")); |
|
1019 // Delete the test data buffer |
|
1020 CStartupAdaptationWrapper::DeleteLastCommandData(); |
|
1021 // Close the adaptation wrapper language array |
|
1022 languageListResponse.Close(); |
|
1023 __UHEAP_MARKEND; |
|
1024 |
|
1025 INFO_PRINTF1(_L("Returning from doTestMiscAdaptationL()")); |
|
1026 } |
|
1027 |
|
1028 /** |
|
1029 Old Test CaseID AFSS-CLAYER-0017 |
|
1030 New Test CaseID DEVSRVS-SSREFPLUGINS-CLAYER-0012 |
|
1031 */ |
|
1032 |
|
1033 void CCLayerTestStartupAdaptationAdapter::doTestConcurrentRequestsL() |
|
1034 { |
|
1035 __UHEAP_MARK; |
|
1036 INFO_PRINTF1(_L("Enterting doTestConcurrentRequestsL()")); |
|
1037 |
|
1038 INFO_PRINTF1(_L("Setting up adaptation classes")); |
|
1039 |
|
1040 INFO_PRINTF1(_L("Creating state adaptation")); |
|
1041 MStateAdaptation* stateAdaptation = CStartupAdaptationAdapter::NewStateAdaptationL(); |
|
1042 TEST(stateAdaptation != NULL); |
|
1043 if(stateAdaptation == NULL) |
|
1044 { |
|
1045 INFO_PRINTF1(_L("Failed to create state adaptation")); |
|
1046 return; |
|
1047 } |
|
1048 |
|
1049 INFO_PRINTF1(_L("Creating SIM adaptation")); |
|
1050 MSimAdaptation* simAdaptation = CStartupAdaptationAdapter::NewSimAdaptationL(); |
|
1051 TEST(simAdaptation != NULL); |
|
1052 if(simAdaptation == NULL) |
|
1053 { |
|
1054 INFO_PRINTF1(_L("Failed to create SIM adaptation")); |
|
1055 return; |
|
1056 } |
|
1057 |
|
1058 INFO_PRINTF1(_L("Creating RTC adaptation")); |
|
1059 MRtcAdaptation* rtcAdaptation = CStartupAdaptationAdapter::NewRtcAdaptationL(); |
|
1060 TEST(rtcAdaptation != NULL); |
|
1061 if(rtcAdaptation == NULL) |
|
1062 { |
|
1063 INFO_PRINTF1(_L("Failed to create RTC adaptation")); |
|
1064 return; |
|
1065 } |
|
1066 |
|
1067 INFO_PRINTF1(_L("Creating emergency call rf adaptation")); |
|
1068 MEmergencyCallRfAdaptation* ecrfAdaptation = CStartupAdaptationAdapter::NewEmergencyCallRfAdaptationL(); |
|
1069 TEST(ecrfAdaptation != NULL); |
|
1070 if(ecrfAdaptation == NULL) |
|
1071 { |
|
1072 INFO_PRINTF1(_L("Failed to create emergency call rf adaptation")); |
|
1073 return; |
|
1074 } |
|
1075 |
|
1076 INFO_PRINTF1(_L("Creating misc. adaptation")); |
|
1077 MMiscAdaptation* miscAdaptation = CStartupAdaptationAdapter::NewMiscAdaptationL(); |
|
1078 TEST(miscAdaptation != NULL); |
|
1079 if(miscAdaptation == NULL) |
|
1080 { |
|
1081 INFO_PRINTF1(_L("Failed to create misc. adaptation")); |
|
1082 return; |
|
1083 } |
|
1084 |
|
1085 INFO_PRINTF1(_L("End of set up of adaptation classes")); |
|
1086 |
|
1087 INFO_PRINTF1(_L("Starting concurrency tests")); |
|
1088 |
|
1089 INFO_PRINTF1(_L("Testing queued requests")); |
|
1090 INFO_PRINTF1(_L("Testing non-queued self test")); |
|
1091 CRequestWaiter* stateRequest = new (ELeave) CRequestWaiter(); |
|
1092 CleanupStack::PushL(stateRequest); |
|
1093 stateAdaptation->RequestCoopSysSelfTest(stateRequest->iStatus); |
|
1094 TEST(stateRequest->iStatus == KRequestPending); |
|
1095 stateRequest->SetActive(); |
|
1096 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteSelftests); |
|
1097 |
|
1098 INFO_PRINTF1(_L("Testing queueing unset wakeup alarm")); |
|
1099 CRequestWaiter* rtcRequest = new (ELeave) CRequestWaiter(); |
|
1100 CleanupStack::PushL(rtcRequest); |
|
1101 rtcAdaptation->UnsetWakeupAlarm(rtcRequest->iStatus); |
|
1102 TEST(rtcRequest->iStatus == KRequestPending); |
|
1103 rtcRequest->SetActive(); |
|
1104 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteSelftests); |
|
1105 |
|
1106 CRequestWaiter* busyRequest = new (ELeave) CRequestWaiter(); |
|
1107 CleanupStack::PushL(busyRequest); |
|
1108 |
|
1109 INFO_PRINTF1(_L("Testing busy response on state adaptation APIs")); |
|
1110 stateAdaptation->RequestCoopSysPerformRestartActions(0, busyRequest->iStatus); |
|
1111 busyRequest->StartWait(); |
|
1112 TEST(busyRequest->iStatus == KErrInUse); |
|
1113 |
|
1114 stateAdaptation->RequestCoopSysPerformRfsActions(ESsmShallowRfs, busyRequest->iStatus); |
|
1115 busyRequest->StartWait(); |
|
1116 TEST(busyRequest->iStatus == KErrInUse); |
|
1117 |
|
1118 stateAdaptation->RequestCoopSysSelfTest(busyRequest->iStatus); |
|
1119 busyRequest->StartWait(); |
|
1120 TEST(busyRequest->iStatus == KErrInUse); |
|
1121 |
|
1122 stateAdaptation->RequestCoopSysPerformShutdownActions(0, busyRequest->iStatus); |
|
1123 busyRequest->StartWait(); |
|
1124 TEST(busyRequest->iStatus == KErrInUse); |
|
1125 |
|
1126 TSsmState state; |
|
1127 stateAdaptation->RequestCoopSysStateChange(state, busyRequest->iStatus); |
|
1128 busyRequest->StartWait(); |
|
1129 TEST(busyRequest->iStatus == KErrInUse); |
|
1130 |
|
1131 INFO_PRINTF1(_L("Testing cancelling dispatched request with queue")); |
|
1132 stateAdaptation->RequestCancel(); |
|
1133 stateRequest->StartWait(); |
|
1134 TEST(stateRequest->iStatus == KErrCancel); |
|
1135 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::ECancelWakeupAlarm); |
|
1136 |
|
1137 INFO_PRINTF1(_L("Testing queueing activate rf for emergency calls")); |
|
1138 CRequestWaiter* ecrfRequest = new (ELeave) CRequestWaiter(); |
|
1139 CleanupStack::PushL(ecrfRequest); |
|
1140 ecrfAdaptation->ActivateRfForEmergencyCall(ecrfRequest->iStatus); |
|
1141 TEST(ecrfRequest->iStatus == KRequestPending); |
|
1142 ecrfRequest->SetActive(); |
|
1143 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::ECancelWakeupAlarm); |
|
1144 |
|
1145 INFO_PRINTF1(_L("Testing queueing sim owned status")); |
|
1146 CRequestWaiter* simRequest = new (ELeave) CRequestWaiter(); |
|
1147 CleanupStack::PushL(simRequest); |
|
1148 TPckgBuf<TBool> simOwnedPckg; |
|
1149 simAdaptation->GetSimOwned(simOwnedPckg, simRequest->iStatus); |
|
1150 TEST(simRequest->iStatus == KRequestPending); |
|
1151 simRequest->SetActive(); |
|
1152 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::ECancelWakeupAlarm); |
|
1153 |
|
1154 INFO_PRINTF1(_L("Testing queueing get startup mode")); |
|
1155 TPckgBuf<TInt> startupModePckg; |
|
1156 CRequestWaiter* miscRequest = new (ELeave) CRequestWaiter(); |
|
1157 CleanupStack::PushL(miscRequest); |
|
1158 miscAdaptation->GetGlobalStartupMode(startupModePckg, miscRequest->iStatus); |
|
1159 TEST(miscRequest->iStatus == KRequestPending); |
|
1160 miscRequest->SetActive(); |
|
1161 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::ECancelWakeupAlarm); |
|
1162 |
|
1163 INFO_PRINTF1(_L("Testing cancelling queued request (get startup mode)")); |
|
1164 miscAdaptation->Cancel(); |
|
1165 miscRequest->StartWait(); |
|
1166 TEST(miscRequest->iStatus == KErrCancel); |
|
1167 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::ECancelWakeupAlarm); |
|
1168 |
|
1169 INFO_PRINTF1(_L("Testing re-queueing get startup mode")); |
|
1170 miscAdaptation->GetGlobalStartupMode(startupModePckg, miscRequest->iStatus); |
|
1171 TEST(miscRequest->iStatus == KRequestPending); |
|
1172 miscRequest->SetActive(); |
|
1173 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::ECancelWakeupAlarm); |
|
1174 |
|
1175 INFO_PRINTF1(_L("Testing busy response on non-state adaptation APIs")); |
|
1176 TBuf8<1> nullBuf; |
|
1177 |
|
1178 INFO_PRINTF1(_L("Testing busy response on SIM adaptation APIs")); |
|
1179 simAdaptation->GetSimOwned(nullBuf, busyRequest->iStatus); |
|
1180 busyRequest->StartWait(); |
|
1181 TEST(busyRequest->iStatus == KErrInUse); |
|
1182 |
|
1183 INFO_PRINTF1(_L("Testing busy response on RTC adaptation APIs")); |
|
1184 rtcAdaptation->SetWakeupAlarm(nullBuf, busyRequest->iStatus); |
|
1185 busyRequest->StartWait(); |
|
1186 TEST(busyRequest->iStatus == KErrInUse); |
|
1187 |
|
1188 rtcAdaptation->UnsetWakeupAlarm(busyRequest->iStatus); |
|
1189 busyRequest->StartWait(); |
|
1190 TEST(busyRequest->iStatus == KErrInUse); |
|
1191 |
|
1192 rtcAdaptation->ValidateRtc(nullBuf, busyRequest->iStatus); |
|
1193 busyRequest->StartWait(); |
|
1194 TEST(busyRequest->iStatus == KErrInUse); |
|
1195 |
|
1196 INFO_PRINTF1(_L("Testing busy response on emergency call RF adaptation APIs")); |
|
1197 ecrfAdaptation->ActivateRfForEmergencyCall(busyRequest->iStatus); |
|
1198 busyRequest->StartWait(); |
|
1199 TEST(busyRequest->iStatus == KErrInUse); |
|
1200 |
|
1201 ecrfAdaptation->DeactivateRfForEmergencyCall(busyRequest->iStatus); |
|
1202 busyRequest->StartWait(); |
|
1203 TEST(busyRequest->iStatus == KErrInUse); |
|
1204 |
|
1205 INFO_PRINTF1(_L("Testing busy response on misc adaptation APIs")); |
|
1206 miscAdaptation->GetGlobalStartupMode(nullBuf, busyRequest->iStatus); |
|
1207 busyRequest->StartWait(); |
|
1208 TEST(busyRequest->iStatus == KErrInUse); |
|
1209 |
|
1210 miscAdaptation->PrepareSimLanguages(EPrimaryLanguages, nullBuf, busyRequest->iStatus); |
|
1211 busyRequest->StartWait(); |
|
1212 TEST(busyRequest->iStatus == KErrInUse); |
|
1213 |
|
1214 miscAdaptation->SecurityStateChange(0, nullBuf, busyRequest->iStatus); |
|
1215 busyRequest->StartWait(); |
|
1216 TEST(busyRequest->iStatus == KErrInUse); |
|
1217 |
|
1218 INFO_PRINTF1(_L("Finished busy response testing")); |
|
1219 |
|
1220 INFO_PRINTF1(_L("Completing wakeup alarm request")); |
|
1221 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::ECancelWakeupAlarm); |
|
1222 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::ECancelWakeupAlarm, nullBuf); |
|
1223 rtcRequest->StartWait(); |
|
1224 TEST(rtcRequest->iStatus == KErrNone); |
|
1225 |
|
1226 INFO_PRINTF1(_L("Completing active rf request")); |
|
1227 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EActivateRfForEmergencyCall); |
|
1228 StartupAdaptation::TResponsePckg okResponse(KErrNone); |
|
1229 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EActivateRfForEmergencyCall, okResponse); |
|
1230 ecrfRequest->StartWait(); |
|
1231 TEST(ecrfRequest->iStatus == KErrNone); |
|
1232 |
|
1233 INFO_PRINTF1(_L("Testing queued self test")); |
|
1234 stateAdaptation->RequestCoopSysSelfTest(stateRequest->iStatus); |
|
1235 TEST(stateRequest->iStatus == KRequestPending); |
|
1236 stateRequest->SetActive(); |
|
1237 |
|
1238 INFO_PRINTF1(_L("Completing sim owned request")); |
|
1239 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetSimOwned); |
|
1240 StartupAdaptation::TBooleanResponsePckg booleanResponsePckg; |
|
1241 booleanResponsePckg().iErrorCode = KErrNone; |
|
1242 booleanResponsePckg().iValue = ETrue; |
|
1243 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetSimOwned, booleanResponsePckg); |
|
1244 simRequest->StartWait(); |
|
1245 TEST(simRequest->iStatus == KErrNone); |
|
1246 TEST(simOwnedPckg()); |
|
1247 |
|
1248 INFO_PRINTF1(_L("Completing get startup mode request")); |
|
1249 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetGlobalStartupMode); |
|
1250 StartupAdaptation::TGlobalStartupModeResponsePckg startupModeResponsePckg; |
|
1251 startupModeResponsePckg().iErrorCode = KErrNone; |
|
1252 startupModeResponsePckg().iValue = StartupAdaptation::ECharging; |
|
1253 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetGlobalStartupMode, startupModeResponsePckg); |
|
1254 miscRequest->StartWait(); |
|
1255 TEST(miscRequest->iStatus == KErrNone); |
|
1256 TEST(startupModePckg() == StartupAdaptation::ECharging); |
|
1257 |
|
1258 INFO_PRINTF1(_L("Completing self test request")); |
|
1259 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteSelftests); |
|
1260 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EExecuteSelftests, okResponse); |
|
1261 stateRequest->StartWait(); |
|
1262 TEST(stateRequest->iStatus == KErrNone); |
|
1263 |
|
1264 INFO_PRINTF1(_L("Testing notify coop sys events, remembering fatal event from SIM test")); |
|
1265 TPckgBuf<TSsmCoopSysEventType> eventBuf; |
|
1266 stateAdaptation->NotifyCoopSysEvent(eventBuf, stateRequest->iStatus); |
|
1267 stateRequest->StartWait(); |
|
1268 TEST(stateRequest->iStatus == KErrNone); |
|
1269 TEST(eventBuf() == ESsmFatalCoopSysError); |
|
1270 |
|
1271 INFO_PRINTF1(_L("Testing queued events for state adaptation")); |
|
1272 StartupAdaptation::TFatalErrorTypePckg fatalErrorPckg(StartupAdaptation::EUnclassifiedError); |
|
1273 CStartupAdaptationWrapper::TriggerObserverEventCallbackL(StartupAdaptation::EFatalError, fatalErrorPckg); |
|
1274 |
|
1275 TBuf8<1> emptyBuf; |
|
1276 CStartupAdaptationWrapper::TriggerObserverEventCallbackL(StartupAdaptation::EDOSOriginatedShutdown, emptyBuf); |
|
1277 |
|
1278 stateAdaptation->NotifyCoopSysEvent(eventBuf, stateRequest->iStatus); |
|
1279 stateRequest->StartWait(); |
|
1280 TEST(stateRequest->iStatus == KErrNone); |
|
1281 TEST(eventBuf() == ESsmFatalCoopSysError); |
|
1282 |
|
1283 stateAdaptation->NotifyCoopSysEvent(eventBuf, stateRequest->iStatus); |
|
1284 stateRequest->StartWait(); |
|
1285 TEST(stateRequest->iStatus == KErrNone); |
|
1286 TEST(eventBuf() == ESsmShutdownDevice); |
|
1287 |
|
1288 INFO_PRINTF1(_L("Testing queued events for SIM adaptation")); |
|
1289 |
|
1290 fatalErrorPckg() = StartupAdaptation::ESimRemoved; |
|
1291 CStartupAdaptationWrapper::TriggerObserverEventCallbackL(StartupAdaptation::EFatalError, fatalErrorPckg); |
|
1292 |
|
1293 StartupAdaptation::TSimEventTypePckg simEventTypePckg; |
|
1294 simEventTypePckg() = StartupAdaptation::ESimUsable; |
|
1295 CStartupAdaptationWrapper::TriggerObserverEventCallbackL(StartupAdaptation::ESimEvent, simEventTypePckg); |
|
1296 |
|
1297 fatalErrorPckg() = StartupAdaptation::ESimRemoved; |
|
1298 CStartupAdaptationWrapper::TriggerObserverEventCallbackL(StartupAdaptation::EFatalError, fatalErrorPckg); |
|
1299 |
|
1300 simEventTypePckg() = StartupAdaptation::ESimNotReady; |
|
1301 CStartupAdaptationWrapper::TriggerObserverEventCallbackL(StartupAdaptation::ESimEvent, simEventTypePckg); |
|
1302 |
|
1303 INFO_PRINTF1(_L("Testing removing queued SIM events")); |
|
1304 TPckgBuf<TSsmSimEventType> simEventPckg; |
|
1305 simAdaptation->NotifySimEvent(simEventPckg, simRequest->iStatus); |
|
1306 simRequest->StartWait(); |
|
1307 TEST(simRequest->iStatus == KErrNone); |
|
1308 TEST(simEventPckg() == ESsmSimRemoved); |
|
1309 |
|
1310 simAdaptation->NotifySimEvent(simEventPckg, simRequest->iStatus); |
|
1311 simRequest->StartWait(); |
|
1312 TEST(simRequest->iStatus == KErrNone); |
|
1313 TEST(simEventPckg() == ESsmSimUsable); |
|
1314 |
|
1315 simAdaptation->NotifySimEvent(simEventPckg, simRequest->iStatus); |
|
1316 simRequest->StartWait(); |
|
1317 TEST(simRequest->iStatus == KErrNone); |
|
1318 TEST(simEventPckg() == ESsmSimRemoved); |
|
1319 |
|
1320 simAdaptation->NotifySimEvent(simEventPckg, simRequest->iStatus); |
|
1321 simRequest->StartWait(); |
|
1322 TEST(simRequest->iStatus == KErrNone); |
|
1323 TEST(simEventPckg() == ESsmSimNotReady); |
|
1324 |
|
1325 INFO_PRINTF1(_L("End of test, tearing down")); |
|
1326 |
|
1327 CleanupStack::PopAndDestroy(miscRequest); |
|
1328 CleanupStack::PopAndDestroy(simRequest); |
|
1329 CleanupStack::PopAndDestroy(ecrfRequest); |
|
1330 CleanupStack::PopAndDestroy(busyRequest); |
|
1331 CleanupStack::PopAndDestroy(rtcRequest); |
|
1332 CleanupStack::PopAndDestroy(stateRequest); |
|
1333 |
|
1334 INFO_PRINTF1(_L("Releasing misc. adaptation")); |
|
1335 miscAdaptation->Release(); |
|
1336 miscAdaptation = NULL; |
|
1337 |
|
1338 INFO_PRINTF1(_L("Releasing emergency call rf adaptation")); |
|
1339 ecrfAdaptation->Release(); |
|
1340 ecrfAdaptation = NULL; |
|
1341 |
|
1342 INFO_PRINTF1(_L("Releasing RTC adaptation")); |
|
1343 rtcAdaptation->Release(); |
|
1344 rtcAdaptation = NULL; |
|
1345 |
|
1346 INFO_PRINTF1(_L("Releasing SIM adaptation")); |
|
1347 simAdaptation->Release(); |
|
1348 simAdaptation = NULL; |
|
1349 |
|
1350 INFO_PRINTF1(_L("Releasing state adaptation")); |
|
1351 stateAdaptation->Release(); |
|
1352 stateAdaptation = NULL; |
|
1353 |
|
1354 INFO_PRINTF1(_L("Heap check macro end")); |
|
1355 // Delete the test data buffer |
|
1356 CStartupAdaptationWrapper::DeleteLastCommandData(); |
|
1357 __UHEAP_MARKEND; |
|
1358 |
|
1359 INFO_PRINTF1(_L("Returning from doTestConcurrentRequestsL()")); |
|
1360 } |
|
1361 |
|
1362 /** |
|
1363 Old Test CaseID AFSS-CLAYER-0018 |
|
1364 New Test CaseID DEVSRVS-SSREFPLUGINS-CLAYER-0012 |
|
1365 */ |
|
1366 |
|
1367 void CCLayerTestStartupAdaptationAdapter::doTestOnDemandL() |
|
1368 { |
|
1369 INFO_PRINTF1(_L("Enterting doTestOnDemandRequestsL()")); |
|
1370 |
|
1371 INFO_PRINTF1(_L("Setting up adaptation classes")); |
|
1372 |
|
1373 INFO_PRINTF1(_L("Creating state adaptation")); |
|
1374 MStateAdaptation* stateAdaptation = CStartupAdaptationAdapter::NewStateAdaptationL(); |
|
1375 TEST(stateAdaptation != NULL); |
|
1376 if(stateAdaptation == NULL) |
|
1377 { |
|
1378 INFO_PRINTF1(_L("Failed to create state adaptation")); |
|
1379 return; |
|
1380 } |
|
1381 |
|
1382 INFO_PRINTF1(_L("Creating SIM adaptation")); |
|
1383 MSimAdaptation* simAdaptation = CStartupAdaptationAdapter::NewSimAdaptationL(); |
|
1384 TEST(simAdaptation != NULL); |
|
1385 if(simAdaptation == NULL) |
|
1386 { |
|
1387 INFO_PRINTF1(_L("Failed to create SIM adaptation")); |
|
1388 return; |
|
1389 } |
|
1390 |
|
1391 INFO_PRINTF1(_L("Creating RTC adaptation")); |
|
1392 MRtcAdaptation* rtcAdaptation = CStartupAdaptationAdapter::NewRtcAdaptationL(); |
|
1393 TEST(rtcAdaptation != NULL); |
|
1394 if(rtcAdaptation == NULL) |
|
1395 { |
|
1396 INFO_PRINTF1(_L("Failed to create RTC adaptation")); |
|
1397 return; |
|
1398 } |
|
1399 |
|
1400 INFO_PRINTF1(_L("Creating emergency call rf adaptation")); |
|
1401 MEmergencyCallRfAdaptation* ecrfAdaptation = CStartupAdaptationAdapter::NewEmergencyCallRfAdaptationL(); |
|
1402 TEST(ecrfAdaptation != NULL); |
|
1403 if(ecrfAdaptation == NULL) |
|
1404 { |
|
1405 INFO_PRINTF1(_L("Failed to create emergency call rf adaptation")); |
|
1406 return; |
|
1407 } |
|
1408 |
|
1409 INFO_PRINTF1(_L("Creating misc. adaptation")); |
|
1410 MMiscAdaptation* miscAdaptation = CStartupAdaptationAdapter::NewMiscAdaptationL(); |
|
1411 TEST(miscAdaptation != NULL); |
|
1412 if(miscAdaptation == NULL) |
|
1413 { |
|
1414 INFO_PRINTF1(_L("Failed to create misc. adaptation")); |
|
1415 return; |
|
1416 } |
|
1417 |
|
1418 INFO_PRINTF1(_L("End of set up of adaptation classes")); |
|
1419 |
|
1420 INFO_PRINTF1(_L("Starting on demand tests")); |
|
1421 |
|
1422 INFO_PRINTF1(_L("Asseting adaptation isn't loaded")); |
|
1423 TEST(!CStartupAdaptationWrapper::IsLoaded()); |
|
1424 TEST(CStartupAdaptationWrapper::LastCommandId() == 0); |
|
1425 |
|
1426 CRequestWaiter* request = new (ELeave) CRequestWaiter(); |
|
1427 CleanupStack::PushL(request); |
|
1428 |
|
1429 INFO_PRINTF1(_L("Requesting self test")); |
|
1430 stateAdaptation->RequestCoopSysSelfTest(request->iStatus); |
|
1431 TEST(request->iStatus == KRequestPending); |
|
1432 //Signal completion |
|
1433 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteSelftests); |
|
1434 StartupAdaptation::TResponsePckg okResponse(KErrNone); |
|
1435 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EExecuteSelftests, okResponse); |
|
1436 request->StartWait(); |
|
1437 |
|
1438 TEST(request->iStatus == KErrNone); |
|
1439 |
|
1440 CleanupStack::PopAndDestroy(request); |
|
1441 |
|
1442 INFO_PRINTF1(_L("Asseting adaptation is loaded")); |
|
1443 TEST(CStartupAdaptationWrapper::IsLoaded()); |
|
1444 |
|
1445 INFO_PRINTF1(_L("End of test, tearing down")); |
|
1446 |
|
1447 INFO_PRINTF1(_L("Releasing misc. adaptation")); |
|
1448 miscAdaptation->Release(); |
|
1449 miscAdaptation = NULL; |
|
1450 |
|
1451 INFO_PRINTF1(_L("Releasing emergency call rf adaptation")); |
|
1452 ecrfAdaptation->Release(); |
|
1453 ecrfAdaptation = NULL; |
|
1454 |
|
1455 INFO_PRINTF1(_L("Releasing RTC adaptation")); |
|
1456 rtcAdaptation->Release(); |
|
1457 rtcAdaptation = NULL; |
|
1458 |
|
1459 INFO_PRINTF1(_L("Releasing SIM adaptation")); |
|
1460 simAdaptation->Release(); |
|
1461 simAdaptation = NULL; |
|
1462 |
|
1463 INFO_PRINTF1(_L("Releasing state adaptation")); |
|
1464 stateAdaptation->Release(); |
|
1465 stateAdaptation = NULL; |
|
1466 |
|
1467 // Delete the test data buffer |
|
1468 CStartupAdaptationWrapper::DeleteLastCommandData(); |
|
1469 |
|
1470 INFO_PRINTF1(_L("Returning from doTestOnDemandRequestsL()")); |
|
1471 } |
|
1472 |
|
1473 /** |
|
1474 * Tests the state mappings are correct. Used by DoTestStateAdaptation(). |
|
1475 * |
|
1476 * @test |
|
1477 * @internalComponent |
|
1478 */ |
|
1479 void CCLayerTestStartupAdaptationAdapter::doTestStateChangeMappingsL(MStateAdaptation* aStateAdapt) |
|
1480 { |
|
1481 /* We need to check the mappings for every member of StartupAdaptation::TGlobalState |
|
1482 * |
|
1483 * The substate is represented by the enum state value with the following adjustments: |
|
1484 * * minus ESWStateStartingUiServices - to have values starting from 0 |
|
1485 * * add ESsmStartupSubStateCriticalStatic - to base the state values from the critical static state |
|
1486 * |
|
1487 * Mapping is as follows: |
|
1488 * |
|
1489 * ESWStateStartingUiServices = TSsmState(ESsmStartup, ESWStateStartingUiServices - ESWStateStartingUiServices + ESsmStartupSubStateNonCritical); |
|
1490 * ESWStateStartingCriticalApps = TSsmState(ESsmStartup, ESWStateStartingCriticalApps - ESWStateStartingUiServices + ESsmStartupSubStateNonCritical); |
|
1491 * ESWStateSelfTestOK = TSsmState(ESsmStartup, ESWStateSelfTestOK - ESWStateStartingUiServices + ESsmStartupSubStateNonCritical); |
|
1492 * // States for the security check phase. |
|
1493 * ESWStateSecurityCheck = TSsmState(ESsmStartup, ESWStateSecurityCheck - ESWStateStartingUiServices + ESsmStartupSubStateNonCritical); |
|
1494 * ESWStateCriticalPhaseOK = TSsmState(ESsmStartup, ESWStateCriticalPhaseOK - ESWStateStartingUiServices + ESsmStartupSubStateNonCritical); |
|
1495 * ESWStateEmergencyCallsOnly = TSsmState(ESsmStartup, ESWStateEmergencyCallsOnly - ESWStateStartingUiServices + ESsmStartupSubStateNonCritical); |
|
1496 * // Terminal states defined by the boot mode (and some other variables such as offline mode). |
|
1497 * ESWStateTest = TSsmState(ESsmStartup, ESWStateTest - ESWStateStartingUiServices + ESsmStartupSubStateNonCritical); |
|
1498 * ESWStateCharging = TSsmState(ESsmStartup, ESWStateCharging - ESWStateStartingUiServices + ESsmStartupSubStateNonCritical); |
|
1499 * ESWStateAlarm = TSsmState(ESsmStartup, ESWStateAlarm - ESWStateStartingUiServices + ESsmStartupSubStateNonCritical); |
|
1500 * ESWStateNormalRfOn = TSsmState(ESsmNormal, ESWStateNormalRfOn - ESWStateStartingUiServices + ESsmStartupSubStateCriticalStatic); |
|
1501 * ESWStateNormalRfOff = TSsmState(ESsmNormal, ESWStateNormalRfOff - ESWStateStartingUiServices + ESsmStartupSubStateCriticalStatic); |
|
1502 * ESWStateNormalBTSap = TSsmState(ESsmNormal, ESWStateNormalBTSap - ESWStateStartingUiServices + ESsmStartupSubStateCriticalStatic); |
|
1503 * // States for notifying adaptation about a terminal state change. |
|
1504 * ESWStateAlarmToCharging = TSsmState(ESsmStartup, ESWStateAlarmToCharging - ESWStateStartingUiServices + ESsmStartupSubStateNonCritical); |
|
1505 * ESWStateChargingToAlarm = TSsmState(ESsmStartup, ESWStateChargingToAlarm - ESWStateStartingUiServices + ESsmStartupSubStateNonCritical); |
|
1506 * ESWStateChargingToNormal = TSsmState(ESsmStartup, ESWStateChargingToNormal - ESWStateStartingUiServices + ESsmStartupSubStateNonCritical); |
|
1507 * ESWStateAlarmToNormal = TSsmState(ESsmStartup, ESWStateAlarmToNormal - ESWStateStartingUiServices + ESsmStartupSubStateNonCritical); |
|
1508 * // Shutdown-related states. |
|
1509 * ESWStateShuttingDown = TSsmState(ESsmShutdown, KSsmAnySubState); |
|
1510 * // Error states during critical phase. |
|
1511 * ESWStateFatalStartupError = TSsmState(ESsmFail, KSsmAnySubState); |
|
1512 */ |
|
1513 |
|
1514 CRequestWaiter* request = new (ELeave) CRequestWaiter(); |
|
1515 CleanupStack::PushL(request); |
|
1516 |
|
1517 TSsmState state; |
|
1518 StartupAdaptation::TGlobalStateChangePckg globalStatePckg; |
|
1519 StartupAdaptation::TResponsePckg okResponse(KErrNone); |
|
1520 const TInt KStartupRebaseValue = static_cast<TInt>(StartupAdaptation::ESWStateStartingUiServices) |
|
1521 - static_cast<TInt>(ESsmStartupSubStateNonCritical); |
|
1522 const TInt KNormalRebaseValue = static_cast<TInt>(StartupAdaptation::ESWStateStartingUiServices) |
|
1523 - static_cast<TInt>(ESsmStartupSubStateCriticalStatic); |
|
1524 // Import startup adaptation namespace |
|
1525 using namespace StartupAdaptation; |
|
1526 |
|
1527 INFO_PRINTF1(_L("Testing state remapping for ESWStateStartingUiServices")); |
|
1528 state.Set(ESsmStartup, ESWStateStartingUiServices - KStartupRebaseValue); |
|
1529 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1530 TEST(request->iStatus == KRequestPending); |
|
1531 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1532 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1533 TEST(globalStatePckg() == ESWStateStartingUiServices); |
|
1534 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1535 request->StartWait(); |
|
1536 TEST(request->iStatus == KErrNone); |
|
1537 |
|
1538 INFO_PRINTF1(_L("Testing state remapping for ESWStateStartingCriticalApps")); |
|
1539 state.Set(ESsmStartup, ESWStateStartingCriticalApps - KStartupRebaseValue); |
|
1540 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1541 TEST(request->iStatus == KRequestPending); |
|
1542 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1543 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1544 TEST(globalStatePckg() == ESWStateStartingCriticalApps); |
|
1545 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1546 request->StartWait(); |
|
1547 TEST(request->iStatus == KErrNone); |
|
1548 |
|
1549 |
|
1550 INFO_PRINTF1(_L("Testing state remapping for ESWStateSelfTestOK")); |
|
1551 state.Set(ESsmStartup, ESWStateSelfTestOK - KStartupRebaseValue); |
|
1552 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1553 TEST(request->iStatus == KRequestPending); |
|
1554 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1555 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1556 TEST(globalStatePckg() == ESWStateSelfTestOK); |
|
1557 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1558 request->StartWait(); |
|
1559 TEST(request->iStatus == KErrNone); |
|
1560 |
|
1561 |
|
1562 INFO_PRINTF1(_L("Testing state remapping for ESWStateSecurityCheck")); |
|
1563 state.Set(ESsmStartup, ESWStateSecurityCheck - KStartupRebaseValue); |
|
1564 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1565 TEST(request->iStatus == KRequestPending); |
|
1566 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1567 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1568 TEST(globalStatePckg() == ESWStateSecurityCheck); |
|
1569 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1570 request->StartWait(); |
|
1571 TEST(request->iStatus == KErrNone); |
|
1572 |
|
1573 |
|
1574 INFO_PRINTF1(_L("Testing state remapping for ESWStateCriticalPhaseOK")); |
|
1575 state.Set(ESsmStartup, ESWStateCriticalPhaseOK - KStartupRebaseValue); |
|
1576 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1577 TEST(request->iStatus == KRequestPending); |
|
1578 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1579 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1580 TEST(globalStatePckg() == ESWStateCriticalPhaseOK); |
|
1581 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1582 request->StartWait(); |
|
1583 TEST(request->iStatus == KErrNone); |
|
1584 |
|
1585 |
|
1586 INFO_PRINTF1(_L("Testing state remapping for ESWStateEmergencyCallsOnly")); |
|
1587 state.Set(ESsmStartup, ESWStateEmergencyCallsOnly - KStartupRebaseValue); |
|
1588 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1589 TEST(request->iStatus == KRequestPending); |
|
1590 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1591 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1592 TEST(globalStatePckg() == ESWStateEmergencyCallsOnly); |
|
1593 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1594 request->StartWait(); |
|
1595 TEST(request->iStatus == KErrNone); |
|
1596 |
|
1597 |
|
1598 INFO_PRINTF1(_L("Testing state remapping for ESWStateTest")); |
|
1599 state.Set(ESsmStartup, ESWStateTest - KStartupRebaseValue); |
|
1600 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1601 TEST(request->iStatus == KRequestPending); |
|
1602 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1603 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1604 TEST(globalStatePckg() == ESWStateTest); |
|
1605 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1606 request->StartWait(); |
|
1607 TEST(request->iStatus == KErrNone); |
|
1608 |
|
1609 |
|
1610 INFO_PRINTF1(_L("Testing state remapping for ESWStateCharging")); |
|
1611 state.Set(ESsmStartup, ESWStateCharging - KStartupRebaseValue); |
|
1612 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1613 TEST(request->iStatus == KRequestPending); |
|
1614 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1615 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1616 TEST(globalStatePckg() == ESWStateCharging); |
|
1617 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1618 request->StartWait(); |
|
1619 TEST(request->iStatus == KErrNone); |
|
1620 |
|
1621 |
|
1622 INFO_PRINTF1(_L("Testing state remapping for ESWStateAlarm")); |
|
1623 state.Set(ESsmStartup, ESWStateAlarm - KStartupRebaseValue); |
|
1624 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1625 TEST(request->iStatus == KRequestPending); |
|
1626 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1627 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1628 TEST(globalStatePckg() == ESWStateAlarm); |
|
1629 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1630 request->StartWait(); |
|
1631 TEST(request->iStatus == KErrNone); |
|
1632 |
|
1633 INFO_PRINTF1(_L("Testing state remapping for ESWStateNormalRfOn")); |
|
1634 state.Set(ESsmNormal, ESWStateNormalRfOn - KNormalRebaseValue); |
|
1635 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1636 TEST(request->iStatus == KRequestPending); |
|
1637 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1638 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1639 TEST(globalStatePckg() == ESWStateNormalRfOn); |
|
1640 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1641 request->StartWait(); |
|
1642 TEST(request->iStatus == KErrNone); |
|
1643 |
|
1644 |
|
1645 INFO_PRINTF1(_L("Testing state remapping for ESWStateNormalRfOff")); |
|
1646 state.Set(ESsmNormal, ESWStateNormalRfOff - KNormalRebaseValue); |
|
1647 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1648 TEST(request->iStatus == KRequestPending); |
|
1649 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1650 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1651 TEST(globalStatePckg() == ESWStateNormalRfOff); |
|
1652 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1653 request->StartWait(); |
|
1654 TEST(request->iStatus == KErrNone); |
|
1655 |
|
1656 |
|
1657 INFO_PRINTF1(_L("Testing state remapping for ESWStateNormalBTSap")); |
|
1658 state.Set(ESsmNormal, ESWStateNormalBTSap - KNormalRebaseValue); |
|
1659 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1660 TEST(request->iStatus == KRequestPending); |
|
1661 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1662 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1663 TEST(globalStatePckg() == ESWStateNormalBTSap); |
|
1664 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1665 request->StartWait(); |
|
1666 TEST(request->iStatus == KErrNone); |
|
1667 |
|
1668 |
|
1669 INFO_PRINTF1(_L("Testing state remapping for ESWStateAlarmToNormal")); |
|
1670 state.Set(ESsmStartup, ESWStateAlarmToNormal - KStartupRebaseValue); |
|
1671 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1672 TEST(request->iStatus == KRequestPending); |
|
1673 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1674 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1675 TEST(globalStatePckg() == ESWStateAlarmToNormal); |
|
1676 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1677 request->StartWait(); |
|
1678 TEST(request->iStatus == KErrNone); |
|
1679 |
|
1680 |
|
1681 INFO_PRINTF1(_L("Testing state remapping for ESWStateAlarmToCharging")); |
|
1682 state.Set(ESsmStartup, ESWStateAlarmToCharging - KStartupRebaseValue); |
|
1683 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1684 TEST(request->iStatus == KRequestPending); |
|
1685 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1686 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1687 TEST(globalStatePckg() == ESWStateAlarmToCharging); |
|
1688 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1689 request->StartWait(); |
|
1690 TEST(request->iStatus == KErrNone); |
|
1691 |
|
1692 |
|
1693 INFO_PRINTF1(_L("Testing state remapping for ESWStateChargingToAlarm")); |
|
1694 state.Set(ESsmStartup, ESWStateChargingToAlarm - KStartupRebaseValue); |
|
1695 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1696 TEST(request->iStatus == KRequestPending); |
|
1697 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1698 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1699 TEST(globalStatePckg() == ESWStateChargingToAlarm); |
|
1700 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1701 request->StartWait(); |
|
1702 TEST(request->iStatus == KErrNone); |
|
1703 |
|
1704 |
|
1705 INFO_PRINTF1(_L("Testing state remapping for ESWStateChargingToNormal")); |
|
1706 state.Set(ESsmStartup, ESWStateChargingToNormal - KStartupRebaseValue); |
|
1707 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1708 TEST(request->iStatus == KRequestPending); |
|
1709 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1710 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1711 TEST(globalStatePckg() == ESWStateChargingToNormal); |
|
1712 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1713 request->StartWait(); |
|
1714 TEST(request->iStatus == KErrNone); |
|
1715 |
|
1716 |
|
1717 INFO_PRINTF1(_L("Testing state remapping for ESWStateShuttingDown")); |
|
1718 state.Set(ESsmShutdown, KSsmAnySubState); |
|
1719 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1720 TEST(request->iStatus == KRequestPending); |
|
1721 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1722 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1723 TEST(globalStatePckg() == ESWStateShuttingDown); |
|
1724 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1725 request->StartWait(); |
|
1726 TEST(request->iStatus == KErrNone); |
|
1727 |
|
1728 INFO_PRINTF1(_L("Testing state remapping for ESWStateFatalStartupError")); |
|
1729 state.Set(ESsmFail, KSsmAnySubState); |
|
1730 aStateAdapt->RequestCoopSysStateChange(state, request->iStatus); |
|
1731 TEST(request->iStatus == KRequestPending); |
|
1732 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGlobalStateChange); |
|
1733 globalStatePckg.Copy(*CStartupAdaptationWrapper::LastCommandData()); |
|
1734 TEST(globalStatePckg() == ESWStateFatalStartupError); |
|
1735 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGlobalStateChange, okResponse); |
|
1736 request->StartWait(); |
|
1737 TEST(request->iStatus == KErrNone); |
|
1738 |
|
1739 CleanupStack::PopAndDestroy(request); |
|
1740 } |
|
1741 |
|
1742 // declare exported functions for test AFSS-CLAYER-0019 |
|
1743 MEmergencyCallRfAdaptation* CreateEmergencyCallRfAdaptationL(void); |
|
1744 MMiscAdaptation* CreateMiscAdaptationL(void); |
|
1745 MRtcAdaptation* CreateRtcAdaptationL(void); |
|
1746 MSimAdaptation* CreateSimAdaptationL(void); |
|
1747 MStateAdaptation* CreateStateAdaptationL(void); |
|
1748 |
|
1749 /** |
|
1750 Old Test CaseID AFSS-CLAYER-0019 |
|
1751 New Test CaseID DEVSRVS-SSREFPLUGINS-CLAYER-0012 |
|
1752 */ |
|
1753 |
|
1754 void CCLayerTestStartupAdaptationAdapter::doTestCreationAndDestructionL() |
|
1755 { |
|
1756 INFO_PRINTF1(_L("Entering test for creation and destruction of adaptations")); |
|
1757 |
|
1758 __UHEAP_MARK; |
|
1759 INFO_PRINTF1(_L("Requesting Emergency Call Rf Adaptation")); |
|
1760 MEmergencyCallRfAdaptation* ecrfAdaptation = CreateEmergencyCallRfAdaptationL(); |
|
1761 TEST(ecrfAdaptation != NULL); |
|
1762 |
|
1763 INFO_PRINTF1(_L("Requesting Misc Adaptation")); |
|
1764 MMiscAdaptation* miscAdaptation = CreateMiscAdaptationL(); |
|
1765 TEST(miscAdaptation != NULL); |
|
1766 |
|
1767 INFO_PRINTF1(_L("Requesting RTC Adaptation")); |
|
1768 MRtcAdaptation* rtcAdaptation = CreateRtcAdaptationL(); |
|
1769 TEST(rtcAdaptation != NULL); |
|
1770 |
|
1771 INFO_PRINTF1(_L("Requesting SIM Adaptation")); |
|
1772 MSimAdaptation* simAdaptation = CreateSimAdaptationL(); |
|
1773 TEST(simAdaptation != NULL); |
|
1774 |
|
1775 INFO_PRINTF1(_L("Requesting State Adaptation")); |
|
1776 MStateAdaptation* stateAdaptation = CreateStateAdaptationL(); |
|
1777 TEST(stateAdaptation != NULL); |
|
1778 |
|
1779 INFO_PRINTF1(_L("Releasing Emergency Call Rf Adaptation")); |
|
1780 ecrfAdaptation->Release(); |
|
1781 |
|
1782 INFO_PRINTF1(_L("Releasing Misc Adaptation")); |
|
1783 miscAdaptation->Release(); |
|
1784 |
|
1785 INFO_PRINTF1(_L("Releasing RTC Adaptation")); |
|
1786 rtcAdaptation->Release(); |
|
1787 |
|
1788 INFO_PRINTF1(_L("Releasing SIM Adaptation")); |
|
1789 simAdaptation->Release(); |
|
1790 |
|
1791 INFO_PRINTF1(_L("Releasing State Adaptation")); |
|
1792 stateAdaptation->Release(); |
|
1793 |
|
1794 INFO_PRINTF1(_L("Destroying CStartupAdaptationAdapter")); |
|
1795 CStartupAdaptationAdapter::Destroy(); |
|
1796 |
|
1797 INFO_PRINTF1(_L("Checking for memory leaks")); |
|
1798 __UHEAP_MARKEND; |
|
1799 |
|
1800 INFO_PRINTF1(_L("Leaving test for creation and destruction of adaptations")); |
|
1801 } |
|
1802 |
|
1803 /** |
|
1804 Old Test CaseID AFSS-CLAYER-0026 |
|
1805 New Test CaseID DEVSRVS-SSREFPLUGINS-CLAYER-0012 |
|
1806 */ |
|
1807 |
|
1808 |
|
1809 void CCLayerTestStartupAdaptationAdapter::doTestMultipleRequestsL() |
|
1810 { |
|
1811 INFO_PRINTF1(_L("Enterting doTestOnDemandRequestsL()")); |
|
1812 |
|
1813 INFO_PRINTF1(_L("Setting up adaptation classes")); |
|
1814 |
|
1815 INFO_PRINTF1(_L("Creating state adaptation")); |
|
1816 MStateAdaptation* stateAdaptation = CStartupAdaptationAdapter::NewStateAdaptationL(); |
|
1817 TEST(stateAdaptation != NULL); |
|
1818 if(stateAdaptation == NULL) |
|
1819 { |
|
1820 INFO_PRINTF1(_L("Failed to create state adaptation")); |
|
1821 return; |
|
1822 } |
|
1823 |
|
1824 INFO_PRINTF1(_L("Creating SIM adaptation")); |
|
1825 MSimAdaptation* simAdaptation = CStartupAdaptationAdapter::NewSimAdaptationL(); |
|
1826 TEST(simAdaptation != NULL); |
|
1827 if(simAdaptation == NULL) |
|
1828 { |
|
1829 INFO_PRINTF1(_L("Failed to create SIM adaptation")); |
|
1830 return; |
|
1831 } |
|
1832 |
|
1833 INFO_PRINTF1(_L("Creating RTC adaptation")); |
|
1834 MRtcAdaptation* rtcAdaptation = CStartupAdaptationAdapter::NewRtcAdaptationL(); |
|
1835 TEST(rtcAdaptation != NULL); |
|
1836 if(rtcAdaptation == NULL) |
|
1837 { |
|
1838 INFO_PRINTF1(_L("Failed to create RTC adaptation")); |
|
1839 return; |
|
1840 } |
|
1841 |
|
1842 INFO_PRINTF1(_L("Creating emergency call rf adaptation")); |
|
1843 MEmergencyCallRfAdaptation* ecrfAdaptation = CStartupAdaptationAdapter::NewEmergencyCallRfAdaptationL(); |
|
1844 TEST(ecrfAdaptation != NULL); |
|
1845 if(ecrfAdaptation == NULL) |
|
1846 { |
|
1847 INFO_PRINTF1(_L("Failed to create emergency call rf adaptation")); |
|
1848 return; |
|
1849 } |
|
1850 |
|
1851 INFO_PRINTF1(_L("Creating misc. adaptation")); |
|
1852 MMiscAdaptation* miscAdaptation = CStartupAdaptationAdapter::NewMiscAdaptationL(); |
|
1853 TEST(miscAdaptation != NULL); |
|
1854 if(miscAdaptation == NULL) |
|
1855 { |
|
1856 INFO_PRINTF1(_L("Failed to create misc. adaptation")); |
|
1857 return; |
|
1858 } |
|
1859 |
|
1860 INFO_PRINTF1(_L("End of set up of adaptation classes")); |
|
1861 |
|
1862 |
|
1863 // State |
|
1864 INFO_PRINTF1(_L("Requesting first self test")); |
|
1865 CRequestWaiter* stateRequest = new (ELeave) CRequestWaiter(); |
|
1866 CleanupStack::PushL(stateRequest); |
|
1867 stateAdaptation->RequestCoopSysSelfTest(stateRequest->iStatus); |
|
1868 TEST(stateRequest->iStatus == KRequestPending); |
|
1869 stateRequest->SetActive(); |
|
1870 |
|
1871 INFO_PRINTF1(_L("Requesting first event notification")); |
|
1872 CRequestWaiter* eventStateRequest = new (ELeave) CRequestWaiter(); |
|
1873 CleanupStack::PushL(eventStateRequest); |
|
1874 TBuf8<1> emptyBuf; |
|
1875 stateAdaptation->NotifyCoopSysEvent(emptyBuf, eventStateRequest->iStatus); |
|
1876 TEST(eventStateRequest->iStatus == KRequestPending); |
|
1877 eventStateRequest->SetActive(); |
|
1878 |
|
1879 INFO_PRINTF1(_L("Requesting coop sys change, should fail")); |
|
1880 CRequestWaiter* request2 = new (ELeave) CRequestWaiter(); |
|
1881 CleanupStack::PushL(request2); |
|
1882 stateAdaptation->RequestCoopSysStateChange(TSsmState(0,0), request2->iStatus); |
|
1883 request2->StartWait(); |
|
1884 TEST(request2->iStatus == KErrInUse); |
|
1885 |
|
1886 INFO_PRINTF1(_L("Requesting coop sys perform restart actions, should fail")); |
|
1887 stateAdaptation->RequestCoopSysPerformRestartActions(0, request2->iStatus); |
|
1888 request2->StartWait(); |
|
1889 TEST(request2->iStatus == KErrInUse); |
|
1890 |
|
1891 INFO_PRINTF1(_L("Requesting coop sys perform shutdown actions, should fail")); |
|
1892 stateAdaptation->RequestCoopSysPerformShutdownActions(0, request2->iStatus); |
|
1893 request2->StartWait(); |
|
1894 TEST(request2->iStatus == KErrInUse); |
|
1895 |
|
1896 INFO_PRINTF1(_L("Requesting coop sys perform rfs actions, should fail")); |
|
1897 stateAdaptation->RequestCoopSysPerformRfsActions(ESsmShallowRfs, request2->iStatus); |
|
1898 request2->StartWait(); |
|
1899 TEST(request2->iStatus == KErrInUse); |
|
1900 |
|
1901 INFO_PRINTF1(_L("Requesting second self test, should fail")); |
|
1902 stateAdaptation->RequestCoopSysSelfTest(request2->iStatus); |
|
1903 request2->StartWait(); |
|
1904 TEST(request2->iStatus == KErrInUse); |
|
1905 |
|
1906 |
|
1907 INFO_PRINTF1(_L("Requesting second event notification")); |
|
1908 stateAdaptation->NotifyCoopSysEvent(emptyBuf, request2->iStatus); |
|
1909 request2->StartWait(); |
|
1910 TEST(request2->iStatus == KErrInUse); |
|
1911 |
|
1912 // SIM |
|
1913 INFO_PRINTF1(_L("Requesting first sim owned")); |
|
1914 CRequestWaiter* simRequest = new (ELeave) CRequestWaiter(); |
|
1915 CleanupStack::PushL(simRequest); |
|
1916 TPckgBuf<TBool> simOwnedPckg; |
|
1917 simAdaptation->GetSimOwned(simOwnedPckg, simRequest->iStatus); |
|
1918 TEST(simRequest->iStatus == KRequestPending); |
|
1919 simRequest->SetActive(); |
|
1920 |
|
1921 INFO_PRINTF1(_L("Requesting first SIM event notification")); |
|
1922 CRequestWaiter* eventSimRequest = new (ELeave) CRequestWaiter(); |
|
1923 CleanupStack::PushL(eventSimRequest); |
|
1924 simAdaptation->NotifySimEvent(emptyBuf, eventSimRequest->iStatus); |
|
1925 TEST(eventSimRequest->iStatus == KRequestPending); |
|
1926 eventSimRequest->SetActive(); |
|
1927 |
|
1928 INFO_PRINTF1(_L("Requesting second SIM event notification")); |
|
1929 simAdaptation->NotifySimEvent(emptyBuf, request2->iStatus); |
|
1930 request2->StartWait(); |
|
1931 TEST(request2->iStatus == KErrInUse); |
|
1932 |
|
1933 INFO_PRINTF1(_L("Requesting second SIM owned")); |
|
1934 simAdaptation->GetSimOwned(emptyBuf, request2->iStatus); |
|
1935 request2->StartWait(); |
|
1936 TEST(request2->iStatus == KErrInUse); |
|
1937 |
|
1938 // RTC |
|
1939 INFO_PRINTF1(_L("Requesting first RTC validity")); |
|
1940 CRequestWaiter* rtcRequest = new (ELeave) CRequestWaiter(); |
|
1941 CleanupStack::PushL(rtcRequest); |
|
1942 TPckgBuf<TBool> rtcValidityPckg; |
|
1943 rtcAdaptation->ValidateRtc(rtcValidityPckg, rtcRequest->iStatus); |
|
1944 TEST(rtcRequest->iStatus == KRequestPending); |
|
1945 rtcRequest->SetActive(); |
|
1946 |
|
1947 INFO_PRINTF1(_L("Requesting set wakeup alarm")); |
|
1948 rtcAdaptation->SetWakeupAlarm(emptyBuf, request2->iStatus); |
|
1949 request2->StartWait(); |
|
1950 TEST(request2->iStatus == KErrInUse); |
|
1951 |
|
1952 INFO_PRINTF1(_L("Requesting unset wakeup alarm")); |
|
1953 rtcAdaptation->UnsetWakeupAlarm(request2->iStatus); |
|
1954 request2->StartWait(); |
|
1955 TEST(request2->iStatus == KErrInUse); |
|
1956 |
|
1957 INFO_PRINTF1(_L("Requesting second RTC validity")); |
|
1958 rtcAdaptation->ValidateRtc(emptyBuf, request2->iStatus); |
|
1959 request2->StartWait(); |
|
1960 TEST(request2->iStatus == KErrInUse); |
|
1961 |
|
1962 // Emergency Call |
|
1963 INFO_PRINTF1(_L("Requesting first Emergency Call RF on")); |
|
1964 CRequestWaiter* ecrfRequest = new (ELeave) CRequestWaiter(); |
|
1965 CleanupStack::PushL(ecrfRequest); |
|
1966 ecrfAdaptation->ActivateRfForEmergencyCall(ecrfRequest->iStatus); |
|
1967 TEST(ecrfRequest->iStatus == KRequestPending); |
|
1968 ecrfRequest->SetActive(); |
|
1969 |
|
1970 INFO_PRINTF1(_L("Requesting Emergency Call RF off")); |
|
1971 ecrfAdaptation->ActivateRfForEmergencyCall(request2->iStatus); |
|
1972 request2->StartWait(); |
|
1973 TEST(request2->iStatus == KErrInUse); |
|
1974 |
|
1975 INFO_PRINTF1(_L("Requesting second Emergency Call RF on")); |
|
1976 ecrfAdaptation->ActivateRfForEmergencyCall(request2->iStatus); |
|
1977 request2->StartWait(); |
|
1978 TEST(request2->iStatus == KErrInUse); |
|
1979 |
|
1980 // MISC |
|
1981 INFO_PRINTF1(_L("Requesting first get global startup mode")); |
|
1982 CRequestWaiter* miscRequest = new (ELeave) CRequestWaiter(); |
|
1983 CleanupStack::PushL(miscRequest); |
|
1984 TPckgBuf<TInt> startupModePckg; |
|
1985 miscAdaptation->GetGlobalStartupMode(startupModePckg, miscRequest->iStatus); |
|
1986 TEST(miscRequest->iStatus == KRequestPending); |
|
1987 miscRequest->SetActive(); |
|
1988 |
|
1989 INFO_PRINTF1(_L("Requesting security state change")); |
|
1990 miscAdaptation->SecurityStateChange(0 , emptyBuf, request2->iStatus); |
|
1991 request2->StartWait(); |
|
1992 TEST(request2->iStatus == KErrInUse); |
|
1993 |
|
1994 INFO_PRINTF1(_L("Requesting prepare sim languages")); |
|
1995 miscAdaptation->PrepareSimLanguages(ESecondaryLanguages, emptyBuf, request2->iStatus); |
|
1996 request2->StartWait(); |
|
1997 TEST(request2->iStatus == KErrInUse); |
|
1998 |
|
1999 INFO_PRINTF1(_L("Requesting second get global startup mode")); |
|
2000 miscAdaptation->GetGlobalStartupMode(emptyBuf, request2->iStatus); |
|
2001 request2->StartWait(); |
|
2002 TEST(request2->iStatus == KErrInUse); |
|
2003 |
|
2004 |
|
2005 INFO_PRINTF1(_L("Requesting second get global startup mode")); |
|
2006 miscAdaptation->GetGlobalStartupMode(emptyBuf, request2->iStatus); |
|
2007 request2->StartWait(); |
|
2008 TEST(request2->iStatus == KErrInUse); |
|
2009 |
|
2010 // End of testing cycle... clean up |
|
2011 |
|
2012 INFO_PRINTF1(_L("Signal completion of self test")); |
|
2013 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EExecuteSelftests); |
|
2014 StartupAdaptation::TResponsePckg okResponse(KErrNone); |
|
2015 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EExecuteSelftests, okResponse); |
|
2016 stateRequest->StartWait(); |
|
2017 TEST(stateRequest->iStatus == KErrNone); |
|
2018 |
|
2019 INFO_PRINTF1(_L("Signal completion of SIM owned test")); |
|
2020 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetSimOwned); |
|
2021 StartupAdaptation::TBooleanResponsePckg booleanResponsePckg; |
|
2022 booleanResponsePckg().iErrorCode = KErrNone; |
|
2023 booleanResponsePckg().iValue = EFalse; |
|
2024 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetSimOwned, booleanResponsePckg); |
|
2025 simRequest->StartWait(); |
|
2026 TEST(simRequest->iStatus == KErrNone); |
|
2027 TEST(!simOwnedPckg()); |
|
2028 |
|
2029 INFO_PRINTF1(_L("Signal completion of RTC validity test")); |
|
2030 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EValidateRTCTime); |
|
2031 // KErrNotFound means the RTC is not valid |
|
2032 StartupAdaptation::TResponsePckg responsePckg; |
|
2033 responsePckg() = KErrNotFound; |
|
2034 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EValidateRTCTime, responsePckg); |
|
2035 rtcRequest->StartWait(); |
|
2036 TEST(rtcRequest->iStatus == KErrNone); |
|
2037 TEST(!rtcValidityPckg()); |
|
2038 |
|
2039 INFO_PRINTF1(_L("Signal completion of activate RF")); |
|
2040 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EActivateRfForEmergencyCall); |
|
2041 responsePckg() = KErrNone; |
|
2042 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EActivateRfForEmergencyCall, responsePckg); |
|
2043 ecrfRequest->StartWait(); |
|
2044 TEST(ecrfRequest->iStatus == KErrNone); |
|
2045 |
|
2046 INFO_PRINTF1(_L("Signal completion of get startup mode")); |
|
2047 TEST(CStartupAdaptationWrapper::LastCommandId() == StartupAdaptation::EGetGlobalStartupMode); |
|
2048 StartupAdaptation::TGlobalStartupModeResponsePckg startupModeResponsePckg; |
|
2049 startupModeResponsePckg().iErrorCode = KErrNone; |
|
2050 startupModeResponsePckg().iValue = StartupAdaptation::ECharging; |
|
2051 CStartupAdaptationWrapper::TriggerResponseCallbackL(StartupAdaptation::EGetGlobalStartupMode, startupModeResponsePckg); |
|
2052 miscRequest->StartWait(); |
|
2053 TEST(miscRequest->iStatus == KErrNone); |
|
2054 TEST(startupModePckg() == StartupAdaptation::ECharging); |
|
2055 |
|
2056 INFO_PRINTF1(_L("Cancel state notification")); |
|
2057 stateAdaptation->NotifyCancel(); |
|
2058 eventStateRequest->StartWait(); |
|
2059 TEST(eventStateRequest->iStatus == KErrCancel); |
|
2060 |
|
2061 INFO_PRINTF1(_L("Cancel SIM notification")); |
|
2062 simAdaptation->NotifyCancel(); |
|
2063 eventSimRequest->StartWait(); |
|
2064 TEST(eventSimRequest->iStatus == KErrCancel); |
|
2065 |
|
2066 INFO_PRINTF1(_L("End of test, tearing down")); |
|
2067 |
|
2068 CleanupStack::PopAndDestroy(miscRequest); |
|
2069 CleanupStack::PopAndDestroy(ecrfRequest); |
|
2070 CleanupStack::PopAndDestroy(rtcRequest); |
|
2071 CleanupStack::PopAndDestroy(eventSimRequest); |
|
2072 CleanupStack::PopAndDestroy(simRequest); |
|
2073 CleanupStack::PopAndDestroy(request2); |
|
2074 CleanupStack::PopAndDestroy(eventStateRequest); |
|
2075 CleanupStack::PopAndDestroy(stateRequest); |
|
2076 |
|
2077 INFO_PRINTF1(_L("Releasing misc. adaptation")); |
|
2078 miscAdaptation->Release(); |
|
2079 miscAdaptation = NULL; |
|
2080 |
|
2081 INFO_PRINTF1(_L("Releasing emergency call rf adaptation")); |
|
2082 ecrfAdaptation->Release(); |
|
2083 ecrfAdaptation = NULL; |
|
2084 |
|
2085 INFO_PRINTF1(_L("Releasing RTC adaptation")); |
|
2086 rtcAdaptation->Release(); |
|
2087 rtcAdaptation = NULL; |
|
2088 |
|
2089 INFO_PRINTF1(_L("Releasing SIM adaptation")); |
|
2090 simAdaptation->Release(); |
|
2091 simAdaptation = NULL; |
|
2092 |
|
2093 INFO_PRINTF1(_L("Releasing state adaptation")); |
|
2094 stateAdaptation->Release(); |
|
2095 stateAdaptation = NULL; |
|
2096 |
|
2097 // Delete the test data buffer |
|
2098 CStartupAdaptationWrapper::DeleteLastCommandData(); |
|
2099 |
|
2100 INFO_PRINTF1(_L("Returning from doTestOnDemandRequestsL()")); |
|
2101 } |