|
1 // Copyright (c) 2009-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 #ifndef SMSSTACKBASETESTSTEPS_H |
|
17 #define SMSSTACKBASETESTSTEPS_H |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <test\testexecutestepbase.h> |
|
21 #include <smsuaddr.h> |
|
22 #include <gsmupdu.h> |
|
23 #include <sacls.h> |
|
24 #include <rscommon.h> |
|
25 #include <c32root.h> |
|
26 #include <etelmm.h> |
|
27 |
|
28 class RSocketServ; |
|
29 class RSocket; |
|
30 class CSmsMessage; |
|
31 class CSmsBuffer; |
|
32 class CSmsPduDbMessage; |
|
33 class CSmsStackTestUtils; |
|
34 class TTestCase; |
|
35 |
|
36 /** |
|
37 Base class housing SMS test Steps |
|
38 */ |
|
39 class CSmsBaseTestStep : public CTestStep |
|
40 { |
|
41 public: |
|
42 IMPORT_C virtual TVerdict doTestStepPreambleL(); |
|
43 IMPORT_C virtual TVerdict doTestStepPostambleL(); |
|
44 |
|
45 IMPORT_C virtual ~CSmsBaseTestStep(); |
|
46 |
|
47 enum TCodingScheme{ESevenBit=7, EEightBit}; |
|
48 |
|
49 /* Functions grabbed from SMS Stack Test Utils */ |
|
50 // Socket utils |
|
51 IMPORT_C void OpenSmsSocketL(RSocketServ& aSocketServer, RSocket& aSocket, TSmsAddr& aSmsAddr); |
|
52 IMPORT_C void OpenSmsSocketL(RSocketServ& aSocketServer, RSocket& aSocket, TSmsAddrFamily aFamily); |
|
53 |
|
54 IMPORT_C void ParseSettingsFromFileL(); |
|
55 |
|
56 IMPORT_C void SetSimTSYTestNumberL(TInt aTestNumber); |
|
57 IMPORT_C void SetTestNumberL(TInt aTestNumberProperty, TInt aTestNumber); |
|
58 IMPORT_C void SetTestNumberFromConfigurationFileL(); |
|
59 |
|
60 IMPORT_C TInt GetIntegerFromConfigL(const TDesC& aKey); |
|
61 IMPORT_C TPtrC GetStringFromConfigL(const TDesC& aKey); |
|
62 |
|
63 IMPORT_C void ConnectSocketServerL(RSocketServ& aSocketServer); |
|
64 IMPORT_C void ConnectSocketServerLC(RSocketServ& aSocketServer); |
|
65 |
|
66 IMPORT_C void WaitForRecvL(RSocket& aSocket); |
|
67 IMPORT_C TBool TimedWaitForRecvL(RSocket& aSocket, TUint aDelay); |
|
68 |
|
69 IMPORT_C CSmsMessage* RecvSmsL(RSocket& aSocket, TInt aIoctl = KIoctlReadMessageSucceeded); |
|
70 IMPORT_C CSmsMessage* RecvSmsFailedL(RSocket& aSocket); |
|
71 |
|
72 IMPORT_C TSmsStatus::TSmsStatusValue RecvStatusReportL(TSmsServiceCenterAddress& aRecipientNumber, RSocket& aSocket); |
|
73 |
|
74 IMPORT_C CSmsMessage* CreateSmsMessageLC(CSmsPDU::TSmsPDUType aType, CSmsBuffer* aBuffer, const TDesC& aAddress); |
|
75 IMPORT_C CSmsMessage* CreateSmsMessageL(const TDesC& aDes, TSmsDataCodingScheme::TSmsAlphabet aAlphabet, CSmsPDU::TSmsPDUType aType = CSmsPDU::ESmsSubmit); |
|
76 IMPORT_C CSmsMessage* CreateSmsMessageLC(const TDesC& aDes, TSmsDataCodingScheme::TSmsAlphabet aAlphabet, CSmsPDU::TSmsPDUType aType = CSmsPDU::ESmsSubmit); |
|
77 //This method is used to create SMS message from test data |
|
78 IMPORT_C CSmsMessage* CreateSMSL(); |
|
79 IMPORT_C CSmsMessage* CreateSmsWithStatusReportReqL(const TDesC& aDes, TSmsDataCodingScheme::TSmsAlphabet aAlphabet); |
|
80 |
|
81 IMPORT_C TUint64 SetHighLowLimitsAndDiskSpaceLevelL(TUint aHighDrop, TUint aLowDrop, TUint aFreeDrop, TUint64 aMax=0x7fffffff); |
|
82 IMPORT_C void SetFreeDiskSpaceFromDropLevelL(TUint aFreeDrop, TUint64 aMax=0x7fffffff); |
|
83 IMPORT_C void SetFreeDiskSpaceL(TInt64 aNewFreeValue); |
|
84 IMPORT_C void ReleaseDiskSpaceL(); |
|
85 IMPORT_C void SetLowHighLimitsInSmsuRscL(TInt64 aLowLimit, TInt64 aHighLimit); |
|
86 IMPORT_C void RemoveLowHighLimitsFromSmsuRscL(); |
|
87 |
|
88 IMPORT_C void SendSmsL(const CSmsMessage* aSms, RSocket& aSocket, TInt aExpectedError=KErrNone, TInt aMaxRetries=3); |
|
89 IMPORT_C void SendSmsCancelL(CSmsMessage* aSms, RSocket& aSocket1, RSocket& aSocket2); |
|
90 IMPORT_C TInt SendSmsErrorL(CSmsMessage* aSms, RSocket& aSocket); |
|
91 IMPORT_C void SendCommandSmsL(CSmsMessage* aSms, RSocket& aSocket); |
|
92 IMPORT_C void SendTestMessageL(const TTestCase& aTestCase, RSocket& aSocket); |
|
93 IMPORT_C void SendSmsDontCheckReturnValueL(CSmsMessage* aSms, RSocket& aSocket); |
|
94 |
|
95 IMPORT_C void SendAndRecvTestMessageL(const TTestCase& aTestCase, RSocket& aSocket); |
|
96 IMPORT_C void SendAndRecvSms7BitL(const TDesC& aDes, RSocket& aSocket); |
|
97 IMPORT_C void DoSendAndRecvSmsL(const TDesC& aDes, TSmsDataCodingScheme::TSmsAlphabet aAlphabet, RSocket& aSocket); |
|
98 |
|
99 IMPORT_C void PrintMessageDetailedL(const CSmsMessage* aSms); |
|
100 IMPORT_C void PrintMessageL(const CSmsMessage* aSms); |
|
101 |
|
102 IMPORT_C void TestSmsContentsL(CSmsMessage* aSms, const TDesC& aDes, TBool aIgnorePrintOutput = EFalse); |
|
103 IMPORT_C void TestMessageContentsL(CSmsMessage* aSms, const TTestCase& aTestCase); |
|
104 |
|
105 IMPORT_C void WriteSmsToSimL(CSmsMessage& aSms, RSocket& aSocket); |
|
106 IMPORT_C void WriteSmsLeaveIfErrorL(const CSmsMessage& aSms, RSocket& aSocket); |
|
107 IMPORT_C TInt CancelWriteSmsToSimL(CSmsMessage& aSms, RSocket& aSocket, TInt aDelay); |
|
108 |
|
109 IMPORT_C void ReadSmsStoreL(RSocket& aSocket, RPointerArray<CSmsMessage>& aMessages); |
|
110 IMPORT_C void ReadSmsStoreL(RSocket& aSocket, RPointerArray<CSmsMessage>& aMessages, TRequestStatus &aStatus); |
|
111 IMPORT_C TInt MakeReadSmsStoreRequestL(RSocket& aSocket); |
|
112 |
|
113 IMPORT_C TInt DeleteSmsL(const CSmsMessage& aSms, RSocket& aSocket, TInt aExpectedError=KErrNone); |
|
114 IMPORT_C void DeleteSmsLeaveIfErrorL(const CSmsMessage& aSms, RSocket& aSocket); |
|
115 |
|
116 IMPORT_C void SetIndicatorL(const TTestCase& aTestCase, CSmsMessage* aSms); |
|
117 IMPORT_C void FillDes(TDes& aDes,TInt aLength); |
|
118 |
|
119 IMPORT_C TBool DoSingleTestCaseL( const TDesC8& aSection, TInt aCount ); |
|
120 IMPORT_C void ReadPduL( TBuf8<64> aSectionName, RPointerArray<CSmsPduDbMessage>& aArray ); |
|
121 IMPORT_C void TestSendAndRecvMsgsWithDifferentTONL( const RPointerArray<CSmsPduDbMessage>& aArray, |
|
122 const CArrayFixFlat<TInt>* aAlphabetArray, |
|
123 const CArrayFixFlat<TInt>* aTypeOfNumberArray ); |
|
124 IMPORT_C void TestSendAndReceiveIndicatorMsgsL( const RPointerArray<CSmsPduDbMessage>& aArray, |
|
125 const CArrayFixFlat<TInt>* aIndicationStateArray, |
|
126 const CArrayFixFlat<TInt>* aDcsBits7To4Array, |
|
127 const CArrayFixFlat<TInt>* aIndicationTypeArray ); |
|
128 |
|
129 IMPORT_C void ChangeReceiveModeL(RMobileSmsMessaging::TMobileSmsReceiveMode aNewRcvMode); |
|
130 |
|
131 IMPORT_C void UpdatePhonePowerStatusL(RProperty& aPhonePowerProperty, TSAPhoneStatus aNewStatus); |
|
132 |
|
133 IMPORT_C void DoESockMemoryLeakTestL(); |
|
134 |
|
135 public: |
|
136 CActiveScheduler* iScheduler; |
|
137 CSmsStackTestUtils* iSmsStackTestUtils; |
|
138 TSmsServiceCenterAddress iTelephoneNumber; // Test SIM |
|
139 TSmsServiceCenterAddress iServiceCenterNumber; // Radiolinja |
|
140 RSocketServ iSocketServer; |
|
141 |
|
142 protected: |
|
143 IMPORT_C CSmsBaseTestStep(); |
|
144 |
|
145 protected: |
|
146 RFs iFs; |
|
147 TBool iPartOfMultiStepTestCase; |
|
148 TBool iNotLastTestStep; |
|
149 |
|
150 private: |
|
151 class TESockSvrUnloadInfo |
|
152 { |
|
153 public: |
|
154 TCFModuleName iName; |
|
155 RootServer::TRSModuleState iState; |
|
156 TRequestStatus iStatus; |
|
157 }; |
|
158 |
|
159 typedef RPointerArray<TESockSvrUnloadInfo> RUnloadInfoArray; |
|
160 |
|
161 private: |
|
162 void BuildESockCPMListL(RRootServ& aRootServer, RUnloadInfoArray& aInfo, TDes8& aDispList); |
|
163 |
|
164 }; |
|
165 |
|
166 /* |
|
167 * Logging Macros |
|
168 */ |
|
169 #define TESTCHECKL(a, b, s) \ |
|
170 { \ |
|
171 if((a)!=(b)) \ |
|
172 { \ |
|
173 _LIT(KTemp, s); \ |
|
174 ERR_PRINTF4(_L("<font color=FF0000>%S failed: Got %d while expecting %d, leaving </font>"), &KTemp, a, b); \ |
|
175 SetTestStepResult(EFail); \ |
|
176 User::Leave(EFail); \ |
|
177 } \ |
|
178 } |
|
179 |
|
180 #define TESTCHECKCONDITIONL(a, s) \ |
|
181 { \ |
|
182 if (!(a)) \ |
|
183 { \ |
|
184 _LIT(KTemp, s); \ |
|
185 ERR_PRINTF2(_L("<font color=FF0000>%S failed: Condition was false, leaving</font>"), &KTemp); \ |
|
186 SetTestStepResult(EFail); \ |
|
187 User::Leave(EFail); \ |
|
188 } \ |
|
189 } |
|
190 |
|
191 #define TESTCHECK(a, b, s) \ |
|
192 { \ |
|
193 if((a)!=(b)) \ |
|
194 { \ |
|
195 _LIT(KTemp3, s); \ |
|
196 ERR_PRINTF4(_L("<font color=FF0000>%S failed: Got %d while expecting %d</font>"), &KTemp3, a, b); \ |
|
197 SetTestStepResult(EFail); \ |
|
198 } \ |
|
199 } |
|
200 |
|
201 #define TESTCHECKCONDITION(a, s) \ |
|
202 { \ |
|
203 if (!(a)) \ |
|
204 { \ |
|
205 _LIT(KTemp4, s); \ |
|
206 ERR_PRINTF2(_L("<font color=FF0000>%S failed: Condition was false</font>"), &KTemp4); \ |
|
207 SetTestStepResult(EFail); \ |
|
208 } \ |
|
209 } |
|
210 |
|
211 #endif // SMSSTACKBASETESTSTEPS_H |