|
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 "cctsyucasembms010.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_MONITORSERVICECOUNTMULTIPLE 3 |
|
37 #define MBMS_MONITORSERVICECOUNTZERO 0 |
|
38 |
|
39 CTestSuite* CCTsyUCaseMbms010::CreateSuiteL(const TDesC& aName) |
|
40 { |
|
41 SUB_SUITE; |
|
42 ADD_TEST_STEP_ISO_CPP(CCTsyUCaseMbms010, CCTsyIntegrationTestMbms0001L ); |
|
43 END_SUITE; |
|
44 } |
|
45 |
|
46 // |
|
47 // Actual test cases |
|
48 // |
|
49 |
|
50 /** |
|
51 * @SYMTestCaseID BA-CTSY-INT-MB-0019 |
|
52 * @SYMFssID BA/CTSY/PKTS-0019 |
|
53 * @SYMTestCaseDesc Support removing all entries from monitor list |
|
54 * @SYMTestPriority High |
|
55 * @SYMTestActions RPacketContext::SetConfig, RPacketContext::Activate, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::EnumerateNifs, RPacketService::GetContextNameInNif, RPacketService::GetNifInfo, RPacketService::EnumerateContextsInNif, RPacketContext::Deactivate, RPacketService::EnumerateContextsInNif, RPacketContext::Deactivate |
|
56 * @SYMTestExpectedResults Pass - Monitored service list is empty. |
|
57 * @SYMTestType CIT |
|
58 * @SYMTestCaseDependencies live/manual |
|
59 * |
|
60 * Reason for test:Verify that all services is removed correctly to the monitored service list. |
|
61 * |
|
62 * @return - none |
|
63 */ |
|
64 void CCTsyUCaseMbms010::CCTsyIntegrationTestMbms0001L() |
|
65 { |
|
66 |
|
67 // |
|
68 // SET UP |
|
69 // |
|
70 |
|
71 OpenEtelServerL( EUseExtendedError ); |
|
72 CleanupStack::PushL( TCleanupItem( Cleanup, this ) ); |
|
73 OpenPhoneL(); |
|
74 |
|
75 RPacketService packetService; |
|
76 OpenPacketServiceL( packetService ); |
|
77 CleanupClosePushL( packetService ); |
|
78 |
|
79 TInfoName contextId; |
|
80 RPacketMbmsContext packetMbmsContext; |
|
81 packetMbmsContext.OpenNewContext( packetService, contextId ); |
|
82 CleanupClosePushL( packetMbmsContext ); |
|
83 |
|
84 // |
|
85 // SET UP END |
|
86 // |
|
87 |
|
88 // |
|
89 // TEST START |
|
90 // |
|
91 |
|
92 |
|
93 CFilteringActiveScheduler scheduler; |
|
94 CActiveScheduler::Install(&scheduler); |
|
95 |
|
96 RBuf8 data; |
|
97 CleanupClosePushL( data ); |
|
98 |
|
99 // check maximum monitored service value |
|
100 TInt maxvalue( 10 ); |
|
101 TMockLtsyData1<TInt> ltsyData( maxvalue ); |
|
102 data.Close(); |
|
103 ltsyData.SerialiseL( data ); |
|
104 |
|
105 TRequestStatus mockLtsyStatus; |
|
106 iMockLTSY.NotifyTerminated( mockLtsyStatus ); |
|
107 iMockLTSY.CompleteL( EPacketEnumerateMbmsMonitorServiceList, KErrNone, data ); |
|
108 User::WaitForRequest( mockLtsyStatus ); |
|
109 ASSERT_EQUALS( KErrNone, mockLtsyStatus.Int() ); |
|
110 |
|
111 //List retriever |
|
112 CRetrievePcktMbmsMonitoredServices* monitorList = CRetrievePcktMbmsMonitoredServices::NewL( packetService ); |
|
113 CleanupStack::PushL( monitorList ); |
|
114 |
|
115 CActiveRetriever::ResetRequestsNumber(); |
|
116 CActiveRetriever* activeRetriever = CActiveRetriever::NewL( *monitorList ); |
|
117 CleanupStack::PushL( activeRetriever ); |
|
118 scheduler.AddRetrieverL( *activeRetriever ); |
|
119 |
|
120 RBuf8 expectData; |
|
121 CleanupClosePushL( expectData ); |
|
122 TInt i; |
|
123 TMockLtsyData1<TInt> expExpect( i ); |
|
124 expExpect.SerialiseL( expectData ); |
|
125 |
|
126 RBuf8 completeData; |
|
127 CleanupClosePushL( completeData ); |
|
128 |
|
129 TRequestStatus reqStatus; |
|
130 RPacketService::TMbmsServiceAvailabilityV1 param; |
|
131 |
|
132 CPcktMbmsMonitoredServiceList* multipleEntries = CPcktMbmsMonitoredServiceList ::NewL(); |
|
133 CleanupStack::PushL( multipleEntries ); |
|
134 |
|
135 for( TInt i = 0; i < MBMS_MONITORSERVICECOUNTMULTIPLE; i++ ) |
|
136 { |
|
137 param.iTmgi.SetServiceId( i ); |
|
138 param.iTmgi.SetMCC( i ); |
|
139 param.iTmgi.SetMNC( i ); |
|
140 param.iMbmsServiceMode = KBroadcast; |
|
141 param.iMbmsAccessBearer = E2GBearer; |
|
142 multipleEntries->AddEntryL( param ); |
|
143 } |
|
144 |
|
145 iMockLTSY.ExpectL( EPacketUpdateMbmsMonitorServiceList, expectData ); |
|
146 |
|
147 TInt complete( 1 ); |
|
148 TMockLtsyData1< TInt > entryData( complete ); |
|
149 entryData.SerialiseL( completeData ); |
|
150 iMockLTSY.CompleteL( EPacketUpdateMbmsMonitorServiceList, KErrNone, completeData ); |
|
151 |
|
152 // PacketService::UpdateMbmsMonitorServiceListL |
|
153 packetService.UpdateMbmsMonitorServiceListL( reqStatus, EAddEntries, multipleEntries ); |
|
154 User::WaitForRequest( reqStatus ); |
|
155 ASSERT_EQUALS( KErrNone, reqStatus.Int() ); |
|
156 |
|
157 monitorList->Start( activeRetriever->Status() ); |
|
158 activeRetriever->Activate(); |
|
159 scheduler.StartScheduler(); |
|
160 |
|
161 ASSERT_EQUALS( 0, CActiveRetriever::ResetRequestsNumber() ); |
|
162 ASSERT_EQUALS( KErrNone, activeRetriever->iStatus.Int() ); |
|
163 |
|
164 CPcktMbmsMonitoredServiceList* list = monitorList->RetrieveListL(); |
|
165 CleanupStack::PushL( list ); |
|
166 |
|
167 ASSERT_EQUALS( MBMS_MONITORSERVICECOUNTMULTIPLE, list->Enumerate() ); |
|
168 // ensure that Services is added correctly into the monitored service list |
|
169 ASSERT_TRUE( TComparator<CPcktMbmsMonitoredServiceList>::IsEqual( *multipleEntries, *list ) ); |
|
170 |
|
171 TMockLtsyData1< TInt > dataForComplete( complete ); |
|
172 iMockLTSY.ExpectL( EPacketUpdateMbmsMonitorServiceList, expectData ); |
|
173 dataForComplete.SerialiseL( completeData ); |
|
174 iMockLTSY.CompleteL( EPacketUpdateMbmsMonitorServiceList, KErrNone, completeData ); |
|
175 |
|
176 CPcktMbmsMonitoredServiceList* nullPtr( NULL ); |
|
177 // PacketService::UpdateMbmsMonitorServiceListL |
|
178 packetService.UpdateMbmsMonitorServiceListL( reqStatus, ERemoveAllEntries, nullPtr ); |
|
179 User::WaitForRequest( reqStatus ); |
|
180 ASSERT_EQUALS( KErrNone, reqStatus.Int() ); |
|
181 |
|
182 monitorList->Start( activeRetriever->Status() ); |
|
183 activeRetriever->Activate(); |
|
184 scheduler.StartScheduler(); |
|
185 |
|
186 ASSERT_EQUALS( 0, CActiveRetriever::ResetRequestsNumber() ); |
|
187 ASSERT_EQUALS( KErrNone, activeRetriever->iStatus.Int() ); |
|
188 |
|
189 list = monitorList->RetrieveListL(); |
|
190 |
|
191 TInt ix( 0 ); |
|
192 while( multipleEntries->Enumerate() > 0 ) |
|
193 { |
|
194 multipleEntries->DeleteEntryL( ix ); |
|
195 } |
|
196 |
|
197 ASSERT_EQUALS( MBMS_MONITORSERVICECOUNTZERO, list->Enumerate() ); |
|
198 // ensure that all Services are removed correctly into the monitored service list |
|
199 ASSERT_TRUE( TComparator<CPcktMbmsMonitoredServiceList>::IsEqual( *multipleEntries, *list ) ); |
|
200 |
|
201 AssertMockLtsyStatusL(); |
|
202 CActiveScheduler::Install( NULL ); |
|
203 CleanupStack::PopAndDestroy( 10, this ); |
|
204 } |
|
205 |