|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file The TEFUnit integration test suite for MBMS Context support in the Common TSY. |
|
18 */ |
|
19 |
|
20 #include "cctsyucasembms009.h" |
|
21 #include "cctsyactiveretriever.h" |
|
22 #include <etel.h> |
|
23 #include <etelmm.h> |
|
24 #include <et_clsvr.h> |
|
25 #include <ctsy/mmtsy_names.h> |
|
26 #include <ctsy/serviceapi/mmtsy_ipcdefs.h> |
|
27 #include "tmockltsydata.h" |
|
28 #include <ctsy/serviceapi/gsmerror.h> |
|
29 |
|
30 #include <pcktcs.h> |
|
31 #include <pcktlist.h> |
|
32 #include "pcktretrieve.h" |
|
33 #include "CMmCommonStaticUtility.h" |
|
34 #include <ctsy/serviceapi/mmtsy_defaults.h> |
|
35 |
|
36 #define MBMS_MONITORSERVICECOUNTONE 1 |
|
37 #define MBMS_MONITORSERVICECOUNTMULTIPLE 3 |
|
38 |
|
39 CTestSuite* CCTsyUCaseMbms009::CreateSuiteL(const TDesC& aName) |
|
40 { |
|
41 SUB_SUITE; |
|
42 ADD_TEST_STEP_ISO_CPP(CCTsyUCaseMbms009, CCtsyIntegrationTestMbms0001L ); |
|
43 ADD_TEST_STEP_ISO_CPP(CCTsyUCaseMbms009, CCtsyIntegrationTestMbms0002L ); |
|
44 END_SUITE; |
|
45 } |
|
46 |
|
47 // |
|
48 // Actual test cases |
|
49 // |
|
50 |
|
51 /** |
|
52 * @SYMTestCaseID BA-CTSY-INT-MB-0017 |
|
53 * @SYMFssID BA/CTSY/PKTS-0017 |
|
54 * @SYMTestCaseDesc Support monitor list by removing entry. |
|
55 * @SYMTestPriority High |
|
56 * @SYMTestActions RPacketService::NotifyMbmsNetworkServiceStatusChange, RPacketService::UpdateMbmsMonitorServiceListL |
|
57 * @SYMTestExpectedResults Pass - Service is removed from the monitored service list. |
|
58 * @SYMTestType CIT |
|
59 * @SYMTestCaseDependencies live/manual |
|
60 * |
|
61 * Reason for test: Verify that services is removed correctly to the monitored service list. |
|
62 * |
|
63 * @return - none |
|
64 */ |
|
65 void CCTsyUCaseMbms009::CCtsyIntegrationTestMbms0001L() |
|
66 { |
|
67 |
|
68 // |
|
69 // SET UP |
|
70 // |
|
71 |
|
72 OpenEtelServerL( EUseExtendedError ); |
|
73 CleanupStack::PushL( TCleanupItem( Cleanup, this ) ); |
|
74 OpenPhoneL(); |
|
75 |
|
76 RBuf8 data; |
|
77 CleanupClosePushL(data); |
|
78 |
|
79 RPacketService packetService; |
|
80 OpenPacketServiceL( packetService ); |
|
81 CleanupClosePushL( packetService ); |
|
82 |
|
83 TRequestStatus requestStatus; |
|
84 TRequestStatus requestStatus2; |
|
85 TRequestStatus mockLtsyStatus; |
|
86 |
|
87 // |
|
88 // SET UP END |
|
89 // |
|
90 |
|
91 // |
|
92 // TEST START |
|
93 // |
|
94 |
|
95 TInt maxAllowed = 3; |
|
96 TInt maxvalue = 3; |
|
97 |
|
98 // check maximum monitored service value |
|
99 TMockLtsyData1<TInt> ltsyData2(maxvalue); |
|
100 data.Close(); |
|
101 ltsyData2.SerialiseL(data); |
|
102 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
103 iMockLTSY.CompleteL(EPacketEnumerateMbmsMonitorServiceList, KErrNone, data); |
|
104 User::WaitForRequest(mockLtsyStatus); |
|
105 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
106 ASSERT_EQUALS( maxvalue, maxAllowed ); |
|
107 |
|
108 CFilteringActiveScheduler scheduler; |
|
109 CActiveScheduler::Install(&scheduler); |
|
110 |
|
111 // post RPacketService::NotifyMbmsNetworkServiceAvailabilityChange |
|
112 packetService.NotifyMbmsServiceAvailabilityChange( requestStatus ); |
|
113 |
|
114 //List retriever |
|
115 CRetrievePcktMbmsMonitoredServices* monitorList = CRetrievePcktMbmsMonitoredServices::NewL(packetService); |
|
116 CleanupStack::PushL(monitorList); |
|
117 |
|
118 CActiveRetriever::ResetRequestsNumber(); |
|
119 CActiveRetriever* activeRetriever = CActiveRetriever::NewL(*monitorList); |
|
120 CleanupStack::PushL(activeRetriever); |
|
121 scheduler.AddRetrieverL(*activeRetriever); |
|
122 |
|
123 RBuf8 expectData1; |
|
124 CleanupClosePushL(expectData1); |
|
125 TInt i; |
|
126 TMockLtsyData1<TInt> expExpect1(i); |
|
127 expExpect1.SerialiseL(expectData1); |
|
128 |
|
129 RBuf8 CompleteData; |
|
130 CleanupClosePushL(CompleteData); |
|
131 |
|
132 TRequestStatus aReqStatus; |
|
133 RPacketService::TMbmsServiceAvailabilityV1 existingParams; |
|
134 |
|
135 |
|
136 CPcktMbmsMonitoredServiceList* multipleEntries = CPcktMbmsMonitoredServiceList ::NewL(); |
|
137 CleanupStack::PushL(multipleEntries); |
|
138 |
|
139 for(TInt i=0;i < MBMS_MONITORSERVICECOUNTMULTIPLE ;i++) |
|
140 { |
|
141 existingParams.iTmgi.SetServiceId(i); |
|
142 existingParams.iTmgi.SetMCC(i); |
|
143 existingParams.iTmgi.SetMNC(i); |
|
144 existingParams.iMbmsServiceMode = KBroadcast; |
|
145 existingParams.iMbmsAccessBearer = E2GBearer; |
|
146 existingParams.iMbmsAvailabilityStatus = EMbmsUnavailable; |
|
147 multipleEntries->AddEntryL( existingParams ); |
|
148 } |
|
149 |
|
150 iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, expectData1); |
|
151 iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone, CompleteData); |
|
152 |
|
153 // PacketService::UpdateMbmsMonitorServiceListL |
|
154 packetService.UpdateMbmsMonitorServiceListL(aReqStatus, EAddEntries, multipleEntries); |
|
155 |
|
156 // wait for completion of UpdateMbmsMonitorServiceListL( |
|
157 User::WaitForRequest(aReqStatus); |
|
158 // wait for completion of NotifyMbmsServiceAvailabilityChange |
|
159 User::WaitForRequest( requestStatus ); |
|
160 AssertMockLtsyStatusL(); |
|
161 ASSERT_EQUALS( KErrNone, aReqStatus.Int() ); |
|
162 |
|
163 monitorList->Start(activeRetriever->Status()); |
|
164 activeRetriever->Activate(); |
|
165 scheduler.StartScheduler(); |
|
166 |
|
167 ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber()); |
|
168 ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int()); |
|
169 |
|
170 CPcktMbmsMonitoredServiceList* list = monitorList->RetrieveListL(); |
|
171 CleanupStack::PushL( list ); |
|
172 |
|
173 ASSERT_EQUALS(MBMS_MONITORSERVICECOUNTMULTIPLE, list->Enumerate() ); |
|
174 |
|
175 monitorList->Start( activeRetriever->Status() ); |
|
176 activeRetriever->Activate(); |
|
177 scheduler.StartScheduler(); |
|
178 |
|
179 ASSERT_EQUALS( 0, CActiveRetriever::ResetRequestsNumber() ); |
|
180 ASSERT_EQUALS( KErrNone, activeRetriever->iStatus.Int() ); |
|
181 |
|
182 list = monitorList->RetrieveListL(); |
|
183 CleanupStack::PushL( list ); |
|
184 // ensure that Services is added correctly into the monitored service list |
|
185 ASSERT_TRUE( TComparator<CPcktMbmsMonitoredServiceList>::IsEqual( *multipleEntries, *list ) ); |
|
186 |
|
187 //------------------------------------------------------------------------- |
|
188 // Test removing one entry |
|
189 //------------------------------------------------------------------------- |
|
190 |
|
191 // post RPacketService::NotifyMbmsNetworkServiceAvailabilityChange |
|
192 packetService.NotifyMbmsServiceAvailabilityChange( requestStatus ); |
|
193 |
|
194 iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, expectData1); |
|
195 |
|
196 TInt complete = 1; |
|
197 TMockLtsyData1< TInt > dataForComplete(complete); |
|
198 dataForComplete.SerialiseL(CompleteData); |
|
199 iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone, CompleteData); |
|
200 |
|
201 CPcktMbmsMonitoredServiceList* oneEntry = CPcktMbmsMonitoredServiceList ::NewL(); |
|
202 CleanupStack::PushL(oneEntry); |
|
203 |
|
204 oneEntry = CPcktMbmsMonitoredServiceList ::NewL(); |
|
205 CleanupStack::PushL(oneEntry); |
|
206 RPacketService::TMbmsServiceAvailabilityV1 param2; |
|
207 param2.iTmgi.SetServiceId(0); |
|
208 oneEntry->AddEntryL( param2 ); |
|
209 packetService.UpdateMbmsMonitorServiceListL(aReqStatus, ERemoveEntries, oneEntry); |
|
210 // wait for completion of UpdateMbmsMonitorServiceListL( |
|
211 User::WaitForRequest(aReqStatus); |
|
212 // wait for completion of NotifyMbmsServiceAvailabilityChange |
|
213 User::WaitForRequest( requestStatus ); |
|
214 AssertMockLtsyStatusL(); |
|
215 ASSERT_EQUALS( KErrNone, aReqStatus.Int() ); |
|
216 |
|
217 monitorList->Start(activeRetriever->Status()); |
|
218 activeRetriever->Activate(); |
|
219 scheduler.StartScheduler(); |
|
220 |
|
221 ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber()); |
|
222 ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int()); |
|
223 |
|
224 list = monitorList->RetrieveListL(); |
|
225 CleanupStack::PushL( list ); |
|
226 |
|
227 multipleEntries->DeleteEntryL(0); |
|
228 ASSERT_EQUALS((MBMS_MONITORSERVICECOUNTMULTIPLE-1), list->Enumerate() ); |
|
229 // ensure that Services is added correctly into the monitored service list |
|
230 ASSERT_TRUE( TComparator<CPcktMbmsMonitoredServiceList>::IsEqual(*multipleEntries, *list) ); |
|
231 CleanupStack::PopAndDestroy( list ); |
|
232 // |
|
233 // TEST END |
|
234 // |
|
235 |
|
236 AssertMockLtsyStatusL(); |
|
237 CleanupStack::PopAndDestroy( 12, this ); // packetMbmsContext, packetService, this |
|
238 } |
|
239 |
|
240 // |
|
241 // Actual test cases |
|
242 // |
|
243 |
|
244 /** |
|
245 * @SYMTestCaseID BA-CTSY-INT-MB-0018 |
|
246 * @SYMFssID BA/CTSY/PKTS-0018 |
|
247 * @SYMTestCaseDesc Support monitor list by removing entry. |
|
248 * @SYMTestPriority High |
|
249 * @SYMTestActions RPacketService::NotifyMbmsNetworkServiceStatusChange, RPacketService::UpdateMbmsMonitorServiceListL |
|
250 * @SYMTestExpectedResults Pass - Service is removed from the monitored service list. |
|
251 * @SYMTestType CIT |
|
252 * @SYMTestCaseDependencies live/manual |
|
253 * |
|
254 * Reason for test: Verify that services is removed correctly to the monitored service list. |
|
255 * |
|
256 * @return - none |
|
257 */ |
|
258 void CCTsyUCaseMbms009::CCtsyIntegrationTestMbms0002L() |
|
259 { |
|
260 |
|
261 // |
|
262 // SET UP |
|
263 // |
|
264 |
|
265 OpenEtelServerL( EUseExtendedError ); |
|
266 CleanupStack::PushL( TCleanupItem( Cleanup, this ) ); |
|
267 OpenPhoneL(); |
|
268 |
|
269 RBuf8 data; |
|
270 CleanupClosePushL(data); |
|
271 |
|
272 RPacketService packetService; |
|
273 OpenPacketServiceL( packetService ); |
|
274 CleanupClosePushL( packetService ); |
|
275 |
|
276 TRequestStatus requestStatus; |
|
277 TRequestStatus requestStatus2; |
|
278 TRequestStatus mockLtsyStatus; |
|
279 |
|
280 // |
|
281 // SET UP END |
|
282 // |
|
283 |
|
284 // |
|
285 // TEST START |
|
286 // |
|
287 |
|
288 TInt maxAllowed = 3; |
|
289 TInt maxvalue = 3; |
|
290 |
|
291 // check maximum monitored service value |
|
292 TMockLtsyData1<TInt> ltsyData2(maxvalue); |
|
293 data.Close(); |
|
294 ltsyData2.SerialiseL(data); |
|
295 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
296 iMockLTSY.CompleteL(EPacketEnumerateMbmsMonitorServiceList, KErrNone, data); |
|
297 User::WaitForRequest(mockLtsyStatus); |
|
298 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
299 ASSERT_EQUALS( maxvalue, maxAllowed ); |
|
300 |
|
301 CFilteringActiveScheduler scheduler; |
|
302 CActiveScheduler::Install(&scheduler); |
|
303 |
|
304 // post RPacketService::NotifyMbmsNetworkServiceAvailabilityChange |
|
305 packetService.NotifyMbmsServiceAvailabilityChange( requestStatus ); |
|
306 |
|
307 //List retriever |
|
308 CRetrievePcktMbmsMonitoredServices* monitorList = CRetrievePcktMbmsMonitoredServices::NewL(packetService); |
|
309 CleanupStack::PushL(monitorList); |
|
310 |
|
311 CActiveRetriever::ResetRequestsNumber(); |
|
312 CActiveRetriever* activeRetriever = CActiveRetriever::NewL(*monitorList); |
|
313 CleanupStack::PushL(activeRetriever); |
|
314 scheduler.AddRetrieverL(*activeRetriever); |
|
315 |
|
316 RBuf8 expectData1; |
|
317 CleanupClosePushL(expectData1); |
|
318 TInt i; |
|
319 TMockLtsyData1<TInt> expExpect1(i); |
|
320 expExpect1.SerialiseL(expectData1); |
|
321 |
|
322 RBuf8 CompleteData; |
|
323 CleanupClosePushL(CompleteData); |
|
324 |
|
325 TRequestStatus aReqStatus; |
|
326 RPacketService::TMbmsServiceAvailabilityV1 existingParams; |
|
327 |
|
328 |
|
329 CPcktMbmsMonitoredServiceList* multipleEntries = CPcktMbmsMonitoredServiceList ::NewL(); |
|
330 CleanupStack::PushL(multipleEntries); |
|
331 |
|
332 for(TInt i=0;i < MBMS_MONITORSERVICECOUNTMULTIPLE ;i++) |
|
333 { |
|
334 existingParams.iTmgi.SetServiceId(i); |
|
335 existingParams.iTmgi.SetMCC(i); |
|
336 existingParams.iTmgi.SetMNC(i); |
|
337 existingParams.iMbmsServiceMode = KBroadcast; |
|
338 existingParams.iMbmsAccessBearer = E2GBearer; |
|
339 existingParams.iMbmsAvailabilityStatus = EMbmsUnavailable; |
|
340 multipleEntries->AddEntryL( existingParams ); |
|
341 } |
|
342 |
|
343 iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, expectData1); |
|
344 iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone, CompleteData); |
|
345 |
|
346 packetService.UpdateMbmsMonitorServiceListL(aReqStatus, EAddEntries, multipleEntries); |
|
347 |
|
348 // wait for completion of UpdateMbmsMonitorServiceListL( |
|
349 User::WaitForRequest(aReqStatus); |
|
350 // wait for completion of NotifyMbmsServiceAvailabilityChange |
|
351 User::WaitForRequest( requestStatus ); |
|
352 AssertMockLtsyStatusL(); |
|
353 ASSERT_EQUALS( KErrNone, aReqStatus.Int() ); |
|
354 |
|
355 monitorList->Start(activeRetriever->Status()); |
|
356 activeRetriever->Activate(); |
|
357 scheduler.StartScheduler(); |
|
358 |
|
359 ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber()); |
|
360 ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int()); |
|
361 |
|
362 CPcktMbmsMonitoredServiceList* list = monitorList->RetrieveListL(); |
|
363 CleanupStack::PushL( list ); |
|
364 |
|
365 ASSERT_EQUALS(MBMS_MONITORSERVICECOUNTMULTIPLE, list->Enumerate() ); |
|
366 |
|
367 monitorList->Start( activeRetriever->Status() ); |
|
368 activeRetriever->Activate(); |
|
369 scheduler.StartScheduler(); |
|
370 |
|
371 ASSERT_EQUALS( 0, CActiveRetriever::ResetRequestsNumber() ); |
|
372 ASSERT_EQUALS( KErrNone, activeRetriever->iStatus.Int() ); |
|
373 |
|
374 list = monitorList->RetrieveListL(); |
|
375 CleanupStack::PushL( list ); |
|
376 // ensure that Services is added correctly into the monitored service list |
|
377 ASSERT_TRUE( TComparator<CPcktMbmsMonitoredServiceList>::IsEqual( *multipleEntries, *list ) ); |
|
378 |
|
379 //------------------------------------------------------------------------- |
|
380 // Test removing one entry |
|
381 //------------------------------------------------------------------------- |
|
382 |
|
383 // post RPacketService::NotifyMbmsNetworkServiceAvailabilityChange |
|
384 packetService.NotifyMbmsServiceAvailabilityChange( requestStatus ); |
|
385 |
|
386 iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, expectData1); |
|
387 |
|
388 TInt complete = 1; |
|
389 TMockLtsyData1< TInt > dataForComplete(complete); |
|
390 dataForComplete.SerialiseL(CompleteData); |
|
391 iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone, CompleteData); |
|
392 |
|
393 CPcktMbmsMonitoredServiceList* oneEntry = CPcktMbmsMonitoredServiceList ::NewL(); |
|
394 CleanupStack::PushL(oneEntry); |
|
395 |
|
396 RPacketService::TMbmsServiceAvailabilityV1 param2; |
|
397 param2.iTmgi.SetServiceId(0); |
|
398 oneEntry->AddEntryL( param2 ); |
|
399 packetService.UpdateMbmsMonitorServiceListL(aReqStatus, ERemoveEntries, oneEntry); |
|
400 // wait for completion of UpdateMbmsMonitorServiceListL( |
|
401 User::WaitForRequest(aReqStatus); |
|
402 // wait for completion of NotifyMbmsServiceAvailabilityChange |
|
403 User::WaitForRequest( requestStatus ); |
|
404 AssertMockLtsyStatusL(); |
|
405 ASSERT_EQUALS( KErrNone, aReqStatus.Int() ); |
|
406 |
|
407 //------------------------------------------------------------------------- |
|
408 // Try to remove same entry again |
|
409 //------------------------------------------------------------------------- |
|
410 |
|
411 // post RPacketService::NotifyMbmsNetworkServiceAvailabilityChange |
|
412 packetService.NotifyMbmsServiceAvailabilityChange( requestStatus ); |
|
413 |
|
414 // PacketService::UpdateMbmsMonitorServiceListL |
|
415 packetService.UpdateMbmsMonitorServiceListL(aReqStatus, ERemoveEntries, oneEntry); |
|
416 |
|
417 // wait for completion of UpdateMbmsMonitorServiceListL( |
|
418 User::WaitForRequest(aReqStatus); |
|
419 AssertMockLtsyStatusL(); |
|
420 ASSERT_EQUALS( KErrNotFound, aReqStatus.Int() ); |
|
421 |
|
422 monitorList->Start(activeRetriever->Status()); |
|
423 activeRetriever->Activate(); |
|
424 scheduler.StartScheduler(); |
|
425 |
|
426 ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber()); |
|
427 ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int()); |
|
428 |
|
429 list = monitorList->RetrieveListL(); |
|
430 CleanupStack::PushL( list ); |
|
431 |
|
432 multipleEntries->DeleteEntryL(0); |
|
433 ASSERT_EQUALS((MBMS_MONITORSERVICECOUNTMULTIPLE-1), list->Enumerate() ); |
|
434 ASSERT_TRUE( TComparator<CPcktMbmsMonitoredServiceList>::IsEqual(*multipleEntries, *list) ); |
|
435 |
|
436 // |
|
437 // TEST END |
|
438 // |
|
439 |
|
440 AssertMockLtsyStatusL(); |
|
441 CleanupStack::PopAndDestroy( 12, this ); // packetMbmsContext, packetService, this |
|
442 } |
|
443 |