|
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 // base class for CTSY component tests |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 |
|
22 #include "cctsycomponenttestbase.h" |
|
23 #include <etel.h> |
|
24 #include <etelmm.h> |
|
25 #include <et_clsvr.h> |
|
26 #include <pcktcs.h> |
|
27 #include <ctsy/mmtsy_names.h> |
|
28 #include <ctsy/serviceapi/mmtsy_ipcdefs.h> |
|
29 #include "tmockltsydata.h" |
|
30 #include <ctsy/serviceapi/gsmerror.h> |
|
31 #include <ctsy/rmmcustomapi.h> |
|
32 #include "cctsycustomipcfu.h" |
|
33 |
|
34 |
|
35 _LIT(KDoubleColon, "::"); |
|
36 |
|
37 /** |
|
38 To push a CleanupItem ont the cleanupstack to close the phone |
|
39 */ |
|
40 void CCtsyComponentTestBase::Cleanup(TAny* aSelf) |
|
41 { |
|
42 static_cast<CCtsyComponentTestBase*>(aSelf)->DoCleanup(); |
|
43 } |
|
44 |
|
45 /** |
|
46 Close the Phone a the server connection |
|
47 */ |
|
48 void CCtsyComponentTestBase::DoCleanup() |
|
49 { |
|
50 iPhone.Close(); |
|
51 iMockLTSY.Close(); |
|
52 |
|
53 TInt ret = iTelServer.UnloadPhoneModule(KMmTsyModuleName); |
|
54 if (ret != KErrNone) |
|
55 { |
|
56 INFO_PRINTF1(_L("Failed to unload phone module")); |
|
57 } |
|
58 |
|
59 iTelServer.Close(); |
|
60 } |
|
61 |
|
62 /** |
|
63 Assert MockLtsy Terminated all handlings without errors |
|
64 */ |
|
65 void CCtsyComponentTestBase::AssertMockLtsyStatusL() |
|
66 { |
|
67 TBool hasWaitingExpect; |
|
68 TBool hasPendingComplete; |
|
69 TBool hasError; |
|
70 iMockLTSY.GetStatus(hasWaitingExpect,hasPendingComplete,hasError); |
|
71 if (hasWaitingExpect || hasPendingComplete) |
|
72 { |
|
73 ERR_PRINTF1(_L("MockLTsy still have pending/waiting events!")); |
|
74 } |
|
75 if (hasWaitingExpect || hasPendingComplete || hasError) |
|
76 { |
|
77 TBuf<255> log; |
|
78 do { |
|
79 iMockLTSY.GetNextLogLine(log); |
|
80 INFO_PRINTF1(log); |
|
81 } |
|
82 while(log.Length() > 0); |
|
83 User::Leave(KErrTEFUnitFail); // Fail the test |
|
84 } |
|
85 } |
|
86 |
|
87 |
|
88 /** |
|
89 Open Server session |
|
90 */ |
|
91 void CCtsyComponentTestBase::OpenEtelServerL(TExtendedErrorClient aSetExtendedErrorClient) |
|
92 { |
|
93 TInt ret = iTelServer.Connect(); |
|
94 |
|
95 if (ret != KErrNone) |
|
96 { |
|
97 INFO_PRINTF1(_L("Failed connect phone")); |
|
98 User::Leave(ret); |
|
99 } |
|
100 |
|
101 ret = iTelServer.LoadPhoneModule(KMmTsyModuleName); |
|
102 |
|
103 if (ret != KErrNone) |
|
104 { |
|
105 INFO_PRINTF1(_L("Failed load phone module")); |
|
106 iTelServer.Close(); |
|
107 User::Leave(ret); |
|
108 } |
|
109 |
|
110 if(aSetExtendedErrorClient == EUseExtendedError) |
|
111 { |
|
112 iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ); |
|
113 } |
|
114 } |
|
115 |
|
116 /** |
|
117 Standard function to open the phone up to the end of the boot sequence |
|
118 */ |
|
119 void CCtsyComponentTestBase::OpenPhoneL() |
|
120 { |
|
121 RBuf8 data; |
|
122 CleanupClosePushL(data); |
|
123 |
|
124 //Initialize local variables first: |
|
125 //EMobilePhoneGetHomeNetwork |
|
126 RMobilePhone::TMobilePhoneNetworkInfoV8 homeNetwork; |
|
127 homeNetwork.iMode = RMobilePhone::ENetworkModeWcdma; |
|
128 homeNetwork.iStatus = RMobilePhone::ENetworkStatusCurrent; |
|
129 homeNetwork.iBandInfo = RMobilePhone::EBandUnknown; |
|
130 homeNetwork.iCountryCode = _L("234"); |
|
131 homeNetwork.iCdmaSID = _L(""); |
|
132 homeNetwork.iAnalogSID = _L(""); |
|
133 homeNetwork.iNetworkId = _L("23499"); |
|
134 homeNetwork.iDisplayTag = _L("symbian"); |
|
135 homeNetwork.iShortName = _L("symbian"); |
|
136 homeNetwork.iLongName = _L("symbian mobile"); |
|
137 homeNetwork.iAccess = RMobilePhone::ENetworkAccessUtran; |
|
138 homeNetwork.iEgprsAvailableIndicator = ETrue; |
|
139 homeNetwork.iHsdpaAvailableIndicator = ETrue; |
|
140 homeNetwork.iHsupaAvailableIndicator = ETrue; |
|
141 TMockLtsyData1<RMobilePhone::TMobilePhoneNetworkInfoV8> homeNetworkData(homeNetwork); |
|
142 homeNetworkData.SerialiseL(data); |
|
143 |
|
144 TInt err = iPhone.Open(iTelServer,KMmTsyPhoneName); |
|
145 ASSERT_EQUALS(KErrNone, err); |
|
146 |
|
147 err=iMockLTSY.Connect(); |
|
148 ASSERT_EQUALS(KErrNone, err); |
|
149 TRequestStatus mockLtsyStatus; |
|
150 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
151 |
|
152 // EMmTsyBootNotifyModemStatusReadyIPC |
|
153 ASSERT_EQUALS(KErrNone, iMockLTSY.PauseCompletion()); |
|
154 iMockLTSY.CompleteL(EMmTsyBootNotifyModemStatusReadyIPC,KErrNone); |
|
155 |
|
156 // EMobilePhoneGetNetworkRegistrationStatus |
|
157 iMockLTSY.ExpectL(EMobilePhoneGetNetworkRegistrationStatus); |
|
158 iMockLTSY.CompleteL(EMobilePhoneGetNetworkRegistrationStatus,KErrNone,0); |
|
159 |
|
160 // EMmTsyBootNotifySimStatusReadyIPC |
|
161 iMockLTSY.ExpectL(EMmTsyBootNotifySimStatusReadyIPC); |
|
162 iMockLTSY.CompleteL(EMmTsyBootNotifySimStatusReadyIPC,KErrNone,0); |
|
163 |
|
164 // EMobilePhoneGetHomeNetwork |
|
165 iMockLTSY.ExpectL(EMobilePhoneGetHomeNetwork); |
|
166 iMockLTSY.CompleteL(EMobilePhoneGetHomeNetwork,KErrNone,data,0); |
|
167 |
|
168 // EMmTsyPhoneGetPin1DisableSupportedIPC |
|
169 iMockLTSY.ExpectL(EMmTsyPhoneGetPin1DisableSupportedIPC); |
|
170 |
|
171 // EMmTsySimRefreshRegisterIPC |
|
172 iMockLTSY.ExpectL(EMmTsySimRefreshRegisterIPC); |
|
173 |
|
174 // EMobilePhoneGetServiceTable |
|
175 RMobilePhone::TMobilePhoneServiceTable serviceTable = RMobilePhone::ESIMServiceTable; |
|
176 TMockLtsyData1<RMobilePhone::TMobilePhoneServiceTable> serviceTableData(serviceTable); |
|
177 data.Close(); |
|
178 serviceTableData.SerialiseL(data); |
|
179 iMockLTSY.ExpectL(EMobilePhoneGetServiceTable, data); |
|
180 |
|
181 // EMobilePhoneGetALSLine |
|
182 iMockLTSY.ExpectL(EMobilePhoneGetALSLine); |
|
183 |
|
184 iMockLTSY.ExpectL(ECustomGetIccCallForwardingStatusIPC); |
|
185 |
|
186 // EMobilePhoneGetIccMessageWaitingIndicators |
|
187 iMockLTSY.ExpectL(EMobilePhoneGetIccMessageWaitingIndicators); |
|
188 |
|
189 //ECustomCheckAlsPpSupportIPC |
|
190 iMockLTSY.ExpectL(ECustomCheckAlsPpSupportIPC); |
|
191 |
|
192 //EMobilePhoneGetCustomerServiceProfile |
|
193 iMockLTSY.ExpectL(EMobilePhoneGetCustomerServiceProfile); |
|
194 |
|
195 |
|
196 // Complete for EMmTsyPhoneGetPin1DisableSupportedIPC |
|
197 TBool pin1DisableSupport = ETrue; |
|
198 TMockLtsyData1<TBool> pin1DisableSupportData(pin1DisableSupport); |
|
199 data.Close(); |
|
200 pin1DisableSupportData.SerialiseL(data); |
|
201 iMockLTSY.CompleteL(EMmTsyPhoneGetPin1DisableSupportedIPC,KErrNone,data,0); |
|
202 |
|
203 // Complete for EMmTsySimRefreshRegisterIPC |
|
204 iMockLTSY.CompleteL(EMmTsySimRefreshRegisterIPC, KErrGeneral, 0); |
|
205 |
|
206 // Complete for EMobilePhoneGetServiceTable |
|
207 RMobilePhone::TMobilePhoneServiceTableV1 serviceTableResult; |
|
208 serviceTableResult.iServices1To8 = 0xFF; |
|
209 serviceTableResult.iServices9To16 = 0xFF; |
|
210 serviceTableResult.iServices17To24= 0xFF; |
|
211 serviceTableResult.iServices25To32= 0xFF; |
|
212 serviceTableResult.iServices33To40= 0xFF; |
|
213 serviceTableResult.iServices41To48= 0xFF; |
|
214 serviceTableResult.iServices49To56= 0xFF; |
|
215 TMockLtsyData1<RMobilePhone::TMobilePhoneServiceTableV1> serviceTableResultData(serviceTableResult); |
|
216 data.Close(); |
|
217 serviceTableResultData.SerialiseL(data); |
|
218 iMockLTSY.CompleteL(EMobilePhoneGetServiceTable,KErrNone,data,0); |
|
219 |
|
220 |
|
221 // Complete for EMobilePhoneGetALSLine |
|
222 RMobilePhone::TMobilePhoneALSLine alsLine = RMobilePhone::EAlternateLinePrimary; |
|
223 TMockLtsyData1<RMobilePhone::TMobilePhoneALSLine> alsLineData(alsLine); |
|
224 data.Close(); |
|
225 alsLineData.SerialiseL(data); |
|
226 iMockLTSY.CompleteL(EMobilePhoneGetALSLine,KErrNone,data,0); |
|
227 |
|
228 |
|
229 |
|
230 // Complete for EMobilePhoneGetIccMessageWaitingIndicators |
|
231 RMobilePhone::TMobilePhoneMessageWaitingV1 expectedMessageIndicators; |
|
232 TMockLtsyData1<RMobilePhone::TMobilePhoneMessageWaitingV1> |
|
233 indicatorsData(expectedMessageIndicators); |
|
234 data.Close(); |
|
235 indicatorsData.SerialiseL(data); |
|
236 iMockLTSY.CompleteL(EMobilePhoneGetIccMessageWaitingIndicators, KErrNone, data); |
|
237 |
|
238 //Complete for ECustomCheckAlsPpSupportIPC |
|
239 RMmCustomAPI::TAlsSupport alsSupport(RMmCustomAPI::EAlsSupportOff); |
|
240 TMockLtsyData1< RMmCustomAPI::TAlsSupport > alsSupportData(alsSupport); |
|
241 data.Close(); |
|
242 alsSupportData.SerialiseL(data); |
|
243 iMockLTSY.CompleteL(ECustomCheckAlsPpSupportIPC, KErrNone, data); |
|
244 |
|
245 // Complete for EMobilePhoneGetCustomerServiceProfile |
|
246 RMobilePhone::TMobilePhoneCspFileV1 completeCsp; |
|
247 completeCsp.iCallOfferingServices = 1; |
|
248 completeCsp.iCallRestrictionServices = 2; |
|
249 completeCsp.iOtherSuppServices = 3; |
|
250 completeCsp.iCallCompletionServices = 4; |
|
251 completeCsp.iTeleservices = 5; |
|
252 completeCsp.iCphsTeleservices = 6; |
|
253 completeCsp.iCphsFeatures = 7; |
|
254 completeCsp.iNumberIdentServices = 8; |
|
255 completeCsp.iPhase2PlusServices = 9; |
|
256 completeCsp.iValueAddedServices = 10; |
|
257 TMockLtsyData1<RMobilePhone::TMobilePhoneCspFileV1> completeLtsyData(completeCsp); |
|
258 data.Close(); |
|
259 completeLtsyData.SerialiseL(data); |
|
260 iMockLTSY.CompleteL(EMobilePhoneGetCustomerServiceProfile, KErrNone, data, 10); |
|
261 |
|
262 ASSERT_EQUALS(KErrNone, iMockLTSY.ResumeCompletion()); |
|
263 User::WaitForRequest(mockLtsyStatus); |
|
264 |
|
265 CleanupStack::PopAndDestroy(1); // data |
|
266 } |
|
267 |
|
268 /** |
|
269 Dial call |
|
270 @param aCall the call to use to dial |
|
271 @param aService type of call (must match the line the call what created on) |
|
272 @param aCallId callId ltsy must allocate for this call |
|
273 */ |
|
274 void CCtsyComponentTestBase::DialL(RCall& aCall, const TInt aCallId, const RMobilePhone::TMobileService aService) |
|
275 { |
|
276 DialL(aCall, aCallId, aService, _L("01632960000")); |
|
277 } |
|
278 |
|
279 /** |
|
280 Dial call |
|
281 @param aCall the call to use to dial |
|
282 @param aCallId callId ltsy must allocate for this call |
|
283 @param aService type of call (must match the line the call what created on) |
|
284 @param aTelNumber A telephone number |
|
285 */ |
|
286 void CCtsyComponentTestBase::DialL(RCall& aCall, |
|
287 const TInt aCallId, |
|
288 const RMobilePhone::TMobileService aService, |
|
289 const TDesC &aTelNumber) |
|
290 { |
|
291 RBuf8 data; |
|
292 CleanupClosePushL(data); |
|
293 |
|
294 // EEtelCallDial |
|
295 RMobileCall::TMobileCallParamsV1 callParams; |
|
296 RMobileCall::TMobileCallParamsV1Pckg callParamsPckg(callParams); |
|
297 callParams.iInterval = 0; |
|
298 callParams.iCug.iCugIndex = 0xFFFF; |
|
299 RMobileCall::TMobileCallInfoV8 callInfo; |
|
300 callInfo.iDialledParty.iTelNumber.Copy(aTelNumber); |
|
301 callInfo.iService = aService; |
|
302 callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating; |
|
303 TMockLtsyCallData2<RMobileCall::TMobileCallParamsV1, RMobileCall::TMobileCallInfoV8> |
|
304 dialData(0, aService, callParams, callInfo); |
|
305 dialData.SerialiseL(data); |
|
306 iMockLTSY.ExpectL(EEtelCallDial,data); |
|
307 |
|
308 // EMobileCallGetMobileCallInfo |
|
309 CallGetMobileCallInfoL(aCallId, aService, aTelNumber); |
|
310 |
|
311 // complete Dial |
|
312 TMockLtsyCallData0 dialCompleteData(aCallId,aService); |
|
313 data.Close(); |
|
314 dialCompleteData.SerialiseL(data); |
|
315 iMockLTSY.CompleteL(EEtelCallDial,KErrNone,data); |
|
316 |
|
317 TRequestStatus requestStatus ; |
|
318 aCall.Dial(requestStatus, callInfo.iDialledParty.iTelNumber); |
|
319 |
|
320 User::WaitForRequest(requestStatus); |
|
321 AssertMockLtsyStatusL(); |
|
322 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
323 |
|
324 CleanupStack::PopAndDestroy(1); |
|
325 } |
|
326 |
|
327 /** |
|
328 Open packet service session. |
|
329 @param aStartAttachStatus Starting attach status. |
|
330 @param aStartAttachMode Starting atach mode. The CTSY does not even cache this value so it does not really matter what it gets set to. |
|
331 */ |
|
332 void CCtsyComponentTestBase::OpenPacketServiceL |
|
333 ( |
|
334 RPacketService& aRPacketService, |
|
335 RPacketService::TStatus aStartAttachStatus, |
|
336 RPacketService::TAttachMode aStartAttachMode, |
|
337 TInt aMaxMonitorServices, |
|
338 TInt aMaxServices |
|
339 ) |
|
340 { |
|
341 RBuf8 data; |
|
342 CleanupClosePushL(data); |
|
343 |
|
344 TRequestStatus mockLtsyStatus; |
|
345 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
346 |
|
347 iMockLTSY.ExpectL(EPacketNotifyStatusChange); |
|
348 |
|
349 TBool resumed = EFalse; |
|
350 TMockLtsyData2<RPacketService::TStatus , TBool> comNotifyStatus(aStartAttachStatus, resumed); |
|
351 comNotifyStatus.SerialiseL(data); |
|
352 iMockLTSY.CompleteL(EPacketNotifyStatusChange,KErrNone, data); |
|
353 |
|
354 TBool expInitState = ETrue; |
|
355 TMockLtsyData1<TBool> expGetAttachMode(expInitState); |
|
356 data.Close(); |
|
357 expGetAttachMode.SerialiseL(data); |
|
358 iMockLTSY.ExpectL(EPacketGetAttachMode, data); |
|
359 |
|
360 TMockLtsyData1<RPacketService::TAttachMode> comGetAttachMode(aStartAttachMode); |
|
361 data.Close(); |
|
362 comGetAttachMode.SerialiseL(data); |
|
363 iMockLTSY.CompleteL(EPacketGetAttachMode,KErrNone, data); |
|
364 |
|
365 TMockLtsyData1< TInt > iniData(aMaxServices); |
|
366 iniData.SerialiseL(data); |
|
367 iMockLTSY.ExpectL(EPacketEnumerateMbmsMonitorServiceList); |
|
368 iMockLTSY.CompleteL( EPacketEnumerateMbmsMonitorServiceList, KErrNone, data ); |
|
369 |
|
370 |
|
371 |
|
372 TMockLtsyData1< TInt > iniData2(aMaxMonitorServices); |
|
373 iniData2.SerialiseL(data); |
|
374 iMockLTSY.ExpectL(EPacketEnumerateMbmsActiveServiceList); |
|
375 iMockLTSY.CompleteL( EPacketEnumerateMbmsActiveServiceList, KErrNone, data ); |
|
376 |
|
377 //this is actually a sync call to LTSY where return represents a context id offset rather than error code. |
|
378 iMockLTSY.ExpectL(EPacketInitProxiesIPC, 3); |
|
379 |
|
380 //this actually completes before all messages between CTSY<->LTSY have finished. |
|
381 TInt err = aRPacketService.Open(iPhone); |
|
382 |
|
383 // Wait for the end of initialisation |
|
384 User::WaitForRequest(mockLtsyStatus); |
|
385 AssertMockLtsyStatusL(); |
|
386 |
|
387 CleanupStack::PopAndDestroy(); // data |
|
388 } |
|
389 |
|
390 /** |
|
391 Context initiation |
|
392 @param aPacketContext context object |
|
393 @param aContextName context name |
|
394 */ |
|
395 |
|
396 TInt CCtsyComponentTestBase::InitContextL(RPacketContext& aPacketContext, |
|
397 TInfoName& aContextName, |
|
398 TInfoName aHostCidName) |
|
399 { |
|
400 RBuf8 data; |
|
401 CleanupClosePushL(data); |
|
402 |
|
403 // data for initialisation of the context |
|
404 TRequestStatus initStatus; |
|
405 RPacketContext::TDataChannelV2 dataCh; |
|
406 TPckg<RPacketContext::TDataChannelV2> pckgInit(dataCh); |
|
407 TMockLtsyData2< TInfoName, TInfoName > ltsyInit(aContextName, aHostCidName); |
|
408 ltsyInit.SerialiseL(data); |
|
409 iMockLTSY.ExpectL(EPacketContextInitialiseContext, data); |
|
410 |
|
411 TMockLtsyData1< TInfoName > ltsyData(aContextName); |
|
412 data.Close(); |
|
413 ltsyData.SerialiseL(data); |
|
414 iMockLTSY.CompleteL(EPacketContextInitialiseContext, KErrNone, data); |
|
415 //initialisation of the context |
|
416 aPacketContext.InitialiseContext(initStatus, pckgInit); |
|
417 User::WaitForRequest(initStatus); |
|
418 |
|
419 CleanupStack::PopAndDestroy(1); // data |
|
420 return initStatus.Int(); |
|
421 } |
|
422 |
|
423 /** |
|
424 Context initiation |
|
425 @param aPacketContext context object |
|
426 @param aContextName context name |
|
427 */ |
|
428 |
|
429 TInt CCtsyComponentTestBase::InitMbmsContextL(RPacketMbmsContext& aPacketContext, |
|
430 TInfoName& aContextName ) |
|
431 { |
|
432 RBuf8 data; |
|
433 CleanupClosePushL(data); |
|
434 |
|
435 // data for initialisation of the context |
|
436 TMockLtsyData1< TInfoName> ltsyInit(aContextName); |
|
437 ltsyInit.SerialiseL(data); |
|
438 iMockLTSY.ExpectL(ECtsyPacketMbmsInitialiseContextReq, data); |
|
439 |
|
440 RPacketMbmsContext::TDataChannelV2 dataCh; |
|
441 TPckg<RPacketMbmsContext::TDataChannelV2> pckgInit(dataCh); |
|
442 TMockLtsyData2< TInfoName, RPacketMbmsContext::TDataChannelV2 > ltsyData(aContextName, dataCh); |
|
443 data.Close(); |
|
444 ltsyData.SerialiseL(data); |
|
445 iMockLTSY.CompleteL(ECtsyPacketMbmsInitialiseContextComp, KErrNone, data); |
|
446 |
|
447 //initialisation of the context |
|
448 TRequestStatus initStatus; |
|
449 aPacketContext.InitialiseContext(initStatus, pckgInit); |
|
450 User::WaitForRequest(initStatus); |
|
451 |
|
452 CleanupStack::PopAndDestroy(1); // data |
|
453 return initStatus.Int(); |
|
454 } |
|
455 |
|
456 |
|
457 |
|
458 /** |
|
459 Context activation |
|
460 @param aContextName context name |
|
461 */ |
|
462 |
|
463 TInt CCtsyComponentTestBase::SetContextActiveL(TInfoName& aContextName) |
|
464 { |
|
465 RBuf8 data; |
|
466 CleanupClosePushL(data); |
|
467 |
|
468 //data for CompleteL |
|
469 TContextMisc completeMisc; |
|
470 completeMisc.iStatus = RPacketContext::EStatusActive; |
|
471 TMockLtsyData2 <TInfoName, TContextMisc> |
|
472 ltsyData1(aContextName, completeMisc); |
|
473 ltsyData1.SerialiseL(data); |
|
474 |
|
475 TRequestStatus mockLtsyStatus; |
|
476 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
477 //send completion |
|
478 iMockLTSY.CompleteL(EPacketContextNotifyStatusChange, KErrNone, data); |
|
479 // wait for completion |
|
480 User::WaitForRequest(mockLtsyStatus); |
|
481 |
|
482 CleanupStack::PopAndDestroy(1); // data |
|
483 |
|
484 return mockLtsyStatus.Int(); |
|
485 } |
|
486 |
|
487 |
|
488 /** |
|
489 Context activation |
|
490 @param aContextName context name |
|
491 */ |
|
492 |
|
493 TInt CCtsyComponentTestBase::SetMbmsActiveL(RPacketMbmsContext& aMbmsContext, |
|
494 RPacketMbmsContext::TContextConfigMbmsV1& aConfig, |
|
495 TInfoName& aContextName) |
|
496 { |
|
497 RBuf8 data; |
|
498 CleanupClosePushL(data); |
|
499 |
|
500 RBuf8 expectData; |
|
501 CleanupClosePushL(expectData); |
|
502 |
|
503 TMockLtsyData1 <TInfoName> expData( aContextName ); |
|
504 expData.SerialiseL( expectData ); |
|
505 |
|
506 TMockLtsyData2< TInfoName, RPacketMbmsContext::TContextConfigMbmsV1 > ltsyData1(aContextName, aConfig); |
|
507 ltsyData1.SerialiseL(data); |
|
508 |
|
509 iMockLTSY.ExpectL( EPacketContextActivate, expectData ); |
|
510 iMockLTSY.CompleteL(EPacketContextActivate, KErrNone, data); |
|
511 |
|
512 TRequestStatus requestStatus; |
|
513 aMbmsContext.Activate( requestStatus ); |
|
514 User::WaitForRequest( requestStatus ); |
|
515 |
|
516 CleanupStack::PopAndDestroy(2); // data, expectData |
|
517 |
|
518 return requestStatus.Int(); |
|
519 } |
|
520 |
|
521 TInt CCtsyComponentTestBase::SetMbmsDeactiveL(RPacketMbmsContext& aPacketContext, |
|
522 TInfoName& aContextName) |
|
523 { |
|
524 RBuf8 data; |
|
525 CleanupClosePushL(data); |
|
526 |
|
527 RPacketMbmsContext::CMbmsSession* list=RPacketMbmsContext::CMbmsSession::NewL(); |
|
528 CleanupStack::PushL(list); |
|
529 TMockLtsyData2< TInfoName, RPacketMbmsContext::CMbmsSession* > ltsyData2(aContextName, list); |
|
530 ltsyData2.SerialiseL(data); |
|
531 |
|
532 iMockLTSY.ExpectL( EPacketContextDeactivate, data ); |
|
533 |
|
534 RBuf8 compData; |
|
535 CleanupClosePushL(compData); |
|
536 TMockLtsyData1< TInfoName> ltsyData1(aContextName); |
|
537 ltsyData1.SerialiseL(compData); |
|
538 iMockLTSY.CompleteL(EPacketContextDeactivate, KErrNone, compData); |
|
539 |
|
540 TRequestStatus requestStatus; |
|
541 aPacketContext.Deactivate( requestStatus ); |
|
542 User::WaitForRequest( requestStatus ); |
|
543 |
|
544 CleanupStack::PopAndDestroy(3); // data, list, compData |
|
545 |
|
546 return requestStatus.Int(); |
|
547 } |
|
548 |
|
549 TInt CCtsyComponentTestBase::SetMbmsDeleteL(RPacketMbmsContext& aPacketContext, |
|
550 TInfoName& aContextName) |
|
551 { |
|
552 RBuf8 data; |
|
553 CleanupClosePushL(data); |
|
554 |
|
555 TMockLtsyData1< TInfoName > ltsyData1(aContextName); |
|
556 ltsyData1.SerialiseL(data); |
|
557 |
|
558 iMockLTSY.ExpectL( EPacketContextDelete, data ); |
|
559 iMockLTSY.CompleteL(EPacketContextDelete, KErrNone, data); |
|
560 |
|
561 TRequestStatus requestStatus; |
|
562 aPacketContext.Delete( requestStatus ); |
|
563 User::WaitForRequest( requestStatus ); |
|
564 |
|
565 CleanupStack::PopAndDestroy(1); // data |
|
566 |
|
567 return requestStatus.Int(); |
|
568 |
|
569 } |
|
570 |
|
571 /** |
|
572 Set context to new status |
|
573 @param aContextName context name |
|
574 @param aStatus status to set |
|
575 */ |
|
576 TInt CCtsyComponentTestBase::SetContextStatusL(TInfoName& aContextName, RPacketContext::TContextStatus aStatus) |
|
577 { |
|
578 RBuf8 data; |
|
579 CleanupClosePushL(data); |
|
580 |
|
581 //data for CompleteL |
|
582 TContextMisc completeMisc; |
|
583 completeMisc.iStatus = aStatus; |
|
584 TMockLtsyData2 <TInfoName, TContextMisc> |
|
585 ltsyData1(aContextName, completeMisc); |
|
586 ltsyData1.SerialiseL(data); |
|
587 |
|
588 TRequestStatus mockLtsyStatus; |
|
589 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
590 //send completion |
|
591 iMockLTSY.CompleteL(EPacketContextNotifyStatusChange, KErrNone, data); |
|
592 // wait for completion |
|
593 User::WaitForRequest(mockLtsyStatus); |
|
594 |
|
595 CleanupStack::PopAndDestroy(1); // data |
|
596 |
|
597 return mockLtsyStatus.Int(); |
|
598 } |
|
599 |
|
600 /** |
|
601 Set context to new status |
|
602 @param aContextName context name |
|
603 @param aStatus status to set |
|
604 */ |
|
605 TInt CCtsyComponentTestBase::SetMbmsConfigL( |
|
606 RPacketMbmsContext& aMbmsContext, |
|
607 TInfoName& aContextName, |
|
608 RPacketMbmsContext::TContextConfigMbmsV1 aStatus) |
|
609 { |
|
610 RBuf8 data; |
|
611 CleanupClosePushL(data); |
|
612 |
|
613 RBuf8 expectData; |
|
614 CleanupClosePushL(expectData); |
|
615 |
|
616 TPckg<RPacketMbmsContext::TContextConfigMbmsV1> pckgConfig(aStatus); |
|
617 |
|
618 TMockLtsyData2<RPacketMbmsContext::TContextConfigMbmsV1, TInfoName > expExpect(aStatus, aContextName); |
|
619 expExpect.SerialiseL(expectData); |
|
620 |
|
621 TMockLtsyData1<TInfoName > contexName(aContextName); |
|
622 contexName.SerialiseL(data); |
|
623 TRequestStatus mockLtsyStatus; |
|
624 |
|
625 iMockLTSY.ExpectL(EPacketContextSetConfig, expectData); |
|
626 iMockLTSY.CompleteL(EPacketContextSetConfig, KErrNone, data); |
|
627 |
|
628 aMbmsContext.SetConfig(mockLtsyStatus, pckgConfig); |
|
629 |
|
630 // wait for completion |
|
631 User::WaitForRequest(mockLtsyStatus); |
|
632 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
633 |
|
634 CleanupStack::PopAndDestroy(2); // data, expectData |
|
635 |
|
636 return mockLtsyStatus.Int(); |
|
637 } |
|
638 |
|
639 /** |
|
640 Create QoS and set profile params |
|
641 @param aPacketQoS packet qos object |
|
642 @param aPacketContext context object |
|
643 @param aRequested profile |
|
644 */ |
|
645 |
|
646 TInt CCtsyComponentTestBase::CreateQoSAndSetProfileParamLC(RPacketQoS& aPacketQoS, |
|
647 RPacketContext& aPacketContext, |
|
648 TInfoName& aContextName, |
|
649 TPacketDataConfigBase& aRequested, |
|
650 TInfoName aPrimaryContextName) |
|
651 { |
|
652 // ------ create New QoS ------------------------------------------------- |
|
653 TName qosName; |
|
654 aPacketQoS.OpenNewQoS(aPacketContext, qosName); |
|
655 CleanupClosePushL(aPacketQoS); |
|
656 |
|
657 RBuf8 expectDataSPP; |
|
658 CleanupClosePushL(expectDataSPP); |
|
659 |
|
660 TInt ret(KErrArgument); |
|
661 |
|
662 // Get Context current status |
|
663 // test 1: context not inited |
|
664 RPacketContext::TContextStatus contextStatus; |
|
665 TBool statusChanged = EFalse; |
|
666 aPacketContext.GetStatus(contextStatus); |
|
667 |
|
668 //check Context current status |
|
669 if ( RPacketContext::EStatusActivating != contextStatus && |
|
670 RPacketContext::EStatusActive != contextStatus) |
|
671 { |
|
672 // and change it to RPacketContext::EStatusActive |
|
673 SetContextActiveL(aContextName); |
|
674 statusChanged = ETrue; |
|
675 } |
|
676 |
|
677 |
|
678 // ------ SetProfileParameters -------------------------------------------- |
|
679 TRequestStatus requestStatus; |
|
680 |
|
681 if (TPacketDataConfigBase::KConfigGPRS == aRequested.ExtensionId()) |
|
682 { |
|
683 RPacketQoS::TQoSGPRSRequested* req; |
|
684 req = reinterpret_cast< RPacketQoS::TQoSGPRSRequested* > ( &aRequested ); |
|
685 TPckg<RPacketQoS::TQoSGPRSRequested> pckg(*req); |
|
686 // prepare data for expectDataSPP ... |
|
687 // ... context status |
|
688 RPacketContext::TContextStatus contextStatus; |
|
689 aPacketContext.GetStatus(contextStatus); |
|
690 AssertMockLtsyStatusL(); |
|
691 // ... get contextConfig |
|
692 RPacketContext::TContextConfigGPRS contextConfig; |
|
693 TPckg< RPacketContext::TContextConfigGPRS > pckgContextConfig = |
|
694 ( TPckg< RPacketContext::TContextConfigGPRS > ) contextConfig; |
|
695 aPacketContext.GetConfig(requestStatus, pckgContextConfig); |
|
696 User::WaitForRequest(requestStatus); |
|
697 AssertMockLtsyStatusL(); |
|
698 |
|
699 // data for SetProfileParameters's ExpectL |
|
700 TContextParams contextParams; |
|
701 contextParams.iContextName = aContextName; |
|
702 contextParams.iContextType = contextConfig.iNWIContext; |
|
703 contextParams.iPdpType = contextConfig.iPdpType; |
|
704 contextParams.iPrimaryContextName = aPrimaryContextName; |
|
705 contextParams.iContextStatus = contextStatus; |
|
706 TMockLtsyData2<TContextParams, RPacketQoS::TQoSGPRSRequested> |
|
707 expExpect(contextParams, *req); |
|
708 expExpect.SerialiseL(expectDataSPP); |
|
709 |
|
710 iMockLTSY.ExpectL(EPacketQoSSetProfileParams, expectDataSPP); |
|
711 aPacketQoS.SetProfileParameters(requestStatus, pckg); |
|
712 User::WaitForRequest(requestStatus); |
|
713 AssertMockLtsyStatusL(); |
|
714 ret = KErrNone; |
|
715 } |
|
716 |
|
717 if (TPacketDataConfigBase::KConfigRel99Rel4 == aRequested.ExtensionId()) |
|
718 { |
|
719 RPacketQoS::TQoSR99_R4Requested* req; |
|
720 req = reinterpret_cast< RPacketQoS::TQoSR99_R4Requested* > ( &aRequested ); |
|
721 TPckg<RPacketQoS::TQoSR99_R4Requested> pckg(*req); |
|
722 |
|
723 // prepare data for expectDataSPP ... |
|
724 // ... context status |
|
725 RPacketContext::TContextStatus contextStatus; |
|
726 aPacketContext.GetStatus(contextStatus); |
|
727 // ... get contextConfig |
|
728 RPacketContext::TContextConfigR99_R4 contextConfig; |
|
729 TPckg< RPacketContext::TContextConfigR99_R4 > pckgContextConfig = |
|
730 ( TPckg< RPacketContext::TContextConfigR99_R4 > ) contextConfig; |
|
731 aPacketContext.GetConfig(requestStatus, pckgContextConfig); |
|
732 User::WaitForRequest(requestStatus); |
|
733 |
|
734 // data for SetProfileParameters's ExpectL |
|
735 TInfoName primaryContextName; |
|
736 TContextParams contextParams; |
|
737 contextParams.iContextName = aContextName; |
|
738 contextParams.iContextType = contextConfig.iNWIContext; |
|
739 contextParams.iPdpType = contextConfig.iPdpType; |
|
740 contextParams.iPrimaryContextName = primaryContextName; |
|
741 contextParams.iContextStatus = contextStatus; |
|
742 TMockLtsyData2<TContextParams, RPacketQoS::TQoSR99_R4Requested> |
|
743 expExpect(contextParams, *req); |
|
744 expectDataSPP.Close(); |
|
745 expExpect.SerialiseL(expectDataSPP); |
|
746 |
|
747 iMockLTSY.ExpectL(EPacketQoSSetProfileParams, expectDataSPP); |
|
748 aPacketQoS.SetProfileParameters(requestStatus, pckg); |
|
749 User::WaitForRequest(requestStatus); |
|
750 AssertMockLtsyStatusL(); |
|
751 ret = KErrNone; |
|
752 } |
|
753 |
|
754 if (TPacketDataConfigBase::KConfigRel5 == aRequested.ExtensionId()) |
|
755 { |
|
756 RPacketQoS::TQoSR5Requested* req; |
|
757 req = reinterpret_cast< RPacketQoS::TQoSR5Requested* > ( &aRequested ); |
|
758 TPckg<RPacketQoS::TQoSR5Requested> pckg(*req); |
|
759 |
|
760 // prepare data for expectDataSPP ... |
|
761 // ... context status |
|
762 RPacketContext::TContextStatus contextStatus; |
|
763 aPacketContext.GetStatus(contextStatus); |
|
764 // ... get contextConfig |
|
765 RPacketContext::TContextConfig_R5 contextConfig; |
|
766 TPckg< RPacketContext::TContextConfig_R5 > pckgContextConfig = |
|
767 ( TPckg< RPacketContext::TContextConfig_R5 > ) contextConfig; |
|
768 aPacketContext.GetConfig(requestStatus, pckgContextConfig); |
|
769 User::WaitForRequest(requestStatus); |
|
770 |
|
771 // data for SetProfileParameters's ExpectL |
|
772 TInfoName primaryContextName; |
|
773 TContextParams contextParams; |
|
774 contextParams.iContextName = aContextName; |
|
775 contextParams.iContextType = contextConfig.iNWIContext; |
|
776 contextParams.iPdpType = contextConfig.iPdpType; |
|
777 contextParams.iPrimaryContextName = primaryContextName; |
|
778 contextParams.iContextStatus = contextStatus; |
|
779 TMockLtsyData2<TContextParams, RPacketQoS::TQoSR5Requested> |
|
780 expExpect(contextParams, *req); |
|
781 expectDataSPP.Close(); |
|
782 expExpect.SerialiseL(expectDataSPP); |
|
783 |
|
784 iMockLTSY.ExpectL(EPacketQoSSetProfileParams, expectDataSPP); |
|
785 |
|
786 aPacketQoS.SetProfileParameters(requestStatus, pckg); |
|
787 User::WaitForRequest(requestStatus); |
|
788 AssertMockLtsyStatusL(); |
|
789 ret = KErrNone; |
|
790 } |
|
791 |
|
792 |
|
793 // if context status was changed |
|
794 if (statusChanged) |
|
795 { |
|
796 // return to previous status |
|
797 SetContextStatusL(aContextName, contextStatus); |
|
798 } |
|
799 |
|
800 CleanupStack::PopAndDestroy(1);// expectDataSPP |
|
801 // aPacketQoS is still in CleanupStack !!! |
|
802 return ret; |
|
803 } |
|
804 |
|
805 |
|
806 /** |
|
807 Set status to RPacketService |
|
808 @param aStatus status to set |
|
809 @param aIsResumed -- is resumed |
|
810 */ |
|
811 TInt CCtsyComponentTestBase::SetPacketServiceStatusL(RPacketService::TStatus& aStatus, TBool aIsResumed) |
|
812 { |
|
813 |
|
814 RBuf8 data; |
|
815 CleanupClosePushL(data); |
|
816 |
|
817 // Data for CompleteL |
|
818 TMockLtsyData2 <RPacketService::TStatus, TBool > ltsyData(aStatus, aIsResumed); |
|
819 ltsyData.SerialiseL(data); |
|
820 |
|
821 TRequestStatus mockLtsyStatus; |
|
822 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
823 |
|
824 // Issue the Complete... |
|
825 iMockLTSY.CompleteL(EPacketNotifyStatusChange, KErrNone, data); |
|
826 User::WaitForRequest(mockLtsyStatus); |
|
827 |
|
828 CleanupStack::PopAndDestroy(1); // data |
|
829 |
|
830 return mockLtsyStatus.Int(); |
|
831 } |
|
832 |
|
833 /** |
|
834 Add filter to RContext |
|
835 @param aContext RPacketContext use to add filter |
|
836 @param aPacketFilterInfo -- Reference to a TPacketFilterV2 class packaged inside a TPckg<> class. |
|
837 */ |
|
838 TInt CCtsyComponentTestBase::AddContextPacketFilterL(RPacketContext& aContext, |
|
839 TInfoName& aContextName, |
|
840 RPacketContext::TPacketFilterV2& aFilter, |
|
841 TBool aIsFailInCTSY) |
|
842 { |
|
843 |
|
844 RBuf8 data; |
|
845 CleanupClosePushL(data); |
|
846 |
|
847 TRequestStatus requestStatus; |
|
848 |
|
849 RPacketContext::TPacketFilterV2Pckg filterPckg (aFilter); |
|
850 |
|
851 // if request reaches LTSY |
|
852 if (!aIsFailInCTSY) |
|
853 { |
|
854 //data for ExpectL |
|
855 RPacketContext::TContextConfigGPRS configGPRS; |
|
856 CArrayFixFlat< RPacketContext::TPacketFilterV2 >* filterArray = new ( ELeave ) CArrayFixFlat |
|
857 <RPacketContext::TPacketFilterV2>( 1 ); |
|
858 CleanupStack::PushL(filterArray); |
|
859 |
|
860 filterArray->AppendL( aFilter ); |
|
861 |
|
862 TMockLtsyContextData2< TInfoName, CArrayFixFlat< RPacketContext::TPacketFilterV2 >* > |
|
863 packetFilterData( configGPRS, 0, aContextName, filterArray ); |
|
864 packetFilterData.SerialiseL(data); |
|
865 iMockLTSY.ExpectL(EPacketContextAddPacketFilter, data); |
|
866 |
|
867 //data for CompleteL |
|
868 TMockLtsyData1<TInfoName > contexName(aContextName); |
|
869 data.Close(); |
|
870 contexName.SerialiseL(data); |
|
871 iMockLTSY.CompleteL(EPacketContextSetConfig, KErrNone, data); |
|
872 |
|
873 CleanupStack::PopAndDestroy(1); // filterArray |
|
874 } |
|
875 |
|
876 aContext.AddPacketFilter(requestStatus, filterPckg); |
|
877 User::WaitForRequest(requestStatus); |
|
878 |
|
879 CleanupStack::PopAndDestroy(1); // data |
|
880 |
|
881 return requestStatus.Int(); |
|
882 } |
|
883 |
|
884 TInt CCtsyComponentTestBase::OpenNewCall(RLine& aLine, RCall& aCall, const TDesC& aLineName) |
|
885 { |
|
886 TName name; |
|
887 name = KMmTsyPhoneName; |
|
888 name.Append(KDoubleColon); |
|
889 name.Append(aLineName); |
|
890 name.Append(KDoubleColon); |
|
891 |
|
892 return aCall.OpenNewCall(aLine, name); |
|
893 } |
|
894 |
|
895 TInt CCtsyComponentTestBase::OpenNewCall(RLine& aLine, RCall& aCall, const TDesC& aLineName, TName& aNewName) |
|
896 { |
|
897 aNewName = KMmTsyPhoneName; |
|
898 aNewName.Append(KDoubleColon); |
|
899 aNewName.Append(aLineName); |
|
900 aNewName.Append(KDoubleColon); |
|
901 |
|
902 return aCall.OpenNewCall(aLine, aNewName); |
|
903 } |
|
904 |
|
905 /** |
|
906 Create incoming call on RLine |
|
907 @param aLine RLine use to create call. |
|
908 @param aCallId Call id for created call. |
|
909 @param aLineName The name of the line. Deprecated, line should be opened in advance |
|
910 @param aIncomingCallName On completion contains the name of the incoming call. |
|
911 @param aMobileService Applicability of created call to a mobile service group. |
|
912 @param aMobileCallStatus Call state of created call. |
|
913 */ |
|
914 TInt CCtsyComponentTestBase::CreateIncomingCallL(RLine& aLine, |
|
915 const TInt aCallId, |
|
916 const TDesC& /*aLineName*/, |
|
917 TName& aIncomingCallName, |
|
918 RMobilePhone::TMobileService aMobileService, |
|
919 RMobileCall::TMobileCallStatus aMobileCallStatus) |
|
920 { |
|
921 RBuf8 completeData; |
|
922 CleanupClosePushL(completeData); |
|
923 |
|
924 TRequestStatus requestNotify; |
|
925 TRequestStatus mockLtsyStatus; |
|
926 |
|
927 aLine.NotifyIncomingCall(requestNotify, aIncomingCallName); |
|
928 |
|
929 // call CompleteNotifyIncomingCall for set iCallId = aCallId. |
|
930 RMobileCall::TMobileCallInfoV1 mobileCallInfo; |
|
931 mobileCallInfo.iService = aMobileService; |
|
932 TMockLtsyCallData1<RMobileCall::TMobileCallInfoV1> mockCallData1(aCallId, aMobileService, mobileCallInfo); |
|
933 mockCallData1.SerialiseL(completeData); |
|
934 |
|
935 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
936 iMockLTSY.CompleteL(EEtelLineNotifyIncomingCall, KErrNone, completeData); |
|
937 User::WaitForRequest(mockLtsyStatus); |
|
938 AssertMockLtsyStatusL(); |
|
939 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
940 |
|
941 User::WaitForRequest(requestNotify); |
|
942 AssertMockLtsyStatusL(); |
|
943 ASSERT_EQUALS(KErrNone, requestNotify.Int()); |
|
944 |
|
945 // call CompleteNotifyStatusChange for set iMobileCallStatus = aMobileCallStatus. |
|
946 TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData2(aCallId, aMobileService, aMobileCallStatus); |
|
947 completeData.Close(); |
|
948 mockCallData2.SerialiseL(completeData); |
|
949 |
|
950 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
951 iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData); |
|
952 User::WaitForRequest(mockLtsyStatus); |
|
953 AssertMockLtsyStatusL(); |
|
954 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
955 |
|
956 AssertMockLtsyStatusL(); |
|
957 CleanupStack::PopAndDestroy(1); |
|
958 |
|
959 return KErrNone; |
|
960 } |
|
961 |
|
962 /** |
|
963 Close incoming call |
|
964 @param aCall RCall to close. |
|
965 @param aCallId Call id of the call. |
|
966 @param aMobileService Applicability of the call to a mobile service group. |
|
967 */ |
|
968 void CCtsyComponentTestBase::CloseIncomingCallL(RCall& aCall, const TInt aCallId, |
|
969 const RMobilePhone::TMobileService aMobileService) |
|
970 { |
|
971 CloseCallL(aCall, aCallId, aMobileService); |
|
972 } |
|
973 |
|
974 |
|
975 /** |
|
976 Close call |
|
977 @param aCall RCall to close. |
|
978 @param aCallId Call id of the call. |
|
979 @param aMobileService Applicability of the call to a mobile service group. |
|
980 */ |
|
981 |
|
982 void CCtsyComponentTestBase::CloseCallL(RCall& aCall, |
|
983 const TInt aCallId, |
|
984 const RMobilePhone::TMobileService aMobileService) |
|
985 { |
|
986 PrepareCallCloseL(aCallId, aMobileService); |
|
987 |
|
988 aCall.Close(); |
|
989 AssertMockLtsyStatusL(); |
|
990 } |
|
991 |
|
992 /** |
|
993 Prepare call close |
|
994 @param aCallId Call id of the call. |
|
995 @param aMobileService Applicability of the call to a mobile service group. |
|
996 */ |
|
997 |
|
998 void CCtsyComponentTestBase::PrepareCallCloseL(const TInt aCallId, |
|
999 const RMobilePhone::TMobileService aMobileService) |
|
1000 { |
|
1001 RBuf8 expectData; |
|
1002 CleanupClosePushL(expectData); |
|
1003 |
|
1004 TInt hangUpCause = KErrGsmReleaseByUser; |
|
1005 TBool autoStChangeDisable = EFalse; |
|
1006 TMockLtsyCallData2<TInt, TBool> mockData2(aCallId, aMobileService, |
|
1007 hangUpCause, |
|
1008 autoStChangeDisable); |
|
1009 mockData2.SerialiseL(expectData); |
|
1010 iMockLTSY.ExpectL(EEtelCallHangUp, expectData); |
|
1011 |
|
1012 CleanupStack::PopAndDestroy(1); // expectData |
|
1013 } |
|
1014 |
|
1015 /** |
|
1016 Close line |
|
1017 @param aCall RLine to close. |
|
1018 @param aCallId Call id of connected call on the line |
|
1019 @param aMobileService Applicability of the call to a mobile service group. |
|
1020 */ |
|
1021 void CCtsyComponentTestBase::CloseLineL(RLine& aLine, TInt aCallId, RMobilePhone::TMobileService aMobileService) |
|
1022 { |
|
1023 RBuf8 expectData; |
|
1024 CleanupClosePushL(expectData); |
|
1025 |
|
1026 // Get Call Status |
|
1027 RCall::TStatus callStatus; |
|
1028 aLine.GetStatus(callStatus); |
|
1029 |
|
1030 // Hang up call if call is still connecting |
|
1031 // so in this case we have to prepare expectData |
|
1032 if ( !( RMobileCall::EStatusIdle == callStatus || |
|
1033 RMobileCall::EStatusDisconnecting == callStatus || |
|
1034 RMobileCall::EStatusDisconnectingWithInband == callStatus ) |
|
1035 && aCallId !=0 && aMobileService != RMobilePhone::EServiceUnspecified) |
|
1036 { |
|
1037 // prepare data for close line |
|
1038 TInt symbianHangUpCause( KErrGsmReleaseByUser ); |
|
1039 TBool autoStChangeDisable = EFalse; |
|
1040 TMockLtsyCallData2<TInt, TBool> expData(aCallId, aMobileService, symbianHangUpCause, autoStChangeDisable); |
|
1041 expData.SerialiseL(expectData); |
|
1042 iMockLTSY.ExpectL(EEtelCallHangUp, expectData); |
|
1043 } |
|
1044 |
|
1045 // close line |
|
1046 aLine.Close(); |
|
1047 |
|
1048 CleanupStack::PopAndDestroy(1); // expectData |
|
1049 } |
|
1050 |
|
1051 /** |
|
1052 Put complete data of CallGetMobileCallInfo IPC to MockLTSY |
|
1053 @param aCallId Call id of the call |
|
1054 @param aService Applicability of the call to a mobile service group. |
|
1055 @param aTelNumber Telephone number of the call. |
|
1056 */ |
|
1057 void CCtsyComponentTestBase::CallGetMobileCallInfoL(TInt aCallId, |
|
1058 RMobilePhone::TMobileService aService, |
|
1059 const TDesC &aTelNumber) |
|
1060 { |
|
1061 RBuf8 data; |
|
1062 CleanupClosePushL(data); |
|
1063 |
|
1064 RMobileCall::TMobileCallInfoV1 callInfo; |
|
1065 callInfo.iDialledParty.iTelNumber.Copy(aTelNumber); |
|
1066 callInfo.iService = aService; |
|
1067 callInfo.iEmergency = EFalse; |
|
1068 callInfo.iRemoteParty.iCallingName = KNullDesC; |
|
1069 callInfo.iRemoteParty.iRemoteIdStatus = RMobileCall::ERemoteIdentityUnknown; |
|
1070 callInfo.iRemoteParty.iRemoteNumber.iTelNumber = KNullDesC; |
|
1071 callInfo.iRemoteParty.iRemoteNumber.iNumberPlan = RMobilePhone::EUnknownNumberingPlan; |
|
1072 callInfo.iRemoteParty.iRemoteNumber.iTypeOfNumber = RMobilePhone::EUnknownNumber; |
|
1073 callInfo.iForwarded = EFalse; |
|
1074 callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallRemoteParty; |
|
1075 |
|
1076 TMockLtsyCallData1<RMobileCall::TMobileCallInfoV1> callInfoData(aCallId, aService, callInfo); |
|
1077 callInfoData.SerialiseL(data); |
|
1078 |
|
1079 iMockLTSY.CompleteL(EMobileCallGetMobileCallInfo, KErrNone, data); |
|
1080 |
|
1081 CleanupStack::PopAndDestroy(1); |
|
1082 } |
|
1083 |
|
1084 /** |
|
1085 Change call status |
|
1086 @param aCallId Call id of the call |
|
1087 @param aMobileService Applicability of the call to a mobile service group. |
|
1088 @param aCallStatus Call status. |
|
1089 */ |
|
1090 void CCtsyComponentTestBase::ChangeCallStatusL(const TInt aCallId, |
|
1091 const RMobilePhone::TMobileService aMobileService, |
|
1092 const RMobileCall::TMobileCallStatus aCallStatus, |
|
1093 const TInt aError) |
|
1094 { |
|
1095 RBuf8 data; |
|
1096 data.CleanupClosePushL(); |
|
1097 |
|
1098 TRequestStatus mockLtsyStatus; |
|
1099 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
1100 |
|
1101 RMobileCall::TMobileCallStatus callStatus = aCallStatus; |
|
1102 TMockLtsyCallData1<RMobileCall::TMobileCallStatus> completeCallStatusData(aCallId, aMobileService, callStatus); |
|
1103 data.Close(); |
|
1104 completeCallStatusData.SerialiseL(data); |
|
1105 iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, aError, data); |
|
1106 |
|
1107 User::WaitForRequest(mockLtsyStatus); |
|
1108 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
1109 |
|
1110 AssertMockLtsyStatusL(); |
|
1111 |
|
1112 CleanupStack::PopAndDestroy(&data); |
|
1113 } |
|
1114 |
|
1115 /** |
|
1116 Gets next main service group enumeration value |
|
1117 @param aServiceGroup current service group |
|
1118 */ |
|
1119 void CCtsyComponentTestBase::GetNextServiceGroup(RMobilePhone::TMobileService &aServiceGroup) |
|
1120 { |
|
1121 switch ( aServiceGroup ) |
|
1122 { |
|
1123 case RMobilePhone::EVoiceService: |
|
1124 aServiceGroup = RMobilePhone::EAuxVoiceService; |
|
1125 break; |
|
1126 case RMobilePhone::EAuxVoiceService: |
|
1127 aServiceGroup = RMobilePhone::ECircuitDataService; |
|
1128 break; |
|
1129 case RMobilePhone::ECircuitDataService: |
|
1130 aServiceGroup = RMobilePhone::EFaxService; |
|
1131 break; |
|
1132 default: |
|
1133 aServiceGroup = RMobilePhone::EVoiceService; |
|
1134 break; |
|
1135 } |
|
1136 } |
|
1137 |
|
1138 /** |
|
1139 Opens a line |
|
1140 @param aLine The line to open |
|
1141 @param aLineName The name of the line |
|
1142 */ |
|
1143 void CCtsyComponentTestBase::OpenLineLC(RLine& aLine, const TDesC& aLineName) |
|
1144 { |
|
1145 TInt errorCode = aLine.Open(iPhone, aLineName); |
|
1146 ASSERT_EQUALS(KErrNone, errorCode) |
|
1147 CleanupClosePushL(aLine); |
|
1148 } |
|
1149 |
|
1150 /** |
|
1151 Opens a call |
|
1152 @param aLine A line to open the call from |
|
1153 @param aCall The call to open |
|
1154 */ |
|
1155 void CCtsyComponentTestBase::OpenNewCallLC(RLine& aLine, RCall& aCall) |
|
1156 { |
|
1157 TInt errorCode = aCall.OpenNewCall(aLine); |
|
1158 ASSERT_EQUALS(KErrNone, errorCode); |
|
1159 CleanupClosePushL(aCall); |
|
1160 } |
|
1161 |
|
1162 void CCtsyComponentTestBase::OpenIncomingCallLC( |
|
1163 RLine& aLine, |
|
1164 RCall& aCall, |
|
1165 TInt aCallId, |
|
1166 RMobilePhone::TMobileService aMobileService, |
|
1167 RMobileCall::TMobileCallStatus aMobileCallStatus) |
|
1168 { |
|
1169 |
|
1170 TName incomingCallName; |
|
1171 |
|
1172 TInt err = CreateIncomingCallL(aLine, aCallId, KNullDesC, incomingCallName, |
|
1173 aMobileService, aMobileCallStatus); |
|
1174 ASSERT_EQUALS(KErrNone, err); |
|
1175 |
|
1176 err = aCall.OpenExistingCall(aLine, incomingCallName); |
|
1177 ASSERT_EQUALS(KErrNone, err); |
|
1178 CleanupClosePushL(aCall); |
|
1179 AssertMockLtsyStatusL(); |
|
1180 |
|
1181 } |
|
1182 |
|
1183 /** |
|
1184 Opens RMobilePhoneBookStore |
|
1185 @param aStore phoneBookStore |
|
1186 @param aName phoneBookStore name |
|
1187 @param RMobilePhone phone for phoneBookStore. |
|
1188 */ |
|
1189 |
|
1190 void CCtsyComponentTestBase::OpenPhoneBookStoreL(RMobilePhoneBookStore &aStore, TName &aName, RMobilePhone &aPhone) |
|
1191 { |
|
1192 |
|
1193 if ( !aName.CompareF( KETelIccAdnPhoneBook ) || |
|
1194 !aName.CompareF( KETelIccFdnPhoneBook )) |
|
1195 { |
|
1196 RBuf8 data; |
|
1197 CleanupClosePushL(data); |
|
1198 |
|
1199 RBuf8 data2; |
|
1200 CleanupClosePushL(data2); |
|
1201 |
|
1202 |
|
1203 TRequestStatus mockLtsyStatus; |
|
1204 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
1205 |
|
1206 |
|
1207 //EMmTsyPhoneBookStoreInitIPC |
|
1208 TMockLtsyPhoneBookData0 storeInitData(aName); |
|
1209 storeInitData.SerialiseL(data); |
|
1210 |
|
1211 iMockLTSY.ExpectL(EMmTsyPhoneBookStoreInitIPC, data); |
|
1212 |
|
1213 |
|
1214 CStorageInfoData storageData; |
|
1215 |
|
1216 SetStorageInfoData(storageData); |
|
1217 |
|
1218 TMockLtsyPhoneBookData1< CStorageInfoData > retStoreInitC(aName, storageData); |
|
1219 retStoreInitC.SerialiseL(data2); |
|
1220 |
|
1221 iMockLTSY.CompleteL(EMmTsyPhoneBookStoreInitIPC, KErrNone, data2, 0); |
|
1222 |
|
1223 |
|
1224 //EMmTsyPhoneBookStoreCacheIPC |
|
1225 CArrayPtrSeg<CPhoneBookStoreEntry>* cache = new(ELeave) CArrayPtrSeg<CPhoneBookStoreEntry>( 1 ); |
|
1226 CleanupStack::PushL(cache); |
|
1227 |
|
1228 TMockLtsyPhoneBookData1<CArrayPtrSeg<CPhoneBookStoreEntry>*> storeCacheData(aName, cache); |
|
1229 data2.Close(); |
|
1230 storeCacheData.SerialiseL(data2); |
|
1231 data.Close(); |
|
1232 storeInitData.SerialiseL(data); |
|
1233 |
|
1234 |
|
1235 iMockLTSY.ExpectL(EMmTsyPhoneBookStoreCacheIPC, data); |
|
1236 iMockLTSY.CompleteL(EMmTsyPhoneBookStoreCacheIPC, KErrNone, data2, 0); |
|
1237 |
|
1238 //Open |
|
1239 TInt ret = aStore.Open(aPhone, aName); |
|
1240 ASSERT_EQUALS(KErrNone, ret); |
|
1241 |
|
1242 User::WaitForRequest(mockLtsyStatus); |
|
1243 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
1244 AssertMockLtsyStatusL(); |
|
1245 |
|
1246 |
|
1247 CleanupStack::PopAndDestroy(3); //data, data2, cache |
|
1248 |
|
1249 } |
|
1250 else |
|
1251 { |
|
1252 RBuf8 data; |
|
1253 CleanupClosePushL(data); |
|
1254 |
|
1255 RBuf8 data2; |
|
1256 CleanupClosePushL(data2); |
|
1257 |
|
1258 |
|
1259 TRequestStatus mockLtsyStatus; |
|
1260 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
1261 |
|
1262 |
|
1263 //EMmTsyPhoneBookStoreInitIPC |
|
1264 TMockLtsyPhoneBookData0 storeInitData(aName); |
|
1265 storeInitData.SerialiseL(data); |
|
1266 |
|
1267 iMockLTSY.ExpectL(EMmTsyPhoneBookStoreInitIPC, data); |
|
1268 |
|
1269 |
|
1270 CStorageInfoData storageData; |
|
1271 |
|
1272 SetStorageInfoData(storageData); |
|
1273 |
|
1274 TMockLtsyPhoneBookData1< CStorageInfoData > retStoreInitC(aName, storageData); |
|
1275 retStoreInitC.SerialiseL(data2); |
|
1276 |
|
1277 iMockLTSY.CompleteL(EMmTsyPhoneBookStoreInitIPC, KErrNone, data2, 0); |
|
1278 |
|
1279 //Open |
|
1280 TInt ret = aStore.Open(aPhone, aName); |
|
1281 ASSERT_EQUALS(KErrNone, ret); |
|
1282 |
|
1283 User::WaitForRequest(mockLtsyStatus); |
|
1284 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
1285 AssertMockLtsyStatusL(); |
|
1286 |
|
1287 CleanupStack::PopAndDestroy(2); //data, data2 |
|
1288 } |
|
1289 } |
|
1290 |
|
1291 void CCtsyComponentTestBase::ChangeUsedSimCardTypeL(TICCType aType) |
|
1292 { |
|
1293 TRequestStatus mockLtsyStatus; |
|
1294 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
1295 |
|
1296 RBuf8 completeData; |
|
1297 CleanupClosePushL(completeData); |
|
1298 TICCType myICCType(aType); |
|
1299 |
|
1300 TMockLtsyData1<TICCType> iccData(myICCType); |
|
1301 completeData.Close(); |
|
1302 iccData.SerialiseL(completeData); |
|
1303 |
|
1304 TPckg<TInt> dataPckg(aType); |
|
1305 iMockLTSY.CompleteL(EMmTsySimGetICCType, KErrNone, completeData); |
|
1306 |
|
1307 iMockLTSY.ExpectL(EMmTsySecurityGetSimActivePinStateIPC); |
|
1308 |
|
1309 User::WaitForRequest(mockLtsyStatus); |
|
1310 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
1311 AssertMockLtsyStatusL(); |
|
1312 CleanupStack::PopAndDestroy(1); |
|
1313 } |
|
1314 |
|
1315 |
|
1316 void CCtsyComponentTestBase::SetStorageInfoData(CStorageInfoData& aStorage, TInt aVal) |
|
1317 { |
|
1318 aStorage.iADNNumberLengthMax = |
|
1319 aStorage.iADNTextLengthMax = |
|
1320 aStorage.iFDNNumberLengthMax = |
|
1321 aStorage.iFDNTextLengthMax = |
|
1322 aStorage.iSDNNumberLengthMax = |
|
1323 aStorage.iSDNTextLengthMax = |
|
1324 aStorage.iVMBXNumberLengthMax = |
|
1325 aStorage.iVMBXTextLengthMax = |
|
1326 aStorage.iMBDNNumberLengthMax = |
|
1327 aStorage.iMBDNTextLengthMax = aVal; |
|
1328 } |
|
1329 |
|
1330 /* |
|
1331 * CompleteDialStatusNotificationsL completes the correct call notifications to get the call into the |
|
1332 connected state simulating the remote party answering the dialled call. |
|
1333 * @param aCall A call which has been dialled. |
|
1334 * @param aCallId callId ltsy must allocate for this call |
|
1335 * @param aMobileService type of call. |
|
1336 */ |
|
1337 void CCtsyComponentTestBase::CompleteDialStatusNotificationsL(RCall &aCall, TInt aCallId, RMobilePhone::TMobileService aMobileService ) |
|
1338 { |
|
1339 |
|
1340 RBuf8 completeData; |
|
1341 CleanupClosePushL(completeData); |
|
1342 |
|
1343 TRequestStatus mockLtsyStatus; |
|
1344 TRequestStatus reqState1, reqState2, reqState3; |
|
1345 RCall::TStatus status; |
|
1346 |
|
1347 aCall.NotifyStatusChange(reqState1, status); |
|
1348 |
|
1349 RMobileCall::TMobileCallStatus mobileCallCurrentStatus = RMobileCall::EStatusDialling; |
|
1350 TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData4(aCallId, aMobileService, mobileCallCurrentStatus); |
|
1351 completeData.Close(); |
|
1352 mockCallData4.SerialiseL(completeData); |
|
1353 |
|
1354 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
1355 iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData); |
|
1356 User::WaitForRequest(mockLtsyStatus); |
|
1357 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
1358 |
|
1359 User::WaitForRequest(reqState1); |
|
1360 aCall.NotifyStatusChange(reqState2, status); |
|
1361 |
|
1362 mobileCallCurrentStatus = RMobileCall::EStatusConnecting; |
|
1363 TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData5(aCallId, aMobileService, mobileCallCurrentStatus); |
|
1364 completeData.Close(); |
|
1365 mockCallData5.SerialiseL(completeData); |
|
1366 |
|
1367 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
1368 iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData); |
|
1369 User::WaitForRequest(mockLtsyStatus); |
|
1370 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
1371 |
|
1372 User::WaitForRequest(reqState2); |
|
1373 aCall.NotifyStatusChange(reqState3, status); |
|
1374 |
|
1375 mobileCallCurrentStatus = RMobileCall::EStatusConnected; |
|
1376 TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData6(aCallId, aMobileService, mobileCallCurrentStatus); |
|
1377 completeData.Close(); |
|
1378 mockCallData6.SerialiseL(completeData); |
|
1379 |
|
1380 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
1381 iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData); |
|
1382 User::WaitForRequest(mockLtsyStatus); |
|
1383 AssertMockLtsyStatusL(); |
|
1384 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
1385 |
|
1386 // status call becomes 'connected' here... |
|
1387 |
|
1388 User::WaitForRequest(reqState3); |
|
1389 |
|
1390 CleanupStack::PopAndDestroy(1); |
|
1391 } |
|
1392 |
|
1393 /* |
|
1394 * CompleteCallDisconnectNotificationsL completes the necessary call status notification to disconnect a connected call. |
|
1395 * @param aCallId callId ltsy must allocate for this call |
|
1396 * @param aMobileService type of call. |
|
1397 */ |
|
1398 void CCtsyComponentTestBase::CompleteCallDisconnectNotificationsL(TInt aCallId, RMobilePhone::TMobileService aMobileService) |
|
1399 { |
|
1400 |
|
1401 RBuf8 expectData; |
|
1402 CleanupClosePushL(expectData); |
|
1403 |
|
1404 RBuf8 completeData; |
|
1405 CleanupClosePushL(completeData); |
|
1406 |
|
1407 TRequestStatus mockLtsyStatus; |
|
1408 |
|
1409 // call CMmVoiceCallTsy::CompleteNotifyStatusChange for setting |
|
1410 // iMobileCallStatus = RMobileCall::EStatusDisconnecting. |
|
1411 RMobileCall::TMobileCallStatus mobileCallSt = RMobileCall::EStatusDisconnecting; |
|
1412 TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallDataStatus1(aCallId, aMobileService, mobileCallSt); |
|
1413 completeData.Close(); |
|
1414 mockCallDataStatus1.SerialiseL(completeData); |
|
1415 |
|
1416 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
1417 iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData); |
|
1418 |
|
1419 User::WaitForRequest(mockLtsyStatus); |
|
1420 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
1421 |
|
1422 // call CMmVoiceCallTsy::CompleteNotifyStatusChange for setting |
|
1423 // iMobileCallStatus = RMobileCall::EStatusIdle. |
|
1424 mobileCallSt = RMobileCall::EStatusIdle; |
|
1425 TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallDataStatus2(aCallId, aMobileService, mobileCallSt); |
|
1426 completeData.Close(); |
|
1427 mockCallDataStatus2.SerialiseL(completeData); |
|
1428 |
|
1429 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
1430 iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData); |
|
1431 |
|
1432 // when call becomes idle, remaining duration of the call is added to life time param in LTSY: |
|
1433 TUint32 duration2 = 4; // this is a dummy value, which won't be checked by mocksy engine |
|
1434 TMockLtsyData1<TUint32> ltsyData2( duration2 ); |
|
1435 expectData.Close(); |
|
1436 ltsyData2.SerialiseL(expectData); |
|
1437 iMockLTSY.ExpectL(EMmTsyUpdateLifeTimeIPC, expectData); |
|
1438 |
|
1439 User::WaitForRequest(mockLtsyStatus); |
|
1440 // we did set a sleep time for 15sec, but after stopping timer it may give us 14 sec or 15 sec |
|
1441 // we can not determine the correct value for the mockLTSY; |
|
1442 // we tell mocksy engine to ignore duration param value |
|
1443 AssertMockLtsyStatusL(); |
|
1444 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
1445 |
|
1446 TRequestStatus mockLtsyStatus3; |
|
1447 iMockLTSY.NotifyTerminated(mockLtsyStatus3); |
|
1448 iMockLTSY.CompleteL(EMmTsyUpdateLifeTimeIPC, KErrNone); |
|
1449 |
|
1450 User::WaitForRequest(mockLtsyStatus3); |
|
1451 ASSERT_EQUALS(KErrNone, mockLtsyStatus3.Int()); |
|
1452 |
|
1453 CleanupStack::PopAndDestroy(2); |
|
1454 |
|
1455 } |
|
1456 |