|
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 "cctsyucasembms011.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 |
|
38 CTestSuite* CCTsyUCaseMbms011::CreateSuiteL(const TDesC& aName) |
|
39 { |
|
40 SUB_SUITE; |
|
41 ADD_TEST_STEP_ISO_CPP(CCTsyUCaseMbms011, CCTsyIntegrationTestMbms0001L ); |
|
42 ADD_TEST_STEP_ISO_CPP(CCTsyUCaseMbms011, CCTsyIntegrationTestMbms0002L ); |
|
43 END_SUITE; |
|
44 } |
|
45 |
|
46 // |
|
47 // Actual test cases |
|
48 // |
|
49 |
|
50 /** |
|
51 * @SYMTestCaseID BA-CTSY-INT-MB-0020 |
|
52 * @SYMFssID BA/CTSY/PKTS-0020 |
|
53 * @SYMTestCaseDesc Support retrieving current availability status for each service currently being monitored |
|
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 - Every service has a valid status (Unknown, Unavailable or Available). |
|
57 * @SYMTestType CIT |
|
58 * @SYMTestCaseDependencies live/manual |
|
59 * |
|
60 * Reason for test: Support retrieving current availability status. |
|
61 * |
|
62 * @return - none |
|
63 */ |
|
64 void CCTsyUCaseMbms011::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 RBuf8 data; |
|
93 CleanupClosePushL( data ); |
|
94 TRequestStatus requestStatus; |
|
95 TRequestStatus mockLtsyStatus; |
|
96 |
|
97 TInt maxAllowed( 10 ); |
|
98 TInt maxvalue( 10 ); |
|
99 |
|
100 // check maximum monitored service value |
|
101 TMockLtsyData1<TInt> ltsyData( maxvalue ); |
|
102 data.Close(); |
|
103 ltsyData.SerialiseL( data ); |
|
104 iMockLTSY.NotifyTerminated( mockLtsyStatus ); |
|
105 iMockLTSY.CompleteL( EPacketEnumerateMbmsMonitorServiceList, KErrNone, data ); |
|
106 User::WaitForRequest( mockLtsyStatus ); |
|
107 ASSERT_EQUALS( KErrNone, mockLtsyStatus.Int() ); |
|
108 ASSERT_EQUALS( maxvalue, maxAllowed ); |
|
109 |
|
110 CFilteringActiveScheduler scheduler; |
|
111 CActiveScheduler::Install( &scheduler ); |
|
112 |
|
113 //List retriever |
|
114 CRetrievePcktMbmsMonitoredServices* monitorList = CRetrievePcktMbmsMonitoredServices::NewL( packetService ); |
|
115 CleanupStack::PushL( monitorList ); |
|
116 |
|
117 CActiveRetriever::ResetRequestsNumber(); |
|
118 CActiveRetriever* activeRetriever = CActiveRetriever::NewL( *monitorList ); |
|
119 CleanupStack::PushL( activeRetriever ); |
|
120 scheduler.AddRetrieverL( *activeRetriever ); |
|
121 |
|
122 RBuf8 expectData; |
|
123 CleanupClosePushL( expectData ); |
|
124 TInt i; |
|
125 TMockLtsyData1<TInt> expExpect( i ); |
|
126 expExpect.SerialiseL( expectData ); |
|
127 |
|
128 RBuf8 completeData; |
|
129 CleanupClosePushL( completeData ); |
|
130 |
|
131 TRequestStatus aReqStatus; |
|
132 RPacketService::TMbmsServiceAvailabilityV1 existingParams; |
|
133 |
|
134 CPcktMbmsMonitoredServiceList* multipleEntries = CPcktMbmsMonitoredServiceList ::NewL(); |
|
135 CleanupStack::PushL( multipleEntries ); |
|
136 |
|
137 for( TInt i = 0; i < MBMS_MONITORSERVICECOUNTMULTIPLE; i++ ) |
|
138 { |
|
139 existingParams.iTmgi.SetServiceId( i ); |
|
140 existingParams.iTmgi.SetMCC( i ); |
|
141 existingParams.iTmgi.SetMNC( i ); |
|
142 existingParams.iMbmsServiceMode = KBroadcast; |
|
143 existingParams.iMbmsAccessBearer = E2GBearer; |
|
144 existingParams.iMbmsAvailabilityStatus = EMbmsUnavailable; |
|
145 multipleEntries->AddEntryL( existingParams ); |
|
146 } |
|
147 |
|
148 iMockLTSY.ExpectL( EPacketUpdateMbmsMonitorServiceList, expectData ); |
|
149 iMockLTSY.CompleteL( EPacketUpdateMbmsMonitorServiceList, KErrNone, completeData ); |
|
150 |
|
151 // PacketService::UpdateMbmsMonitorServiceListL |
|
152 packetService.UpdateMbmsMonitorServiceListL( aReqStatus, EAddEntries, multipleEntries ); |
|
153 User::WaitForRequest( aReqStatus ); |
|
154 ASSERT_EQUALS( KErrNone, aReqStatus.Int() ); |
|
155 |
|
156 monitorList->Start( activeRetriever->Status() ); |
|
157 activeRetriever->Activate(); |
|
158 scheduler.StartScheduler(); |
|
159 |
|
160 ASSERT_EQUALS( 0, CActiveRetriever::ResetRequestsNumber() ); |
|
161 ASSERT_EQUALS( KErrNone, activeRetriever->iStatus.Int() ); |
|
162 |
|
163 CPcktMbmsMonitoredServiceList* list = monitorList->RetrieveListL(); |
|
164 CleanupStack::PushL( list ); |
|
165 |
|
166 ASSERT_EQUALS( MBMS_MONITORSERVICECOUNTMULTIPLE, list->Enumerate() ); |
|
167 |
|
168 |
|
169 monitorList->Start( activeRetriever->Status() ); |
|
170 activeRetriever->Activate(); |
|
171 scheduler.StartScheduler(); |
|
172 |
|
173 ASSERT_EQUALS( 0, CActiveRetriever::ResetRequestsNumber() ); |
|
174 // ensure that every service has a valid status |
|
175 ASSERT_EQUALS( KErrNone, activeRetriever->iStatus.Int() ); |
|
176 |
|
177 list = monitorList->RetrieveListL(); |
|
178 CleanupStack::PushL( list ); |
|
179 // ensure that Services is added correctly into the monitored service list |
|
180 ASSERT_TRUE( TComparator<CPcktMbmsMonitoredServiceList>::IsEqual( *multipleEntries, *list ) ); |
|
181 |
|
182 // |
|
183 // TEST END |
|
184 // |
|
185 |
|
186 AssertMockLtsyStatusL(); |
|
187 CleanupStack::PopAndDestroy( 11, this ); // list, multipleEntries, completeData, expectData, activeRetriever, monitorList, data, packetMbmsContext, packetService, this |
|
188 } |
|
189 |
|
190 /** |
|
191 * @SYMTestCaseID BA-CTSY-INT-MB-0021 |
|
192 * @SYMFssID BA/CTSY/PKTS-0021 |
|
193 * @SYMTestCaseDesc Support retrieving current availability status for each service currently being monitored |
|
194 * @SYMTestPriority High |
|
195 * @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 |
|
196 * @SYMTestExpectedResults Pass - Every service has a valid status (Unknown, Unavailable or Available). |
|
197 * @SYMTestType CIT |
|
198 * @SYMTestCaseDependencies live/manual |
|
199 * |
|
200 * Reason for test: Support retrieving current availability status. |
|
201 * |
|
202 * @return - none |
|
203 */ |
|
204 void CCTsyUCaseMbms011::CCTsyIntegrationTestMbms0002L() |
|
205 { |
|
206 |
|
207 // |
|
208 // SET UP |
|
209 // |
|
210 |
|
211 OpenEtelServerL( EUseExtendedError ); |
|
212 CleanupStack::PushL( TCleanupItem( Cleanup, this ) ); |
|
213 OpenPhoneL(); |
|
214 |
|
215 RPacketService packetService; |
|
216 OpenPacketServiceL( packetService ); |
|
217 CleanupClosePushL( packetService ); |
|
218 |
|
219 RBuf8 data; |
|
220 CleanupClosePushL( data ); |
|
221 |
|
222 CFilteringActiveScheduler scheduler; |
|
223 CActiveScheduler::Install( &scheduler ); |
|
224 |
|
225 // |
|
226 // SET UP END |
|
227 // |
|
228 |
|
229 // |
|
230 // TEST START |
|
231 // |
|
232 |
|
233 |
|
234 CRetrievePcktMbmsMonitoredServices* monitorList = CRetrievePcktMbmsMonitoredServices::NewL( packetService ); |
|
235 CleanupStack::PushL( monitorList ); |
|
236 |
|
237 CActiveRetriever::ResetRequestsNumber(); |
|
238 CActiveRetriever* activeRetriever = CActiveRetriever::NewL( *monitorList ); |
|
239 CleanupStack::PushL( activeRetriever ); |
|
240 scheduler.AddRetrieverL( *activeRetriever ); |
|
241 |
|
242 monitorList->Start( activeRetriever->Status() ); |
|
243 activeRetriever->Activate(); |
|
244 scheduler.StartScheduler(); |
|
245 |
|
246 ASSERT_EQUALS( 0, CActiveRetriever::ResetRequestsNumber() ); |
|
247 // ensure that Status is KErrNotFound because list is empty |
|
248 ASSERT_EQUALS( KErrNotFound, activeRetriever->iStatus.Int() ); |
|
249 |
|
250 // |
|
251 // TEST END |
|
252 // |
|
253 |
|
254 AssertMockLtsyStatusL(); |
|
255 CActiveScheduler::Install( NULL ); |
|
256 CleanupStack::PopAndDestroy( 5, this ); // activeRetriever, monitorList, data, packetService, this, list |
|
257 } |
|
258 |