|
1 // Copyright (c) 2000-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 // TESTWAPP.H |
|
15 // Test Enviroment for WAP Access Point Settings parser. |
|
16 // Started by Sean Jesson of Teleca Ltd. November 1999. |
|
17 // Updated by Andrew Fawcett, Teleca Ltd Feb 2000 |
|
18 // |
|
19 // |
|
20 |
|
21 |
|
22 #if !defined (__TESTWAPP_H__) |
|
23 #define __TESTWAPP_H__ |
|
24 |
|
25 #ifndef _TESTWAPP_H_ |
|
26 #define _TESTWAPP_H_ |
|
27 |
|
28 #include <e32std.h> |
|
29 #include <e32test.h> |
|
30 #include <c32comm.h> |
|
31 #include <in_sock.h> |
|
32 |
|
33 #include <commsdattypesv1_1.h> |
|
34 #include <commsdat.h> |
|
35 using namespace CommsDat; |
|
36 |
|
37 extern RTest Test; |
|
38 //extern RSocketServ SocketServer; |
|
39 //extern RHeap* TestHeap; |
|
40 |
|
41 #define BIO_MSG_ENTRY_PARSED 1 // Set entry.iMtmData3 to 1, indicates entry has store i.e parsed & externalised |
|
42 |
|
43 const TUint KWappModemInitValue = (99999); |
|
44 |
|
45 //Some string defines |
|
46 _LIT(KBIOWAPPrefix, "WAP*"); // prefix for WAP message |
|
47 const TPtrC KWappTestTxtFileDir = _L("c:\\test\\bio\\wapp\\");//Source files dir |
|
48 #define KSmsFileName _L("c:\\Mailtest\\Wapptest\\Wapp.txt") |
|
49 const TPtrC KWappLogFile = _L("C:\\Logs\\Bio\\Wap.log"); // Test log file |
|
50 const TPtrC KFileName = _L("Wap.dat"); |
|
51 const TPtrC KAttachmentName = _L("Wappbmp.cng"); |
|
52 |
|
53 #define KTestWappPriority (EPriorityStandard) //Change this.... |
|
54 |
|
55 // Panic errors: |
|
56 const TInt KWappNullPtr = (111); |
|
57 const TInt KBioMsgNotParsed = (222); |
|
58 const TInt KBioMsgEntryHasNoStore = (333); |
|
59 const TInt KBioMsgNotProcessed = (444); |
|
60 |
|
61 //const TUid KUidMsvMessageDriveStream = {0x1000163E}; |
|
62 const TUid KUIDMsvBIODataStream = {0x10005268}; |
|
63 |
|
64 const TPtrC KWappToken = _L("WAP Access Point"); // A script header. |
|
65 const TPtrC KWappTab = _L("\t"); |
|
66 const TPtrC KWappLinefeed16 = _L("\n"); |
|
67 const TPtrC KWappParserName = _L("WAP Access Point Parser"); // A human readable name. |
|
68 const TVersion KVer1(0,0,1); // A version number. |
|
69 |
|
70 // |
|
71 // Forward references: // |
|
72 // |
|
73 class TWappBearerType; |
|
74 |
|
75 |
|
76 // |
|
77 // Global declarations: // |
|
78 // |
|
79 LOCAL_D RTest test(_L("WAPP Test Harness")); |
|
80 |
|
81 void CommInitL(TBool aEnhanced); |
|
82 |
|
83 |
|
84 // |
|
85 // Class definitions: // |
|
86 // |
|
87 |
|
88 // |
|
89 // CExampleScheduler: INTERFACE // |
|
90 // |
|
91 class CTestScheduler : public CActiveScheduler |
|
92 { |
|
93 public: |
|
94 void Error(TInt anError) const; |
|
95 }; |
|
96 |
|
97 |
|
98 // |
|
99 // CTestWapp: INTERFACE // |
|
100 // |
|
101 |
|
102 class CTestWapp : public CActive |
|
103 { |
|
104 public: |
|
105 enum TSessionState |
|
106 { |
|
107 EWappClearCommDB, |
|
108 EWappCreateNewMessages, // Creating messages in Global Inbox |
|
109 EWappCreateParser, // Create a parser set to next message entry |
|
110 EWappProcessUnparsed, // Call ProcessL for an unparsed message - should fail! |
|
111 EWappParse, // parse the message |
|
112 EWappParseAgain, // parse it a second time |
|
113 EWappProcess, // process the parsed fields of the message |
|
114 EWappProcessAgain, // process a second time |
|
115 EWappDisplay, // Display entry data. |
|
116 EWappComplete // wrap-up everything |
|
117 }; |
|
118 |
|
119 enum TTestMode |
|
120 { |
|
121 ETWappConcise, // Minimal info |
|
122 ETWappDetailed, // Logs Parsed Fields |
|
123 ETWappVerbose // Logs everything parsed fields, and commdb entries |
|
124 }; |
|
125 |
|
126 enum TTestWappBearerType |
|
127 { |
|
128 ETestWappUnknownBearer, |
|
129 ETestWappGsmCsdBearer, |
|
130 ETestWappGsmSmsBearer, |
|
131 ETestWappGsmUssdBearer, |
|
132 ETestWappIS136CsdBearer, |
|
133 ETestWappGprsBearer |
|
134 }; |
|
135 |
|
136 public: |
|
137 ~CTestWapp(); |
|
138 CTestWapp(RFs& aFs); |
|
139 static CTestWapp* NewL(RFs& aFs); |
|
140 void ConstructL(); |
|
141 void StartL(); |
|
142 void RunL(); |
|
143 TInt RunError(TInt aError); |
|
144 void DoCancel(); |
|
145 void RequestComplete(TRequestStatus& aStatus,TInt aCompletion); |
|
146 |
|
147 private: |
|
148 void RunAutoTest(); |
|
149 void ShowMenuL(); |
|
150 void CreateParserL(); |
|
151 void QueueOperationAsync(TInt aErr); // Queues the parser on the AO list |
|
152 void InitialiseTesterL(); // Initialises test harness. |
|
153 void DoRunL(); |
|
154 void CreateFilenameArrayL(); // Creates an array with names of test files |
|
155 void GenerateNextMessageL(); // Creates a dummy BIO message |
|
156 void UnloadParser(); |
|
157 void ExtractBodyPartsL(); |
|
158 void ParseMessageL(); |
|
159 void ProcessMessageL(); |
|
160 void ProcessUnparsedMessageL(); |
|
161 void RecordEntryDataL(); |
|
162 void LogParsedDataL(); |
|
163 void SetEntryNameL(); |
|
164 |
|
165 void DisplayTestSummaryL(); |
|
166 void DisplayBookmarksL(); |
|
167 CMDBRecordSetBase* GetGenericPointerL(TMDBElementId aRecordElementId); //Returns a RecordSetBase |
|
168 // Based on the supplied element id |
|
169 void DisplayCommDatTablesL(); |
|
170 TInt DisplayCommDatWapApTableL(CMDBRecordSetBase& aGenericRecBase); |
|
171 TInt DisplayCommDatWapIpTableL(CMDBRecordSetBase& aGenericRecBase, TDesC& aEntryName, TUint32 aIapId); |
|
172 TInt DisplayCommDatWapSmsTableL(CMDBRecordSetBase& aGenericRecBase); |
|
173 TInt DisplayCommDatDialOutISPTableL(CMDBRecordSetBase& aGenericRecBase, TDesC& aEntryName); |
|
174 TInt DisplayCommDatIAPTableL(CMDBRecordSetBase& aGenericRecBase, TDesC& aEntryName, TTestWappBearerType aBearerType); |
|
175 //void DisplayCommDatModemTableL(CCDModemBearerRecord& aModemBearerRecord, TInt aRecCount); |
|
176 TInt DisplayCommDatGprsTableL(CMDBRecordSetBase& aGenericRecBase, TDesC& aEntryName); |
|
177 void DisplayErrorReasonL(TInt& aReason); |
|
178 void DisplayMMSURLL(); |
|
179 |
|
180 TBool IsLineTermination(TChar aChar); |
|
181 void OutputTextListL( const TDesC& aFieldName, const TDesC& aValueName); |
|
182 void OutputTextListL( const TDesC& aFieldName, TUint aValue); |
|
183 void OutputFormattedTextL(TRefByValue<const TDesC> aFmt,...); |
|
184 void PrintDescriptor(const TDesC& aBuffer); |
|
185 |
|
186 void DeleteCommDbTableL(); //trashes all entries in the WAP, Dial In/Out ISP, IAP tables |
|
187 |
|
188 |
|
189 private: |
|
190 RFs& iFs; // Our file server session |
|
191 TInt iState; // Holds the current state of the test harness. |
|
192 CMsvEntrySelection* iMsvSelection; // TMsvIds of our messages. |
|
193 TMsvId iEntryId; // ID of sms entry. |
|
194 |
|
195 TInt iParsedFieldsNum; |
|
196 TInt iTestSuccesses; |
|
197 TInt iTestFailures; |
|
198 TInt iTestCounter; |
|
199 TInt iMessagesCreated; |
|
200 TInt iFilesProcessed; |
|
201 TTestMode iTestMode; // Holds logging mode |
|
202 |
|
203 CBaseScriptParser2* iWappParser; |
|
204 |
|
205 HBufC* iMessageBody; |
|
206 CBioTestUtils* iBioTestUtils; // Makes messages, etc. |
|
207 TInt iNumWapEntries; //No of entries in WAP table |
|
208 HBufC* iCurrentSettingsName; // Name of the current settings |
|
209 TUint32 iCurrentIspID; |
|
210 TUint32 iCurrentIapID; |
|
211 TUint32 iWAPModemID; |
|
212 TUint32 iWapAccessPointID; //ID of WAP_ACCESS_POINT entry |
|
213 |
|
214 CCommsDatabase* iTestCommDb; |
|
215 TUint32 iGsmCsdIapId; |
|
216 TUint32 iGprsIapId; |
|
217 }; |
|
218 |
|
219 |
|
220 #endif |
|
221 |
|
222 #endif // __TESTWAPP_H__ |