19 |
19 |
20 #ifndef _TE_SMSPRTBASE_H_ |
20 #ifndef _TE_SMSPRTBASE_H_ |
21 #define _TE_SMSPRTBASE_H_ |
21 #define _TE_SMSPRTBASE_H_ |
22 |
22 |
23 #include <commsdattypesv1_1.h> |
23 #include <commsdattypesv1_1.h> |
24 #include "Te_smsprttestcase.h" |
|
25 #include "TE_smsprt_alphabet.h" |
|
26 #include "smsstacktestutilities.h" |
|
27 #include <e32base.h> |
24 #include <e32base.h> |
28 #include <es_sock.h> |
25 #include <es_sock.h> |
29 #include <f32file.h> |
26 #include <f32file.h> |
30 #include <e32test.h> |
27 #include <e32test.h> |
31 #include <c32comm.h> |
28 #include <c32comm.h> |
32 #include <simtsy.h> |
29 #include <simtsy.h> |
33 #include <gsmumsg.h> |
30 #include <gsmumsg.h> |
34 #include <gsmubuf.h> |
31 #include <gsmubuf.h> |
35 #include <gsmuset.h> |
32 #include <gsmuset.h> |
36 #include <smsustrm.h> |
33 #include <smsustrm.h> |
37 #include "smspdudb.h" |
|
38 #include "smspproc.h" |
|
39 #include "attributes.h" |
|
40 #include <es_wsms.h> |
34 #include <es_wsms.h> |
41 #include <testconfigfileparser.h> |
35 #include <testconfigfileparser.h> |
42 #include <test/testexecuteserverbase.h> |
36 #include <test/testexecuteserverbase.h> |
43 |
37 |
44 #define DSTDNC_NEWCALL_FULLNAME _L("DummyNc::PotsNc::") |
38 #include "smsstacktestcase.h" |
45 |
39 #include "TE_smsprt_alphabet.h" |
46 _LIT(KGmsSmsConfigFileName,"setupgsmsms.txt"); |
40 #include "smsstacktestutilities.h" |
47 _LIT(KTSmsPrtConfigFileName, "tsmsprt_config.txt"); |
41 #include "smsstackbaseteststeps.h" |
48 _LIT(KTSmsPrtConfigExtraFileName, "tsmsprt_config_extra.txt"); |
42 #include "smsstacktestconsts.h" |
49 _LIT(KTSmsPrtConfigTxRxMaxMsgFileName, "tsmsprt_config_tx_rx_maxmsg.txt"); |
43 #include "smspdudb.h" |
50 |
44 #include "smspproc.h" |
51 _LIT8(KServiceCentreAddress, "ServiceCentreAddress"); |
45 #include "attributes.h" |
52 _LIT8(KSmspEntryValidParams, "SmspEntryValidParams"); |
|
53 _LIT8(KSmspEntryScTypeOfNumber, "SmspEntryScTypeOfNumber"); |
|
54 _LIT8(KSmspEntryScNumberPlan, "SmspEntryScNumberPlan"); |
|
55 |
|
56 _LIT(KVodafoneSC,"+447785016005"); //Vodafone SC |
|
57 _LIT(KRegTestNumber,"+447747065548"); //Number used with regtest |
|
58 _LIT(KTestNumber,"+447747065825"); //Number used with regtest |
|
59 |
|
60 _LIT(KSoneraSC,"+358405202000"); //Sonera SC |
|
61 _LIT(KRadiolinjaSC,"+358508771010"); //Radiolinja SC |
|
62 |
|
63 _LIT(KPekka,"+358408415528"); //Pekka's telephone number |
|
64 _LIT(KOther,"+358408415582"); // Other test number |
|
65 _LIT(KLocalNumber, "08408415528"); //Local test number to verify local/international switching |
|
66 _LIT(KInternationalTestNumber, "+819021710979"); // International number to be used with a status |
|
67 // report containing local version of this number |
|
68 |
|
69 _LIT8(KTestSendAndRecvMsgsWithDifferentTON, "SendAndRecvMsgsWithDifferentTON"); |
|
70 _LIT8(KTestSendAndReceiveIndicatorMsgs, "SendAndReceiveIndicatorMsgs"); |
|
71 _LIT(KConfigFileDir,"sms"); |
|
72 _LIT8(KAlphabet, "Alphabet"); |
|
73 _LIT8(KTypeOfNumber, "TypeOfNumber"); |
|
74 _LIT8(KIndicationType, "IndicationType"); |
|
75 _LIT8(KDCSBits7To4, "DCSBits7To4"); |
|
76 _LIT8(KIndicationState, "IndicationState"); |
|
77 |
|
78 _LIT(KText, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123"); |
|
79 |
|
80 |
|
81 const TUint KSocketMessageSlots = 16; // Override the default value of 8 |
|
82 |
46 |
83 using namespace CommsDat; |
47 using namespace CommsDat; |
84 |
|
85 |
|
86 // |
|
87 // Test macros |
|
88 // |
|
89 #define TESTCHECKL(a, b) \ |
|
90 { \ |
|
91 if((a)!=(b)) \ |
|
92 { \ |
|
93 INFO_PRINTF3(_L("<font color=FF0000>Failed: Got %d while expecting %d.</font>"),a,b); \ |
|
94 SetTestStepResult(EFail); \ |
|
95 User::Leave(EFail); \ |
|
96 } \ |
|
97 } |
|
98 |
|
99 #define TESTCHECKCONDITIONL(a) \ |
|
100 { \ |
|
101 if (!(a)) \ |
|
102 { \ |
|
103 INFO_PRINTF1(_L("<font color=FF0000>Failed: Condition was false.</font>")); \ |
|
104 SetTestStepResult(EFail); \ |
|
105 User::Leave(EFail); \ |
|
106 } \ |
|
107 } |
|
108 |
|
109 #define TESTCHECKSTRL(a, b) \ |
|
110 { \ |
|
111 if((a)!=(b)) \ |
|
112 { \ |
|
113 TBuf<255> temp = a ; \ |
|
114 INFO_PRINTF3(_L("<font color=FF0000>Failed: Got \"%S\" while expecting \"%S\".</font>"), &temp,&(b)); \ |
|
115 SetTestStepResult(EFail); \ |
|
116 User::Leave(EFail); \ |
|
117 } \ |
|
118 } |
|
119 |
|
120 #define TESTCHECK(a, b) \ |
|
121 { \ |
|
122 if((a)!=(b)) \ |
|
123 { \ |
|
124 INFO_PRINTF3(_L("<font color=FF0000>Failed: Got %d while expecting %d.</font>"),a,b); \ |
|
125 SetTestStepResult(EFail); \ |
|
126 } \ |
|
127 } |
|
128 |
|
129 #define TESTCHECKCONDITION(a) \ |
|
130 { \ |
|
131 if (!(a)) \ |
|
132 { \ |
|
133 INFO_PRINTF1(_L("<font color=FF0000>Failed: Condition was false.</font>")); \ |
|
134 SetTestStepResult(EFail); \ |
|
135 } \ |
|
136 } |
|
137 |
|
138 #define TESTCHECKSTR(a, b) \ |
|
139 { \ |
|
140 if((a)!=(b)) \ |
|
141 { \ |
|
142 TBuf<255> temp = a ; \ |
|
143 INFO_PRINTF3(_L("<font color=FF0000>Failed: Got \"%S\" while expecting \"%S\".</font>"), &temp,&(b)); \ |
|
144 SetTestStepResult(EFail); \ |
|
145 } \ |
|
146 } |
|
147 |
|
148 |
|
149 /** |
|
150 Base class housing SMS test Steps |
|
151 */ |
|
152 class CSMSTestSteps : public CTestStep |
|
153 { |
|
154 public: |
|
155 |
|
156 // static CSMSTestSteps* NewL(); |
|
157 ~CSMSTestSteps(); |
|
158 |
|
159 |
|
160 enum TCodingScheme{ESevenBit=7, EEightBit}; |
|
161 |
|
162 /* Functions grabbed from SMS Stack Test Utils */ |
|
163 //Socket utils |
|
164 void OpenSmsSocketL(RSocketServ& aSocketServer, RSocket& aSocket, TSmsAddr& aSmsAddr); |
|
165 void OpenSmsSocketL(RSocketServ& aSocketServer, RSocket& aSocket, TSmsAddrFamily aFamily); |
|
166 void WaitForInitializeL(); |
|
167 void SetSimTSYTestNumberL(TInt aTestNumber); |
|
168 void ParseSettingsFromFileL(); |
|
169 void PrepareRegTestLC(RSocketServ& aSocketServer, TInt aTestNumber); |
|
170 CSmsMessage* CreateSmsMessageL(const TDesC& aDes, TSmsDataCodingScheme::TSmsAlphabet aAlphabet, CSmsPDU::TSmsPDUType aType = CSmsPDU::ESmsSubmit); |
|
171 CSmsMessage* RecvSmsL(RSocket& aSocket, TInt aIoctl = KIoctlReadMessageSucceeded); |
|
172 CSmsMessage* CreateSmsWithStatusReportReqL(const TDesC& aDes, TSmsDataCodingScheme::TSmsAlphabet aAlphabet); |
|
173 CSmsMessage* RecvSmsFailedL(RSocket& aSocket); |
|
174 CSmsMessage* CreateSmsMessageLC(CSmsPDU::TSmsPDUType aType, CSmsBuffer* aBuffer, const TDesC& aAddress); |
|
175 //This method is used to create SMS message from test data |
|
176 CSmsMessage* CreateSMSL(); |
|
177 void SetFreeDiskSpaceL(TInt64 aNewFreeValue); |
|
178 void ReleaseDiskSpaceL(); |
|
179 TUint64 SetHighLowLimitsAndDiskSpaceLevelL(TUint aHighDrop, TUint aLowDrop, TUint aFreeDrop, TUint64 aMax=0x7fffffff); |
|
180 void SetFreeDiskSpaceFromDropLevelL(TUint aFreeDrop); |
|
181 void SetLowHighLimitsInSmsuRscL(TInt64 aLowLimit, TInt64 aHighLimit); |
|
182 void RemoveLowHighLimitsFromSmsuRscL(); |
|
183 void SendSmsL(const CSmsMessage* aSms, RSocket& aSocket); |
|
184 void SendSmsCancelL(CSmsMessage* aSms, RSocket& aSocket1, RSocket& aSocket2); |
|
185 TInt SendSmsErrorL(CSmsMessage* aSms, RSocket& aSocket); |
|
186 void SendCommandSmsL(CSmsMessage* aSms, RSocket& aSocket); |
|
187 void SendAndRecvTestMessageL(const TTestCase& aTestCase, RSocket& aSocket); |
|
188 void SendTestMessageL(const TTestCase& aTestCase, RSocket& aSocket); |
|
189 void SendSmsDontCheckReturnValueL(CSmsMessage* aSms, RSocket& aSocket); |
|
190 void SendAndRecvSms7BitL(const TDesC& aDes, RSocket& aSocket); |
|
191 void DoSendAndRecvSmsL(const TDesC& aDes, TSmsDataCodingScheme::TSmsAlphabet aAlphabet, RSocket& aSocket); |
|
192 void PrintMessageL(const CSmsMessage* aSms); |
|
193 void PrintSmsMessage(const CSmsMessage& aMessage); |
|
194 TSmsStatus::TSmsStatusValue RecvStatusReportL(TSmsServiceCenterAddress& aRecipientNumber, RSocket& aSocket); |
|
195 void WaitForRecvL(RSocket& aSocket); |
|
196 void TestSmsContentsL(CSmsMessage* aSms, const TDesC& aDes, TBool aIgnorePrintOutput = EFalse); |
|
197 void TestMessageContentsL(CSmsMessage* aSms, const TTestCase& aTestCase); |
|
198 void WriteSmsToSimL(CSmsMessage& aSms, RSocket& aSocket); |
|
199 void WriteSmsLeaveIfErrorL(const CSmsMessage& aSms, RSocket& aSocket); |
|
200 void ReadSmsStoreL(RSocket& aSocket, RPointerArray<CSmsMessage>& aMessages); |
|
201 void ReadSmsStoreL(RSocket& aSocket, RPointerArray<CSmsMessage>& aMessages, TRequestStatus &aStatus); |
|
202 TInt DeleteSmsL(const CSmsMessage& aSms, RSocket& aSocket); |
|
203 void DeleteSmsLeaveIfErrorL(const CSmsMessage& aSms, RSocket& aSocket); |
|
204 void SetIndicatorL(const TTestCase& aTestCase, CSmsMessage* aSms); |
|
205 void FillDes(TDes& aDes,TInt aLength); |
|
206 TInt MakeReadSmsStoreRequestL(RSocket& aSocket); |
|
207 TBool TimedWaitForRecvL(RSocket& aSocket, TUint aDelay); |
|
208 TInt CancelWriteSmsToSimL(CSmsMessage& aSms, RSocket& aSocket, TInt aDelay); |
|
209 TBool DoSingleTestCaseL( const TDesC8& aSection, TInt aCount ); |
|
210 void ReadPduL( TBuf8<64> aSectionName, RPointerArray<CSmsPduDbMessage>& aArray ); |
|
211 void TestSendAndRecvMsgsWithDifferentTONL( const RPointerArray<CSmsPduDbMessage>& aArray, |
|
212 const CArrayFixFlat<TInt>* aAlphabetArray, |
|
213 const CArrayFixFlat<TInt>* aTypeOfNumberArray ); |
|
214 void TestSendAndReceiveIndicatorMsgsL( const RPointerArray<CSmsPduDbMessage>& aArray, |
|
215 const CArrayFixFlat<TInt>* aIndicationStateArray, |
|
216 const CArrayFixFlat<TInt>* aDcsBits7To4Array, |
|
217 const CArrayFixFlat<TInt>* aIndicationTypeArray ); |
|
218 RFs iFs; |
|
219 RSocketServ *iSocketServer; |
|
220 |
|
221 TSmsServiceCenterAddress iTelephoneNumber; //Test SIM |
|
222 TSmsServiceCenterAddress iServiceCenterNumber; //Radiolinja |
|
223 |
|
224 void WriteToSIML(RSocket& aSocket, const CSmsMessage& aMsg); |
|
225 |
|
226 CSmsStackTestUtils* iSmsStackTestUtils; |
|
227 |
|
228 virtual TVerdict doTestStepPreambleL(); |
|
229 virtual TVerdict doTestStepPostambleL(); |
|
230 |
|
231 protected: |
|
232 CSmsMessage *iSms; |
|
233 }; |
|
234 |
|
235 |
|
236 /** |
|
237 Legacy base class. This was the original base class. It has a dependency with SmsStackTestUtils. |
|
238 Its preamble and postamble steps create and destroy the socket server session and socket |
|
239 subsession - This is limiting as it only allows one test step to execute within a session. |
|
240 |
|
241 The CSmsTestSteps was abstracted from this class. This has effectively removed this constraint. |
|
242 The CSmsTestSteps share the socket session and subsession, which establishes re-usable test steps. |
|
243 */ |
|
244 class CSmsPrtTestStep : public CSMSTestSteps |
|
245 { |
|
246 |
|
247 public: |
|
248 virtual TVerdict doTestStepPreambleL(); |
|
249 virtual TVerdict doTestStepPostambleL(); |
|
250 void DoESockMemoryLeakTestL(); |
|
251 |
|
252 public: |
|
253 CActiveScheduler* iScheduler; |
|
254 }; |
|
255 |
|
256 |
48 |
257 /** |
49 /** |
258 * Test Step base case for all encoding tests. |
50 * Test Step base case for all encoding tests. |
259 */ |
51 */ |
260 class CSmsPrtEncodingTestStep : public CSmsPrtTestStep |
52 class CSmsPrtEncodingTestStep : public CSmsBaseTestStep |
261 { |
53 { |
262 public: |
54 public: |
263 virtual TVerdict doTestStepPreambleL(); |
55 virtual TVerdict doTestStepPreambleL(); |
264 virtual TVerdict doTestStepPostambleL(); |
56 virtual TVerdict doTestStepPostambleL(); |
265 |
57 |