24
|
1 |
|
|
2 |
// Copyright (c) 1999-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_smspdudbbase.h"
|
|
20 |
#include "TE_testsmspdudb.h"
|
|
21 |
|
|
22 |
|
|
23 |
TVerdict CTestSmsPduDbMessage::doTestStepL()
|
|
24 |
/*
|
|
25 |
* implementation of Message test case
|
|
26 |
*/
|
|
27 |
{
|
|
28 |
CSmsPduDatabase* db = CSmsPduDatabase::NewL(iFs, KSmsPduDbDefaultSection, KSmsPduDbTestFilename, KSmsPduDbDefaultComponent);
|
|
29 |
CleanupStack::PushL(db);
|
|
30 |
|
|
31 |
RPointerArray<CSmsPduDbMessage> array;
|
|
32 |
CleanupResetAndDestroyPushL(array);
|
|
33 |
|
|
34 |
db->GetMessageL(array, CSmsPDU::ESmsSubmit);
|
|
35 |
|
|
36 |
const TInt count = array.Count();
|
|
37 |
TInt i = 0;
|
|
38 |
for (i = 0; i < count; i++)
|
|
39 |
{
|
|
40 |
PrintMessage(i, *array[i]);
|
|
41 |
}
|
|
42 |
|
|
43 |
CleanupStack::PopAndDestroy(&array);
|
|
44 |
CleanupStack::PopAndDestroy(db);
|
|
45 |
|
|
46 |
return TestStepResult();
|
|
47 |
}
|
|
48 |
|
|
49 |
|
|
50 |
TVerdict CTestSmsPduDbPdu::doTestStepL()
|
|
51 |
/*
|
|
52 |
* implementation of Pdu test case
|
|
53 |
*/
|
|
54 |
{
|
|
55 |
CSmsPduDatabase* db = CSmsPduDatabase::NewL(iFs, KSmsPduDbDefaultSection, KSmsPduDbTestFilename, KSmsPduDbDefaultComponent);
|
|
56 |
CleanupStack::PushL(db);
|
|
57 |
|
|
58 |
RPointerArray<CSmsPduDbPdu> array;
|
|
59 |
CleanupResetAndDestroyPushL(array);
|
|
60 |
|
|
61 |
db->GetPduL(array, CSmsPDU::ESmsSubmit);
|
|
62 |
TInt count = array.Count();
|
|
63 |
TInt i = 0;
|
|
64 |
for (i = 0; i < count; i++)
|
|
65 |
{
|
|
66 |
const CSmsPduDbPdu& pdu = *array[i];
|
|
67 |
PrintPdu(i, pdu);
|
|
68 |
}
|
|
69 |
array.ResetAndDestroy();
|
|
70 |
db->GetPduL(array, CSmsPDU::ESmsDeliver);
|
|
71 |
count = array.Count();
|
|
72 |
|
|
73 |
for (i = 0; i < count; i++)
|
|
74 |
{
|
|
75 |
const CSmsPduDbPdu& pdu = *array[i];
|
|
76 |
PrintPdu(i, pdu);
|
|
77 |
}
|
|
78 |
|
|
79 |
CleanupStack::PopAndDestroy(&array);
|
|
80 |
CleanupStack::PopAndDestroy(db);
|
|
81 |
|
|
82 |
return TestStepResult() ;
|
|
83 |
}
|
|
84 |
|
|
85 |
|
|
86 |
TVerdict CTestSmsPduDbConcatSegment::doTestStepL()
|
|
87 |
/*
|
|
88 |
* implementation of Concat Segment test case
|
|
89 |
*/
|
|
90 |
{
|
|
91 |
// The test case was empty in old t_smspdudb.exe
|
|
92 |
|
|
93 |
return TestStepResult();
|
|
94 |
}
|
|
95 |
|
|
96 |
|
|
97 |
TVerdict CTestSmsPduDbConcat::doTestStepL()
|
|
98 |
/*
|
|
99 |
* implementation of Concat test case
|
|
100 |
*/
|
|
101 |
{
|
|
102 |
CSmsPduDatabase* db = CSmsPduDatabase::NewL(iFs, KSmsPduDbDefaultSection, KSmsPduDbTestFilename, KSmsPduDbDefaultComponent);
|
|
103 |
CleanupStack::PushL(db);
|
|
104 |
|
|
105 |
RPointerArray<CSmsPduDbConcat> array;
|
|
106 |
CleanupResetAndDestroyPushL(array);
|
|
107 |
|
|
108 |
db->GetConcatL(array, CSmsPDU::ESmsSubmit);
|
|
109 |
TInt count = array.Count();
|
|
110 |
TInt i = 0;
|
|
111 |
for (i = 0; i < count; i++)
|
|
112 |
{
|
|
113 |
const CSmsPduDbConcat& concat = *array[i];
|
|
114 |
PrintConcat(i, concat);
|
|
115 |
}
|
|
116 |
|
|
117 |
array.ResetAndDestroy();
|
|
118 |
|
|
119 |
db->GetConcatL(array, CSmsPDU::ESmsDeliver);
|
|
120 |
count = array.Count();
|
|
121 |
|
|
122 |
for (i = 0; i < count; i++)
|
|
123 |
{
|
|
124 |
const CSmsPduDbConcat& concat = *array[i];
|
|
125 |
PrintConcat(i, concat);
|
|
126 |
}
|
|
127 |
|
|
128 |
CleanupStack::PopAndDestroy(&array);
|
|
129 |
CleanupStack::PopAndDestroy(db);
|
|
130 |
|
|
131 |
return TestStepResult();
|
|
132 |
}
|
|
133 |
|
|
134 |
|
|
135 |
TVerdict CTestSmsPduDbParse::doTestStepL()
|
|
136 |
/*
|
|
137 |
* implementation of Parse test case
|
|
138 |
*/
|
|
139 |
{
|
|
140 |
CSmsPduDatabase* db = CSmsPduDatabase::NewL(iFs, KSmsPduDbDefaultSection, KSmsPduDbTestFilename, KSmsPduDbDefaultComponent);
|
|
141 |
CleanupStack::PushL(db);
|
|
142 |
|
|
143 |
db->RewriteFileL(KSmsPduDbTestFilename, KSmsPduDbDefaultComponent, KSmsPduDbTestOutput);
|
|
144 |
|
|
145 |
|
|
146 |
CleanupStack::PopAndDestroy(db);
|
|
147 |
|
|
148 |
return TestStepResult();
|
|
149 |
}
|
|
150 |
|
|
151 |
|
|
152 |
TVerdict CTestSmsPduDbCompile::doTestStepL()
|
|
153 |
/*
|
|
154 |
* implementation of Compile test case
|
|
155 |
*/
|
|
156 |
{
|
|
157 |
CSmsPduDatabase* db = CSmsPduDatabase::NewL(iFs);
|
|
158 |
CleanupStack::PushL(db);
|
|
159 |
|
|
160 |
const CTestConfig& configFile = db->ConfigFile();
|
|
161 |
|
|
162 |
const TInt sectionCount = configFile.Sections().Count();
|
|
163 |
|
|
164 |
for (TInt section = 0; section < sectionCount; section++)
|
|
165 |
{
|
|
166 |
const CTestConfigSection& configSection = configFile[section];
|
|
167 |
const TInt itemCount = configSection.Items().Count();
|
|
168 |
|
|
169 |
for (TInt item = 0; item < itemCount; item++)
|
|
170 |
{
|
|
171 |
const CTestConfigItem& configItem = configSection[item];
|
|
172 |
CSmsPduDbPdu* pdu = NULL;
|
|
173 |
|
|
174 |
TRAPD(err, pdu = db->PduFactoryL(configItem));
|
|
175 |
if (err != KErrNone)
|
|
176 |
{
|
|
177 |
DisplayCompileErrorL(configSection, configItem, err);
|
|
178 |
TEST(EFalse);
|
|
179 |
continue;
|
|
180 |
}
|
|
181 |
|
|
182 |
CleanupStack::PushL(pdu);
|
|
183 |
|
|
184 |
if (pdu->iDecodeError > KErrNone)
|
|
185 |
{
|
|
186 |
DisplayCompileErrorL(configSection, configItem, KErrArgument);
|
|
187 |
TEST(EFalse);
|
|
188 |
}
|
|
189 |
else if (pdu->iSmsMessageError > KErrNone)
|
|
190 |
{
|
|
191 |
DisplayCompileErrorL(configSection, configItem, KErrCorrupt);
|
|
192 |
TEST(EFalse);
|
|
193 |
}
|
|
194 |
|
|
195 |
CleanupStack::PopAndDestroy(pdu);
|
|
196 |
}
|
|
197 |
}
|
|
198 |
|
|
199 |
CleanupStack::PopAndDestroy(db);
|
|
200 |
|
|
201 |
return TestStepResult();
|
|
202 |
}
|
|
203 |
|
|
204 |
|
|
205 |
TVerdict CTestSmsPduDbTools::doTestStepL()
|
|
206 |
/*
|
|
207 |
* implementation of Tools test case
|
|
208 |
*/
|
|
209 |
{
|
|
210 |
TGsmSms pdu;
|
|
211 |
TSmsFirstOctet fo(iSmsStackTestUtils->FirstDeliverOctet(EFalse, EFalse, EFalse, ETrue));
|
|
212 |
TSmsDataCodingScheme dcs;
|
|
213 |
TSmsProtocolIdentifier pid;
|
|
214 |
|
|
215 |
TGsmSmsTelNumber oa;
|
|
216 |
oa.iTelNumber.Copy(_L("HelloHello"));
|
|
217 |
oa.iTypeOfAddress.SetNPI(EGsmSmsNPIUnknown);
|
|
218 |
oa.iTypeOfAddress.SetTON(EGsmSmsTONAlphaNumeric);
|
|
219 |
|
|
220 |
TTime scts;
|
|
221 |
scts.UniversalTime();
|
|
222 |
TInt offsetToUTCInQtrHours = ((User::UTCOffset()).Int()/900);
|
|
223 |
|
|
224 |
CCnvCharacterSetConverter* conv = CCnvCharacterSetConverter::NewL();
|
|
225 |
CleanupStack::PushL(conv);
|
|
226 |
|
|
227 |
CSmsUserData* ud = CSmsUserData::NewL(*conv, iSmsStackTestUtils->iFs, fo, dcs);
|
|
228 |
CleanupStack::PushL(ud);
|
|
229 |
|
|
230 |
iSmsStackTestUtils->DeliverWithoutUserDataL(pdu, fo, oa, pid, dcs, scts, offsetToUTCInQtrHours);
|
|
231 |
iSmsStackTestUtils->AppendUserDataL(pdu, *ud);
|
|
232 |
iSmsStackTestUtils->PrintAndTestDecodeL(pdu, dcs, pid, *ud, ETrue, KErrNone);
|
|
233 |
|
|
234 |
fo = iSmsStackTestUtils->FirstDeliverOctet(ETrue, ETrue, ETrue, ETrue);
|
|
235 |
iSmsStackTestUtils->DeliverWithoutUserDataL(pdu, fo, oa, pid, dcs, scts, offsetToUTCInQtrHours);
|
|
236 |
iSmsStackTestUtils->AppendUserDataL(pdu, *ud);
|
|
237 |
iSmsStackTestUtils->PrintAndTestDecodeL(pdu, dcs, pid, *ud, ETrue, KErrNone);
|
|
238 |
|
|
239 |
iSmsStackTestUtils->DeliverWithoutUserDataL(pdu, fo, oa, pid, dcs, scts, offsetToUTCInQtrHours);
|
|
240 |
iSmsStackTestUtils->AppendUserDataL(pdu, *ud, 0x99);
|
|
241 |
iSmsStackTestUtils->PrintAndTestDecodeL(pdu, dcs, pid, *ud, ETrue, KErrGsmuDecoding);
|
|
242 |
|
|
243 |
ud->SetBodyL(_L8("Dundee United SPL Champions 1983"));
|
|
244 |
iSmsStackTestUtils->DeliverWithoutUserDataL(pdu, fo, oa, pid, dcs, scts, offsetToUTCInQtrHours);
|
|
245 |
iSmsStackTestUtils->AppendUserDataL(pdu, *ud);
|
|
246 |
iSmsStackTestUtils->PrintAndTestDecodeL(pdu, dcs, pid, *ud, ETrue, KErrNone);
|
|
247 |
|
|
248 |
TPckgBuf<TInt32> buf;
|
|
249 |
buf() = 200;
|
|
250 |
|
|
251 |
ud->AddInformationElementL(CSmsInformationElement::ESmsIEIConcatenatedShortMessages16BitReference, buf);
|
|
252 |
iSmsStackTestUtils->DeliverWithoutUserDataL(pdu, fo, oa, pid, dcs, scts, offsetToUTCInQtrHours);
|
|
253 |
iSmsStackTestUtils->AppendUserDataL(pdu, *ud);
|
|
254 |
iSmsStackTestUtils->PrintAndTestDecodeL(pdu, dcs, pid, *ud, ETrue, KErrNone);
|
|
255 |
|
|
256 |
|
|
257 |
CleanupStack::PopAndDestroy(2);
|
|
258 |
|
|
259 |
return TestStepResult();
|
|
260 |
}
|
|
261 |
|
|
262 |
|
|
263 |
TVerdict CTestSmsServiceCenterTimeStamp::doTestStepL()
|
|
264 |
/*
|
|
265 |
* implementation of Tools test case
|
|
266 |
*/
|
|
267 |
{
|
|
268 |
iSmsStackTestUtils->CreateTSmsServiceCenterTimeStampL();
|
|
269 |
iSmsStackTestUtils->EncodeTSmsServiceCenterTimeStampL();
|
|
270 |
iSmsStackTestUtils->DecodeTSmsServiceCenterTimeStampL();
|
|
271 |
|
|
272 |
return TestStepResult();
|
|
273 |
}
|
|
274 |
|
|
275 |
|
|
276 |
TVerdict CTestSmsValidityPeriod::doTestStepL()
|
|
277 |
/*
|
|
278 |
* implementation of Tools test case
|
|
279 |
*/
|
|
280 |
{
|
|
281 |
iSmsStackTestUtils->CreateTSmsValidityPeriodL();
|
|
282 |
iSmsStackTestUtils->EncodeTSmsValidityPeriodL();
|
|
283 |
iSmsStackTestUtils->DecodeTSmsValidityPeriodL();
|
|
284 |
|
|
285 |
return TestStepResult();
|
|
286 |
}
|