|
1 /* |
|
2 * Copyright (c) 1999-2005 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _TESTWAPP_H_ |
|
20 #define _TESTWAPP_H_ |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <e32test.h> |
|
24 #include <c32comm.h> |
|
25 #include <in_sock.h> |
|
26 |
|
27 extern RTest Test; |
|
28 extern RSocketServ SocketServer; |
|
29 extern RHeap* TestHeap; |
|
30 |
|
31 #define BIO_MSG_ENTRY_PARSED 1 // Set entry .iMtmData3 to 1 to indicate that the entry has store i.e parsed,externalised |
|
32 |
|
33 _LIT(KBIOWAPPrefix, "WAP*"); // prefix for WAP message |
|
34 const TPtrC KWappTestTxtFileDir = _L("c:\\test\\bio\\wapp\\"); //dir for source files |
|
35 #define MSV_INDEX_FILE _L("c:\\system\\Mail\\index") // Index for mail messages. |
|
36 #define KSmsFileName _L("c:\\Mailtest\\Wapptest\\Wapp.txt") |
|
37 const TPtrC KWappLogFile = _L("C:\\Logs\\Bio\\Wap.log"); // file for test logging |
|
38 const TPtrC KFileName = _L("Wap.dat"); |
|
39 const TPtrC KAttachmentName = _L("Wappbmp.cng"); |
|
40 |
|
41 |
|
42 |
|
43 #define KTestWappPriority (EPriorityStandard) //Change this.... |
|
44 |
|
45 // Support for printing message details to the test console: |
|
46 #define _TEST_PRINTING_ // Uncomment this to enable printing. |
|
47 // Support for logging details of messages and tests: |
|
48 #define _TEST_LOGGING_ // Uncomment this to enable logging. |
|
49 |
|
50 // Panic errors: |
|
51 const TInt KWappNullPtr = (111); |
|
52 const TInt KBioMsgNotParsed = (222); |
|
53 const TInt KBioMsgEntryHasNoStore = (333); |
|
54 const TInt KBioMsgNotProcessed = (444); |
|
55 |
|
56 //const TUid KUidMsvMessageDriveStream = {0x1000163E}; |
|
57 const TUid KUIDMsvBIODataStream = {0x10005268}; |
|
58 |
|
59 const TPtrC KWappToken = _L("WAP Access Point"); // A script header. |
|
60 const TPtrC KWappParserName = _L("WAP Access Point Parser"); // A human readable name. |
|
61 const TVersion KVer1(0,0,1); // A version number. |
|
62 |
|
63 |
|
64 // Forward references: |
|
65 class CExampleScheduler; |
|
66 LOCAL_C void DisplayErrorReason(TInt& aReason); |
|
67 |
|
68 ////////////////////////// |
|
69 // Global declarations: // |
|
70 ////////////////////////// |
|
71 LOCAL_D CExampleScheduler* exampleScheduler; |
|
72 LOCAL_D RTest test(_L("WAPP Test Harness")); |
|
73 LOCAL_D RFs gFs; |
|
74 |
|
75 // Logging support |
|
76 LOCAL_D CMsvBIOTestPrinter* myPrinter; |
|
77 |
|
78 // Logging support |
|
79 LOCAL_D CMsvBIOTestLogger* myLogger; |
|
80 |
|
81 void CommInitL(TBool aEnhanced); |
|
82 |
|
83 |
|
84 //////////////////////// |
|
85 // Class definitions: // |
|
86 //////////////////////// |
|
87 |
|
88 /////////////////////////////// |
|
89 // CExampleScheduler: INTERFACE // |
|
90 /////////////////////////////// |
|
91 class CExampleScheduler : public CActiveScheduler |
|
92 { |
|
93 public: |
|
94 void Error(TInt anError) const; |
|
95 }; |
|
96 |
|
97 |
|
98 /////////////////////////// |
|
99 // CTestTimer: INTERFACE // |
|
100 /////////////////////////// |
|
101 class CTestTimer : public CTimer |
|
102 { |
|
103 public: |
|
104 static CTestTimer* NewL(); |
|
105 private: |
|
106 CTestTimer(); |
|
107 void RunL(); |
|
108 }; |
|
109 |
|
110 ////////////////////////////////////// |
|
111 // CDummySessionObserver: INTERFACE // |
|
112 ////////////////////////////////////// |
|
113 // Does nothing at all but is required for the CMsvSession constructor. |
|
114 class CDummySessionObserver : public MMsvSessionObserver |
|
115 { |
|
116 void HandleSessionEventL(TMsvSessionEvent aEvent, |
|
117 TAny* arg1, TAny* arg2, TAny* arg3); |
|
118 }; |
|
119 |
|
120 |
|
121 ////////////////////////// |
|
122 // CTestWapp: INTERFACE // |
|
123 ////////////////////////// |
|
124 |
|
125 class CTestWapp : public CActive |
|
126 { |
|
127 public: |
|
128 ~CTestWapp(); |
|
129 CTestWapp(); |
|
130 CTestWapp(CMsvServerEntry* aEntry, CMsvBIOTestLogger* aLogger, |
|
131 CMsvBIOTestPrinter* aPrinter); |
|
132 static CTestWapp* NewL(CMsvServerEntry* aEntry, CMsvBIOTestLogger* aLogger=NULL, |
|
133 CMsvBIOTestPrinter* aPrinter=NULL); |
|
134 void ConstructL(); |
|
135 void StartL(TInt aCmd); |
|
136 void RunL(); |
|
137 void DoCancel(); |
|
138 void RequestComplete(TRequestStatus& aStatus,TInt aCompletion); |
|
139 |
|
140 enum TSessionState |
|
141 { |
|
142 EReadingFiles, |
|
143 ECreateNewMessage, |
|
144 ECreateParser, |
|
145 EParse, |
|
146 EProcess, |
|
147 EDisplay, // Display entry data. |
|
148 EFinish |
|
149 }; |
|
150 |
|
151 private: |
|
152 CBaseScriptParser* CreateParserL(); |
|
153 void QueueOperationAsync(TInt aErr); |
|
154 void CreateFilenameArrayL(); |
|
155 void GenerateNextMessageL(); |
|
156 void UnloadParserL(); |
|
157 void InitialiseParserL(); |
|
158 void ExtractBodyPartsL(); |
|
159 void MakeMessage(); |
|
160 void ParseMessageTextL(); |
|
161 void ProcessMessageL(); |
|
162 void DisplayEntryDataL(); |
|
163 void DisplayStoreL(); |
|
164 void InternalizeL(RMsvReadStream& aReadStream); |
|
165 void ReLoadParsedDataL(CMsvStore& aStore); |
|
166 void DisplayParsedFieldsL(CMsvStore& aStore); |
|
167 void DisplayBookmarksL(); |
|
168 void DisplayLogDescriptorL(const TDesC& aBuffer); |
|
169 void AppendDescriptorL(TDes& aWriteString, const TDesC& aReadString); |
|
170 |
|
171 |
|
172 TInt GetWAPEntryTotalL(); //returns the current number of entries in the WAP table |
|
173 |
|
174 private: |
|
175 TInt iState; // Holds the current state of the test harness. |
|
176 CMsvServerEntry* iEntry; // N.B. don't own this! |
|
177 TMsvId iEntryId; // ID of sms entry. |
|
178 |
|
179 CDir* iDir; // Holds the names of the files to process. |
|
180 TInt iNumFiles; |
|
181 TInt iMessagesCreated; |
|
182 TInt iFilesProcessed; |
|
183 CRegisteredParserDll* iRegisteredParserDll; |
|
184 CBaseScriptParser* iParser; |
|
185 CMsvBIOTestLogger* iLogger; // N.B. don't own this |
|
186 CMsvBIOTestPrinter* iPrinter; // or this! |
|
187 |
|
188 HBufC* iMessageBody; |
|
189 CBIOServerSideTestUtils* iMessageMaker; |
|
190 |
|
191 CBIODatabase* iBioDatabase; |
|
192 TInt iNumWapEntries; //Number of entries in the WAP table |
|
193 HBufC* iCurrentSettingsName; // Name of the current settings obtained from characteristic in message |
|
194 TUint32 iCurrentIspID; |
|
195 TUint32 iCurrentIapID; |
|
196 TInt32 iWapModemID; |
|
197 CArrayPtrSeg<CParsedField>* iParsedFieldArray; |
|
198 }; |
|
199 |
|
200 |
|
201 #endif |
|
202 |