|
1 // Copyright (c) 1997-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 // WAP prot test suite server |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 |
|
22 // Include your own server header file and step header file(s) here |
|
23 #include "WapProtSuiteServer.h" |
|
24 #include "WapIoctlSteps.h" |
|
25 #include "WapStatusReports.h" |
|
26 |
|
27 |
|
28 CWapProtSuite* CWapProtSuite::NewL() |
|
29 /** |
|
30 * @return - Instance of the test server |
|
31 * Same code for Secure and non-secure variants |
|
32 * Called inside the MainL() function to create and start the |
|
33 * CTestServer derived server. |
|
34 */ |
|
35 { |
|
36 CWapProtSuite * server = new (ELeave) CWapProtSuite(); |
|
37 CleanupStack::PushL(server); |
|
38 // CServer base class call |
|
39 |
|
40 RProcess handle = RProcess(); |
|
41 TParsePtrC serverName(handle.FileName()); |
|
42 server->ConstructL(serverName.Name()); |
|
43 |
|
44 CleanupStack::Pop(server); |
|
45 return server; |
|
46 } |
|
47 |
|
48 |
|
49 LOCAL_C void MainL() |
|
50 { |
|
51 CActiveScheduler* sched=NULL; |
|
52 sched=new(ELeave) CActiveScheduler; |
|
53 CActiveScheduler::Install(sched); |
|
54 CWapProtSuite* server = NULL; |
|
55 // Create the CTestServer derived server |
|
56 TRAPD(err,server = CWapProtSuite::NewL()); |
|
57 if(!err) |
|
58 { |
|
59 // sync with the client and enter the active scheduler |
|
60 RProcess::Rendezvous(KErrNone); |
|
61 sched->Start(); |
|
62 } |
|
63 delete server; |
|
64 delete sched; |
|
65 } |
|
66 |
|
67 |
|
68 |
|
69 GLDEF_C TInt E32Main() |
|
70 /** |
|
71 * @return - Standard Epoc error code on process exit |
|
72 * Secure variant only |
|
73 * Process entry point. Called by client using RProcess API |
|
74 */ |
|
75 { |
|
76 __UHEAP_MARK; |
|
77 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
78 if(cleanup == NULL) |
|
79 { |
|
80 return KErrNoMemory; |
|
81 } |
|
82 TRAPD(err,MainL()); |
|
83 delete cleanup; |
|
84 __UHEAP_MARKEND; |
|
85 |
|
86 return err; |
|
87 } |
|
88 |
|
89 CTestStep* CWapProtSuite::CreateTestStep(const TDesC& aStepName) |
|
90 /** |
|
91 * @return - A CTestStep derived instance |
|
92 * Secure and non-secure variants |
|
93 * Implementation of CTestServer pure virtual |
|
94 */ |
|
95 { |
|
96 CTestStep* testStep = NULL; |
|
97 |
|
98 // |
|
99 // Here the test step is created when it is needed. Note that this |
|
100 // function is non-leaving so we cannot use new(ELeave). Therefore |
|
101 // the new could return NULL, but that is not a problem as it implies |
|
102 // the test step is missing and this will be marked in the log file. |
|
103 // |
|
104 |
|
105 //************************************* |
|
106 // IOCTL tests |
|
107 //************************************* |
|
108 |
|
109 // IOCTL steps [1 - XYZ] |
|
110 if (aStepName == _L("IoctlStep_1")) |
|
111 { |
|
112 testStep = new CIoctlStep_1(); |
|
113 } |
|
114 else if (aStepName == _L("IoctlStep_2")) |
|
115 { |
|
116 testStep = new CIoctlStep_2(); |
|
117 } |
|
118 else if (aStepName == _L("IoctlStep_3")) |
|
119 { |
|
120 testStep = new CIoctlStep_3(); |
|
121 } |
|
122 else if (aStepName == _L("IoctlStep_4")) |
|
123 { |
|
124 testStep = new CIoctlStep_4(); |
|
125 } |
|
126 else if (aStepName == _L("IoctlStep_5")) |
|
127 { |
|
128 testStep = new CIoctlStep_5(); |
|
129 } |
|
130 else if (aStepName == _L("IoctlStep_6")) |
|
131 { |
|
132 testStep = new CIoctlStep_6(); |
|
133 } |
|
134 else if (aStepName == _L("IoctlStep_7")) |
|
135 { |
|
136 testStep = new CIoctlStep_7(); |
|
137 } |
|
138 else if (aStepName == _L("IoctlStep_8")) |
|
139 { |
|
140 testStep = new CIoctlStep_8(); |
|
141 } |
|
142 else if (aStepName == _L("IoctlStep_9")) |
|
143 { |
|
144 testStep = new CIoctlStep_9(); |
|
145 } |
|
146 else if (aStepName == _L("IoctlStep_10")) |
|
147 { |
|
148 testStep = new CIoctlStep_10(); |
|
149 } |
|
150 else if (aStepName == _L("IoctlStep_11")) |
|
151 { |
|
152 testStep = new CIoctlStep_11(); |
|
153 } |
|
154 else if (aStepName == _L("IoctlStep_12")) |
|
155 { |
|
156 testStep = new CIoctlStep_12(); |
|
157 } |
|
158 else if (aStepName == _L("IoctlStep_13")) |
|
159 { |
|
160 testStep = new CIoctlStep_13(); |
|
161 } |
|
162 else if (aStepName == _L("IoctlStep_14")) |
|
163 { |
|
164 testStep = new CIoctlStep_14(); |
|
165 } |
|
166 else if (aStepName == _L("IoctlStep_15")) |
|
167 { |
|
168 testStep = new CIoctlStep_15(); |
|
169 } |
|
170 else if (aStepName == _L("BackupRestoreStep")) |
|
171 { |
|
172 testStep = new CBackupRestoreStep(); |
|
173 } |
|
174 else if (aStepName == _L("IoctlStep_17")) |
|
175 { |
|
176 testStep = new CIoctlStep_17(); |
|
177 } |
|
178 else if (aStepName == _L("IoctlStep_18")) |
|
179 { |
|
180 testStep = new CIoctlStep_18(); |
|
181 } |
|
182 else if (aStepName == _L("IoctlStep_19")) |
|
183 { |
|
184 testStep = new CIoctlStep_19(); |
|
185 } |
|
186 else if (aStepName == _L("IoctlStep_20")) |
|
187 { |
|
188 testStep = new CIoctlStep_20(); |
|
189 } |
|
190 else if (aStepName == _L("IoctlStep_21")) |
|
191 { |
|
192 testStep = new CIoctlStep_21(); |
|
193 } |
|
194 else if (aStepName == _L("IoctlStep_22")) |
|
195 { |
|
196 testStep = new CIoctlStep_22(); |
|
197 } |
|
198 else if (aStepName == _L("IoctlStep_23")) |
|
199 { |
|
200 testStep = new CIoctlStep_23(); |
|
201 } |
|
202 else if (aStepName == _L("IoctlStep_24")) |
|
203 { |
|
204 testStep = new CIoctlStep_24(); |
|
205 } |
|
206 else if (aStepName == _L("IoctlStep_25")) |
|
207 { |
|
208 testStep = new CIoctlStep_25(); |
|
209 } |
|
210 else if (aStepName == _L("IoctlStep_26")) |
|
211 { |
|
212 testStep = new CIoctlStep_26(); |
|
213 } |
|
214 else if (aStepName == _L("IoctlStep_27")) |
|
215 { |
|
216 testStep = new CIoctlStep_27(); |
|
217 } |
|
218 else if (aStepName == _L("IoctlStep_28")) |
|
219 { |
|
220 testStep = new CIoctlStep_28(); |
|
221 } |
|
222 //Status report tests |
|
223 else if (aStepName == _L("TestRequestingStatusReports")) |
|
224 { |
|
225 testStep = new CTestRequestingStatusReports(); |
|
226 } |
|
227 else if(aStepName == _L("TestRequestingStatusReportsWithOption")) |
|
228 { |
|
229 testStep = new CTestRequestingStatusReportsWithOption(); |
|
230 } |
|
231 else if (aStepName == _L("TestReceivingStatusReports")) |
|
232 { |
|
233 testStep = new CTestReceivingStatusReports(); |
|
234 } |
|
235 else if (aStepName == _L("TestReceivingStatusReportsSevenBitMultiplePDUs")) |
|
236 { |
|
237 testStep = new CTestReceivingStatusReportsSevenBitMultiplePDUs(); |
|
238 } |
|
239 else if (aStepName == _L("TestReceivingStatusReportsWithOption")) |
|
240 { |
|
241 testStep = new CTestReceivingStatusReportsWithOption(); |
|
242 } |
|
243 else if (aStepName == _L("SetDiskMonitorLimits")) |
|
244 { |
|
245 testStep = new CSetDiskMonitorLimits(); |
|
246 } |
|
247 else if (aStepName == _L("SetDiskSpace")) |
|
248 { |
|
249 testStep = new CSetDiskSpace(); |
|
250 } |
|
251 else if (aStepName == _L("FreeDiskSpace")) |
|
252 { |
|
253 testStep = new CFreeDiskSpace(); |
|
254 } |
|
255 else if (aStepName == _L("ReceiveWapMessage")) |
|
256 { |
|
257 testStep = new CReceiveWapMessage(); |
|
258 } |
|
259 else if (aStepName == _L("InitializePhone")) |
|
260 { |
|
261 testStep = new CInitializePhone(); |
|
262 } |
|
263 else if (aStepName == _L("TestEnumeratingVCard")) |
|
264 { |
|
265 testStep = new CTestEnumeratingVCard(); |
|
266 } |
|
267 else if (aStepName == _L("Test7BitBusinessCardWithEmail")) |
|
268 { |
|
269 testStep = new CTest7BitBusinessCardWithEmail(); |
|
270 } |
|
271 else if (aStepName == _L("TestOversizedDatagram")) |
|
272 { |
|
273 testStep = new CTestOversizedDatagram(); |
|
274 } |
|
275 else if (aStepName == _L("TestWapDatagramSegmentContainingNoData")) |
|
276 { |
|
277 testStep = new CTestWapDatagramSegmentContainingNoData(); |
|
278 } |
|
279 |
|
280 // |
|
281 // Set the test step name here to save code!!! |
|
282 // |
|
283 if (testStep != NULL) |
|
284 { |
|
285 testStep->SetTestStepName(aStepName); |
|
286 } |
|
287 |
|
288 return testStep; |
|
289 } |