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 SmsControl in the Common TSY.
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "cctsysmsfu.h"
|
|
23 |
#include <etel.h>
|
|
24 |
#include <etelmm.h>
|
|
25 |
#include <et_clsvr.h>
|
|
26 |
#include <ctsy/mmtsy_names.h>
|
|
27 |
#include <ctsy/serviceapi/mmtsy_ipcdefs.h>
|
|
28 |
#include <test/tmockltsydata.h>
|
|
29 |
#include <ctsy/serviceapi/gsmerror.h>
|
|
30 |
#include <ctsy/ltsy/mltsydispatchphoneinterface.h>
|
|
31 |
#include <ctsy/ltsy/mltsydispatchsmsinterface.h>
|
|
32 |
#include "cctsyactiveretriever.h"
|
|
33 |
#include <mmretrieve.h>
|
|
34 |
#include "mockltsyindicatorids.h"
|
|
35 |
|
|
36 |
CTestSuite* CCTsySmsFU::CreateSuiteL(const TDesC& aName)
|
|
37 |
{
|
|
38 |
SUB_SUITE;
|
|
39 |
|
|
40 |
//add use-case tests
|
|
41 |
ADD_TEST_STEP_ISO_CPP(CCTsySmsFU, TestUseCase0001L);
|
|
42 |
ADD_TEST_STEP_ISO_CPP(CCTsySmsFU, TestUseCase0002L);
|
|
43 |
|
|
44 |
//add other unit tests
|
|
45 |
ADD_TEST_STEP_ISO_CPP(CCTsySmsFU, TestUnit0001L);
|
|
46 |
ADD_TEST_STEP_ISO_CPP(CCTsySmsFU, TestUnit0002L);
|
|
47 |
ADD_TEST_STEP_ISO_CPP(CCTsySmsFU, TestUnit0003L);
|
|
48 |
ADD_TEST_STEP_ISO_CPP(CCTsySmsFU, TestUnit0004L);
|
|
49 |
ADD_TEST_STEP_ISO_CPP(CCTsySmsFU, TestUnit0005L);
|
|
50 |
ADD_TEST_STEP_ISO_CPP(CCTsySmsFU, TestUnit0006L);
|
|
51 |
ADD_TEST_STEP_ISO_CPP(CCTsySmsFU, TestUnit0007L);
|
|
52 |
ADD_TEST_STEP_ISO_CPP(CCTsySmsFU, TestUnit0008L);
|
|
53 |
ADD_TEST_STEP_ISO_CPP(CCTsySmsFU, TestUnit0009L);
|
|
54 |
ADD_TEST_STEP_ISO_CPP(CCTsySmsFU, TestUnit0010L);
|
|
55 |
|
|
56 |
END_SUITE;
|
|
57 |
}
|
|
58 |
|
|
59 |
LOCAL_C void FillInSmsParams(
|
|
60 |
TSmsParameters& aSmsParams1,
|
|
61 |
TSmsParameters& aSmsParams2)
|
|
62 |
{
|
|
63 |
aSmsParams1.iLocationNumber = 1;
|
|
64 |
aSmsParams1.iParameterIndicator = KDestinationAddress|KServiceCentreAddress;
|
|
65 |
aSmsParams1.iProtocolId = 2;
|
|
66 |
aSmsParams1.iDataCodingScheme = 3;
|
|
67 |
aSmsParams1.iValidityPeriod = 4;
|
|
68 |
aSmsParams1.iMobileScTON = RMobilePhone::EInternationalNumber;
|
|
69 |
aSmsParams1.iMobileScNPI = RMobilePhone::EIsdnNumberPlan;
|
|
70 |
aSmsParams1.iMobileDeTON = RMobilePhone::ENationalNumber;
|
|
71 |
aSmsParams1.iMobileDeNPI = RMobilePhone::EDataNumberPlan;
|
|
72 |
aSmsParams1.iAlphaTagPresent = ETrue;
|
|
73 |
aSmsParams1.iServiceCenterAddress.Copy(_L("asta"));
|
|
74 |
aSmsParams1.iDestinationAddress.Copy(_L("la"));
|
|
75 |
aSmsParams1.iAlphaTagData.Copy(_L("vista"));
|
|
76 |
|
|
77 |
aSmsParams2.iLocationNumber = 5;
|
|
78 |
aSmsParams2.iParameterIndicator = KProtocolID|KDataCodingScheme|KValidityPeriod;
|
|
79 |
aSmsParams2.iProtocolId = 6;
|
|
80 |
aSmsParams2.iDataCodingScheme = 7;
|
|
81 |
aSmsParams2.iValidityPeriod = 8;
|
|
82 |
aSmsParams2.iMobileScTON = RMobilePhone::ENetworkSpecificNumber;
|
|
83 |
aSmsParams2.iMobileScNPI = RMobilePhone::ETelexNumberPlan;
|
|
84 |
aSmsParams2.iMobileDeTON = RMobilePhone::ESubscriberNumber;
|
|
85 |
aSmsParams2.iMobileDeNPI = RMobilePhone::ENationalNumberPlan;
|
|
86 |
aSmsParams2.iAlphaTagPresent = EFalse;
|
|
87 |
aSmsParams2.iServiceCenterAddress.Copy(_L("I'l"));
|
|
88 |
aSmsParams2.iDestinationAddress.Copy(_L("be"));
|
|
89 |
aSmsParams2.iAlphaTagData.Copy(_L("back"));
|
|
90 |
|
|
91 |
}
|
|
92 |
|
|
93 |
|
|
94 |
//
|
|
95 |
// Use-case tests
|
|
96 |
//
|
|
97 |
|
|
98 |
/**
|
|
99 |
@SYMTestCaseID BA-CTSYD-DIS-SMS-UC0001
|
|
100 |
@SYMComponent telephony_ctsy
|
|
101 |
@SYMTestCaseDesc Test support in CTSY for ReceiveMessage()
|
|
102 |
@SYMTestPriority High
|
|
103 |
@SYMTestActions Invokes ReceiveMessage()
|
|
104 |
@SYMTestExpectedResults Pass
|
|
105 |
@SYMTestType CT
|
|
106 |
*/
|
|
107 |
void CCTsySmsFU::TestUseCase0001L()
|
|
108 |
{
|
|
109 |
OpenEtelServerL(EUseExtendedError);
|
|
110 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
111 |
OpenPhoneL();
|
|
112 |
|
|
113 |
RMobileSmsMessaging messaging;
|
|
114 |
TInt err = messaging.Open(iPhone);
|
|
115 |
ASSERT_EQUALS(KErrNone, err);
|
|
116 |
CleanupClosePushL(messaging);
|
|
117 |
|
|
118 |
RBuf8 data;
|
|
119 |
CleanupClosePushL(data);
|
|
120 |
|
|
121 |
TRequestStatus reqStatus;
|
|
122 |
TRequestStatus mockLtsyStatus;
|
|
123 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1 receiveAttr;
|
|
124 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg receiveAttrPckg(receiveAttr);
|
|
125 |
|
|
126 |
_LIT8(KMessage, "Happy New Year");
|
|
127 |
TBuf8<100> forMsg;
|
|
128 |
|
|
129 |
// receiving message:
|
|
130 |
messaging.ReceiveMessage(reqStatus, forMsg, receiveAttrPckg);
|
|
131 |
|
|
132 |
TSmsMsg smsMsg;
|
|
133 |
TSmsMsg* smsMsgPtr(&smsMsg);
|
|
134 |
TBool ind(EFalse);
|
|
135 |
|
|
136 |
smsMsg.iSmsClass2 = ETrue;
|
|
137 |
smsMsg.iDeleteAfterClientAck = ETrue;
|
|
138 |
smsMsg.iSmsMsg.Copy(KMessage);
|
|
139 |
|
|
140 |
TMockLtsyData2<TBool, TSmsMsg*> compTsyData(ind, smsMsgPtr);
|
|
141 |
compTsyData.SerialiseL(data);
|
|
142 |
|
|
143 |
iMockLTSY.CompleteL(KMockLtsyDispatchSmsNotifyReceiveSmsMessageIndId, KErrNone, data);
|
|
144 |
|
|
145 |
User::WaitForRequest(reqStatus);
|
|
146 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
147 |
AssertMockLtsyStatusL();
|
|
148 |
|
|
149 |
TDesC8* msgPtr = const_cast<TDesC8*>(&KMessage);
|
|
150 |
TInt rpCause(0);
|
|
151 |
TMockLtsyData2<TDesC8*, TInt> expTsyData(msgPtr, rpCause);
|
|
152 |
data.Close();
|
|
153 |
expTsyData.SerialiseL(data);
|
|
154 |
|
|
155 |
iMockLTSY.ExpectL(MLtsyDispatchSmsNackSmsStored::KLtsyDispatchSmsNackSmsStoredApiId, data);
|
|
156 |
iMockLTSY.CompleteL(MLtsyDispatchSmsNackSmsStored::KLtsyDispatchSmsNackSmsStoredApiId, KErrNone);
|
|
157 |
|
|
158 |
messaging.NackSmsStored(reqStatus, KMessage, rpCause);
|
|
159 |
|
|
160 |
User::WaitForRequest(reqStatus);
|
|
161 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
162 |
AssertMockLtsyStatusL();
|
|
163 |
|
|
164 |
// receiving message:
|
|
165 |
messaging.ReceiveMessage(reqStatus, forMsg, receiveAttrPckg);
|
|
166 |
|
|
167 |
compTsyData.SerialiseL(data);
|
|
168 |
|
|
169 |
iMockLTSY.CompleteL(KMockLtsyDispatchSmsNotifyReceiveSmsMessageIndId, KErrNone, data);
|
|
170 |
|
|
171 |
User::WaitForRequest(reqStatus);
|
|
172 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
173 |
AssertMockLtsyStatusL();
|
|
174 |
|
|
175 |
|
|
176 |
TDesC8* msgPtr2 = const_cast<TDesC8*>(&KMessage);
|
|
177 |
TMockLtsyData1<TDesC8*> expTsyData2(msgPtr2);
|
|
178 |
data.Close();
|
|
179 |
expTsyData2.SerialiseL(data);
|
|
180 |
|
|
181 |
iMockLTSY.ExpectL(MLtsyDispatchSmsAckSmsStored::KLtsyDispatchSmsAckSmsStoredApiId, data);
|
|
182 |
iMockLTSY.CompleteL(MLtsyDispatchSmsAckSmsStored::KLtsyDispatchSmsAckSmsStoredApiId, KErrNone);
|
|
183 |
|
|
184 |
// acknowledgment message receive:
|
|
185 |
messaging.AckSmsStored(reqStatus, KMessage, ETrue);
|
|
186 |
|
|
187 |
User::WaitForRequest(reqStatus);
|
|
188 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
189 |
AssertMockLtsyStatusL();
|
|
190 |
|
|
191 |
// receiving message:
|
|
192 |
messaging.ReceiveMessage(reqStatus, forMsg, receiveAttrPckg);
|
|
193 |
data.Close();
|
|
194 |
compTsyData.SerialiseL(data);
|
|
195 |
|
|
196 |
iMockLTSY.CompleteL(KMockLtsyDispatchSmsNotifyReceiveSmsMessageIndId, KErrNone, data);
|
|
197 |
|
|
198 |
TDesC8* msgPtr3 = NULL;
|
|
199 |
TMockLtsyData1<TDesC8*> expTsyData3(msgPtr3);
|
|
200 |
data.Close();
|
|
201 |
expTsyData3.SerialiseL(data);
|
|
202 |
iMockLTSY.ExpectL(MLtsyDispatchSmsAckSmsStored::KLtsyDispatchSmsAckSmsStoredApiId, data);
|
|
203 |
|
|
204 |
User::WaitForRequest(reqStatus);
|
|
205 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
206 |
AssertMockLtsyStatusL();
|
|
207 |
|
|
208 |
CleanupStack::PopAndDestroy(3, this);
|
|
209 |
}
|
|
210 |
|
|
211 |
/**
|
|
212 |
@SYMTestCaseID BA-CTSYD-DIS-SMS-UC0002
|
|
213 |
@SYMComponent telephony_ctsy
|
|
214 |
@SYMTestCaseDesc Test support in CTSY for successful RMobileSmsMessaging::SendMessage
|
|
215 |
@SYMTestPriority High
|
|
216 |
@SYMTestActions Invokes RMobileSmsMessaging::SendMessage
|
|
217 |
@SYMTestExpectedResults Pass
|
|
218 |
@SYMTestType CT
|
|
219 |
*/
|
|
220 |
void CCTsySmsFU::TestUseCase0002L()
|
|
221 |
{
|
|
222 |
OpenEtelServerL(EUseExtendedError);
|
|
223 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
224 |
OpenPhoneL();
|
|
225 |
|
|
226 |
RBuf8 data;
|
|
227 |
CleanupClosePushL(data);
|
|
228 |
RMobileSmsMessaging messaging;
|
|
229 |
TInt err = messaging.Open(iPhone);
|
|
230 |
ASSERT_EQUALS(KErrNone, err);
|
|
231 |
CleanupClosePushL(messaging);
|
|
232 |
|
|
233 |
|
|
234 |
_LIT8(KMessage, "Hello");
|
|
235 |
TBuf8<32> tmpName(KMessage);
|
|
236 |
|
|
237 |
TRequestStatus reqStatus;
|
|
238 |
RMobileSmsMessaging::TMobileSmsSendAttributesV1 expectSmsAttr;
|
|
239 |
RMobileSmsMessaging::TMobileSmsSendAttributesV1 smsAttr;
|
|
240 |
RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg smsAttrPckg(smsAttr);
|
|
241 |
|
|
242 |
TSendSmsDataAndAttributes dataAndAttr;
|
|
243 |
dataAndAttr.iIpc = EMobileSmsMessagingSendMessage;
|
|
244 |
dataAndAttr.iAttributes = &expectSmsAttr;
|
|
245 |
dataAndAttr.iMsgData = &tmpName;
|
|
246 |
|
|
247 |
TDesC8* msgPtr = dataAndAttr.iMsgData;
|
|
248 |
TMockLtsyData5< RMobilePhone::TMobileAddress,
|
|
249 |
TDesC8*,
|
|
250 |
RMobileSmsMessaging::TMobileSmsDataFormat,
|
|
251 |
RMobilePhone::TMobileAddress,
|
|
252 |
TBool
|
|
253 |
> expTsyData(smsAttr.iDestination, msgPtr, smsAttr.iDataFormat, smsAttr.iGsmServiceCentre, smsAttr.iMore);
|
|
254 |
|
|
255 |
_LIT8(KSubmit, "Submit");
|
|
256 |
_LIT(KNum, "+7903030303");
|
|
257 |
|
|
258 |
smsAttr.iGsmServiceCentre.iTypeOfNumber = RMobilePhone::EInternationalNumber;
|
|
259 |
smsAttr.iGsmServiceCentre.iNumberPlan = RMobilePhone::EIsdnNumberPlan;
|
|
260 |
smsAttr.iGsmServiceCentre.iTelNumber.Copy(KNum);
|
|
261 |
smsAttr.iCdmaServiceCategory = 0;
|
|
262 |
smsAttr.iCdmaTeleservice = 0;
|
|
263 |
smsAttr.iDataFormat = RMobileSmsMessaging::EFormatGsmTpdu;
|
|
264 |
smsAttr.iFlags = 0;
|
|
265 |
smsAttr.iMsgRef = 0;
|
|
266 |
smsAttr.iSubmitReport = KSubmit;
|
|
267 |
smsAttr.iMore = EFalse;
|
|
268 |
smsAttr.iDestination.iTypeOfNumber = RMobilePhone::EInternationalNumber;
|
|
269 |
smsAttr.iDestination.iNumberPlan = RMobilePhone::EIsdnNumberPlan;
|
|
270 |
smsAttr.iDestination.iTelNumber.Copy(KNum);
|
|
271 |
|
|
272 |
expectSmsAttr = smsAttr;
|
|
273 |
|
|
274 |
expTsyData.SerialiseL(data);
|
|
275 |
iMockLTSY.ExpectL(MLtsyDispatchSmsSendSmsMessage::KLtsyDispatchSmsSendSmsMessageApiId, data);
|
|
276 |
data.Close();
|
|
277 |
|
|
278 |
const TInt16 KMsgRef(25);
|
|
279 |
TInt16 msgRef(KMsgRef);
|
|
280 |
TBuf8<RMobileSmsMessaging::KGsmTpduSize> smsMsg(KMessage);
|
|
281 |
TMockLtsyData2<TInt16, TBuf8<RMobileSmsMessaging::KGsmTpduSize> > compTsyData(msgRef, smsMsg);
|
|
282 |
compTsyData.SerialiseL(data);
|
|
283 |
iMockLTSY.CompleteL(MLtsyDispatchSmsSendSmsMessage::KLtsyDispatchSmsSendSmsMessageApiId, KErrNone, data, 10);
|
|
284 |
data.Close();
|
|
285 |
/*
|
|
286 |
* The fields required will probably be message data format, destination
|
|
287 |
* and possibly a new service centre address.
|
|
288 |
* On return, for either successful or failed transmission, the message reference number assigned to this
|
|
289 |
* sent message will be placed by the TSY in the iMsgRef field.
|
|
290 |
* Also, if the SMS was sent during GSM or WCDMA mode, then
|
|
291 |
* the SMS-SUBMIT-REPORT will be placed by the TSY in the iSubmitReport field.
|
|
292 |
*
|
|
293 |
*/
|
|
294 |
messaging.SendMessage(reqStatus, tmpName, smsAttrPckg);
|
|
295 |
User::WaitForRequest(reqStatus);
|
|
296 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
297 |
|
|
298 |
ASSERT_EQUALS(RMobilePhone::EInternationalNumber, smsAttr.iGsmServiceCentre.iTypeOfNumber);
|
|
299 |
ASSERT_EQUALS(RMobilePhone::EIsdnNumberPlan, smsAttr.iGsmServiceCentre.iNumberPlan);
|
|
300 |
ASSERT_EQUALS(0, smsAttr.iGsmServiceCentre.iTelNumber.Compare(KNum));
|
|
301 |
ASSERT_EQUALS(0, smsAttr.iCdmaServiceCategory);
|
|
302 |
ASSERT_EQUALS(0, smsAttr.iCdmaTeleservice);
|
|
303 |
ASSERT_EQUALS(RMobileSmsMessaging::EFormatGsmTpdu, smsAttr.iDataFormat);
|
|
304 |
ASSERT_TRUE((RMobileSmsMessaging::KMessageReference | RMobileSmsMessaging::KGsmSubmitReport)
|
|
305 |
== smsAttr.iFlags);
|
|
306 |
ASSERT_TRUE(msgRef == smsAttr.iMsgRef);
|
|
307 |
ASSERT_EQUALS(0, smsAttr.iSubmitReport.Compare(smsMsg));
|
|
308 |
ASSERT_TRUE(EFalse == smsAttr.iMore);
|
|
309 |
ASSERT_EQUALS(RMobilePhone::EInternationalNumber, smsAttr.iDestination.iTypeOfNumber);
|
|
310 |
ASSERT_EQUALS(RMobilePhone::EIsdnNumberPlan, smsAttr.iDestination.iNumberPlan);
|
|
311 |
ASSERT_EQUALS(0, smsAttr.iDestination.iTelNumber.Compare(KNum));
|
|
312 |
|
|
313 |
AssertMockLtsyStatusL();
|
|
314 |
CleanupStack::PopAndDestroy(3, this);
|
|
315 |
}
|
|
316 |
|
|
317 |
//
|
|
318 |
// Other unit tests
|
|
319 |
//
|
|
320 |
|
|
321 |
/**
|
|
322 |
@SYMTestCaseID BA-CTSYD-DIS-SMS-UN0001
|
|
323 |
@SYMComponent telephony_ctsy
|
|
324 |
@SYMTestCaseDesc Test support in CTSY for RMobileSmsMessaging::AckSmsStored()
|
|
325 |
@SYMTestPriority High
|
|
326 |
@SYMTestActions Invokes AckSmsStored()
|
|
327 |
@SYMTestExpectedResults Pass
|
|
328 |
@SYMTestType UT
|
|
329 |
*/
|
|
330 |
void CCTsySmsFU::TestUnit0001L()
|
|
331 |
{
|
|
332 |
OpenEtelServerL(EUseExtendedError);
|
|
333 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
334 |
OpenPhoneL();
|
|
335 |
|
|
336 |
RMobileSmsMessaging messaging;
|
|
337 |
TInt err = messaging.Open(iPhone);
|
|
338 |
ASSERT_EQUALS(KErrNone, err);
|
|
339 |
CleanupClosePushL(messaging);
|
|
340 |
|
|
341 |
RBuf8 data;
|
|
342 |
CleanupClosePushL(data);
|
|
343 |
|
|
344 |
_LIT8(KMessage, "Happy New Year");
|
|
345 |
TRequestStatus reqStatus;
|
|
346 |
TRequestStatus mockLtsyStatus;
|
|
347 |
TDesC8* msgPtr = const_cast<TDesC8*>(&KMessage);
|
|
348 |
TMockLtsyData1<TDesC8*> expTsyData(msgPtr);
|
|
349 |
|
|
350 |
|
|
351 |
//-------------------------------------------------------------------------
|
|
352 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
353 |
//-------------------------------------------------------------------------
|
|
354 |
|
|
355 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1 receiveAttr;
|
|
356 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg receiveAttrPckg(receiveAttr);
|
|
357 |
|
|
358 |
TBuf8<100> forMsg;
|
|
359 |
|
|
360 |
// receiving message:
|
|
361 |
messaging.ReceiveMessage(reqStatus, forMsg, receiveAttrPckg);
|
|
362 |
|
|
363 |
TSmsMsg smsMsg;
|
|
364 |
TSmsMsg* smsMsgPtr(&smsMsg);
|
|
365 |
TBool ind(EFalse);
|
|
366 |
|
|
367 |
smsMsg.iSmsClass2 = ETrue;
|
|
368 |
smsMsg.iDeleteAfterClientAck = ETrue;
|
|
369 |
smsMsg.iSmsMsg.Copy(KMessage);
|
|
370 |
|
|
371 |
TMockLtsyData2<TBool, TSmsMsg*> compTsyData(ind, smsMsgPtr);
|
|
372 |
compTsyData.SerialiseL(data);
|
|
373 |
|
|
374 |
iMockLTSY.CompleteL(KMockLtsyDispatchSmsNotifyReceiveSmsMessageIndId, KErrNone, data);
|
|
375 |
|
|
376 |
User::WaitForRequest(reqStatus);
|
|
377 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
378 |
AssertMockLtsyStatusL();
|
|
379 |
|
|
380 |
expTsyData.SerialiseL(data);
|
|
381 |
|
|
382 |
iMockLTSY.ExpectL(MLtsyDispatchSmsAckSmsStored::KLtsyDispatchSmsAckSmsStoredApiId, data);
|
|
383 |
iMockLTSY.CompleteL(MLtsyDispatchSmsAckSmsStored::KLtsyDispatchSmsAckSmsStoredApiId, KErrGeneral);
|
|
384 |
|
|
385 |
messaging.AckSmsStored(reqStatus, KMessage, ETrue);
|
|
386 |
|
|
387 |
User::WaitForRequest(reqStatus);
|
|
388 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
389 |
|
|
390 |
AssertMockLtsyStatusL();
|
|
391 |
|
|
392 |
//-------------------------------------------------------------------------
|
|
393 |
// TEST C1, check AckSmsStored() when there is no sms received
|
|
394 |
//-------------------------------------------------------------------------
|
|
395 |
|
|
396 |
messaging.AckSmsStored(reqStatus, KMessage, ETrue);
|
|
397 |
|
|
398 |
User::WaitForRequest(reqStatus);
|
|
399 |
ASSERT_EQUALS(KErrNotReady, reqStatus.Int());
|
|
400 |
|
|
401 |
AssertMockLtsyStatusL();
|
|
402 |
|
|
403 |
//-------------------------------------------------------------------------
|
|
404 |
// TEST E: Unsolicited completion of RMobileSmsMessaging::AckSmsStored
|
|
405 |
// from LTSY.
|
|
406 |
//-------------------------------------------------------------------------
|
|
407 |
|
|
408 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
409 |
|
|
410 |
iMockLTSY.CompleteL(MLtsyDispatchSmsAckSmsStored::KLtsyDispatchSmsAckSmsStoredApiId, KErrNone);
|
|
411 |
|
|
412 |
User::WaitForRequest(mockLtsyStatus);
|
|
413 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
414 |
|
|
415 |
AssertMockLtsyStatusL();
|
|
416 |
|
|
417 |
CleanupStack::PopAndDestroy(3, this); // data, messaging, this
|
|
418 |
}
|
|
419 |
|
|
420 |
/**
|
|
421 |
@SYMTestCaseID BA-CTSYD-DIS-SMS-UN0002
|
|
422 |
@SYMComponent telephony_ctsy
|
|
423 |
@SYMTestCaseDesc Test support in CTSY for RMobileSmsMessaging::GetMessageStoreInfo()
|
|
424 |
@SYMTestPriority High
|
|
425 |
@SYMTestActions Invokes GetMessageStoreInfo()
|
|
426 |
@SYMTestExpectedResults Pass
|
|
427 |
@SYMTestType UT
|
|
428 |
*/
|
|
429 |
void CCTsySmsFU::TestUnit0002L()
|
|
430 |
{
|
|
431 |
OpenEtelServerL(EUseExtendedError);
|
|
432 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
433 |
OpenPhoneL();
|
|
434 |
|
|
435 |
RBuf8 data;
|
|
436 |
CleanupClosePushL(data);
|
|
437 |
|
|
438 |
RMobileSmsMessaging messaging;
|
|
439 |
TInt err = messaging.Open(iPhone);
|
|
440 |
ASSERT_EQUALS(KErrNone, err);
|
|
441 |
CleanupClosePushL(messaging);
|
|
442 |
|
|
443 |
TRequestStatus reqStatus;
|
|
444 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1 info;
|
|
445 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg pckgInfo(info);
|
|
446 |
TInt index(0);
|
|
447 |
|
|
448 |
//-------------------------------------------------------------------------
|
|
449 |
// TEST A: failure to dispatch request to LTSY
|
|
450 |
//-------------------------------------------------------------------------
|
|
451 |
|
|
452 |
iMockLTSY.ExpectL(MLtsyDispatchSmsGetSmsStoreInfo::KLtsyDispatchSmsGetSmsStoreInfoApiId, KErrNotSupported);
|
|
453 |
|
|
454 |
messaging.GetMessageStoreInfo(reqStatus, index, pckgInfo);
|
|
455 |
|
|
456 |
User::WaitForRequest(reqStatus);
|
|
457 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
458 |
|
|
459 |
AssertMockLtsyStatusL();
|
|
460 |
|
|
461 |
//-------------------------------------------------------------------------
|
|
462 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
463 |
//-------------------------------------------------------------------------
|
|
464 |
|
|
465 |
iMockLTSY.ExpectL(MLtsyDispatchSmsGetSmsStoreInfo::KLtsyDispatchSmsGetSmsStoreInfoApiId);
|
|
466 |
|
|
467 |
messaging.GetMessageStoreInfo(reqStatus, index, pckgInfo);
|
|
468 |
|
|
469 |
TInt total(0);
|
|
470 |
TInt used(0);
|
|
471 |
|
|
472 |
TMockLtsyData2<TInt, TInt> compData(total, used);
|
|
473 |
|
|
474 |
compData.SerialiseL(data);
|
|
475 |
|
|
476 |
iMockLTSY.CompleteL(MLtsyDispatchSmsGetSmsStoreInfo::KLtsyDispatchSmsGetSmsStoreInfoApiId, KErrGeneral, data);
|
|
477 |
|
|
478 |
User::WaitForRequest(reqStatus);
|
|
479 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
480 |
|
|
481 |
AssertMockLtsyStatusL();
|
|
482 |
|
|
483 |
//-------------------------------------------------------------------------
|
|
484 |
// TEST C: Successful completion request of
|
|
485 |
// RMobileSmsMessaging::GetMessageStoreInfo when result is not cached.
|
|
486 |
//-------------------------------------------------------------------------
|
|
487 |
|
|
488 |
iMockLTSY.ExpectL(MLtsyDispatchSmsGetSmsStoreInfo::KLtsyDispatchSmsGetSmsStoreInfoApiId);
|
|
489 |
|
|
490 |
messaging.GetMessageStoreInfo(reqStatus, index, pckgInfo);
|
|
491 |
|
|
492 |
total = 2;
|
|
493 |
used = 1;
|
|
494 |
|
|
495 |
data.Close();
|
|
496 |
compData.SerialiseL(data);
|
|
497 |
|
|
498 |
iMockLTSY.CompleteL(MLtsyDispatchSmsGetSmsStoreInfo::KLtsyDispatchSmsGetSmsStoreInfoApiId, KErrNone, data);
|
|
499 |
|
|
500 |
User::WaitForRequest(reqStatus);
|
|
501 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
502 |
|
|
503 |
ASSERT_EQUALS(0, info.iName.Compare(KETelIccSmsStore));
|
|
504 |
ASSERT_EQUALS(RMobilePhoneStore::EShortMessageStore, info.iType);
|
|
505 |
ASSERT_TRUE(total == info.iTotalEntries);
|
|
506 |
ASSERT_TRUE(used == info.iUsedEntries);
|
|
507 |
ASSERT_EQUALS(KSmsMessageStoreInfoCaps, info.iCaps);
|
|
508 |
|
|
509 |
AssertMockLtsyStatusL();
|
|
510 |
|
|
511 |
//-------------------------------------------------------------------------
|
|
512 |
// TEST C2: Successful completion request of
|
|
513 |
// RMobileSmsMessaging::GetMessageStoreInfo when result is not cached.
|
|
514 |
//-------------------------------------------------------------------------
|
|
515 |
|
|
516 |
iMockLTSY.ExpectL(MLtsyDispatchSmsGetSmsStoreInfo::KLtsyDispatchSmsGetSmsStoreInfoApiId);
|
|
517 |
|
|
518 |
messaging.GetMessageStoreInfo(reqStatus, index, pckgInfo);
|
|
519 |
|
|
520 |
iMockLTSY.CompleteL(MLtsyDispatchSmsGetSmsStoreInfo::KLtsyDispatchSmsGetSmsStoreInfoApiId, KErrNotFound, data);
|
|
521 |
|
|
522 |
User::WaitForRequest(reqStatus);
|
|
523 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
524 |
|
|
525 |
ASSERT_EQUALS(0, info.iName.Compare(KETelIccSmsStore));
|
|
526 |
ASSERT_EQUALS(RMobilePhoneStore::EShortMessageStore, info.iType);
|
|
527 |
ASSERT_TRUE(total == info.iTotalEntries);
|
|
528 |
ASSERT_TRUE(used == info.iUsedEntries);
|
|
529 |
ASSERT_EQUALS(KSmsMessageStoreInfoCaps, info.iCaps);
|
|
530 |
|
|
531 |
AssertMockLtsyStatusL();
|
|
532 |
|
|
533 |
//-------------------------------------------------------------------------
|
|
534 |
// TEST E: Unsolicited completion of RMobileSmsMessaging::GetMessageStoreInfo
|
|
535 |
// from LTSY.
|
|
536 |
//-------------------------------------------------------------------------
|
|
537 |
|
|
538 |
TRequestStatus mockLtsyStatus;
|
|
539 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
540 |
|
|
541 |
iMockLTSY.CompleteL(MLtsyDispatchSmsGetSmsStoreInfo::KLtsyDispatchSmsGetSmsStoreInfoApiId, KErrNone, data);
|
|
542 |
|
|
543 |
User::WaitForRequest(mockLtsyStatus);
|
|
544 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
545 |
|
|
546 |
AssertMockLtsyStatusL();
|
|
547 |
|
|
548 |
CleanupStack::PopAndDestroy(3, this);
|
|
549 |
}
|
|
550 |
|
|
551 |
/**
|
|
552 |
@SYMTestCaseID BA-CTSYD-DIS-SMS-UN0003
|
|
553 |
@SYMComponent telephony_ctsy
|
|
554 |
@SYMTestCaseDesc Test support in CTSY for ReadSmspListPhase1L()
|
|
555 |
@SYMTestPriority High
|
|
556 |
@SYMTestActions Invokes ReadSmspListPhase1L()
|
|
557 |
@SYMTestExpectedResults Pass
|
|
558 |
@SYMTestType UT
|
|
559 |
*/
|
|
560 |
void CCTsySmsFU::TestUnit0003L()
|
|
561 |
{
|
|
562 |
OpenEtelServerL(EUseExtendedError);
|
|
563 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
564 |
OpenPhoneL();
|
|
565 |
|
|
566 |
RBuf8 data;
|
|
567 |
CleanupClosePushL(data);
|
|
568 |
|
|
569 |
//CFilteringActiveScheduler does not need to be used, this should be changed
|
|
570 |
//to a listretrieverao type class
|
|
571 |
CFilteringActiveScheduler* scheduler = new (ELeave) CFilteringActiveScheduler();
|
|
572 |
CleanupStack::PushL(scheduler);
|
|
573 |
CActiveScheduler::Install(scheduler);
|
|
574 |
|
|
575 |
RMobileSmsMessaging messaging;
|
|
576 |
TInt err = messaging.Open(iPhone);
|
|
577 |
ASSERT_EQUALS(KErrNone, err);
|
|
578 |
CleanupClosePushL(messaging);
|
|
579 |
CRetrieveMobilePhoneSmspList* asyncRetrieveList =
|
|
580 |
CRetrieveMobilePhoneSmspList::NewL(messaging);
|
|
581 |
CleanupStack::PushL(asyncRetrieveList);
|
|
582 |
|
|
583 |
CActiveRetriever::ResetRequestsNumber();
|
|
584 |
CActiveRetriever* activeRetriever =
|
|
585 |
CActiveRetriever::NewL(*asyncRetrieveList);
|
|
586 |
CleanupStack::PushL(activeRetriever);
|
|
587 |
scheduler->AddRetrieverL(*activeRetriever);
|
|
588 |
|
|
589 |
//-------------------------------------------------------------------------
|
|
590 |
// TEST A: failure to dispatch request to LTSY
|
|
591 |
//-------------------------------------------------------------------------
|
|
592 |
|
|
593 |
iMockLTSY.ExpectL(MLtsyDispatchSmsGetSmspList::KLtsyDispatchSmsGetSmspListApiId, KErrNotSupported);
|
|
594 |
|
|
595 |
asyncRetrieveList->Start(activeRetriever->iStatus);
|
|
596 |
activeRetriever->Activate();
|
|
597 |
scheduler->StartScheduler();
|
|
598 |
|
|
599 |
ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
|
|
600 |
ASSERT_EQUALS(KErrNotSupported, activeRetriever->iStatus.Int());
|
|
601 |
AssertMockLtsyStatusL();
|
|
602 |
|
|
603 |
// test for KErrNotFound
|
|
604 |
iMockLTSY.ExpectL(MLtsyDispatchSmsGetSmspList::KLtsyDispatchSmsGetSmspListApiId, KErrNotFound);
|
|
605 |
|
|
606 |
asyncRetrieveList->Start(activeRetriever->iStatus);
|
|
607 |
activeRetriever->Activate();
|
|
608 |
scheduler->StartScheduler();
|
|
609 |
|
|
610 |
ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
|
|
611 |
ASSERT_EQUALS(KErrNotFound, activeRetriever->iStatus.Int());
|
|
612 |
AssertMockLtsyStatusL();
|
|
613 |
|
|
614 |
//-------------------------------------------------------------------------
|
|
615 |
// TEST C: Successful completion request of
|
|
616 |
// CRetrieveMobilePhoneSmspList::Start when result is not cached.
|
|
617 |
//-------------------------------------------------------------------------
|
|
618 |
|
|
619 |
iMockLTSY.ExpectL(MLtsyDispatchSmsGetSmspList::KLtsyDispatchSmsGetSmspListApiId);
|
|
620 |
|
|
621 |
TSmsParameters entry;
|
|
622 |
TSmsParameters entry1;
|
|
623 |
FillInSmsParams(entry, entry1);
|
|
624 |
|
|
625 |
TDesC* strPtr1 = &entry.iServiceCenterAddress;
|
|
626 |
TDesC* strPtr2 = &entry.iDestinationAddress;
|
|
627 |
TDesC* strPtr3 = &entry.iAlphaTagData;
|
|
628 |
TBool bMoreToCome = ETrue;
|
|
629 |
|
|
630 |
DispatcherSim::TSmsParameters smsParam;
|
|
631 |
|
|
632 |
smsParam.iLocationNumber = entry.iLocationNumber;
|
|
633 |
smsParam.iParameterIndicator = entry.iParameterIndicator;
|
|
634 |
smsParam.iProtocolId = entry.iProtocolId;
|
|
635 |
smsParam.iDataCodingScheme = entry.iDataCodingScheme;
|
|
636 |
smsParam.iValidityPeriod = entry.iValidityPeriod;
|
|
637 |
smsParam.iMobileScTON = entry.iMobileScTON;
|
|
638 |
smsParam.iMobileScNPI = entry.iMobileScNPI;
|
|
639 |
smsParam.iMobileDeTON = entry.iMobileDeTON;
|
|
640 |
smsParam.iMobileDeNPI = entry.iMobileDeNPI;
|
|
641 |
smsParam.iAlphaTagPresent = entry.iAlphaTagPresent;
|
|
642 |
|
|
643 |
TMockLtsyData5<TDesC* , TDesC*, TDesC*, DispatcherSim::TSmsParameters , TBool> completeLtsyData(strPtr1, strPtr2, strPtr3, smsParam, bMoreToCome);
|
|
644 |
data.Close();
|
|
645 |
completeLtsyData.SerialiseL(data);
|
|
646 |
iMockLTSY.CompleteL(MLtsyDispatchSmsGetSmspList::KLtsyDispatchSmsGetSmspListApiId, KErrNone, data);
|
|
647 |
|
|
648 |
TBool bMoreToCome2 = EFalse;
|
|
649 |
TDesC* strPtr21 = &entry1.iServiceCenterAddress;
|
|
650 |
TDesC* strPtr22 = &entry1.iDestinationAddress;
|
|
651 |
TDesC* strPtr23 = &entry1.iAlphaTagData;
|
|
652 |
|
|
653 |
DispatcherSim::TSmsParameters smsParam2;
|
|
654 |
|
|
655 |
smsParam2.iLocationNumber = entry1.iLocationNumber;
|
|
656 |
smsParam2.iParameterIndicator = entry1.iParameterIndicator;
|
|
657 |
smsParam2.iProtocolId = entry1.iProtocolId;
|
|
658 |
smsParam2.iDataCodingScheme = entry1.iDataCodingScheme;
|
|
659 |
smsParam2.iValidityPeriod = entry1.iValidityPeriod;
|
|
660 |
smsParam2.iMobileScTON = entry1.iMobileScTON;
|
|
661 |
smsParam2.iMobileScNPI = entry1.iMobileScNPI;
|
|
662 |
smsParam2.iMobileDeTON = entry1.iMobileDeTON;
|
|
663 |
smsParam2.iMobileDeNPI = entry1.iMobileDeNPI;
|
|
664 |
smsParam2.iAlphaTagPresent = entry1.iAlphaTagPresent;
|
|
665 |
|
|
666 |
TMockLtsyData5<TDesC* , TDesC*, TDesC*, DispatcherSim::TSmsParameters , TBool> completeLtsyData2(strPtr21, strPtr22, strPtr23, smsParam2, bMoreToCome2);
|
|
667 |
data.Close();
|
|
668 |
completeLtsyData2.SerialiseL(data);
|
|
669 |
iMockLTSY.CompleteL(MLtsyDispatchSmsGetSmspList::KLtsyDispatchSmsGetSmspListApiId, KErrNone, data);
|
|
670 |
|
|
671 |
asyncRetrieveList->Start(activeRetriever->iStatus);
|
|
672 |
activeRetriever->Activate();
|
|
673 |
scheduler->StartScheduler();
|
|
674 |
|
|
675 |
ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
|
|
676 |
ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
|
|
677 |
|
|
678 |
CMobilePhoneSmspList* list = asyncRetrieveList->RetrieveListL();
|
|
679 |
CleanupStack::PushL( list );
|
|
680 |
|
|
681 |
ASSERT_EQUALS(2, list->Enumerate());
|
|
682 |
const RMobileSmsMessaging::TMobileSmspEntryV1& smspEntry = list->GetEntryL(0);
|
|
683 |
|
|
684 |
TInt completeIndex(entry.iLocationNumber);
|
|
685 |
ASSERT_EQUALS(completeIndex, smspEntry.iIndex);
|
|
686 |
ASSERT_EQUALS(entry.iAlphaTagData, smspEntry.iText);
|
|
687 |
TUint32 completeValidParams(entry.iParameterIndicator);
|
|
688 |
ASSERT_EQUALS(completeValidParams, smspEntry.iValidParams);
|
|
689 |
ASSERT_EQUALS(entry.iMobileDeTON, smspEntry.iDestination.iTypeOfNumber);
|
|
690 |
ASSERT_EQUALS(entry.iMobileDeNPI, smspEntry.iDestination.iNumberPlan);
|
|
691 |
ASSERT_TRUE( 0 == entry.iDestinationAddress.Compare(smspEntry.iDestination.iTelNumber) );
|
|
692 |
ASSERT_EQUALS(entry.iMobileScTON, smspEntry.iServiceCentre.iTypeOfNumber);
|
|
693 |
ASSERT_EQUALS(entry.iMobileScNPI, smspEntry.iServiceCentre.iNumberPlan);
|
|
694 |
ASSERT_TRUE( 0 == entry.iServiceCenterAddress.Compare(smspEntry.iServiceCentre.iTelNumber) );
|
|
695 |
|
|
696 |
const RMobileSmsMessaging::TMobileSmspEntryV1& smspEntry1 = list->GetEntryL(1);
|
|
697 |
|
|
698 |
completeIndex = entry1.iLocationNumber;
|
|
699 |
ASSERT_EQUALS(completeIndex, smspEntry1.iIndex);
|
|
700 |
ASSERT_EQUALS(0, smspEntry1.iText.Length());
|
|
701 |
completeValidParams = entry1.iParameterIndicator;
|
|
702 |
ASSERT_EQUALS(completeValidParams, smspEntry1.iValidParams);
|
|
703 |
ASSERT_EQUALS(entry1.iProtocolId, smspEntry1.iProtocolId);
|
|
704 |
ASSERT_EQUALS(entry1.iDataCodingScheme, smspEntry1.iDcs);
|
|
705 |
ASSERT_EQUALS(entry1.iValidityPeriod, smspEntry1.iValidityPeriod);
|
|
706 |
|
|
707 |
CleanupStack::PopAndDestroy(list);
|
|
708 |
AssertMockLtsyStatusL();
|
|
709 |
|
|
710 |
//-------------------------------------------------------------------------
|
|
711 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
712 |
//-------------------------------------------------------------------------
|
|
713 |
|
|
714 |
iMockLTSY.ExpectL(MLtsyDispatchSmsGetSmspList::KLtsyDispatchSmsGetSmspListApiId);
|
|
715 |
data.Close();
|
|
716 |
completeLtsyData2.SerialiseL(data);
|
|
717 |
iMockLTSY.CompleteL(MLtsyDispatchSmsGetSmspList::KLtsyDispatchSmsGetSmspListApiId, KErrGeneral, data);
|
|
718 |
|
|
719 |
asyncRetrieveList->Start(activeRetriever->iStatus);
|
|
720 |
activeRetriever->Activate();
|
|
721 |
scheduler->StartScheduler();
|
|
722 |
|
|
723 |
ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
|
|
724 |
ASSERT_EQUALS(KErrGeneral, activeRetriever->iStatus.Int());
|
|
725 |
AssertMockLtsyStatusL();
|
|
726 |
|
|
727 |
//-------------------------------------------------------------------------
|
|
728 |
// TEST E: Unsolicited completion of CRetrieveMobilePhoneSmspList::Start
|
|
729 |
// from LTSY.
|
|
730 |
//-------------------------------------------------------------------------
|
|
731 |
|
|
732 |
TRequestStatus mockLtsyStatus;
|
|
733 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
734 |
|
|
735 |
data.Close();
|
|
736 |
completeLtsyData.SerialiseL(data);
|
|
737 |
iMockLTSY.CompleteL(MLtsyDispatchSmsGetSmspList::KLtsyDispatchSmsGetSmspListApiId, KErrNone, data);
|
|
738 |
|
|
739 |
data.Close();
|
|
740 |
completeLtsyData2.SerialiseL(data);
|
|
741 |
iMockLTSY.CompleteL(MLtsyDispatchSmsGetSmspList::KLtsyDispatchSmsGetSmspListApiId, KErrNone, data);
|
|
742 |
|
|
743 |
User::WaitForRequest(mockLtsyStatus);
|
|
744 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
745 |
AssertMockLtsyStatusL();
|
|
746 |
|
|
747 |
// increase coverage
|
|
748 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
749 |
|
|
750 |
data.Close();
|
|
751 |
completeLtsyData2.SerialiseL(data);
|
|
752 |
iMockLTSY.CompleteL(MLtsyDispatchSmsGetSmspList::KLtsyDispatchSmsGetSmspListApiId, KErrGeneral, data);
|
|
753 |
|
|
754 |
User::WaitForRequest(mockLtsyStatus);
|
|
755 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
756 |
AssertMockLtsyStatusL();
|
|
757 |
|
|
758 |
CleanupStack::PopAndDestroy(3); // activeRetriever, asyncRetrieveList, messaging
|
|
759 |
CleanupStack::PopAndDestroy(3, this); // data, scheduler, this
|
|
760 |
}
|
|
761 |
|
|
762 |
/**
|
|
763 |
@SYMTestCaseID BA-CTSYD-DIS-SMS-UN0004
|
|
764 |
@SYMComponent telephony_ctsy
|
|
765 |
@SYMTestCaseDesc Test support in CTSY for RMobileSmsMessaging::NackSmsStored()
|
|
766 |
@SYMTestPriority High
|
|
767 |
@SYMTestActions Invokes NackSmsStored()
|
|
768 |
@SYMTestExpectedResults Pass
|
|
769 |
@SYMTestType UT
|
|
770 |
*/
|
|
771 |
void CCTsySmsFU::TestUnit0004L()
|
|
772 |
{
|
|
773 |
OpenEtelServerL(EUseExtendedError);
|
|
774 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
775 |
OpenPhoneL();
|
|
776 |
|
|
777 |
RMobileSmsMessaging messaging;
|
|
778 |
TInt err = messaging.Open(iPhone);
|
|
779 |
ASSERT_EQUALS(KErrNone, err);
|
|
780 |
CleanupClosePushL(messaging);
|
|
781 |
|
|
782 |
RBuf8 data;
|
|
783 |
CleanupClosePushL(data);
|
|
784 |
|
|
785 |
_LIT8(KMessage, "Happy New Year");
|
|
786 |
|
|
787 |
TRequestStatus mockLtsyStatus;
|
|
788 |
TRequestStatus reqStatus;
|
|
789 |
TDesC8* msgPtr = const_cast<TDesC8*>(&KMessage);
|
|
790 |
TInt rpCause(0);
|
|
791 |
|
|
792 |
//-------------------------------------------------------------------------
|
|
793 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
794 |
//-------------------------------------------------------------------------
|
|
795 |
|
|
796 |
TMockLtsyData2<TDesC8*, TInt> expTsyData(msgPtr, rpCause);
|
|
797 |
|
|
798 |
|
|
799 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1 receiveAttr;
|
|
800 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg receiveAttrPckg(receiveAttr);
|
|
801 |
|
|
802 |
TBuf8<100> forMsg;
|
|
803 |
|
|
804 |
// receiving message:
|
|
805 |
messaging.ReceiveMessage(reqStatus, forMsg, receiveAttrPckg);
|
|
806 |
|
|
807 |
TSmsMsg smsMsg;
|
|
808 |
TSmsMsg* smsMsgPtr(&smsMsg);
|
|
809 |
TBool ind(EFalse);
|
|
810 |
|
|
811 |
smsMsg.iSmsClass2 = ETrue;
|
|
812 |
smsMsg.iDeleteAfterClientAck = ETrue;
|
|
813 |
smsMsg.iSmsMsg.Copy(KMessage);
|
|
814 |
|
|
815 |
TMockLtsyData2<TBool, TSmsMsg*> compTsyData(ind, smsMsgPtr);
|
|
816 |
compTsyData.SerialiseL(data);
|
|
817 |
|
|
818 |
iMockLTSY.CompleteL(KMockLtsyDispatchSmsNotifyReceiveSmsMessageIndId, KErrNone, data);
|
|
819 |
|
|
820 |
User::WaitForRequest(reqStatus);
|
|
821 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
822 |
AssertMockLtsyStatusL();
|
|
823 |
|
|
824 |
expTsyData.SerialiseL(data);
|
|
825 |
|
|
826 |
iMockLTSY.ExpectL(MLtsyDispatchSmsNackSmsStored::KLtsyDispatchSmsNackSmsStoredApiId, data);
|
|
827 |
iMockLTSY.CompleteL(MLtsyDispatchSmsNackSmsStored::KLtsyDispatchSmsNackSmsStoredApiId, KErrGeneral);
|
|
828 |
|
|
829 |
messaging.NackSmsStored(reqStatus, KMessage, rpCause);
|
|
830 |
|
|
831 |
User::WaitForRequest(reqStatus);
|
|
832 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
833 |
|
|
834 |
AssertMockLtsyStatusL();
|
|
835 |
|
|
836 |
//-------------------------------------------------------------------------
|
|
837 |
// TEST C1: Unsuccessful completion request of
|
|
838 |
// RMobileSmsMessaging::NackSmsStored when there are no sms received.
|
|
839 |
//-------------------------------------------------------------------------
|
|
840 |
|
|
841 |
messaging.NackSmsStored(reqStatus, KMessage, rpCause);
|
|
842 |
|
|
843 |
User::WaitForRequest(reqStatus);
|
|
844 |
ASSERT_EQUALS(KErrNotReady, reqStatus.Int());
|
|
845 |
|
|
846 |
AssertMockLtsyStatusL();
|
|
847 |
|
|
848 |
//-------------------------------------------------------------------------
|
|
849 |
// TEST E: Unsolicited completion of RMobileSmsMessaging::NackSmsStored
|
|
850 |
// from LTSY.
|
|
851 |
//-------------------------------------------------------------------------
|
|
852 |
|
|
853 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
854 |
|
|
855 |
iMockLTSY.CompleteL(MLtsyDispatchSmsNackSmsStored::KLtsyDispatchSmsNackSmsStoredApiId, KErrNone);
|
|
856 |
|
|
857 |
User::WaitForRequest(mockLtsyStatus);
|
|
858 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
859 |
AssertMockLtsyStatusL();
|
|
860 |
|
|
861 |
CleanupStack::PopAndDestroy(3, this);
|
|
862 |
}
|
|
863 |
|
|
864 |
/**
|
|
865 |
@SYMTestCaseID BA-CTSYD-DIS-SMS-UN0005
|
|
866 |
@SYMComponent telephony_ctsy
|
|
867 |
@SYMTestCaseDesc Test support in CTSY for RMobileSmsMessaging::ReceiveMessage()
|
|
868 |
@SYMTestPriority High
|
|
869 |
@SYMTestActions Invokes ReceiveMessage()
|
|
870 |
@SYMTestExpectedResults Pass
|
|
871 |
@SYMTestType UT
|
|
872 |
*/
|
|
873 |
void CCTsySmsFU::TestUnit0005L()
|
|
874 |
{
|
|
875 |
OpenEtelServerL(EUseExtendedError);
|
|
876 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
877 |
OpenPhoneL();
|
|
878 |
|
|
879 |
RMobileSmsMessaging messaging;
|
|
880 |
TInt err = messaging.Open(iPhone);
|
|
881 |
ASSERT_EQUALS(KErrNone, err);
|
|
882 |
CleanupClosePushL(messaging);
|
|
883 |
|
|
884 |
RBuf8 data;
|
|
885 |
CleanupClosePushL(data);
|
|
886 |
|
|
887 |
TRequestStatus reqStatus;
|
|
888 |
TRequestStatus mockLtsyStatus;
|
|
889 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1 receiveAttr;
|
|
890 |
RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg receiveAttrPckg(receiveAttr);
|
|
891 |
|
|
892 |
_LIT8(KMessage, "Happy New Year");
|
|
893 |
TBuf8<100> forMsg;
|
|
894 |
|
|
895 |
//-------------------------------------------------------------------------
|
|
896 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
897 |
//-------------------------------------------------------------------------
|
|
898 |
|
|
899 |
messaging.ReceiveMessage(reqStatus, forMsg, receiveAttrPckg);
|
|
900 |
|
|
901 |
TSmsMsg smsMsg;
|
|
902 |
TSmsMsg* smsMsgPtr(&smsMsg);
|
|
903 |
TBool ind(EFalse);
|
|
904 |
|
|
905 |
smsMsg.iSmsClass2 = ETrue;
|
|
906 |
smsMsg.iDeleteAfterClientAck = ETrue;
|
|
907 |
smsMsg.iSmsMsg.Copy(KMessage);
|
|
908 |
|
|
909 |
TMockLtsyData2<TBool, TSmsMsg*> compTsyData(ind, smsMsgPtr);
|
|
910 |
compTsyData.SerialiseL(data);
|
|
911 |
|
|
912 |
iMockLTSY.CompleteL(KMockLtsyDispatchSmsNotifyReceiveSmsMessageIndId, KErrGeneral, data);
|
|
913 |
|
|
914 |
User::WaitForRequest(reqStatus);
|
|
915 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
916 |
|
|
917 |
AssertMockLtsyStatusL();
|
|
918 |
|
|
919 |
//-------------------------------------------------------------------------
|
|
920 |
// TEST E: Unsolicited completion of RMobileSmsMessaging::ReceiveMessage
|
|
921 |
// from LTSY.
|
|
922 |
//-------------------------------------------------------------------------
|
|
923 |
|
|
924 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
925 |
|
|
926 |
iMockLTSY.CompleteL(KMockLtsyDispatchSmsNotifyReceiveSmsMessageIndId, KErrNone, data);
|
|
927 |
|
|
928 |
TDesC8* zeroPtr(NULL);
|
|
929 |
TInt rpCause(KErrGsmSMSUnspecifiedProtocolError);
|
|
930 |
TMockLtsyData2<TDesC8*, TInt> expTsyData(zeroPtr, rpCause);
|
|
931 |
|
|
932 |
data.Close();
|
|
933 |
expTsyData.SerialiseL(data);
|
|
934 |
|
|
935 |
iMockLTSY.ExpectL(MLtsyDispatchSmsNackSmsStored::KLtsyDispatchSmsNackSmsStoredApiId, data);
|
|
936 |
|
|
937 |
User::WaitForRequest(mockLtsyStatus);
|
|
938 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
939 |
|
|
940 |
AssertMockLtsyStatusL();
|
|
941 |
|
|
942 |
CleanupStack::PopAndDestroy(3, this);
|
|
943 |
}
|
|
944 |
|
|
945 |
/**
|
|
946 |
@SYMTestCaseID BA-CTSY-SMSM-SRSR-0006
|
|
947 |
@SYMComponent telephony_ctsy
|
|
948 |
@SYMTestCaseDesc Test support in CTSY for RMobileSmsMessaging::ResumeSmsReception
|
|
949 |
@SYMTestPriority High
|
|
950 |
@SYMTestActions Invokes RMobileSmsMessaging::ResumeSmsReception
|
|
951 |
@SYMTestExpectedResults Pass
|
|
952 |
@SYMTestType CT
|
|
953 |
*/
|
|
954 |
void CCTsySmsFU::TestUnit0006L()
|
|
955 |
{
|
|
956 |
OpenEtelServerL(EUseExtendedError);
|
|
957 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
958 |
OpenPhoneL();
|
|
959 |
|
|
960 |
RBuf8 data;
|
|
961 |
CleanupClosePushL(data);
|
|
962 |
|
|
963 |
RMobileSmsMessaging messaging;
|
|
964 |
TInt err = messaging.Open(iPhone);
|
|
965 |
ASSERT_EQUALS(KErrNone, err);
|
|
966 |
CleanupClosePushL(messaging);
|
|
967 |
|
|
968 |
TRequestStatus reqStatus;
|
|
969 |
|
|
970 |
//-------------------------------------------------------------------------
|
|
971 |
// TEST A: failure to dispatch request to LTSY
|
|
972 |
//-------------------------------------------------------------------------
|
|
973 |
|
|
974 |
iMockLTSY.ExpectL(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId, KErrNotSupported);
|
|
975 |
|
|
976 |
messaging.ResumeSmsReception(reqStatus);
|
|
977 |
User::WaitForRequest(reqStatus);
|
|
978 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
979 |
|
|
980 |
AssertMockLtsyStatusL();
|
|
981 |
|
|
982 |
//-------------------------------------------------------------------------
|
|
983 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
984 |
//-------------------------------------------------------------------------
|
|
985 |
|
|
986 |
iMockLTSY.ExpectL(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId);
|
|
987 |
|
|
988 |
messaging.ResumeSmsReception(reqStatus);
|
|
989 |
|
|
990 |
iMockLTSY.CompleteL(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId, KErrGeneral);
|
|
991 |
|
|
992 |
User::WaitForRequest(reqStatus);
|
|
993 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
994 |
|
|
995 |
AssertMockLtsyStatusL();
|
|
996 |
|
|
997 |
//-------------------------------------------------------------------------
|
|
998 |
// TEST C: Successful completion request of
|
|
999 |
// RMobileSmsMessaging::ResumeSmsReception when result is not cached.
|
|
1000 |
//-------------------------------------------------------------------------
|
|
1001 |
|
|
1002 |
iMockLTSY.ExpectL(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId);
|
|
1003 |
|
|
1004 |
messaging.ResumeSmsReception(reqStatus);
|
|
1005 |
|
|
1006 |
iMockLTSY.CompleteL(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId, KErrNone);
|
|
1007 |
|
|
1008 |
User::WaitForRequest(reqStatus);
|
|
1009 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
1010 |
|
|
1011 |
AssertMockLtsyStatusL();
|
|
1012 |
|
|
1013 |
//-------------------------------------------------------------------------
|
|
1014 |
// TEST E: Unsolicited completion of RMobileSmsMessaging::ResumeSmsReception
|
|
1015 |
// from LTSY.
|
|
1016 |
//-------------------------------------------------------------------------
|
|
1017 |
|
|
1018 |
TRequestStatus mockLtsyStatus;
|
|
1019 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
1020 |
|
|
1021 |
iMockLTSY.CompleteL(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId, KErrNone);
|
|
1022 |
|
|
1023 |
User::WaitForRequest(mockLtsyStatus);
|
|
1024 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
1025 |
|
|
1026 |
CleanupStack::PopAndDestroy(3, this);
|
|
1027 |
}
|
|
1028 |
|
|
1029 |
|
|
1030 |
/**
|
|
1031 |
@SYMTestCaseID BA-CTSY-SMSM-SSM-0007
|
|
1032 |
@SYMComponent telephony_ctsy
|
|
1033 |
@SYMTestCaseDesc Test support in CTSY for RMobileSmsMessaging::SendMessage
|
|
1034 |
@SYMTestPriority High
|
|
1035 |
@SYMTestActions Invokes RMobileSmsMessaging::SendMessage
|
|
1036 |
@SYMTestExpectedResults Pass
|
|
1037 |
@SYMTestType CT
|
|
1038 |
*/
|
|
1039 |
void CCTsySmsFU::TestUnit0007L()
|
|
1040 |
{
|
|
1041 |
|
|
1042 |
OpenEtelServerL(EUseExtendedError);
|
|
1043 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
1044 |
OpenPhoneL();
|
|
1045 |
|
|
1046 |
RBuf8 data;
|
|
1047 |
CleanupClosePushL(data);
|
|
1048 |
|
|
1049 |
RMobileSmsMessaging messaging;
|
|
1050 |
TInt err = messaging.Open(iPhone);
|
|
1051 |
ASSERT_EQUALS(KErrNone, err);
|
|
1052 |
CleanupClosePushL(messaging);
|
|
1053 |
|
|
1054 |
//-------------------------------------------------------------------------
|
|
1055 |
// TEST A: failure to dispatch request to LTSY
|
|
1056 |
//-------------------------------------------------------------------------
|
|
1057 |
|
|
1058 |
_LIT8(KMessage, "Hello");
|
|
1059 |
TBuf8<32> tmpName(KMessage);
|
|
1060 |
|
|
1061 |
TRequestStatus reqStatus;
|
|
1062 |
RMobileSmsMessaging::TMobileSmsSendAttributesV1 expectSmsAttr;
|
|
1063 |
RMobileSmsMessaging::TMobileSmsSendAttributesV1 smsAttr;
|
|
1064 |
RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg smsAttrPckg(smsAttr);
|
|
1065 |
|
|
1066 |
TSendSmsDataAndAttributes dataAndAttr;
|
|
1067 |
dataAndAttr.iIpc = EMobileSmsMessagingSendMessage;
|
|
1068 |
dataAndAttr.iAttributes = &expectSmsAttr;
|
|
1069 |
dataAndAttr.iMsgData = &tmpName;
|
|
1070 |
|
|
1071 |
TDesC8* msgPtr = dataAndAttr.iMsgData;
|
|
1072 |
TMockLtsyData5< RMobilePhone::TMobileAddress,
|
|
1073 |
TDesC8*,
|
|
1074 |
RMobileSmsMessaging::TMobileSmsDataFormat,
|
|
1075 |
RMobilePhone::TMobileAddress,
|
|
1076 |
TBool
|
|
1077 |
> expTsyData(smsAttr.iDestination, msgPtr, smsAttr.iDataFormat, smsAttr.iGsmServiceCentre, smsAttr.iMore);
|
|
1078 |
|
|
1079 |
expTsyData.SerialiseL(data);
|
|
1080 |
iMockLTSY.ExpectL(MLtsyDispatchSmsSendSmsMessage::KLtsyDispatchSmsSendSmsMessageApiId, data, KErrNotSupported);
|
|
1081 |
data.Close();
|
|
1082 |
|
|
1083 |
messaging.SendMessage(reqStatus, tmpName, smsAttrPckg);
|
|
1084 |
User::WaitForRequest(reqStatus);
|
|
1085 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
1086 |
|
|
1087 |
AssertMockLtsyStatusL();
|
|
1088 |
|
|
1089 |
|
|
1090 |
//-------------------------------------------------------------------------
|
|
1091 |
// TEST C: Successful completion request of
|
|
1092 |
// RMobileSmsMessaging::SendMessage when result is not cached.
|
|
1093 |
//-------------------------------------------------------------------------
|
|
1094 |
|
|
1095 |
_LIT(KNum, "+7903030303");
|
|
1096 |
_LIT8(KSubmit, "Submit");
|
|
1097 |
|
|
1098 |
const TInt16 KMsgRef(25);
|
|
1099 |
TInt16 msgRef(KMsgRef);
|
|
1100 |
TBuf8<RMobileSmsMessaging::KGsmTpduSize> smsMsg(KMessage);
|
|
1101 |
TMockLtsyData2<TInt16, TBuf8<RMobileSmsMessaging::KGsmTpduSize> > compTsyData(msgRef, smsMsg);
|
|
1102 |
|
|
1103 |
smsAttr.iGsmServiceCentre.iTypeOfNumber = RMobilePhone::EInternationalNumber;
|
|
1104 |
smsAttr.iGsmServiceCentre.iNumberPlan = RMobilePhone::EIsdnNumberPlan;
|
|
1105 |
smsAttr.iGsmServiceCentre.iTelNumber.Copy(KNum);
|
|
1106 |
smsAttr.iCdmaServiceCategory = 0;
|
|
1107 |
smsAttr.iCdmaTeleservice = 0;
|
|
1108 |
smsAttr.iDataFormat = RMobileSmsMessaging::EFormatGsmTpdu;
|
|
1109 |
smsAttr.iFlags = 0;
|
|
1110 |
smsAttr.iMsgRef = 0;
|
|
1111 |
smsAttr.iSubmitReport = KSubmit;
|
|
1112 |
smsAttr.iMore = EFalse;
|
|
1113 |
smsAttr.iDestination.iTypeOfNumber = RMobilePhone::EInternationalNumber;
|
|
1114 |
smsAttr.iDestination.iNumberPlan = RMobilePhone::EIsdnNumberPlan;
|
|
1115 |
smsAttr.iDestination.iTelNumber.Copy(KNum);
|
|
1116 |
|
|
1117 |
expectSmsAttr = smsAttr;
|
|
1118 |
|
|
1119 |
tmpName.SetLength(0);
|
|
1120 |
smsMsg.SetLength(0);
|
|
1121 |
|
|
1122 |
|
|
1123 |
expTsyData.SerialiseL(data);
|
|
1124 |
iMockLTSY.ExpectL(MLtsyDispatchSmsSendSmsMessage::KLtsyDispatchSmsSendSmsMessageApiId, data);
|
|
1125 |
data.Close();
|
|
1126 |
|
|
1127 |
compTsyData.SerialiseL(data);
|
|
1128 |
iMockLTSY.CompleteL(MLtsyDispatchSmsSendSmsMessage::KLtsyDispatchSmsSendSmsMessageApiId, KErrNone, data, 10);
|
|
1129 |
|
|
1130 |
messaging.SendMessage(reqStatus, tmpName, smsAttrPckg);
|
|
1131 |
User::WaitForRequest(reqStatus);
|
|
1132 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
1133 |
|
|
1134 |
ASSERT_EQUALS(RMobilePhone::EInternationalNumber, smsAttr.iGsmServiceCentre.iTypeOfNumber);
|
|
1135 |
ASSERT_EQUALS(RMobilePhone::EIsdnNumberPlan, smsAttr.iGsmServiceCentre.iNumberPlan);
|
|
1136 |
ASSERT_EQUALS(0, smsAttr.iGsmServiceCentre.iTelNumber.Compare(KNum));
|
|
1137 |
ASSERT_EQUALS(0, smsAttr.iCdmaServiceCategory);
|
|
1138 |
ASSERT_EQUALS(0, smsAttr.iCdmaTeleservice);
|
|
1139 |
ASSERT_EQUALS(RMobileSmsMessaging::EFormatGsmTpdu, smsAttr.iDataFormat);
|
|
1140 |
ASSERT_TRUE(RMobileSmsMessaging::KMessageReference == smsAttr.iFlags);
|
|
1141 |
ASSERT_TRUE(KMsgRef == smsAttr.iMsgRef);
|
|
1142 |
ASSERT_EQUALS(0, smsAttr.iSubmitReport.Compare(KSubmit));
|
|
1143 |
ASSERT_TRUE(EFalse == smsAttr.iMore);
|
|
1144 |
ASSERT_EQUALS(RMobilePhone::EInternationalNumber, smsAttr.iDestination.iTypeOfNumber);
|
|
1145 |
ASSERT_EQUALS(RMobilePhone::EIsdnNumberPlan, smsAttr.iDestination.iNumberPlan);
|
|
1146 |
ASSERT_EQUALS(0, smsAttr.iDestination.iTelNumber.Compare(KNum));
|
|
1147 |
|
|
1148 |
AssertMockLtsyStatusL();
|
|
1149 |
|
|
1150 |
//-------------------------------------------------------------------------
|
|
1151 |
// TEST D: Unsolicited completion of RMobileSmsMessaging::SendMessage
|
|
1152 |
// from LTSY.
|
|
1153 |
//-------------------------------------------------------------------------
|
|
1154 |
|
|
1155 |
TRequestStatus mockLtsyStatus;
|
|
1156 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
1157 |
|
|
1158 |
iMockLTSY.CompleteL(MLtsyDispatchSmsSendSmsMessage::KLtsyDispatchSmsSendSmsMessageApiId, KErrNone, data, 10);
|
|
1159 |
data.Close();
|
|
1160 |
|
|
1161 |
User::WaitForRequest(mockLtsyStatus);
|
|
1162 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
1163 |
AssertMockLtsyStatusL();
|
|
1164 |
|
|
1165 |
CleanupStack::PopAndDestroy(3, this);
|
|
1166 |
|
|
1167 |
}
|
|
1168 |
|
|
1169 |
|
|
1170 |
/**
|
|
1171 |
@SYMTestCaseID BA-CTSY-SMSM-SSMNFC-0008
|
|
1172 |
@SYMComponent telephony_ctsy
|
|
1173 |
@SYMTestCaseDesc Test support in CTSY for RMobileSmsMessaging::SendMessageNoFdnCheck
|
|
1174 |
@SYMTestPriority High
|
|
1175 |
@SYMTestActions Invokes RMobileSmsMessaging::SendMessageNoFdnCheck
|
|
1176 |
@SYMTestExpectedResults Pass
|
|
1177 |
@SYMTestType CT
|
|
1178 |
*/
|
|
1179 |
void CCTsySmsFU::TestUnit0008L()
|
|
1180 |
{
|
|
1181 |
OpenEtelServerL(EUseExtendedError);
|
|
1182 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
1183 |
OpenPhoneL();
|
|
1184 |
|
|
1185 |
RBuf8 data;
|
|
1186 |
CleanupClosePushL(data);
|
|
1187 |
|
|
1188 |
RMobileSmsMessaging messaging;
|
|
1189 |
TInt err = messaging.Open(iPhone);
|
|
1190 |
ASSERT_EQUALS(KErrNone, err);
|
|
1191 |
CleanupClosePushL(messaging);
|
|
1192 |
|
|
1193 |
|
|
1194 |
_LIT8(KMessage, "Merry christmas");
|
|
1195 |
TBuf8<32> tmpName(KMessage);
|
|
1196 |
|
|
1197 |
TRequestStatus reqStatus;
|
|
1198 |
RMobileSmsMessaging::TMobileSmsSendAttributesV1 smsAttr;
|
|
1199 |
RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg smsAttrPckg(smsAttr);
|
|
1200 |
|
|
1201 |
TSendSmsDataAndAttributes dataAndAttr;
|
|
1202 |
dataAndAttr.iIpc = EMobileSmsMessagingSendMessageNoFdnCheck;
|
|
1203 |
dataAndAttr.iAttributes = &smsAttr;
|
|
1204 |
dataAndAttr.iMsgData = &tmpName;
|
|
1205 |
|
|
1206 |
TDesC8* msgPtr = dataAndAttr.iMsgData;
|
|
1207 |
TMockLtsyData5< RMobilePhone::TMobileAddress,
|
|
1208 |
TDesC8*,
|
|
1209 |
RMobileSmsMessaging::TMobileSmsDataFormat,
|
|
1210 |
RMobilePhone::TMobileAddress,
|
|
1211 |
TBool
|
|
1212 |
> expTsyData(smsAttr.iDestination, msgPtr, smsAttr.iDataFormat, smsAttr.iGsmServiceCentre, smsAttr.iMore);
|
|
1213 |
expTsyData.SerialiseL(data);
|
|
1214 |
data.Close();
|
|
1215 |
|
|
1216 |
|
|
1217 |
//-------------------------------------------------------------------------
|
|
1218 |
// TEST A: Successful completion request of
|
|
1219 |
// RMobileSmsMessaging::SendMessage.
|
|
1220 |
//-------------------------------------------------------------------------
|
|
1221 |
|
|
1222 |
_LIT8(KSubmit, "Submit");
|
|
1223 |
_LIT(KNum, "+7903030303");
|
|
1224 |
|
|
1225 |
smsAttr.iGsmServiceCentre.iTypeOfNumber = RMobilePhone::EInternationalNumber;
|
|
1226 |
smsAttr.iGsmServiceCentre.iNumberPlan = RMobilePhone::EIsdnNumberPlan;
|
|
1227 |
smsAttr.iGsmServiceCentre.iTelNumber.Copy(KNum);
|
|
1228 |
smsAttr.iCdmaServiceCategory = 0;
|
|
1229 |
smsAttr.iCdmaTeleservice = 0;
|
|
1230 |
smsAttr.iDataFormat = RMobileSmsMessaging::EFormatGsmTpdu;
|
|
1231 |
smsAttr.iFlags = 0;
|
|
1232 |
smsAttr.iMsgRef = 0;
|
|
1233 |
smsAttr.iSubmitReport = KSubmit;
|
|
1234 |
smsAttr.iMore = EFalse;
|
|
1235 |
smsAttr.iDestination.iTypeOfNumber = RMobilePhone::EInternationalNumber;
|
|
1236 |
smsAttr.iDestination.iNumberPlan = RMobilePhone::EIsdnNumberPlan;
|
|
1237 |
smsAttr.iDestination.iTelNumber.Copy(KNum);
|
|
1238 |
|
|
1239 |
data.Close();
|
|
1240 |
expTsyData.SerialiseL(data);
|
|
1241 |
iMockLTSY.ExpectL(MLtsyDispatchSmsSendSmsMessageNoFdnCheck::KLtsyDispatchSmsSendSmsMessageNoFdnCheckApiId, data);
|
|
1242 |
|
|
1243 |
const TInt16 KMsgRef(25);
|
|
1244 |
TInt16 msgRef(KMsgRef);
|
|
1245 |
TBuf8<RMobileSmsMessaging::KGsmTpduSize> smsMsg(KMessage);
|
|
1246 |
TMockLtsyData2<TInt16, TBuf8<RMobileSmsMessaging::KGsmTpduSize> > compTsyData(msgRef, smsMsg);
|
|
1247 |
data.Close();
|
|
1248 |
compTsyData.SerialiseL(data);
|
|
1249 |
iMockLTSY.CompleteL(MLtsyDispatchSmsSendSmsMessageNoFdnCheck::KLtsyDispatchSmsSendSmsMessageNoFdnCheckApiId, KErrNone, data, 10);
|
|
1250 |
|
|
1251 |
messaging.SendMessageNoFdnCheck(reqStatus, tmpName, smsAttrPckg);
|
|
1252 |
User::WaitForRequest(reqStatus);
|
|
1253 |
|
|
1254 |
|
|
1255 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
1256 |
|
|
1257 |
ASSERT_EQUALS(RMobilePhone::EInternationalNumber, smsAttr.iGsmServiceCentre.iTypeOfNumber);
|
|
1258 |
ASSERT_EQUALS(RMobilePhone::EIsdnNumberPlan, smsAttr.iGsmServiceCentre.iNumberPlan);
|
|
1259 |
ASSERT_EQUALS(0, smsAttr.iGsmServiceCentre.iTelNumber.Compare(KNum));
|
|
1260 |
ASSERT_EQUALS(0, smsAttr.iCdmaServiceCategory);
|
|
1261 |
ASSERT_EQUALS(0, smsAttr.iCdmaTeleservice);
|
|
1262 |
ASSERT_EQUALS(RMobileSmsMessaging::EFormatGsmTpdu, smsAttr.iDataFormat);
|
|
1263 |
ASSERT_TRUE((RMobileSmsMessaging::KMessageReference | RMobileSmsMessaging::KGsmSubmitReport)
|
|
1264 |
== smsAttr.iFlags);
|
|
1265 |
ASSERT_TRUE(KMsgRef == smsAttr.iMsgRef);
|
|
1266 |
ASSERT_EQUALS(0, smsAttr.iSubmitReport.Compare(KMessage));
|
|
1267 |
ASSERT_TRUE(EFalse == smsAttr.iMore);
|
|
1268 |
ASSERT_EQUALS(RMobilePhone::EInternationalNumber, smsAttr.iDestination.iTypeOfNumber);
|
|
1269 |
ASSERT_EQUALS(RMobilePhone::EIsdnNumberPlan, smsAttr.iDestination.iNumberPlan);
|
|
1270 |
ASSERT_EQUALS(0, smsAttr.iDestination.iTelNumber.Compare(KNum));
|
|
1271 |
|
|
1272 |
AssertMockLtsyStatusL();
|
|
1273 |
|
|
1274 |
|
|
1275 |
//-------------------------------------------------------------------------
|
|
1276 |
// TEST B: Unsolicited completion of RMobileSmsMessaging::SendMessage
|
|
1277 |
// from LTSY.
|
|
1278 |
//-------------------------------------------------------------------------
|
|
1279 |
|
|
1280 |
data.Close();
|
|
1281 |
compTsyData.SerialiseL(data);
|
|
1282 |
|
|
1283 |
TRequestStatus mockLtsyStatus;
|
|
1284 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
1285 |
|
|
1286 |
iMockLTSY.CompleteL(MLtsyDispatchSmsSendSmsMessageNoFdnCheck::KLtsyDispatchSmsSendSmsMessageNoFdnCheckApiId, KErrNone, data, 10);
|
|
1287 |
|
|
1288 |
User::WaitForRequest(mockLtsyStatus);
|
|
1289 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
1290 |
|
|
1291 |
|
|
1292 |
//-------------------------------------------------------------------------
|
|
1293 |
// TEST C: failure to dispatch request to LTSY
|
|
1294 |
//-------------------------------------------------------------------------
|
|
1295 |
|
|
1296 |
data.Close();
|
|
1297 |
expTsyData.SerialiseL(data);
|
|
1298 |
iMockLTSY.ExpectL(MLtsyDispatchSmsSendSmsMessageNoFdnCheck::KLtsyDispatchSmsSendSmsMessageNoFdnCheckApiId, data, KErrNotSupported);
|
|
1299 |
|
|
1300 |
messaging.SendMessageNoFdnCheck(reqStatus, tmpName, smsAttrPckg);
|
|
1301 |
User::WaitForRequest(reqStatus);
|
|
1302 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
1303 |
|
|
1304 |
AssertMockLtsyStatusL();
|
|
1305 |
CleanupStack::PopAndDestroy(3, this);
|
|
1306 |
}
|
|
1307 |
|
|
1308 |
/**
|
|
1309 |
@SYMTestCaseID BA-CTSY-SMSM-SSMNFC-0009
|
|
1310 |
@SYMComponent telephony_ctsy
|
|
1311 |
@SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobileSmsMessaging::SetMoSmsBearer
|
|
1312 |
@SYMTestPriority High
|
|
1313 |
@SYMTestActions Invokes multiple client requests to RMobileSmsMessaging::SetMoSmsBearer
|
|
1314 |
@SYMTestExpectedResults Pass
|
|
1315 |
@SYMTestType CT
|
|
1316 |
*/
|
|
1317 |
void CCTsySmsFU::TestUnit0009L()
|
|
1318 |
{
|
|
1319 |
|
|
1320 |
OpenEtelServerL(EUseExtendedError);
|
|
1321 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
1322 |
OpenPhoneL();
|
|
1323 |
|
|
1324 |
RBuf8 data;
|
|
1325 |
CleanupClosePushL(data);
|
|
1326 |
|
|
1327 |
// Open second client
|
|
1328 |
RTelServer telServer2;
|
|
1329 |
TInt ret = telServer2.Connect();
|
|
1330 |
ASSERT_EQUALS(KErrNone, ret);
|
|
1331 |
CleanupClosePushL(telServer2);
|
|
1332 |
|
|
1333 |
RMobilePhone phone2;
|
|
1334 |
ret = phone2.Open(telServer2,KMmTsyPhoneName);
|
|
1335 |
ASSERT_EQUALS(KErrNone, ret);
|
|
1336 |
CleanupClosePushL(phone2);
|
|
1337 |
|
|
1338 |
|
|
1339 |
RMobileSmsMessaging messaging;
|
|
1340 |
TInt err = messaging.Open(iPhone);
|
|
1341 |
ASSERT_EQUALS(KErrNone, err);
|
|
1342 |
CleanupClosePushL(messaging);
|
|
1343 |
|
|
1344 |
RMobileSmsMessaging messaging2;
|
|
1345 |
err = messaging2.Open(phone2);
|
|
1346 |
ASSERT_EQUALS(KErrNone, err);
|
|
1347 |
CleanupClosePushL(messaging2);
|
|
1348 |
|
|
1349 |
|
|
1350 |
TRequestStatus reqStatus;
|
|
1351 |
TRequestStatus reqStatus2;
|
|
1352 |
RMobileSmsMessaging::TMobileSmsBearer smsBearer(RMobileSmsMessaging::ESmsBearerCircuitPreferred);
|
|
1353 |
RMobileSmsMessaging::TMobileSmsBearer smsBearer2(RMobileSmsMessaging::ESmsBearerPacketOnly);
|
|
1354 |
|
|
1355 |
|
|
1356 |
//-------------------------------------------------------------------------
|
|
1357 |
// Test A: Test multiple clients requesting RMobileSmsMessaging::SetMoSmsBearer
|
|
1358 |
//-------------------------------------------------------------------------
|
|
1359 |
|
|
1360 |
TMockLtsyData1<RMobileSmsMessaging::TMobileSmsBearer> expTsyData(smsBearer);
|
|
1361 |
expTsyData.SerialiseL(data);
|
|
1362 |
iMockLTSY.ExpectL(MLtsyDispatchSmsSetMoSmsBearer::KLtsyDispatchSmsSetMoSmsBearerApiId, data);
|
|
1363 |
|
|
1364 |
messaging.SetMoSmsBearer(reqStatus, smsBearer);
|
|
1365 |
messaging2.SetMoSmsBearer(reqStatus2, smsBearer2);
|
|
1366 |
|
|
1367 |
|
|
1368 |
iMockLTSY.CompleteL(MLtsyDispatchSmsSetMoSmsBearer::KLtsyDispatchSmsSetMoSmsBearerApiId, KErrNone);
|
|
1369 |
User::WaitForRequest(reqStatus);
|
|
1370 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
1371 |
|
|
1372 |
User::WaitForRequest(reqStatus2);
|
|
1373 |
ASSERT_EQUALS(KErrServerBusy, reqStatus2.Int());
|
|
1374 |
|
|
1375 |
AssertMockLtsyStatusL();
|
|
1376 |
|
|
1377 |
CleanupStack::PopAndDestroy(6, this);
|
|
1378 |
}
|
|
1379 |
|
|
1380 |
/**
|
|
1381 |
@SYMTestCaseID BA-CTSY-SMSM-SSMNFC-0010
|
|
1382 |
@SYMComponent telephony_ctsy
|
|
1383 |
@SYMTestCaseDesc Test support in CTSY for RMobileSmsMessaging::StoreSmspListL
|
|
1384 |
@SYMTestPriority High
|
|
1385 |
@SYMTestActions Invokes multiple client requests to RMobileSmsMessaging::StoreSmspListL
|
|
1386 |
@SYMTestExpectedResults Pass
|
|
1387 |
@SYMTestType CT
|
|
1388 |
*/
|
|
1389 |
|
|
1390 |
void CCTsySmsFU::TestUnit0010L()
|
|
1391 |
{
|
|
1392 |
|
|
1393 |
OpenEtelServerL(EUseExtendedError);
|
|
1394 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
1395 |
OpenPhoneL();
|
|
1396 |
|
|
1397 |
RBuf8 data;
|
|
1398 |
CleanupClosePushL(data);
|
|
1399 |
|
|
1400 |
RMobileSmsMessaging messaging;
|
|
1401 |
TInt err = messaging.Open(iPhone);
|
|
1402 |
ASSERT_EQUALS(KErrNone, err);
|
|
1403 |
CleanupClosePushL(messaging);
|
|
1404 |
|
|
1405 |
TRequestStatus reqStatus;
|
|
1406 |
CMobilePhoneSmspList* smspListPtr = CMobilePhoneSmspList::NewL();
|
|
1407 |
CleanupStack::PushL(smspListPtr);
|
|
1408 |
|
|
1409 |
|
|
1410 |
//-------------------------------------------------------------------------
|
|
1411 |
// TEST A: failure to dispatch request to LTSY
|
|
1412 |
//-------------------------------------------------------------------------
|
|
1413 |
|
|
1414 |
RMobileSmsMessaging::TMobileSmspEntryV1 smspEntry;
|
|
1415 |
smspListPtr->AddEntryL(smspEntry);
|
|
1416 |
|
|
1417 |
TMockLtsyData1<RMobileSmsMessaging::TMobileSmspEntryV1> smspEntryData(smspEntry);
|
|
1418 |
smspEntryData.SerialiseL(data);
|
|
1419 |
iMockLTSY.ExpectL(MLtsyDispatchSmsStoreSmspListEntry::KLtsyDispatchSmsStoreSmspListEntryApiId, data, KErrNotSupported);
|
|
1420 |
|
|
1421 |
messaging.StoreSmspListL(reqStatus, smspListPtr);
|
|
1422 |
User::WaitForRequest(reqStatus);
|
|
1423 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
1424 |
|
|
1425 |
AssertMockLtsyStatusL();
|
|
1426 |
|
|
1427 |
//-------------------------------------------------------------------------
|
|
1428 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
1429 |
//-------------------------------------------------------------------------
|
|
1430 |
|
|
1431 |
iMockLTSY.ExpectL(MLtsyDispatchSmsStoreSmspListEntry::KLtsyDispatchSmsStoreSmspListEntryApiId, data);
|
|
1432 |
|
|
1433 |
messaging.StoreSmspListL(reqStatus, smspListPtr);
|
|
1434 |
|
|
1435 |
iMockLTSY.CompleteL(MLtsyDispatchSmsStoreSmspListEntry::KLtsyDispatchSmsStoreSmspListEntryApiId, KErrGeneral);
|
|
1436 |
|
|
1437 |
User::WaitForRequest(reqStatus);
|
|
1438 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
1439 |
|
|
1440 |
AssertMockLtsyStatusL();
|
|
1441 |
|
|
1442 |
//-------------------------------------------------------------------------
|
|
1443 |
// TEST C: Successful completion request of
|
|
1444 |
// RMobileSmsMessaging::StoreSmspListL when result is not cached.
|
|
1445 |
//-------------------------------------------------------------------------
|
|
1446 |
|
|
1447 |
iMockLTSY.ExpectL(MLtsyDispatchSmsStoreSmspListEntry::KLtsyDispatchSmsStoreSmspListEntryApiId, data);
|
|
1448 |
|
|
1449 |
messaging.StoreSmspListL(reqStatus, smspListPtr);
|
|
1450 |
|
|
1451 |
iMockLTSY.CompleteL(MLtsyDispatchSmsStoreSmspListEntry::KLtsyDispatchSmsStoreSmspListEntryApiId, KErrNone);
|
|
1452 |
|
|
1453 |
User::WaitForRequest(reqStatus);
|
|
1454 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
1455 |
|
|
1456 |
AssertMockLtsyStatusL();
|
|
1457 |
|
|
1458 |
//-------------------------------------------------------------------------
|
|
1459 |
// TEST D: Unsolicited completion of RMobileSmsMessaging::StoreSmspListL
|
|
1460 |
// from LTSY.
|
|
1461 |
//-------------------------------------------------------------------------
|
|
1462 |
|
|
1463 |
TRequestStatus mockLtsyStatus;
|
|
1464 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
1465 |
|
|
1466 |
iMockLTSY.CompleteL(MLtsyDispatchSmsStoreSmspListEntry::KLtsyDispatchSmsStoreSmspListEntryApiId, KErrNone);
|
|
1467 |
|
|
1468 |
User::WaitForRequest(mockLtsyStatus);
|
|
1469 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
1470 |
|
|
1471 |
AssertMockLtsyStatusL();
|
|
1472 |
CleanupStack::PopAndDestroy(4, this);
|
|
1473 |
|
|
1474 |
}
|
|
1475 |
|
|
1476 |
|