|
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 "cctsyucasembms018.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 CTestSuite* CCTsyUCaseMbms018::CreateSuiteL(const TDesC& aName) |
|
37 { |
|
38 SUB_SUITE; |
|
39 ADD_TEST_STEP_ISO_CPP(CCTsyUCaseMbms018, CCtsyIntegrationTestMbms0001L ); |
|
40 END_SUITE; |
|
41 } |
|
42 |
|
43 // |
|
44 // Actual test cases |
|
45 // |
|
46 |
|
47 /** |
|
48 * @SYMTestCaseID BA-CTSY-INT-MB-0034 |
|
49 * @SYMFssID BA/CTSY/MB-0034 |
|
50 * @SYMTestCaseDesc MBMS data reception suspended |
|
51 * @SYMTestPriority High |
|
52 * @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 |
|
53 * @SYMTestExpectedResults Pass - Context1 is suspended. Context2 is receiving. |
|
54 * @SYMTestType CIT |
|
55 * @SYMTestCaseDependencies live/manual |
|
56 * |
|
57 * Reason for test: test data reception suspended. |
|
58 * |
|
59 * @return - none |
|
60 */ |
|
61 void CCTsyUCaseMbms018::CCtsyIntegrationTestMbms0001L() |
|
62 { |
|
63 |
|
64 // |
|
65 // SET UP |
|
66 // |
|
67 |
|
68 OpenEtelServerL( EUseExtendedError ); |
|
69 CleanupStack::PushL( TCleanupItem( Cleanup, this ) ); |
|
70 OpenPhoneL(); |
|
71 |
|
72 RBuf8 data; |
|
73 CleanupClosePushL(data); |
|
74 |
|
75 TInt maxSessions( 5 ); |
|
76 RPacketService packetService; |
|
77 OpenPacketServiceL( packetService, |
|
78 RPacketService::EStatusUnattached, |
|
79 RPacketService::EAttachWhenNeeded, |
|
80 maxSessions, |
|
81 maxSessions ); |
|
82 CleanupClosePushL( packetService ); |
|
83 |
|
84 TInfoName contextId1, contextId2; |
|
85 RPacketMbmsContext context1, context2; |
|
86 context1.OpenNewContext( packetService, contextId1 ); |
|
87 context2.OpenNewContext( packetService, contextId2 ); |
|
88 CleanupClosePushL( context1 ); |
|
89 CleanupClosePushL( context2 ); |
|
90 |
|
91 // data for NotifyStatusChange |
|
92 TRequestStatus requestStatus, requestStatus2; |
|
93 RPacketContext::TContextStatus contextStatus, contextStatus2; |
|
94 TContextMisc completeMisc, completeMisc2; |
|
95 TRequestStatus mockLtsyStatus, mockLtsyStatus2; |
|
96 |
|
97 // |
|
98 // SET UP END |
|
99 // |
|
100 |
|
101 // |
|
102 // TEST START |
|
103 // |
|
104 |
|
105 // initialise contexts |
|
106 TInt status = InitMbmsContextL(context1, contextId1); |
|
107 ASSERT_EQUALS( KErrNone, status ); |
|
108 status = InitMbmsContextL(context2, contextId2); |
|
109 ASSERT_EQUALS( KErrNone, status ); |
|
110 |
|
111 // 1st context configuration |
|
112 RPacketMbmsContext::TContextConfigMbmsV1 setConfig1; |
|
113 setConfig1.iMbmsAccessBearer = E2GBearer; |
|
114 setConfig1.iMbmsServiceMode = KBroadcast; |
|
115 setConfig1.iMbmsServicePriority = EMbmsLowServicePriority; |
|
116 setConfig1.iMbmsSessionFlag = ETrue; |
|
117 |
|
118 // setup context1 |
|
119 status = SetMbmsConfigL( context1, contextId1, setConfig1 ); |
|
120 ASSERT_EQUALS( KErrNone, status ); |
|
121 // status = receiving at first |
|
122 |
|
123 // context activation |
|
124 status = SetMbmsActiveL( context1, setConfig1, contextId1 ); |
|
125 ASSERT_EQUALS( KErrNone, status ); |
|
126 |
|
127 // 2nd context configuration |
|
128 RPacketMbmsContext::TContextConfigMbmsV1 setConfig2; |
|
129 setConfig2.iMbmsAccessBearer = E2GBearer; |
|
130 setConfig2.iMbmsServiceMode = KBroadcast; |
|
131 setConfig2.iMbmsServicePriority = EMbmsHighServicePriority; |
|
132 setConfig2.iMbmsSessionFlag = ETrue; |
|
133 |
|
134 // setup context2 |
|
135 status = SetMbmsConfigL( context2, contextId2, setConfig2 ); |
|
136 ASSERT_EQUALS( KErrNone, status ); |
|
137 // status = receiving at first |
|
138 |
|
139 // context activation |
|
140 status = SetMbmsActiveL( context2, setConfig2, contextId2 ); |
|
141 ASSERT_EQUALS( KErrNone, status ); |
|
142 |
|
143 |
|
144 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
145 |
|
146 // set context 1 on receiving state |
|
147 completeMisc.iStatus = RPacketContext::EStatusReceiving; |
|
148 TMockLtsyData2 <TInfoName, TContextMisc> ltsyData(contextId1, completeMisc); |
|
149 ltsyData.SerialiseL(data); |
|
150 //send request |
|
151 context1.NotifyStatusChange(requestStatus, contextStatus); |
|
152 //send completion |
|
153 iMockLTSY.CompleteL(EPacketContextNotifyStatusChange, KErrNone, data); |
|
154 // wait for completion |
|
155 User::WaitForRequest(mockLtsyStatus); |
|
156 |
|
157 // wait for NotifyStatusChange |
|
158 User::WaitForRequest(requestStatus); |
|
159 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
160 ASSERT_EQUALS(completeMisc.iStatus, contextStatus); |
|
161 AssertMockLtsyStatusL(); |
|
162 |
|
163 // Network sends MBMS indication that Sevice2 is about to commence delivery. |
|
164 iMockLTSY.NotifyTerminated(mockLtsyStatus2); |
|
165 |
|
166 // context 1 is going suspending state |
|
167 completeMisc.iStatus = RPacketContext::EStatusSuspended; |
|
168 TMockLtsyData2 <TInfoName, TContextMisc> ltsyData2(contextId1, completeMisc); |
|
169 ltsyData2.SerialiseL(data); |
|
170 //send request |
|
171 context1.NotifyStatusChange(requestStatus, contextStatus); |
|
172 //send completion |
|
173 iMockLTSY.CompleteL(EPacketContextNotifyStatusChange, KErrMbmsServicePreempted, data); |
|
174 // wait for completion |
|
175 User::WaitForRequest(mockLtsyStatus); |
|
176 |
|
177 // wait for NotifyStatusChange |
|
178 User::WaitForRequest(requestStatus); |
|
179 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
180 ASSERT_EQUALS(completeMisc.iStatus, contextStatus); |
|
181 AssertMockLtsyStatusL(); |
|
182 |
|
183 // LTSY completes indication to CTSY for Context2 with status of context = EStatusReceiving |
|
184 // CTSY completes pending Context2, NotifyStatusChange with status = EStatusReceiving. |
|
185 iMockLTSY.NotifyTerminated(mockLtsyStatus2); |
|
186 |
|
187 // context 2 is going to receive |
|
188 completeMisc2.iStatus = RPacketContext::EStatusReceiving; |
|
189 TMockLtsyData2 <TInfoName, TContextMisc> ltsyData3(contextId2, completeMisc2); |
|
190 ltsyData3.SerialiseL(data); |
|
191 //send request |
|
192 context2.NotifyStatusChange(requestStatus2, contextStatus2); |
|
193 //send completion |
|
194 iMockLTSY.CompleteL(EPacketContextNotifyStatusChange, KErrNone, data); |
|
195 // wait for completion |
|
196 User::WaitForRequest(mockLtsyStatus2); |
|
197 |
|
198 // wait for NotifyStatusChange |
|
199 User::WaitForRequest(requestStatus2); |
|
200 ASSERT_EQUALS(KErrNone, requestStatus2.Int()); |
|
201 ASSERT_EQUALS(completeMisc2.iStatus, contextStatus2); |
|
202 AssertMockLtsyStatusL(); |
|
203 |
|
204 // |
|
205 // TEST END |
|
206 // |
|
207 |
|
208 CleanupStack::PopAndDestroy( 5, this ); // context2, context1, data, packetService, this |
|
209 } |
|
210 |