24
|
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 |
|
|
18 |
/**
|
|
19 |
@file The TEFUnit test suite for CellBroadcastControl in the Common TSY.
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "cctsycellbroadcastfu.h"
|
|
23 |
#include <ctsy/rmmcustomapi.h>
|
|
24 |
#include <etel.h>
|
|
25 |
#include <etelmm.h>
|
|
26 |
#include <et_clsvr.h>
|
|
27 |
#include <ctsy/mmtsy_names.h>
|
|
28 |
#include <ctsy/serviceapi/mmtsy_ipcdefs.h>
|
|
29 |
#include <test/tmockltsydata.h>
|
|
30 |
#include <ctsy/serviceapi/gsmerror.h>
|
|
31 |
#include <ctsy/ltsy/mltsydispatchcellbroadcastinterface.h>
|
|
32 |
#include "mockltsyindicatorids.h"
|
|
33 |
|
|
34 |
CTestSuite* CCTsyCellBroadcastFU::CreateSuiteL(const TDesC& aName)
|
|
35 |
{
|
|
36 |
SUB_SUITE;
|
|
37 |
|
|
38 |
//add use-case tests
|
|
39 |
ADD_TEST_STEP_ISO_CPP(CCTsyCellBroadcastFU, TestUseCase0001L);
|
|
40 |
ADD_TEST_STEP_ISO_CPP(CCTsyCellBroadcastFU, TestUseCase0002L);
|
|
41 |
|
|
42 |
//add other unit tests
|
|
43 |
ADD_TEST_STEP_ISO_CPP(CCTsyCellBroadcastFU, TestUnit0001L);
|
|
44 |
ADD_TEST_STEP_ISO_CPP(CCTsyCellBroadcastFU, TestUnit0002L);
|
|
45 |
ADD_TEST_STEP_ISO_CPP(CCTsyCellBroadcastFU, TestUnit0003L);
|
|
46 |
|
|
47 |
END_SUITE;
|
|
48 |
}
|
|
49 |
|
|
50 |
void CCTsyCellBroadcastFU::InitSimCbTopicsL(RMmCustomAPI& aCustomApi, const TDesC& aTopic, TInt aNum)
|
|
51 |
{
|
|
52 |
|
|
53 |
RBuf8 compData;
|
|
54 |
CleanupClosePushL(compData);
|
|
55 |
|
|
56 |
CArrayFixFlat<RMmCustomAPI::TSimCbTopic>* simTopicArray = new ( ELeave ) CArrayFixFlat
|
|
57 |
<RMmCustomAPI::TSimCbTopic>(1);
|
|
58 |
CleanupStack::PushL(simTopicArray);
|
|
59 |
|
|
60 |
RMmCustomAPI::TSimCbTopic topic;
|
|
61 |
topic.iNumber = aNum;
|
|
62 |
topic.iName.Copy(aTopic);
|
|
63 |
|
|
64 |
simTopicArray->AppendL( topic );
|
|
65 |
|
|
66 |
TMockLtsyData1< CArrayFixFlat<RMmCustomAPI::TSimCbTopic>* > ltsyData(simTopicArray);
|
|
67 |
ltsyData.SerialiseL(compData);
|
|
68 |
|
|
69 |
iMockLTSY.ExpectL( MLtsyDispatchCellBroadcastStartSimCbTopicBrowsing::KLtsyDispatchCellBroadcastStartSimCbTopicBrowsingApiId);
|
|
70 |
iMockLTSY.CompleteL( MLtsyDispatchCellBroadcastStartSimCbTopicBrowsing::KLtsyDispatchCellBroadcastStartSimCbTopicBrowsingApiId, KErrNone, compData);
|
|
71 |
TInt ret = aCustomApi.StartSimCbTopicBrowsing();
|
|
72 |
ASSERT_EQUALS(KErrNone, ret);
|
|
73 |
|
|
74 |
CleanupStack::PopAndDestroy(2); //simTopicArray, compData
|
|
75 |
}
|
|
76 |
|
|
77 |
//
|
|
78 |
// Use-case tests
|
|
79 |
//
|
|
80 |
|
|
81 |
/**
|
|
82 |
@SYMTestCaseID BA-CTSYD-DIS-CELLBROADCAST-UC0001
|
|
83 |
@SYMComponent telephony_ctsy
|
|
84 |
@SYMTestCaseDesc Test support in CTSY for ReceiveMessage(), CompleteReceiveMessageGsmCbs(), SetFilterSettingL(), GetFilterSetting()
|
|
85 |
@SYMTestPriority High
|
|
86 |
@SYMTestActions Invokes ReceiveMessageL(), CompleteReceiveMessageGsmCbs(), SetFilterSettingL(), GetFilterSetting()
|
|
87 |
@SYMTestExpectedResults Pass
|
|
88 |
@SYMTestType CT
|
|
89 |
*/
|
|
90 |
void CCTsyCellBroadcastFU::TestUseCase0001L()
|
|
91 |
{
|
|
92 |
OpenEtelServerL(EUseExtendedError);
|
|
93 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
94 |
OpenPhoneL();
|
|
95 |
|
|
96 |
RBuf8 data;
|
|
97 |
CleanupClosePushL(data);
|
|
98 |
|
|
99 |
RMobileBroadcastMessaging messaging;
|
|
100 |
TInt err = messaging.Open(iPhone);
|
|
101 |
ASSERT_EQUALS(KErrNone, err);
|
|
102 |
CleanupClosePushL(messaging);
|
|
103 |
|
|
104 |
RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter expectData = RMobileBroadcastMessaging::EBroadcastAcceptAll;
|
|
105 |
|
|
106 |
TMockLtsyData1<RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter> expectLtsyData(expectData);
|
|
107 |
expectLtsyData.SerialiseL(data);
|
|
108 |
iMockLTSY.ExpectL(MLtsyDispatchCellBroadcastActivateBroadcastReceiveMessage::KLtsyDispatchCellBroadcastActivateBroadcastReceiveMessageApiId, data);
|
|
109 |
iMockLTSY.CompleteL(MLtsyDispatchCellBroadcastActivateBroadcastReceiveMessage::KLtsyDispatchCellBroadcastActivateBroadcastReceiveMessageApiId, KErrNone);
|
|
110 |
|
|
111 |
_LIT8(KMessage,"CBSMESSAGE");
|
|
112 |
TDesC8* cbsMessage = const_cast<TDesC8*>(&KMessage);
|
|
113 |
TMockLtsyData1<TDesC8*> completeLtsyData(cbsMessage);
|
|
114 |
data.Close();
|
|
115 |
completeLtsyData.SerialiseL(data);
|
|
116 |
iMockLTSY.CompleteL(KMockLtsyDispatchCellBroadcastGsmBroadcastNotifyMessageReceivedIndId, KErrNone, data);
|
|
117 |
|
|
118 |
TRequestStatus reqStatus;
|
|
119 |
RMobileBroadcastMessaging::TBroadcastPageData msgData;
|
|
120 |
RMobileBroadcastMessaging::TMobileBroadcastAttributesV1 attributes;
|
|
121 |
RMobileBroadcastMessaging::TMobileBroadcastAttributesV1Pckg msgAttributes(attributes);
|
|
122 |
messaging.ReceiveMessage(reqStatus, msgData, msgAttributes);
|
|
123 |
|
|
124 |
User::WaitForRequest(reqStatus);
|
|
125 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
126 |
AssertMockLtsyStatusL();
|
|
127 |
|
|
128 |
// iCbRoutingActivated == ETrue now: we can test SetFilterSetting()
|
|
129 |
|
|
130 |
RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter setting;
|
|
131 |
err = messaging.GetFilterSetting(setting);
|
|
132 |
ASSERT_EQUALS(KErrNone, err);
|
|
133 |
ASSERT_EQUALS(RMobileBroadcastMessaging::EBroadcastAcceptAll, setting);
|
|
134 |
AssertMockLtsyStatusL();
|
|
135 |
|
|
136 |
// mockltsy setup:
|
|
137 |
expectData = RMobileBroadcastMessaging::EBroadcastAcceptNone;
|
|
138 |
|
|
139 |
TMockLtsyData1<RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter> expectLtsyData2(expectData);
|
|
140 |
data.Close();
|
|
141 |
expectLtsyData2.SerialiseL(data);
|
|
142 |
iMockLTSY.ExpectL(MLtsyDispatchCellBroadcastSetBroadcastFilterSetting::KLtsyDispatchCellBroadcastSetBroadcastFilterSettingApiId, data);
|
|
143 |
iMockLTSY.CompleteL(MLtsyDispatchCellBroadcastSetBroadcastFilterSetting::KLtsyDispatchCellBroadcastSetBroadcastFilterSettingApiId, KErrNone);
|
|
144 |
|
|
145 |
// change setting
|
|
146 |
messaging.SetFilterSetting(reqStatus, RMobileBroadcastMessaging::EBroadcastAcceptNone);
|
|
147 |
User::WaitForRequest(reqStatus);
|
|
148 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
149 |
AssertMockLtsyStatusL();
|
|
150 |
|
|
151 |
err = messaging.GetFilterSetting(setting);
|
|
152 |
ASSERT_EQUALS(KErrNone, err);
|
|
153 |
ASSERT_EQUALS(RMobileBroadcastMessaging::EBroadcastAcceptNone, setting);
|
|
154 |
AssertMockLtsyStatusL();
|
|
155 |
|
|
156 |
CleanupStack::PopAndDestroy(3, this); // messaging, data, this
|
|
157 |
}
|
|
158 |
|
|
159 |
/**
|
|
160 |
@SYMTestCaseID BA-CTSYD-DIS-CELLBROADCAST-UC0002
|
|
161 |
@SYMComponent telephony_ctsy
|
|
162 |
@SYMTestCaseDesc Test support in CTSY for CompleteReceiveMessageWcdmaCbs()
|
|
163 |
@SYMTestPriority High
|
|
164 |
@SYMTestActions Invokes CompleteReceiveMessageWcdmaCbs()
|
|
165 |
@SYMTestExpectedResults Pass
|
|
166 |
@SYMTestType CT
|
|
167 |
*/
|
|
168 |
void CCTsyCellBroadcastFU::TestUseCase0002L()
|
|
169 |
{
|
|
170 |
OpenEtelServerL(EUseExtendedError);
|
|
171 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
172 |
OpenPhoneL();
|
|
173 |
|
|
174 |
RBuf8 data;
|
|
175 |
CleanupClosePushL(data);
|
|
176 |
|
|
177 |
RMobileBroadcastMessaging messaging;
|
|
178 |
TInt err = messaging.Open(iPhone);
|
|
179 |
ASSERT_EQUALS(KErrNone, err);
|
|
180 |
CleanupClosePushL(messaging);
|
|
181 |
|
|
182 |
RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter expectData = RMobileBroadcastMessaging::EBroadcastAcceptAll;
|
|
183 |
|
|
184 |
TMockLtsyData1<RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter> expectLtsyData(expectData);
|
|
185 |
expectLtsyData.SerialiseL(data);
|
|
186 |
iMockLTSY.ExpectL(MLtsyDispatchCellBroadcastActivateBroadcastReceiveMessage::KLtsyDispatchCellBroadcastActivateBroadcastReceiveMessageApiId, data);
|
|
187 |
iMockLTSY.CompleteL(MLtsyDispatchCellBroadcastActivateBroadcastReceiveMessage::KLtsyDispatchCellBroadcastActivateBroadcastReceiveMessageApiId, KErrNone);
|
|
188 |
|
|
189 |
TUint32 expectedFlags(RMobileBroadcastMessaging::KBroadcastDataFormat);
|
|
190 |
RMobileBroadcastMessaging::TMobileBroadcastDataFormat
|
|
191 |
expectedFormat(RMobileBroadcastMessaging::EFormatGsmTpdu);
|
|
192 |
|
|
193 |
_LIT8(KMessage, "Hello0");
|
|
194 |
TBuf8<RMobileBroadcastMessaging::KBroadcastPageSize> tmpName(KMessage);
|
|
195 |
TInt wcdmaPageNumber(1);
|
|
196 |
DispatcherCellBroadcast::TWcdmaCbsMsgBase wcdmaCbsMsg0;
|
|
197 |
wcdmaCbsMsg0.iNumberOfPages = 2;
|
|
198 |
wcdmaCbsMsg0.iMessageType = 3;
|
|
199 |
wcdmaCbsMsg0.iMessageId = 4;
|
|
200 |
wcdmaCbsMsg0.iSerialNum = 5;
|
|
201 |
wcdmaCbsMsg0.iDCS = 6;
|
|
202 |
wcdmaCbsMsg0.iInfoLength = 5;
|
|
203 |
|
|
204 |
TBool moreToCome = EFalse;
|
|
205 |
TDesC8* strPtr = &tmpName;
|
|
206 |
TMockLtsyData3<TDesC8* , DispatcherCellBroadcast::TWcdmaCbsMsgBase , TBool > completeWcdmaLtsyData(strPtr, wcdmaCbsMsg0, moreToCome);
|
|
207 |
data.Close();
|
|
208 |
completeWcdmaLtsyData.SerialiseL(data);
|
|
209 |
|
|
210 |
iMockLTSY.CompleteL(KMockLtsyDispatchCellBroadcastWcdmaBroadcastMessageReceivedIndId, KErrNone, data);
|
|
211 |
|
|
212 |
TRequestStatus reqStatus;
|
|
213 |
RMobileBroadcastMessaging::TBroadcastPageData msgData;
|
|
214 |
RMobileBroadcastMessaging::TMobileBroadcastAttributesV2 wcdmaAttributes;
|
|
215 |
RMobileBroadcastMessaging::TMobileBroadcastAttributesV2Pckg wcdmaMsgAttributes(wcdmaAttributes);
|
|
216 |
|
|
217 |
messaging.ReceiveMessage(reqStatus, msgData, wcdmaMsgAttributes);
|
|
218 |
|
|
219 |
User::WaitForRequest(reqStatus);
|
|
220 |
|
|
221 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
222 |
|
|
223 |
|
|
224 |
// generate a message from the original message with the page number at the end
|
|
225 |
TBuf8<RMobileBroadcastMessaging::KBroadcastPageSize> messageWithPageNumber;
|
|
226 |
messageWithPageNumber.Copy(tmpName);
|
|
227 |
_LIT8(KFormat, "%c");
|
|
228 |
TBuf8<2> abc(KFormat);
|
|
229 |
// Append pagenumber to end of CBS message
|
|
230 |
messageWithPageNumber.AppendFormat( abc, wcdmaPageNumber);
|
|
231 |
|
|
232 |
ASSERT_EQUALS(messageWithPageNumber, msgData);
|
|
233 |
|
|
234 |
ASSERT_EQUALS(expectedFlags, wcdmaAttributes.iFlags);
|
|
235 |
expectedFormat = RMobileBroadcastMessaging::EFormatWcdmaTpdu;
|
|
236 |
ASSERT_EQUALS(expectedFormat, wcdmaAttributes.iFormat);
|
|
237 |
ASSERT_EQUALS(wcdmaCbsMsg0.iNumberOfPages, wcdmaAttributes.iNumberOfPages);
|
|
238 |
ASSERT_EQUALS(wcdmaCbsMsg0.iMessageType, wcdmaAttributes.iMessageType);
|
|
239 |
ASSERT_EQUALS(wcdmaCbsMsg0.iMessageId, wcdmaAttributes.iMessageId);
|
|
240 |
ASSERT_EQUALS(wcdmaCbsMsg0.iSerialNum, wcdmaAttributes.iSerialNum);
|
|
241 |
ASSERT_EQUALS(wcdmaCbsMsg0.iDCS, wcdmaAttributes.iDCS);
|
|
242 |
|
|
243 |
AssertMockLtsyStatusL();
|
|
244 |
|
|
245 |
RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter expectData2 = RMobileBroadcastMessaging::EBroadcastAcceptNone;
|
|
246 |
TMockLtsyData1<RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter> expectLtsyData2(expectData2);
|
|
247 |
data.Close();
|
|
248 |
expectLtsyData2.SerialiseL(data);
|
|
249 |
iMockLTSY.ExpectL(MLtsyDispatchCellBroadcastReceiveMessageCancel::KLtsyDispatchCellBroadcastReceiveMessageCancelApiId, data);
|
|
250 |
|
|
251 |
CleanupStack::PopAndDestroy(1); // messaging
|
|
252 |
|
|
253 |
TRequestStatus mockLtsyStatus;
|
|
254 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
255 |
iMockLTSY.CompleteL(MLtsyDispatchCellBroadcastReceiveMessageCancel::KLtsyDispatchCellBroadcastReceiveMessageCancelApiId, KErrNone);
|
|
256 |
User::WaitForRequest(mockLtsyStatus);
|
|
257 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
258 |
AssertMockLtsyStatusL();
|
|
259 |
|
|
260 |
CleanupStack::PopAndDestroy(2, this); // data, this
|
|
261 |
}
|
|
262 |
|
|
263 |
//
|
|
264 |
// Other unit tests
|
|
265 |
//
|
|
266 |
|
|
267 |
/**
|
|
268 |
@SYMTestCaseID BA-CTSYD-DIS-CELLBROADCAST-UN0001
|
|
269 |
@SYMComponent telephony_ctsy
|
|
270 |
@SYMTestCaseDesc Test support in CTSY for StartSimCbTopicBrowsing
|
|
271 |
@SYMTestPriority High
|
|
272 |
@SYMTestActions Invokes RMmCustomAPI::StartSimCbTopicBrowsing()
|
|
273 |
@SYMTestExpectedResults Pass
|
|
274 |
@SYMTestType UT
|
|
275 |
*/
|
|
276 |
void CCTsyCellBroadcastFU::TestUnit0001L()
|
|
277 |
{
|
|
278 |
OpenEtelServerL(EUseExtendedError);
|
|
279 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
280 |
OpenPhoneL();
|
|
281 |
|
|
282 |
RMmCustomAPI customAPI;
|
|
283 |
OpenCustomApiLC(customAPI);
|
|
284 |
|
|
285 |
//-------------------------------------------------------------------------
|
|
286 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
287 |
//-------------------------------------------------------------------------
|
|
288 |
|
|
289 |
RBuf8 compData;
|
|
290 |
CleanupClosePushL(compData);
|
|
291 |
|
|
292 |
CArrayFixFlat<RMmCustomAPI::TSimCbTopic>* simTopicArray = new ( ELeave ) CArrayFixFlat
|
|
293 |
<RMmCustomAPI::TSimCbTopic>(1);
|
|
294 |
CleanupStack::PushL(simTopicArray);
|
|
295 |
|
|
296 |
_LIT(KTopic, "Topic");
|
|
297 |
RMmCustomAPI::TSimCbTopic topic;
|
|
298 |
topic.iNumber = 0;
|
|
299 |
topic.iName.Copy(KTopic);
|
|
300 |
|
|
301 |
simTopicArray->AppendL( topic );
|
|
302 |
|
|
303 |
TMockLtsyData1< CArrayFixFlat<RMmCustomAPI::TSimCbTopic>* > ltsyData(simTopicArray);
|
|
304 |
ltsyData.SerialiseL(compData);
|
|
305 |
|
|
306 |
iMockLTSY.ExpectL( MLtsyDispatchCellBroadcastStartSimCbTopicBrowsing::KLtsyDispatchCellBroadcastStartSimCbTopicBrowsingApiId);
|
|
307 |
iMockLTSY.CompleteL( MLtsyDispatchCellBroadcastStartSimCbTopicBrowsing::KLtsyDispatchCellBroadcastStartSimCbTopicBrowsingApiId, KErrGeneral, compData);
|
|
308 |
|
|
309 |
TInt ret = customAPI.StartSimCbTopicBrowsing();
|
|
310 |
|
|
311 |
ASSERT_EQUALS(KErrGeneral, ret);
|
|
312 |
AssertMockLtsyStatusL();
|
|
313 |
|
|
314 |
//-------------------------------------------------------------------------
|
|
315 |
// TEST C: Successful completion request of
|
|
316 |
// RMmCustomAPI::StartSimCbTopicBrowsing when result is not cached.
|
|
317 |
//-------------------------------------------------------------------------
|
|
318 |
|
|
319 |
iMockLTSY.ExpectL( MLtsyDispatchCellBroadcastStartSimCbTopicBrowsing::KLtsyDispatchCellBroadcastStartSimCbTopicBrowsingApiId);
|
|
320 |
iMockLTSY.CompleteL( MLtsyDispatchCellBroadcastStartSimCbTopicBrowsing::KLtsyDispatchCellBroadcastStartSimCbTopicBrowsingApiId, KErrNone, compData);
|
|
321 |
|
|
322 |
ret = customAPI.StartSimCbTopicBrowsing();
|
|
323 |
|
|
324 |
ASSERT_EQUALS(KErrNone, ret);
|
|
325 |
AssertMockLtsyStatusL();
|
|
326 |
|
|
327 |
//-------------------------------------------------------------------------
|
|
328 |
// TEST E: Unsolicited completion of RMmCustomAPI::StartSimCbTopicBrowsing
|
|
329 |
// from LTSY.
|
|
330 |
//-------------------------------------------------------------------------
|
|
331 |
|
|
332 |
TRequestStatus mockLtsyStatus;
|
|
333 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
334 |
|
|
335 |
iMockLTSY.CompleteL( MLtsyDispatchCellBroadcastStartSimCbTopicBrowsing::KLtsyDispatchCellBroadcastStartSimCbTopicBrowsingApiId, KErrNone, compData);
|
|
336 |
|
|
337 |
User::WaitForRequest(mockLtsyStatus);
|
|
338 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
339 |
|
|
340 |
AssertMockLtsyStatusL();
|
|
341 |
|
|
342 |
CleanupStack::PopAndDestroy(4, this);
|
|
343 |
}
|
|
344 |
|
|
345 |
/**
|
|
346 |
@SYMTestCaseID BA-CTSYD-DIS-CELLBROADCAST-UN0002
|
|
347 |
@SYMComponent telephony_ctsy
|
|
348 |
@SYMTestCaseDesc Test support in CTSY for DeleteSimCbTopic
|
|
349 |
@SYMTestPriority High
|
|
350 |
@SYMTestActions Invokes RMmCustomAPI::DeleteSimCbTopic()
|
|
351 |
@SYMTestExpectedResults Pass
|
|
352 |
@SYMTestType UT
|
|
353 |
*/
|
|
354 |
void CCTsyCellBroadcastFU::TestUnit0002L()
|
|
355 |
{
|
|
356 |
OpenEtelServerL(EUseExtendedError);
|
|
357 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
358 |
OpenPhoneL();
|
|
359 |
|
|
360 |
RMmCustomAPI customAPI;
|
|
361 |
OpenCustomApiLC(customAPI);
|
|
362 |
|
|
363 |
TRequestStatus requestStatus;
|
|
364 |
|
|
365 |
RBuf8 expectData;
|
|
366 |
CleanupClosePushL(expectData);
|
|
367 |
|
|
368 |
InitSimCbTopicsL(customAPI, _L("Topic"), 0);
|
|
369 |
|
|
370 |
TUint index(0);
|
|
371 |
TUint expIndex(index);
|
|
372 |
TBool deleteFlag(ETrue);
|
|
373 |
|
|
374 |
TMockLtsyData2< TUint, TBool > ltsyData2(expIndex, deleteFlag);
|
|
375 |
ltsyData2.SerialiseL(expectData);
|
|
376 |
|
|
377 |
//-------------------------------------------------------------------------
|
|
378 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
379 |
//-------------------------------------------------------------------------
|
|
380 |
|
|
381 |
iMockLTSY.ExpectL( MLtsyDispatchCellBroadcastDeleteSimCbTopic::KLtsyDispatchCellBroadcastDeleteSimCbTopicApiId, expectData);
|
|
382 |
iMockLTSY.CompleteL( MLtsyDispatchCellBroadcastDeleteSimCbTopic::KLtsyDispatchCellBroadcastDeleteSimCbTopicApiId, KErrGeneral);
|
|
383 |
|
|
384 |
customAPI.DeleteSimCbTopic(requestStatus, index);
|
|
385 |
|
|
386 |
User::WaitForRequest(requestStatus);
|
|
387 |
ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
|
|
388 |
AssertMockLtsyStatusL();
|
|
389 |
|
|
390 |
//-------------------------------------------------------------------------
|
|
391 |
// TEST E: Unsolicited completion of RMmCustomAPI::DeleteSimCbTopic
|
|
392 |
// from LTSY.
|
|
393 |
//-------------------------------------------------------------------------
|
|
394 |
|
|
395 |
TRequestStatus mockLtsyStatus;
|
|
396 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
397 |
|
|
398 |
iMockLTSY.CompleteL( MLtsyDispatchCellBroadcastDeleteSimCbTopic::KLtsyDispatchCellBroadcastDeleteSimCbTopicApiId, KErrNone);
|
|
399 |
|
|
400 |
User::WaitForRequest(mockLtsyStatus);
|
|
401 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
402 |
AssertMockLtsyStatusL();
|
|
403 |
|
|
404 |
//-------------------------------------------------------------------------
|
|
405 |
// TEST C2: Successful completion request of
|
|
406 |
// RMmCustomAPI::DeleteSimCbTopic when result is not cached.
|
|
407 |
//-------------------------------------------------------------------------
|
|
408 |
|
|
409 |
index = 0;
|
|
410 |
expIndex = index;
|
|
411 |
deleteFlag = ETrue;
|
|
412 |
expectData.Close();
|
|
413 |
ltsyData2.SerialiseL(expectData);
|
|
414 |
|
|
415 |
iMockLTSY.ExpectL( MLtsyDispatchCellBroadcastDeleteSimCbTopic::KLtsyDispatchCellBroadcastDeleteSimCbTopicApiId, expectData);
|
|
416 |
iMockLTSY.CompleteL( MLtsyDispatchCellBroadcastDeleteSimCbTopic::KLtsyDispatchCellBroadcastDeleteSimCbTopicApiId, KErrNone);
|
|
417 |
|
|
418 |
customAPI.DeleteSimCbTopic(requestStatus, index);
|
|
419 |
|
|
420 |
User::WaitForRequest(requestStatus);
|
|
421 |
ASSERT_EQUALS(KErrNone, requestStatus.Int());
|
|
422 |
AssertMockLtsyStatusL();
|
|
423 |
|
|
424 |
CleanupStack::PopAndDestroy(3, this);
|
|
425 |
|
|
426 |
}
|
|
427 |
|
|
428 |
/**
|
|
429 |
@SYMTestCaseID BA-CTSYD-DIS-CELLBROADCAST-UN0003
|
|
430 |
@SYMComponent telephony_ctsy
|
|
431 |
@SYMTestCaseDesc Test support in CTSY for CancelAsyncRequest()
|
|
432 |
@SYMTestPriority High
|
|
433 |
@SYMTestActions Invokes CancelAsyncRequest()
|
|
434 |
@SYMTestExpectedResults Pass
|
|
435 |
@SYMTestType CT
|
|
436 |
*/
|
|
437 |
void CCTsyCellBroadcastFU::TestUnit0003L()
|
|
438 |
{
|
|
439 |
OpenEtelServerL(EUseExtendedError);
|
|
440 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
441 |
OpenPhoneL();
|
|
442 |
|
|
443 |
TRequestStatus mockLtsyStatus;
|
|
444 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
445 |
|
|
446 |
RBuf8 data;
|
|
447 |
CleanupClosePushL(data);
|
|
448 |
|
|
449 |
RMobileBroadcastMessaging messaging;
|
|
450 |
TInt err = messaging.Open(iPhone);
|
|
451 |
ASSERT_EQUALS(KErrNone, err);
|
|
452 |
CleanupClosePushL(messaging);
|
|
453 |
|
|
454 |
//-------------------------------------------------------------------------
|
|
455 |
// Test cancelling of RMobileBroadcastMessaging::ReceiveMessage
|
|
456 |
//-------------------------------------------------------------------------
|
|
457 |
|
|
458 |
RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter expectData = RMobileBroadcastMessaging::EBroadcastAcceptAll;
|
|
459 |
|
|
460 |
TMockLtsyData1<RMobileBroadcastMessaging::TMobilePhoneBroadcastFilter> expectLtsyData(expectData);
|
|
461 |
expectLtsyData.SerialiseL(data);
|
|
462 |
iMockLTSY.ExpectL(MLtsyDispatchCellBroadcastActivateBroadcastReceiveMessage::KLtsyDispatchCellBroadcastActivateBroadcastReceiveMessageApiId, data);
|
|
463 |
|
|
464 |
_LIT8(KMessage,"CBSMESSAGE");
|
|
465 |
TDesC8* cbsMessage = const_cast<TDesC8*>(&KMessage);
|
|
466 |
TMockLtsyData1<TDesC8*> completeLtsyData(cbsMessage);
|
|
467 |
data.Close();
|
|
468 |
completeLtsyData.SerialiseL(data);
|
|
469 |
iMockLTSY.CompleteL(KMockLtsyDispatchCellBroadcastGsmBroadcastNotifyMessageReceivedIndId, KErrNone, data);
|
|
470 |
|
|
471 |
TRequestStatus reqStatus;
|
|
472 |
RMobileBroadcastMessaging::TBroadcastPageData msgData;
|
|
473 |
RMobileBroadcastMessaging::TMobileBroadcastAttributesV1 attributes;
|
|
474 |
RMobileBroadcastMessaging::TMobileBroadcastAttributesV1Pckg msgAttributes(attributes);
|
|
475 |
messaging.ReceiveMessage(reqStatus, msgData, msgAttributes);
|
|
476 |
|
|
477 |
messaging.CancelAsyncRequest(EMobileBroadcastMessagingReceiveMessage);
|
|
478 |
|
|
479 |
User::WaitForRequest(reqStatus);
|
|
480 |
ASSERT_EQUALS(KErrCancel, reqStatus.Int());
|
|
481 |
|
|
482 |
// Wait for completion of iMockLTSY.NotifyTerminated
|
|
483 |
User::WaitForRequest(mockLtsyStatus);
|
|
484 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
485 |
|
|
486 |
AssertMockLtsyStatusL();
|
|
487 |
|
|
488 |
//-------------------------------------------------------------------------
|
|
489 |
// Test cancelling, increase coverage
|
|
490 |
//-------------------------------------------------------------------------
|
|
491 |
|
|
492 |
// setting environment ( CMmBroadcastTsy::iCbRoutingActivated to ETrue)
|
|
493 |
iMockLTSY.NotifyTerminated(reqStatus);
|
|
494 |
iMockLTSY.CompleteL(MLtsyDispatchCellBroadcastActivateBroadcastReceiveMessage::KLtsyDispatchCellBroadcastActivateBroadcastReceiveMessageApiId, KErrNone);
|
|
495 |
User::WaitForRequest(reqStatus);
|
|
496 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
497 |
AssertMockLtsyStatusL();
|
|
498 |
|
|
499 |
// execute request
|
|
500 |
messaging.ReceiveMessage(reqStatus, msgData , msgAttributes);
|
|
501 |
|
|
502 |
// setting cancel request
|
|
503 |
expectData = RMobileBroadcastMessaging::EBroadcastAcceptNone;
|
|
504 |
data.Close();
|
|
505 |
expectLtsyData.SerialiseL(data);
|
|
506 |
iMockLTSY.ExpectL(MLtsyDispatchCellBroadcastReceiveMessageCancel::KLtsyDispatchCellBroadcastReceiveMessageCancelApiId, data, KErrNotSupported);
|
|
507 |
|
|
508 |
messaging.CancelAsyncRequest(EMobileBroadcastMessagingReceiveMessage);
|
|
509 |
|
|
510 |
// ReceiveMessage completion
|
|
511 |
User::WaitForRequest(reqStatus);
|
|
512 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
513 |
|
|
514 |
AssertMockLtsyStatusL();
|
|
515 |
|
|
516 |
//-------------------------------------------------------------------------
|
|
517 |
// Test cancelling, increase coverage
|
|
518 |
//-------------------------------------------------------------------------
|
|
519 |
|
|
520 |
// setting environement ( CMmBroadcastTsy::iCbRoutingActivated to ETrue)
|
|
521 |
iMockLTSY.NotifyTerminated(reqStatus);
|
|
522 |
iMockLTSY.CompleteL(MLtsyDispatchCellBroadcastActivateBroadcastReceiveMessage::KLtsyDispatchCellBroadcastActivateBroadcastReceiveMessageApiId, KErrNone);
|
|
523 |
User::WaitForRequest(reqStatus);
|
|
524 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
525 |
AssertMockLtsyStatusL();
|
|
526 |
|
|
527 |
// execute request
|
|
528 |
messaging.ReceiveMessage(reqStatus, msgData , msgAttributes);
|
|
529 |
|
|
530 |
// setting cancel request
|
|
531 |
data.Close();
|
|
532 |
expectLtsyData.SerialiseL(data);
|
|
533 |
iMockLTSY.ExpectL(MLtsyDispatchCellBroadcastReceiveMessageCancel::KLtsyDispatchCellBroadcastReceiveMessageCancelApiId, data);
|
|
534 |
iMockLTSY.CompleteL(MLtsyDispatchCellBroadcastReceiveMessageCancel::KLtsyDispatchCellBroadcastReceiveMessageCancelApiId, KErrGeneral);
|
|
535 |
|
|
536 |
messaging.CancelAsyncRequest(EMobileBroadcastMessagingReceiveMessage);
|
|
537 |
|
|
538 |
// ReceiveMessage completion
|
|
539 |
User::WaitForRequest(reqStatus);
|
|
540 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
541 |
|
|
542 |
AssertMockLtsyStatusL();
|
|
543 |
|
|
544 |
//-------------------------------------------------------------------------
|
|
545 |
// Test cancelling, increase coverage
|
|
546 |
//-------------------------------------------------------------------------
|
|
547 |
|
|
548 |
// setting environement ( CMmBroadcastTsy::iCbRoutingActivated to ETrue)
|
|
549 |
iMockLTSY.NotifyTerminated(reqStatus);
|
|
550 |
iMockLTSY.CompleteL(MLtsyDispatchCellBroadcastActivateBroadcastReceiveMessage::KLtsyDispatchCellBroadcastActivateBroadcastReceiveMessageApiId, KErrNone);
|
|
551 |
User::WaitForRequest(reqStatus);
|
|
552 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
553 |
AssertMockLtsyStatusL();
|
|
554 |
|
|
555 |
// execute request
|
|
556 |
messaging.ReceiveMessage(reqStatus, msgData, msgAttributes);
|
|
557 |
|
|
558 |
// setting cancel request
|
|
559 |
data.Close();
|
|
560 |
expectLtsyData.SerialiseL(data);
|
|
561 |
iMockLTSY.ExpectL(MLtsyDispatchCellBroadcastReceiveMessageCancel::KLtsyDispatchCellBroadcastReceiveMessageCancelApiId, data);
|
|
562 |
iMockLTSY.CompleteL(MLtsyDispatchCellBroadcastReceiveMessageCancel::KLtsyDispatchCellBroadcastReceiveMessageCancelApiId, KErrNone);
|
|
563 |
|
|
564 |
messaging.CancelAsyncRequest(EMobileBroadcastMessagingReceiveMessage);
|
|
565 |
|
|
566 |
// ReceiveMessage completion
|
|
567 |
User::WaitForRequest(reqStatus);
|
|
568 |
ASSERT_EQUALS(KErrCancel, reqStatus.Int());
|
|
569 |
|
|
570 |
AssertMockLtsyStatusL();
|
|
571 |
|
|
572 |
CleanupStack::PopAndDestroy(3, this); // messaging, data, this
|
|
573 |
}
|