24
|
1 |
|
|
2 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
// All rights reserved.
|
|
4 |
// This component and the accompanying materials are made available
|
|
5 |
// under the terms of "Eclipse Public License v1.0"
|
|
6 |
// which accompanies this distribution, and is available
|
|
7 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
//
|
|
9 |
// Initial Contributors:
|
|
10 |
// Nokia Corporation - initial contribution.
|
|
11 |
//
|
|
12 |
// Contributors:
|
|
13 |
//
|
|
14 |
// Description:
|
|
15 |
// @file
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
#include "TE_testR6SMS.h"
|
|
20 |
|
|
21 |
#include "TE_R6SMSbase.h"
|
|
22 |
#include "Gsmumsg.h"
|
|
23 |
#include "gsmumsgadditionalattributes.h"
|
|
24 |
#include "Gsmuelem.h"
|
|
25 |
#include "gsmuset.h"
|
|
26 |
#include "EMSInformationElement.h"
|
|
27 |
#include "EMSFormatIE.h"
|
|
28 |
|
|
29 |
TVerdict CTestCSmsMessageAdditionalAttributes1::doTestStepL()
|
|
30 |
{
|
|
31 |
/**
|
|
32 |
* Test 1: The class CSmsMessageAdditionalAttributes is a container class used to store
|
|
33 |
* the CSmsMessage's new attributes so that CSmsMessage maintains Data Compatibility.
|
|
34 |
*
|
|
35 |
* CSmsMessageAdditionalAttributes contains a set of queues which are used to store
|
|
36 |
* the control information elements needed by release 6 SMS.
|
|
37 |
*
|
|
38 |
* This test case performs the following initial tests.
|
|
39 |
*
|
|
40 |
* (1) Queries for the 1st entry when the queue is empty.
|
|
41 |
* (2) Checks that an attempt to add a NULL information element can be handled (exception scenario).
|
|
42 |
* (3) Checks that the 1st information element can be added successfully.
|
|
43 |
* (4) Checks that a series of attempts to add information elements using invalid input parameters can be handled.
|
|
44 |
* (5) Checks that a search for a not existent information element can be handled.
|
|
45 |
* (6) Checks that a search can find the information element using the correct input parameters.
|
|
46 |
* (7) Checks that a search for a second instance of the same information element returns EFalse.
|
|
47 |
* (8) Checks that a search for a second instance of a non existent information element returns EFalse
|
|
48 |
* (9) Gets a reference to the information element contained on the queue.
|
|
49 |
* (10) Attempts to reference the information element at an index which is out of range.
|
|
50 |
* (11) Attempts to index an non existent type of information element.
|
|
51 |
* (12) Attempt to locate a non existent type of information element.
|
|
52 |
* (13) Attempts to get reference to an invalid category of information element.
|
|
53 |
* (14) Attempts to a get a reference to the correct category of information element but one that is out range.
|
|
54 |
* (15) Attempts to remove the information element from the queue, but uses various combinations of invalid input parameters.
|
|
55 |
* (16) Removes the information element using the required input parameters.
|
|
56 |
* (17) Adds 2 new information elements to the queue
|
|
57 |
* (18) Locates the second information element.
|
|
58 |
* (19) Resets the class attributes
|
|
59 |
* (20) Attempt to access an invalid type of operation - done here to get the branch coverage.
|
|
60 |
*/
|
|
61 |
__UHEAP_MARK;
|
|
62 |
|
|
63 |
CSmsMessageAdditionalAttributes* aCollectionOfAttributes = CSmsMessageAdditionalAttributes::NewL();
|
|
64 |
|
|
65 |
CleanupStack::PushL(aCollectionOfAttributes);
|
|
66 |
|
|
67 |
_LIT8(KIeData, "hi");
|
|
68 |
TBuf8<3> data(KIeData);
|
|
69 |
CSmsInformationElement* aIE = CSmsInformationElement::NewL(CSmsInformationElement::ESmsIEISCSpecificUse1, KIeData);
|
|
70 |
CleanupStack::PushL(aIE);
|
|
71 |
|
|
72 |
// (1) Queries for the 1st entry when the queue is empty.
|
|
73 |
TBool rc = ETrue;
|
|
74 |
TUint index, startIndex = 0xFFFF;
|
|
75 |
rc = aCollectionOfAttributes->Find1stInstanceOfControlInformationElement(CSmsInformationElement::ESmsIEISCSpecificUse1, index);
|
|
76 |
TEST(rc == EFalse);
|
|
77 |
|
|
78 |
// (2) Checks that an attempt to add a NULL information element can be handled (exception scenario).
|
|
79 |
TRAPD(err, aCollectionOfAttributes->AddControlInformationElementL(NULL));
|
|
80 |
TEST(err == KErrArgument);
|
|
81 |
|
|
82 |
// (3) Checks that the 1st information element can be added successfully.
|
|
83 |
TRAP(err,aCollectionOfAttributes->AddControlInformationElementL(aIE));
|
|
84 |
TEST(err == KErrNone);
|
|
85 |
CleanupStack::Pop(aIE);
|
|
86 |
|
|
87 |
// (4) Checks that a series of attempts to add information elements using invalid input parameters can be handled.
|
|
88 |
CSmsInformationElement* aIE1 = CSmsInformationElement::NewL(CSmsInformationElement::ESmsIEISCSpecificUse2, KIeData);
|
|
89 |
TRAP(err,aCollectionOfAttributes->AddControlInformationElementL((TSmsInformationElementCategories::TInformationElementCategory) 10, aIE1));
|
|
90 |
TEST(err == KErrArgument);
|
|
91 |
TRAP(err,aCollectionOfAttributes->AddControlInformationElementL(TSmsInformationElementCategories::ECtrlMultipleInstancesAllowed, NULL));
|
|
92 |
TEST(err == KErrArgument);
|
|
93 |
TRAP(err,aCollectionOfAttributes->AddControlInformationElementL((TSmsInformationElementCategories::TInformationElementCategory) 10, NULL));
|
|
94 |
TEST(err == KErrArgument);
|
|
95 |
|
|
96 |
// (5) Checks that a search for a not existent information element can be handled.
|
|
97 |
rc = aCollectionOfAttributes->Find1stInstanceOfControlInformationElement(CSmsInformationElement::ESmsIEISCSpecificUse2, index);
|
|
98 |
TEST(rc == EFalse);
|
|
99 |
|
|
100 |
// (6) Checks that a search can find the information element using the correct input parameters.
|
|
101 |
rc = aCollectionOfAttributes->Find1stInstanceOfControlInformationElement(CSmsInformationElement::ESmsIEISCSpecificUse1, index);
|
|
102 |
TEST(rc != EFalse);
|
|
103 |
|
|
104 |
// (7) Checks that a search for a second instance of the same information element returns false.
|
|
105 |
startIndex = index;
|
|
106 |
rc = aCollectionOfAttributes->FindNextInstanceOfControlInformationElement(CSmsInformationElement::ESmsIEISCSpecificUse1, 1, index);
|
|
107 |
TEST(rc == EFalse);
|
|
108 |
|
|
109 |
// (8) Checks that a search for a second instance of a non existent information element returns false
|
|
110 |
startIndex = 0;
|
|
111 |
rc = aCollectionOfAttributes->FindNextInstanceOfControlInformationElement(CSmsInformationElement::ESmsIEISCSpecificUse2, 0, index);
|
|
112 |
TEST(rc == EFalse);
|
|
113 |
|
|
114 |
// (9) Gets a reference to the information element contained on the queue.
|
|
115 |
CSmsInformationElement& aIEReference = aCollectionOfAttributes->GetControlInformationElementL(CSmsInformationElement::ESmsIEISCSpecificUse1, 0);
|
|
116 |
|
|
117 |
// (10) Attempts to reference the information element at an index which is out of range.
|
|
118 |
TRAP(err,aCollectionOfAttributes->GetControlInformationElementL(CSmsInformationElement::ESmsIEISCSpecificUse1, 1));
|
|
119 |
TEST(err == KErrArgument);
|
|
120 |
|
|
121 |
// (11) Attempts to index an non existent type of information element.
|
|
122 |
TRAP(err,aCollectionOfAttributes->GetControlInformationElementL(CSmsInformationElement::ESmsIEISCSpecificUse2, 0));
|
|
123 |
TEST(err == KErrArgument);
|
|
124 |
|
|
125 |
// (12) Attempt to locate a non existent type of information element.
|
|
126 |
TRAP(err,aCollectionOfAttributes->GetControlInformationElementL((TSmsInformationElementCategories::TInformationElementCategory) 10, 0));
|
|
127 |
TEST(err == KErrArgument);
|
|
128 |
|
|
129 |
// (13) Attempts to get reference to an invalid category of information element.
|
|
130 |
TRAP(err,aCollectionOfAttributes->GetControlInformationElementL((TSmsInformationElementCategories::TInformationElementCategory) 0, 10));
|
|
131 |
TEST(err == KErrArgument);
|
|
132 |
|
|
133 |
CSmsInformationElement* aInformationElement = NULL;
|
|
134 |
CSmsInformationElement*& extractedInformationElement = aInformationElement;
|
|
135 |
|
|
136 |
// (15) Attempts to remove the information element from the queue, but uses various combinations of invalid input parameters.
|
|
137 |
rc = aCollectionOfAttributes->RemoveControlInformationElement(CSmsInformationElement::ESmsIEISCSpecificUse2, startIndex, extractedInformationElement);
|
|
138 |
TEST(rc == EFalse);
|
|
139 |
rc = aCollectionOfAttributes->RemoveControlInformationElement(CSmsInformationElement::ESmsIEISCSpecificUse1, 1, extractedInformationElement);
|
|
140 |
TEST(rc == EFalse);
|
|
141 |
rc = aCollectionOfAttributes->RemoveControlInformationElement(CSmsInformationElement::ESmsIEISCSpecificUse2, 1, extractedInformationElement);
|
|
142 |
TEST(rc == EFalse);
|
|
143 |
|
|
144 |
// (16) Removes the information element using the required input parameters.
|
|
145 |
aCollectionOfAttributes->RemoveControlInformationElement(CSmsInformationElement::ESmsIEISCSpecificUse1, startIndex, extractedInformationElement);
|
|
146 |
TEST(aIE == extractedInformationElement);
|
|
147 |
|
|
148 |
// (17) Adds 2 new information elements to the queue
|
|
149 |
TRAP(err,aCollectionOfAttributes->AddControlInformationElementL(aIE));
|
|
150 |
TEST(err==KErrNone);
|
|
151 |
TRAP(err,aCollectionOfAttributes->AddControlInformationElementL(aIE1));
|
|
152 |
TEST(err==KErrNone);
|
|
153 |
// (18) Locates the second information element.
|
|
154 |
rc = aCollectionOfAttributes->FindNextInstanceOfControlInformationElement(CSmsInformationElement::ESmsIEISCSpecificUse1, 0, index);
|
|
155 |
TEST(rc == EFalse);
|
|
156 |
|
|
157 |
// (19) Resets the class attributes
|
|
158 |
aCollectionOfAttributes->ResetAttributesL();
|
|
159 |
|
|
160 |
// (20) Attempt to access an invalid type of operation
|
|
161 |
// Do this here to get the branch coverage
|
|
162 |
TRAP(err,aCollectionOfAttributes->SetIEOperationL(NULL));
|
|
163 |
TEST(err==KErrArgument);
|
|
164 |
|
|
165 |
CleanupStack::Pop(aCollectionOfAttributes);
|
|
166 |
delete aCollectionOfAttributes;
|
|
167 |
|
|
168 |
__UHEAP_MARKEND;
|
|
169 |
|
|
170 |
return TestStepResult();
|
|
171 |
}
|
|
172 |
|
|
173 |
|
|
174 |
TVerdict CTestCSmsMessageAdditionalAttributes2::doTestStepL()
|
|
175 |
{
|
|
176 |
/**
|
|
177 |
* Test CSmsMessageAdditionalAttributes
|
|
178 |
*
|
|
179 |
* Test Scenario:
|
|
180 |
*
|
|
181 |
* Verify that 2 elements of the same type can be added to the collection, indexed and deleted.
|
|
182 |
*
|
|
183 |
* (1) Create 2 information elements and add to collection
|
|
184 |
* (2) Find 1st instance
|
|
185 |
* (3) Find 2nd instance
|
|
186 |
* (4) Get references
|
|
187 |
* (5) Remove and delete 1st element
|
|
188 |
* (6) Remove and delete 2nd instance
|
|
189 |
*/
|
|
190 |
__UHEAP_MARK;
|
|
191 |
|
|
192 |
CSmsMessageAdditionalAttributes* aCollectionOfAttributes = CSmsMessageAdditionalAttributes::NewL();
|
|
193 |
CleanupStack::PushL(aCollectionOfAttributes);
|
|
194 |
|
|
195 |
// (1) Create 2 information elements and add to collection
|
|
196 |
_LIT8(KIeData, "hi");
|
|
197 |
TBuf8<3> data(KIeData);
|
|
198 |
CSmsInformationElement* aIE = CSmsInformationElement::NewL(CSmsInformationElement::ESmsHyperLinkFormat, KIeData);
|
|
199 |
CleanupStack::PushL(aIE);
|
|
200 |
TRAPD(err,aCollectionOfAttributes->AddControlInformationElementL(aIE));
|
|
201 |
TEST(err == KErrNone);
|
|
202 |
CleanupStack::Pop(aIE);
|
|
203 |
|
|
204 |
CSmsInformationElement* aIE1 = CSmsInformationElement::NewL(CSmsInformationElement::ESmsHyperLinkFormat, KIeData);
|
|
205 |
CleanupStack::PushL(aIE1);
|
|
206 |
TRAP(err,aCollectionOfAttributes->AddControlInformationElementL(aIE1));
|
|
207 |
TEST(err == KErrNone);
|
|
208 |
CleanupStack::Pop(aIE1);
|
|
209 |
|
|
210 |
// (2) Find 1st instance
|
|
211 |
TUint index, startIndex;
|
|
212 |
TUint a2ndIndex = 0xFFFF;
|
|
213 |
TBool found = aCollectionOfAttributes->Find1stInstanceOfControlInformationElement(CSmsInformationElement::ESmsHyperLinkFormat, index);
|
|
214 |
TEST (found != EFalse);
|
|
215 |
|
|
216 |
// (3) Find 2nd instance
|
|
217 |
startIndex = index;
|
|
218 |
found = aCollectionOfAttributes->FindNextInstanceOfControlInformationElement(CSmsInformationElement::ESmsHyperLinkFormat, startIndex, a2ndIndex);
|
|
219 |
TEST (found != EFalse);
|
|
220 |
TEST (a2ndIndex == 1);
|
|
221 |
|
|
222 |
// (4) Get references
|
|
223 |
TRAP(err, CSmsInformationElement& aIEReference = aCollectionOfAttributes->GetControlInformationElementL(CSmsInformationElement::ESmsHyperLinkFormat, startIndex));
|
|
224 |
TEST(err == KErrNone);
|
|
225 |
TRAP(err, CSmsInformationElement& aIEReference1 = aCollectionOfAttributes->GetControlInformationElementL(CSmsInformationElement::ESmsHyperLinkFormat, a2ndIndex));
|
|
226 |
TEST(err == KErrNone);
|
|
227 |
|
|
228 |
CSmsInformationElement* aInformationElement = NULL;
|
|
229 |
CSmsInformationElement*& extractedInformationElement = aInformationElement;
|
|
230 |
|
|
231 |
// (5) Remove and delete 1st element
|
|
232 |
TBool deleted = aCollectionOfAttributes->RemoveControlInformationElement(CSmsInformationElement::ESmsHyperLinkFormat, startIndex, extractedInformationElement);
|
|
233 |
TEST (deleted != EFalse);
|
|
234 |
TEST (aIE == extractedInformationElement);
|
|
235 |
|
|
236 |
delete aIE;
|
|
237 |
|
|
238 |
// (6) Remove and delete 2nd instance
|
|
239 |
deleted = aCollectionOfAttributes->RemoveControlInformationElement(CSmsInformationElement::ESmsHyperLinkFormat,
|
|
240 |
--a2ndIndex,
|
|
241 |
extractedInformationElement);
|
|
242 |
TEST (deleted != EFalse);
|
|
243 |
TEST (aIE1 == extractedInformationElement);
|
|
244 |
|
|
245 |
delete aIE1;
|
|
246 |
CleanupStack::Pop(aCollectionOfAttributes);
|
|
247 |
delete aCollectionOfAttributes;
|
|
248 |
|
|
249 |
__UHEAP_MARKEND;
|
|
250 |
return TestStepResult();
|
|
251 |
}
|
|
252 |
|
|
253 |
|
|
254 |
TVerdict CTestCSmsMessageAdditionalAttributes3::doTestStepL()
|
|
255 |
{
|
|
256 |
/**
|
|
257 |
* Test CSmsMessageAdditionalAttributes, client facing methods.
|
|
258 |
*
|
|
259 |
* Verify that CSmsMessageAdditionalAttributes can handle the following requests:
|
|
260 |
*
|
|
261 |
* (1) the addition of 2 elements to one of its collections.
|
|
262 |
* (2) an attempt to access information elements specifying an invalid (out of range) queue ID.
|
|
263 |
* (3) a request to remove the control information element at back of the queue, transfering ownership to the client.
|
|
264 |
* (4) a request to remove the control information element remaining on the queue, transfering ownership to the client.
|
|
265 |
* (5) a request to remove a control information element from the now empty queue.
|
|
266 |
*
|
|
267 |
*/
|
|
268 |
__UHEAP_MARK;
|
|
269 |
|
|
270 |
CSmsMessageAdditionalAttributes* aCollectionOfAttributes = CSmsMessageAdditionalAttributes::NewL();
|
|
271 |
CleanupStack::PushL(aCollectionOfAttributes);
|
|
272 |
|
|
273 |
// (1) Create 2 information elements and add to collection
|
|
274 |
_LIT8(KIeData, "hi");
|
|
275 |
TBuf8<3> data(KIeData);
|
|
276 |
|
|
277 |
CSmsInformationElement* aIE = CSmsInformationElement::NewL(CSmsInformationElement::ESmsHyperLinkFormat, KIeData);
|
|
278 |
CleanupStack::PushL(aIE);
|
|
279 |
TRAPD(err,aCollectionOfAttributes->AddControlInformationElementL(aIE));
|
|
280 |
TEST(err == KErrNone);
|
|
281 |
CleanupStack::Pop(aIE);
|
|
282 |
|
|
283 |
CSmsInformationElement* aIE1 = CSmsInformationElement::NewL(CSmsInformationElement::ESmsHyperLinkFormat, KIeData);
|
|
284 |
CleanupStack::PushL(aIE1);
|
|
285 |
TRAP(err,aCollectionOfAttributes->AddControlInformationElementL(aIE1));
|
|
286 |
TEST(err == KErrNone);
|
|
287 |
CleanupStack::Pop(aIE1);
|
|
288 |
|
|
289 |
CSmsInformationElement* IEptr = NULL;
|
|
290 |
TBool rc;
|
|
291 |
rc = aCollectionOfAttributes->RemoveNextControlInformationElement((TSmsInformationElementCategories::TInformationElementCategory) 10, IEptr);
|
|
292 |
TEST(rc == EFalse);
|
|
293 |
rc = aCollectionOfAttributes->RemoveNextControlInformationElement(TSmsInformationElementCategories::ECtrlMultipleInstancesAllowed, IEptr);
|
|
294 |
TEST(rc != EFalse);
|
|
295 |
delete IEptr;
|
|
296 |
IEptr = NULL;
|
|
297 |
rc = aCollectionOfAttributes->RemoveNextControlInformationElement(TSmsInformationElementCategories::ECtrlMultipleInstancesAllowed, IEptr);
|
|
298 |
TEST(rc != EFalse);
|
|
299 |
delete IEptr;
|
|
300 |
IEptr = NULL;
|
|
301 |
rc = aCollectionOfAttributes->RemoveNextControlInformationElement(TSmsInformationElementCategories::ECtrlMultipleInstancesAllowed, IEptr);
|
|
302 |
TEST(rc == EFalse);
|
|
303 |
|
|
304 |
CleanupStack::Pop(aCollectionOfAttributes);
|
|
305 |
delete aCollectionOfAttributes;
|
|
306 |
|
|
307 |
__UHEAP_MARKEND;
|
|
308 |
return TestStepResult();
|
|
309 |
}
|
|
310 |
|
|
311 |
|
|
312 |
TVerdict CTestR6CSmsMessage::doTestStepL()
|
|
313 |
{
|
|
314 |
/**
|
|
315 |
* Synopsis: Test New R6 CSmsMessage interfaces.
|
|
316 |
*
|
|
317 |
* Provide branch coverage.
|
|
318 |
*
|
|
319 |
* (1) Create all valid operations classes and one invalid operations class.
|
|
320 |
*
|
|
321 |
* (2) Test "Get" and "Set" methods that indicate that indicate whether
|
|
322 |
* a particular message originated on the SIM and whether it should be forwarded
|
|
323 |
* by the stack to its client.
|
|
324 |
*
|
|
325 |
*/
|
|
326 |
RFs fs;
|
|
327 |
User::LeaveIfError(fs.Connect());
|
|
328 |
|
|
329 |
__UHEAP_MARK;
|
|
330 |
|
|
331 |
_LIT16(KName, "David Narey");
|
|
332 |
CSmsBuffer* buffer=CSmsBuffer::NewL();
|
|
333 |
buffer->InsertL(0,KName);
|
|
334 |
|
|
335 |
CSmsMessage* smsMessage = CSmsMessage::NewL(fs, CSmsPDU::ESmsSubmit, buffer);
|
|
336 |
|
|
337 |
TRAPD(err, smsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsIEISpecialSMSMessageIndication));
|
|
338 |
TEST(err == KErrNone);
|
|
339 |
TRAP(err, smsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsHyperLinkFormat));
|
|
340 |
TEST(err == KErrNone);
|
|
341 |
TRAP(err, smsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsReplyAddressFormat));
|
|
342 |
TEST(err == KErrNone);
|
|
343 |
TRAP(err, smsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsEnhanceVoiceMailInformation));
|
|
344 |
TEST(err == KErrNone);
|
|
345 |
TRAP(err, smsMessage->GetOperationsForIEL(CSmsInformationElement::ESmsEnhancedextendedObjectDataRequest));
|
|
346 |
TEST(err == KErrArgument);
|
|
347 |
|
|
348 |
smsMessage->SetDecodedOnSIM(EFalse);
|
|
349 |
TEST(smsMessage->DecodedOnSim() == EFalse);
|
|
350 |
smsMessage->SetDecodedOnSIM(ETrue);
|
|
351 |
TEST(smsMessage->DecodedOnSim() != EFalse);
|
|
352 |
smsMessage->SetForwardToClient(EFalse);
|
|
353 |
TEST(smsMessage->ForwardToClient() == EFalse);
|
|
354 |
smsMessage->SetForwardToClient(ETrue);
|
|
355 |
TEST(smsMessage->ForwardToClient() != EFalse);
|
|
356 |
|
|
357 |
delete smsMessage;
|
|
358 |
|
|
359 |
__UHEAP_MARKEND;
|
|
360 |
return TestStepResult();
|
|
361 |
}
|
|
362 |
|
|
363 |
|
|
364 |
TVerdict CTestAddingIEsViaNewAndExistingInterfaces::doTestStepL()
|
|
365 |
{
|
|
366 |
/**
|
|
367 |
*
|
|
368 |
* Encode and Decode a Special SMS Message Indication into a single PDU
|
|
369 |
* verifying the use of the new Special Message Waiting API and the existing
|
|
370 |
* interface used by Special Message Waiting and other control information elements.
|
|
371 |
*/
|
|
372 |
RFs fs;
|
|
373 |
User::LeaveIfError(fs.Connect());
|
|
374 |
|
|
375 |
__UHEAP_MARK;
|
|
376 |
|
|
377 |
CSmsBuffer* buffer=CSmsBuffer::NewL();
|
|
378 |
|
|
379 |
CSmsMessage* message = CSmsMessage::NewL(fs, CSmsPDU::ESmsSubmit, buffer );
|
|
380 |
CleanupStack::PushL(message);
|
|
381 |
|
|
382 |
TSmsUserDataSettings userDataSettings;
|
|
383 |
userDataSettings.SetAlphabet(TSmsDataCodingScheme::ESmsAlphabetUCS2);
|
|
384 |
message->SetUserDataSettingsL(userDataSettings);
|
|
385 |
|
|
386 |
// Get a handle to the user data
|
|
387 |
CSmsPDU& submitPDU = message->SmsPDU();
|
|
388 |
CSmsUserData& userData = submitPDU.UserData();
|
|
389 |
|
|
390 |
// create a data field for undefined information elements.
|
|
391 |
_LIT8(KUndefinedIE, "\xAA\xBB\xCC");
|
|
392 |
|
|
393 |
// Check that the user data interface does not support the addition of information elements whose values have not yet been defined.
|
|
394 |
TRAPD(err,userData.AddInformationElementL((CSmsInformationElement::TSmsInformationElementIdentifier)0x21,KUndefinedIE));
|
|
395 |
TEST(err==KErrNotSupported);
|
|
396 |
TRAP(err, userData.AddInformationElementL((CSmsInformationElement::TSmsInformationElementIdentifier)0x6F,KUndefinedIE));
|
|
397 |
TEST(err==KErrNotSupported);
|
|
398 |
TRAP(err, userData.AddInformationElementL((CSmsInformationElement::TSmsInformationElementIdentifier)0xA0,KUndefinedIE));
|
|
399 |
TEST(err==KErrNotSupported);
|
|
400 |
TRAP(err, userData.AddInformationElementL((CSmsInformationElement::TSmsInformationElementIdentifier)0xBF,KUndefinedIE));
|
|
401 |
TEST(err==KErrNotSupported);
|
|
402 |
TRAP(err, userData.AddInformationElementL((CSmsInformationElement::TSmsInformationElementIdentifier)0xE0,KUndefinedIE));
|
|
403 |
TEST(err==KErrNotSupported);
|
|
404 |
TRAP(err, userData.AddInformationElementL((CSmsInformationElement::TSmsInformationElementIdentifier)0xFF,KUndefinedIE));
|
|
405 |
TEST(err==KErrNotSupported);
|
|
406 |
|
|
407 |
// add 1st special information element
|
|
408 |
_LIT8(K1stSpecialMessageIE,"\x00\x01");
|
|
409 |
TRAP(err,userData.AddInformationElementL(CSmsInformationElement::ESmsIEISpecialSMSMessageIndication,K1stSpecialMessageIE));
|
|
410 |
TEST(err==KErrNone);
|
|
411 |
// check the same special message cannot be added again
|
|
412 |
// add 1st special information element (modified value)
|
|
413 |
_LIT8(K1stSpecialMessageIEWithNewCount,"\x00\x02");
|
|
414 |
TRAP(err,userData.AddInformationElementL(CSmsInformationElement::ESmsIEISpecialSMSMessageIndication,K1stSpecialMessageIEWithNewCount));
|
|
415 |
TEST(err==KErrAlreadyExists);
|
|
416 |
|
|
417 |
// add 2nd special information element
|
|
418 |
_LIT8(K2ndSpecialMessageIE,"\x01\x03");
|
|
419 |
// add 3rd special information element
|
|
420 |
_LIT8(K3rdSpecialMessageIE,"\x02\x04");
|
|
421 |
// add 4th special information element
|
|
422 |
_LIT8(K4thSpecialMessageIE,"\x07\x05");
|
|
423 |
|
|
424 |
TRAP(err,userData.AddInformationElementL(CSmsInformationElement::ESmsIEISpecialSMSMessageIndication,K2ndSpecialMessageIE));
|
|
425 |
TEST(err==KErrNone);
|
|
426 |
TRAP(err,userData.AddInformationElementL(CSmsInformationElement::ESmsIEISpecialSMSMessageIndication,K3rdSpecialMessageIE));
|
|
427 |
TEST(err==KErrNone);
|
|
428 |
TRAP(err,userData.AddInformationElementL(CSmsInformationElement::ESmsIEISpecialSMSMessageIndication,K4thSpecialMessageIE));
|
|
429 |
TEST(err==KErrNone);
|
|
430 |
|
|
431 |
// add mandatory information element
|
|
432 |
_LIT8(KReplyAddress,"\x0C\x91\x53\x48\x80\x14\x55\x82");
|
|
433 |
CSmsInformationElement* iE = CSmsInformationElement::NewL(CSmsInformationElement::ESmsReplyAddressFormat, KReplyAddress);
|
|
434 |
CleanupStack::PushL(iE);
|
|
435 |
CSmsMessageAdditionalAttributes* additionalAttributes = (CSmsMessageAdditionalAttributes*) message->AdditionalInfo();
|
|
436 |
TRAP(err,additionalAttributes->AddControlInformationElementL(iE));
|
|
437 |
TEST(err==KErrNone);
|
|
438 |
CleanupStack::Pop(iE);
|
|
439 |
|
|
440 |
// Increase the branch coverage by exercising the method UpdateInformationElementArrayL() which the client cannot call directly.
|
|
441 |
TRAP(err,userData.UpdateInformationElementArrayL(CSmsInformationElement::ESmsReplyAddressFormat, KReplyAddress));
|
|
442 |
TEST(err == KErrNone);
|
|
443 |
TRAP(err,userData.UpdateInformationElementArrayL(CSmsInformationElement::ESmsReplyAddressFormat, KReplyAddress));
|
|
444 |
TEST(err == KErrAlreadyExists);
|
|
445 |
TInt index = 0;
|
|
446 |
TBool rc = userData.InformationElementIndex(CSmsInformationElement::ESmsReplyAddressFormat,index);
|
|
447 |
TEST(rc != EFalse);
|
|
448 |
userData.RemoveInformationElement(index);
|
|
449 |
|
|
450 |
// Add a single PDU information element
|
|
451 |
_LIT8(KEnhancedVoiceMail,"\x01\x02\x03\x04\x05\x06\x07\x08");
|
|
452 |
CSmsInformationElement* iE1 = CSmsInformationElement::NewL(CSmsInformationElement::ESmsEnhanceVoiceMailInformation, KEnhancedVoiceMail);
|
|
453 |
CleanupStack::PushL(iE1);
|
|
454 |
TRAP(err,additionalAttributes->AddControlInformationElementL(iE1));
|
|
455 |
TEST(err == KErrNone);
|
|
456 |
CleanupStack::Pop(iE1);
|
|
457 |
|
|
458 |
// Increase the branch coverage by exercising the method UpdateInformationElement in ways the the client cannot do directly.
|
|
459 |
// add single pdu information element.
|
|
460 |
TRAP(err,userData.UpdateInformationElementArrayL(CSmsInformationElement::ESmsEnhanceVoiceMailInformation, KEnhancedVoiceMail));
|
|
461 |
TEST(err == KErrNone);
|
|
462 |
TRAP(err,userData.UpdateInformationElementArrayL(CSmsInformationElement::ESmsEnhanceVoiceMailInformation, KEnhancedVoiceMail));
|
|
463 |
TEST(err == KErrAlreadyExists);
|
|
464 |
index = 0;
|
|
465 |
rc = userData.InformationElementIndex(CSmsInformationElement::ESmsEnhanceVoiceMailInformation,index);
|
|
466 |
TEST(rc != EFalse);
|
|
467 |
userData.RemoveInformationElement(index);
|
|
468 |
|
|
469 |
// Increase the branch coverage by exercising the method UpdateInformationElement in ways the the client cannot do directly.
|
|
470 |
// add email header
|
|
471 |
_LIT8(KEmailHeader,"\x01\x02\x03\x04\x05\x06\x07\x08");
|
|
472 |
TRAP(err,userData.UpdateInformationElementArrayL(CSmsInformationElement::ESmsIEIRFC822EmailHeader, KEmailHeader));
|
|
473 |
TEST(err == KErrNone);
|
|
474 |
TRAP(err,userData.UpdateInformationElementArrayL(CSmsInformationElement::ESmsIEIRFC822EmailHeader, KEmailHeader));
|
|
475 |
TEST(err == KErrAlreadyExists);
|
|
476 |
index = 0;
|
|
477 |
rc = userData.InformationElementIndex(CSmsInformationElement::ESmsIEIRFC822EmailHeader,index);
|
|
478 |
TEST(rc != EFalse);
|
|
479 |
userData.RemoveInformationElement(index);
|
|
480 |
|
|
481 |
// Increase the branch coverage by exercising the method UpdateInformationElement in ways the the client cannot do directly.
|
|
482 |
// add an information element which will be present in every PDU.
|
|
483 |
_LIT8(KESmsIEISIMToolkitSecurityHeaders1,"\x01\x02\x03\x04\x05\x06\x07\x08");
|
|
484 |
TRAP(err,userData.UpdateInformationElementArrayL(CSmsInformationElement::ESmsIEISIMToolkitSecurityHeaders1, KESmsIEISIMToolkitSecurityHeaders1));
|
|
485 |
TEST(err == KErrNone);
|
|
486 |
TRAP(err,userData.UpdateInformationElementArrayL(CSmsInformationElement::ESmsIEISIMToolkitSecurityHeaders1, KESmsIEISIMToolkitSecurityHeaders1));
|
|
487 |
TEST(err == KErrAlreadyExists);
|
|
488 |
index = 0;
|
|
489 |
rc = userData.InformationElementIndex(CSmsInformationElement::ESmsIEISIMToolkitSecurityHeaders1,index);
|
|
490 |
TEST(rc != EFalse);
|
|
491 |
userData.RemoveInformationElement(index);
|
|
492 |
|
|
493 |
// Test adding 17 Multi PDU Hyper Links
|
|
494 |
|
|
495 |
for (TUint i = 0; i < 17; i++)
|
|
496 |
{
|
|
497 |
_LIT8(KBinaryTestData,"\x00\x00\x0F\x0E");
|
|
498 |
CSmsInformationElement* iE = CSmsInformationElement::NewL(CSmsInformationElement::ESmsHyperLinkFormat, KBinaryTestData);
|
|
499 |
CleanupStack::PushL(iE);
|
|
500 |
CSmsMessageAdditionalAttributes* additionalAttributes1 = (CSmsMessageAdditionalAttributes*) message->AdditionalInfo();
|
|
501 |
TRAP(err,additionalAttributes1->AddControlInformationElementL(iE));
|
|
502 |
TEST(err == KErrNone);
|
|
503 |
CleanupStack::Pop(iE);
|
|
504 |
}
|
|
505 |
|
|
506 |
CArrayFixFlat<TGsmSms>* smsArray=new(ELeave) CArrayFixFlat<TGsmSms>(8);
|
|
507 |
|
|
508 |
TRAP(err,rc = message->EncodeIntoSinglePDUL(*smsArray));
|
|
509 |
TEST(err == KErrNone);
|
|
510 |
TEST(rc != EFalse);
|
|
511 |
|
|
512 |
CleanupStack::Pop(message);
|
|
513 |
delete message;
|
|
514 |
|
|
515 |
// now decode the message and check the information elements returned.
|
|
516 |
CSmsBuffer* receiveBuffer = CSmsBuffer::NewL();
|
|
517 |
TGsmSms& sms = smsArray->operator[](0);
|
|
518 |
|
|
519 |
CSmsMessage* decodedMessage = CSmsMessage::NewL(fs, sms, receiveBuffer, EFalse, EFalse);
|
|
520 |
CleanupStack::PushL(decodedMessage);
|
|
521 |
|
|
522 |
CSmsMessageAdditionalAttributes* additionalDecodedAttributes = (CSmsMessageAdditionalAttributes*) decodedMessage->AdditionalInfo();
|
|
523 |
|
|
524 |
TUint numberOfElementsMandatoryIn1stPDU = additionalDecodedAttributes->NumberOfControlInformationElements(TSmsInformationElementCategories::ECtrlMandatoryIn1stPDUOnly);
|
|
525 |
TEST(numberOfElementsMandatoryIn1stPDU==1);
|
|
526 |
|
|
527 |
TUint numberOfSingleInstanceElement = additionalDecodedAttributes->NumberOfControlInformationElements(TSmsInformationElementCategories::ECtrlSingleInstanceOnly);
|
|
528 |
TEST(numberOfSingleInstanceElement==1);
|
|
529 |
|
|
530 |
TUint numberOfMultipleInstanceElements = additionalDecodedAttributes->NumberOfControlInformationElements(TSmsInformationElementCategories::ECtrlMultipleInstancesAllowed);
|
|
531 |
TEST(numberOfMultipleInstanceElements==17);
|
|
532 |
|
|
533 |
CSmsPDU& decodedSubmitPDU = decodedMessage->SmsPDU();
|
|
534 |
CSmsUserData& decodedUserData = decodedSubmitPDU.UserData();
|
|
535 |
|
|
536 |
CArrayFixFlat<TInt>* indices = new(ELeave) CArrayFixFlat<TInt>(8);
|
|
537 |
|
|
538 |
TRAP(err, decodedUserData.InformationElementIndicesL(CSmsInformationElement::ESmsIEISpecialSMSMessageIndication, *indices));
|
|
539 |
TEST(err == KErrNone);
|
|
540 |
TESTL(indices->Count() == 4);
|
|
541 |
|
|
542 |
for (TUint8 i = 0; i < 4; i++)
|
|
543 |
{
|
|
544 |
CSmsInformationElement*& specialSMSI1 = decodedUserData.InformationElementPtr(indices->operator[](i));
|
|
545 |
}
|
|
546 |
|
|
547 |
delete indices;
|
|
548 |
|
|
549 |
CleanupStack::Pop(decodedMessage);
|
|
550 |
delete decodedMessage;
|
|
551 |
|
|
552 |
delete smsArray;
|
|
553 |
|
|
554 |
__UHEAP_MARKEND;
|
|
555 |
return TestStepResult();
|
|
556 |
}
|
|
557 |
|
|
558 |
|
|
559 |
TVerdict CTestIECategoryDefinitions::doTestStepL()
|
|
560 |
{
|
|
561 |
/**
|
|
562 |
* Synopsis:
|
|
563 |
*
|
|
564 |
* Test that each type of information element can be mapped to its correct category
|
|
565 |
* using the utility mehtod TSmsInformationElementCategories::GetCategoryDefinition();
|
|
566 |
*
|
|
567 |
*/
|
|
568 |
TSmsInformationElementCategories::TInformationElementCategory category;
|
|
569 |
|
|
570 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsIEIConcatenatedShortMessages8BitReference, category));
|
|
571 |
TEST(category==TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUButWithValueSpecificToPDU );
|
|
572 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsIEIConcatenatedShortMessages16BitReference, category));
|
|
573 |
TEST(category==TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUButWithValueSpecificToPDU );
|
|
574 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsIEISMSCControlParameters, category));
|
|
575 |
TEST(category==TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUButWithValueSpecificToPDU );
|
|
576 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsIEIRFC822EmailHeader, category));
|
|
577 |
TEST(category==TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUButWithValueSpecificToPDU );
|
|
578 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsIEISpecialSMSMessageIndication, category));
|
|
579 |
TEST(category== TSmsInformationElementCategories::ECtrlMandatoryInEveryPDUMultipleInstancesPerPDU );
|
|
580 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsHyperLinkFormat, category));
|
|
581 |
TEST(category==TSmsInformationElementCategories::ECtrlMultipleInstancesAllowed );
|
|
582 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsReplyAddressFormat, category));
|
|
583 |
TEST(category==TSmsInformationElementCategories::ECtrlMandatoryIn1stPDUOnly );
|
|
584 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsEnhancedPredefinedSound, category));
|
|
585 |
TEST(category==TSmsInformationElementCategories::EEmsInformationElement );
|
|
586 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsEnhancedUserDefinedSound, category));
|
|
587 |
TEST(category==TSmsInformationElementCategories::EEmsInformationElement );
|
|
588 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsEnhancedPredefinedAnimation, category));
|
|
589 |
TEST(category==TSmsInformationElementCategories::EEmsInformationElement );
|
|
590 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsEnhancedLargeAnimation, category));
|
|
591 |
TEST(category==TSmsInformationElementCategories::EEmsInformationElement );
|
|
592 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsEnhancedSmallAnimation, category));
|
|
593 |
TEST(category==TSmsInformationElementCategories::EEmsInformationElement );
|
|
594 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsEnhancedVariablePicture, category));
|
|
595 |
TEST(category==TSmsInformationElementCategories::EEmsInformationElement );
|
|
596 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsEnhancedUserPromptIndicator, category));
|
|
597 |
TEST(category==TSmsInformationElementCategories::EEmsInformationElement );
|
|
598 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsEnhancedExtendedObject, category));
|
|
599 |
TEST(category==TSmsInformationElementCategories::EEmsInformationElement );
|
|
600 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsEnhancedReusedExtendedObject, category));
|
|
601 |
TEST(category==TSmsInformationElementCategories::EEmsInformationElement );
|
|
602 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsEnhancedCompressionControl, category));
|
|
603 |
TEST(category==TSmsInformationElementCategories::EEmsInformationElement );
|
|
604 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsEnhancedODI, category));
|
|
605 |
TEST(category==TSmsInformationElementCategories::EEmsInformationElement );
|
|
606 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsEnhancedStandardWVG, category));
|
|
607 |
TEST(category==TSmsInformationElementCategories::EEmsInformationElement );
|
|
608 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsEnhancedCharacterSizeWVG, category));
|
|
609 |
TEST(category==TSmsInformationElementCategories::EEmsInformationElement );
|
|
610 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsEnhancedextendedObjectDataRequest, category));
|
|
611 |
TEST(category==TSmsInformationElementCategories::EEmsInformationElement );
|
|
612 |
|
|
613 |
//
|
|
614 |
// Some invalid categories...
|
|
615 |
//
|
|
616 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::ESmsIEIReserved, category) == EFalse);
|
|
617 |
TEST(TSmsInformationElementCategories::GetCategoryDefinition(CSmsInformationElement::TSmsInformationElementIdentifier(9999), category) == EFalse);
|
|
618 |
|
|
619 |
return TestStepResult();
|
|
620 |
}
|
|
621 |
|
|
622 |
|
|
623 |
TVerdict CTestR6DCS::doTestStepL()
|
|
624 |
/**
|
|
625 |
*
|
|
626 |
* Test the Data coding scheme bytes can be correctly configured
|
|
627 |
* when R6 automatic deletion feature is active.
|
|
628 |
*/
|
|
629 |
{
|
|
630 |
TSmsDataCodingScheme dataCodingScheme;
|
|
631 |
dataCodingScheme.SetBits7To4((TSmsDataCodingScheme::TSmsDCSBits7To4)0x40);
|
|
632 |
|
|
633 |
// Turn on compression
|
|
634 |
TEST(dataCodingScheme.TextCompressed() == EFalse);
|
|
635 |
dataCodingScheme.SetTextCompressed(ETrue);
|
|
636 |
TEST(dataCodingScheme.TextCompressed() != EFalse);
|
|
637 |
|
|
638 |
// Test switching from 7 bit to 8 bit encoding.
|
|
639 |
TEST(dataCodingScheme.Alphabet() == TSmsDataCodingScheme::ESmsAlphabet7Bit);
|
|
640 |
dataCodingScheme.SetAlphabet(TSmsDataCodingScheme::ESmsAlphabet8Bit);
|
|
641 |
TEST(dataCodingScheme.Alphabet() == TSmsDataCodingScheme::ESmsAlphabet8Bit);
|
|
642 |
|
|
643 |
// Test switching on and off class
|
|
644 |
dataCodingScheme.SetClass(ETrue,(TSmsDataCodingScheme::TSmsClass) 1);
|
|
645 |
TSmsDataCodingScheme::TSmsClass testClass;
|
|
646 |
dataCodingScheme.Class(testClass);
|
|
647 |
TEST(testClass == (TSmsDataCodingScheme::TSmsClass) 1);
|
|
648 |
dataCodingScheme.SetClass(ETrue,(TSmsDataCodingScheme::TSmsClass) 2);
|
|
649 |
dataCodingScheme.Class(testClass);
|
|
650 |
TEST(testClass == (TSmsDataCodingScheme::TSmsClass) 2);
|
|
651 |
|
|
652 |
// Turn off compression
|
|
653 |
dataCodingScheme.SetTextCompressed(EFalse);
|
|
654 |
TEST(dataCodingScheme.TextCompressed() == EFalse);
|
|
655 |
|
|
656 |
// Switch from 8 bit to 7 bit encoding
|
|
657 |
// Test switching from 7 bit to 8 bit encoding.
|
|
658 |
TEST(dataCodingScheme.Alphabet() == TSmsDataCodingScheme::ESmsAlphabet8Bit);
|
|
659 |
dataCodingScheme.SetAlphabet(TSmsDataCodingScheme::ESmsAlphabet7Bit);
|
|
660 |
TEST(dataCodingScheme.Alphabet() == TSmsDataCodingScheme::ESmsAlphabet7Bit);
|
|
661 |
|
|
662 |
// Test data coding scheme class
|
|
663 |
dataCodingScheme.Class(testClass);
|
|
664 |
TEST(testClass == (TSmsDataCodingScheme::TSmsClass) 2);
|
|
665 |
dataCodingScheme.Class(testClass);
|
|
666 |
TEST(testClass == (TSmsDataCodingScheme::TSmsClass) 2);
|
|
667 |
|
|
668 |
return TestStepResult();
|
|
669 |
}
|