|
1 // |
|
2 // * Copyright 2004 Neusoft America Inc. |
|
3 // * All rights reserved. |
|
4 // * This component and the accompanying materials are made available |
|
5 // * under the terms of the 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 // * Contributors: |
|
10 // * Keith Collins (Neusoft America Inc.) original software development and additional code and modifications. |
|
11 // * Thomas Gahagen (Neusoft America Inc.) additional code and modifications. |
|
12 // * Zhen Yuan (Neusoft America Inc.) additional code and modifications. |
|
13 // * |
|
14 // * Description: This contains the Unit Tests dealing with CSY 0710 related |
|
15 // * functionality as documented in the project's Unit Test Spec. |
|
16 // * |
|
17 // * The tests may be run either interactively or automatically. |
|
18 // * |
|
19 // * The tests are dependant on a predictable response from |
|
20 // * the BP side according to the test spec. |
|
21 // * |
|
22 // * The automated tests achieve this predictable response by |
|
23 // * using the Tester component. |
|
24 // |
|
25 |
|
26 // Csy0710UnitTest.cpp |
|
27 |
|
28 /** @file Csy0710UnitTest.cpp |
|
29 * |
|
30 */ |
|
31 |
|
32 #include "Csy27010UnitTest.h" |
|
33 #include <exterror.h> |
|
34 |
|
35 |
|
36 _LIT8(KATCommand1, "AT+CGMM\r"); |
|
37 _LIT8(KATCommand2, "AT+CGMM\r"); |
|
38 _LIT8(KATCommand3, "AT+CMUX?\r"); |
|
39 _LIT8(KATCommand4, "AT\r"); |
|
40 _LIT8(KATCommand5, "AT+CGMI\r"); |
|
41 _LIT8(KATCommand6, "AT+CGSN\r"); |
|
42 _LIT8(KATCommand7, "AT+CGMR\r"); |
|
43 _LIT8(KATCommand8, "AT+CBC\r"); |
|
44 _LIT8(KATCommand9, "AT+CSQ\r"); |
|
45 _LIT8(KATCommand10, "ATS7?\r"); |
|
46 _LIT8(KATCommand11, "ATS0=5\r"); |
|
47 _LIT8(KATCommand12, "AT+FCLASS=2.0\r"); |
|
48 _LIT8(KATCommand13, "AT+CRC=?\r"); |
|
49 |
|
50 //_LIT8(KATCommandToCancel, "ABCDEFGHIJKLMNOPQRSTUVWXYZ\r"); |
|
51 _LIT8(KATCommandToCancel, "AT\r"); |
|
52 |
|
53 //----------------------------------------------------------------------------- |
|
54 // Helper routines |
|
55 //----------------------------------------------------------------------------- |
|
56 // |
|
57 |
|
58 TBool CCsy0710UnitTest::HasTestRangesDefined() |
|
59 { |
|
60 return ETrue; |
|
61 } |
|
62 |
|
63 |
|
64 //----------------------------------------------------------------------------- |
|
65 //----------------------------------------------------------------------------- |
|
66 |
|
67 |
|
68 //----------------------------------------------------------------------------- |
|
69 //----------------------------------------------------------------------------- |
|
70 CCsy0710UnitTest* CCsy0710UnitTest::NewL(const TDesC& aUnitTestName, |
|
71 const TDesC& aLogFileName, |
|
72 const TDesC& aTestSpecName, |
|
73 const TDesC& aTestScriptName) |
|
74 { |
|
75 CCsy0710UnitTest* self = new(ELeave) CCsy0710UnitTest(aUnitTestName, |
|
76 aLogFileName, aTestSpecName, aTestScriptName); |
|
77 CleanupStack::PushL(self); |
|
78 self->ConstructL(); |
|
79 CleanupStack::Pop(); |
|
80 return self; |
|
81 } |
|
82 |
|
83 CCsy0710UnitTest::~CCsy0710UnitTest() |
|
84 { |
|
85 } |
|
86 |
|
87 |
|
88 CCsy0710UnitTest::CCsy0710UnitTest(const TDesC& aUnitTestName, |
|
89 const TDesC& aLogFileName, |
|
90 const TDesC& aTestSpecName, |
|
91 const TDesC& aTestScriptName) |
|
92 : CUnitTestBase(aUnitTestName, aLogFileName, aTestSpecName, aTestScriptName) |
|
93 {} |
|
94 |
|
95 |
|
96 void CCsy0710UnitTest::ConstructL() |
|
97 { |
|
98 CUnitTestBase::ConstructL(); |
|
99 |
|
100 iCmdPortName[0].Copy(_L("gsm0710::1")); |
|
101 iCmdPortName[1].Copy(_L("gsm0710::2")); |
|
102 iCmdPortName[2].Copy(_L("gsm0710::3")); |
|
103 iCmdPortName[3].Copy(_L("gsm0710::4")); |
|
104 iDataPort1Name.Copy(_L("gsm0710::101")); |
|
105 } |
|
106 |
|
107 void CCsy0710UnitTest::PrintTestSpecIdentifiers() |
|
108 { |
|
109 iTest.Printf(_L("\nCSY 0710 Unit Test\n\n")); |
|
110 iTest.Printf(_L("1: CSY A tests\n")); |
|
111 iTest.Printf(_L("2: CSY B tests\n")); |
|
112 iTest.Printf(_L("3: CSY C tests\n")); |
|
113 iTest.Printf(_L("4: CSY D tests\n")); |
|
114 iTest.Printf(_L("5: CSY E tests\n")); |
|
115 iTest.Printf(_L("6: CSY F tests\n")); |
|
116 iTest.Printf(_L("7: CSY G tests\n")); |
|
117 iTest.Printf(_L("8: CSY H tests\n")); |
|
118 } |
|
119 |
|
120 |
|
121 void CCsy0710UnitTest::PrintTestDetails(TInt /*aTstSpecNumber*/) |
|
122 { |
|
123 // This version prints no helpful info on the screen. Overload this in |
|
124 // your own test class to put out test details for the test spec idenifier |
|
125 // selected |
|
126 } |
|
127 |
|
128 |
|
129 void CCsy0710UnitTest::RunTestsL(TBool aEndInd,TTestMode aTestMode, |
|
130 TInt& aErrCode, TInt& aLeaveCode, |
|
131 TInt aApiNumber, TInt aTestNumber) |
|
132 { |
|
133 switch (aApiNumber) |
|
134 { |
|
135 case 0: |
|
136 aLeaveCode = KErrNone; |
|
137 aErrCode = 8; // 8 more tests |
|
138 break; |
|
139 case 1: |
|
140 TRAP(aLeaveCode,aErrCode = CsyAL(aTestNumber)); |
|
141 break; |
|
142 case 2: |
|
143 TRAP(aLeaveCode,aErrCode = CsyBL(aTestNumber)); |
|
144 break; |
|
145 case 3: |
|
146 TRAP(aLeaveCode,aErrCode = CsyCL(aTestNumber)); |
|
147 break; |
|
148 case 4: |
|
149 TRAP(aLeaveCode,aErrCode = CsyDL(aTestNumber)); |
|
150 break; |
|
151 case 5: |
|
152 TRAP(aLeaveCode,aErrCode = CsyEL(aTestNumber)); |
|
153 break; |
|
154 case 6: |
|
155 TRAP(aLeaveCode,aErrCode = CsyFL(aTestNumber)); |
|
156 break; |
|
157 case 7: |
|
158 TRAP(aLeaveCode,aErrCode = CsyGL(aTestNumber)); |
|
159 break; |
|
160 case 8: |
|
161 TRAP(aLeaveCode,aErrCode = CsyHL(aTestNumber)); |
|
162 break; |
|
163 default: |
|
164 ActionNoMatch(aEndInd,aTestMode,aApiNumber, aTestNumber); |
|
165 } |
|
166 |
|
167 //CloseAllResources(); |
|
168 } |
|
169 //----------------------------------------------------------------------------- |
|
170 //----------------------------------------------------------------------------- |
|
171 |
|
172 |
|
173 TInt CCsy0710UnitTest::CsyAL(TInt aTstNum) |
|
174 /** |
|
175 * CSY Information Tests |
|
176 * @param aTstNum test number |
|
177 * @return KErrNone or error code |
|
178 */ |
|
179 { |
|
180 if (aTstNum != 0) |
|
181 iTest.Printf(_L("CSYA-%d\n"), aTstNum); |
|
182 |
|
183 TInt ret = KErrNone; |
|
184 |
|
185 SetTsIdentifier(_L("CSYA")); |
|
186 SetMethodName(_L("CSYA")); |
|
187 |
|
188 switch (aTstNum) |
|
189 { |
|
190 case 0: // Return how may auto tests are present |
|
191 return (4); |
|
192 break; |
|
193 |
|
194 case 1: // Start C32 |
|
195 iTest.Printf(_L("Start C32...\n")); |
|
196 SetFunIndex(1); |
|
197 TEST(LoadSerialDeviceDrivers()); |
|
198 ret = StartC32(); |
|
199 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
200 TEST(ret); |
|
201 iTest.Printf(_L("Test 1-1 Passed\n")); |
|
202 return (KErrNone); |
|
203 break; |
|
204 |
|
205 case 2: // Load and Unload CSY multiple times |
|
206 iTest.Printf(_L("Basic check on something else..\n")); |
|
207 SetFunIndex(1); |
|
208 TEST(LoadSerialDeviceDrivers()); |
|
209 ret = StartC32(); |
|
210 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
211 TEST(ret); |
|
212 |
|
213 TEST(iCommServer.Connect()); |
|
214 ret = iCommServer.LoadCommModule(KCsyName); |
|
215 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
216 |
|
217 ret = iCommServer.LoadCommModule(KCsyName); |
|
218 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
219 |
|
220 ret = iCommServer.LoadCommModule(KCsyName); |
|
221 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
222 iCommServer.Close(); |
|
223 iTest.Printf(_L("Test 1-2 Passed\n")); |
|
224 return (KErrNone); |
|
225 break; |
|
226 |
|
227 case 3: // Open Multiple Sessions to C32 |
|
228 iTest.Printf(_L("Open Multiple Sessions to C32...\n")); |
|
229 SetFunIndex(1); |
|
230 TEST(LoadSerialDeviceDrivers()); |
|
231 ret = StartC32(); |
|
232 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
233 TEST(ret); |
|
234 |
|
235 TEST(iCommServer.Connect()); |
|
236 ret = iCommServer.LoadCommModule(KCsyName); |
|
237 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
238 |
|
239 TEST(OpenAllCommPorts()); |
|
240 User::After(5000000); |
|
241 CloseAllCommPorts(); |
|
242 iCommServer.UnloadCommModule(KCsyName); |
|
243 iCommServer.Close(); |
|
244 User::After(3000000); |
|
245 iTest.Printf(_L("Test 1-3 Passed\n")); |
|
246 return (KErrNone); |
|
247 break; |
|
248 |
|
249 case 4: // Check that the phone supports the expected extensions |
|
250 iTest.Printf(_L("Get CSY Info...\n")); |
|
251 SetFunIndex(1); |
|
252 TEST(LoadSerialDeviceDrivers()); |
|
253 ret = StartC32(); |
|
254 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
255 TEST(ret); |
|
256 |
|
257 TEST(iCommServer.Connect()); |
|
258 ret = iCommServer.LoadCommModule(KCsyName); |
|
259 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
260 |
|
261 TEST(GetCsyInfo()); |
|
262 iCommServer.UnloadCommModule(KCsyName); |
|
263 iCommServer.Close(); |
|
264 User::After(5000000); |
|
265 return KErrNone; |
|
266 break; |
|
267 |
|
268 // Manual Tests Follow... |
|
269 case 100: // Return how many manual tests are present |
|
270 { |
|
271 return 0; |
|
272 } |
|
273 break; |
|
274 |
|
275 default: |
|
276 iTest.Printf(_L("** Not implemented CSYA-%d **\n"), aTstNum); |
|
277 break; |
|
278 } |
|
279 |
|
280 return ret; |
|
281 } |
|
282 |
|
283 |
|
284 TInt CCsy0710UnitTest::CsyBL(TInt aTstNum) |
|
285 /** |
|
286 * CSY Open and Close Logical Ports Tests |
|
287 * @param aTstNum test number |
|
288 * @return void |
|
289 */ |
|
290 { |
|
291 if (aTstNum != 0) |
|
292 iTest.Printf(_L("CSYB-%d\n"), aTstNum); |
|
293 |
|
294 TInt ret = KErrNone; |
|
295 |
|
296 SetTsIdentifier(_L("CSYB")); |
|
297 SetMethodName(_L("CSYB")); |
|
298 |
|
299 switch (aTstNum) |
|
300 { |
|
301 case 0: // Return how may auto tests are present |
|
302 return (6); |
|
303 break; |
|
304 |
|
305 case 1: // open & close subsessions |
|
306 iTest.Printf(_L("Open & Close Subsessions...\n")); |
|
307 SetFunIndex(1); |
|
308 |
|
309 // common test code |
|
310 TEST(LoadSerialDeviceDrivers()); |
|
311 ret = StartC32(); |
|
312 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
313 TEST(ret); |
|
314 |
|
315 TEST(iCommServer.Connect()); |
|
316 ret = iCommServer.LoadCommModule(KCsyName); |
|
317 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
318 |
|
319 // specific test code |
|
320 TEST(OpenAllCommPorts()); |
|
321 CloseAllCommPorts(); |
|
322 iCommServer.UnloadCommModule(KCsyName); |
|
323 iCommServer.Close(); |
|
324 iTest.Printf(_L("Test 2-1 Passed\n")); |
|
325 User::After(3000000); |
|
326 return KErrNone; |
|
327 break; |
|
328 |
|
329 case 2: // check failure to open comm port |
|
330 iTest.Printf(_L("Check failure to open comm port...\n")); |
|
331 SetFunIndex(1); |
|
332 |
|
333 // common test code |
|
334 TEST(LoadSerialDeviceDrivers()); |
|
335 ret = StartC32(); |
|
336 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
337 TEST(ret); |
|
338 TEST(iCommServer.Connect()); |
|
339 ret = iCommServer.LoadCommModule(KCsyName); |
|
340 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
341 |
|
342 // specific test code |
|
343 TEST(OpenCommPortFail()); |
|
344 iCommServer.UnloadCommModule(KCsyName); |
|
345 iCommServer.Close(); |
|
346 iTest.Printf(_L("Test 2-2 Passed\n")); |
|
347 User::After(3000000); |
|
348 return KErrNone; |
|
349 break; |
|
350 |
|
351 case 3: // open many ports |
|
352 iTest.Printf(_L("Open many RComm ports...\n")); |
|
353 SetFunIndex(1); |
|
354 |
|
355 // common test code |
|
356 TEST(LoadSerialDeviceDrivers()); |
|
357 ret = StartC32(); |
|
358 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
359 TEST(ret); |
|
360 TEST(iCommServer.Connect()); |
|
361 ret = iCommServer.LoadCommModule(KCsyName); |
|
362 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
363 |
|
364 // specific test code |
|
365 TEST(OpenAllCommPorts()); |
|
366 User::After(5000000); |
|
367 CloseAllCommPorts(); |
|
368 iCommServer.UnloadCommModule(KCsyName); |
|
369 iCommServer.Close(); |
|
370 iTest.Printf(_L("Test 2-3 Passed\n")); |
|
371 User::After(3000000); |
|
372 return (KErrNone); |
|
373 break; |
|
374 |
|
375 case 4: // check ability to open same port twice |
|
376 iTest.Printf(_L("Check ability to open RComm port twice...\n")); |
|
377 SetFunIndex(1); |
|
378 |
|
379 // common test code |
|
380 TEST(LoadSerialDeviceDrivers()); |
|
381 ret = StartC32(); |
|
382 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
383 TEST(ret); |
|
384 TEST(iCommServer.Connect()); |
|
385 ret = iCommServer.LoadCommModule(KCsyName); |
|
386 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
387 |
|
388 // specific test code |
|
389 TEST(OpenCmdPortTwice()); |
|
390 iCommServer.UnloadCommModule(KCsyName); |
|
391 iCommServer.Close(); |
|
392 iTest.Printf(_L("Test 2-4 Passed\n")); |
|
393 User::After(3000000); |
|
394 return (KErrNone); |
|
395 break; |
|
396 |
|
397 case 5: // open many subsessions at same time |
|
398 iTest.Printf(_L("Open many RComm ports at same time...\n")); |
|
399 SetFunIndex(1); |
|
400 |
|
401 // common test code |
|
402 TEST(LoadSerialDeviceDrivers()); |
|
403 ret = StartC32(); |
|
404 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
405 TEST(ret); |
|
406 TEST(iCommServer.Connect()); |
|
407 ret = iCommServer.LoadCommModule(KCsyName); |
|
408 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
409 |
|
410 // specific test code |
|
411 TEST(OpenAllCommPorts()); |
|
412 User::After(5000000); |
|
413 CloseAllCommPorts(); |
|
414 iCommServer.UnloadCommModule(KCsyName); |
|
415 iCommServer.Close(); |
|
416 iTest.Printf(_L("Test 2-5 Passed\n")); |
|
417 User::After(3000000); |
|
418 return (KErrNone); |
|
419 break; |
|
420 |
|
421 case 6: // check failure to open port with an invalid name |
|
422 iTest.Printf(_L("Check failure to open port with invalid name...\n")); |
|
423 SetFunIndex(1); |
|
424 |
|
425 // common test code |
|
426 TEST(LoadSerialDeviceDrivers()); |
|
427 ret = StartC32(); |
|
428 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
429 TEST(ret); |
|
430 |
|
431 TEST(iCommServer.Connect()); |
|
432 ret = iCommServer.LoadCommModule(KCsyName); |
|
433 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
434 |
|
435 // specific test code |
|
436 TEST(OpenCmdPortInvalidName()); |
|
437 User::After(5000000); |
|
438 iCommServer.UnloadCommModule(KCsyName); |
|
439 iCommServer.Close(); |
|
440 User::After(1000000); |
|
441 iTest.Printf(_L("Test 2-6 Passed\n")); |
|
442 User::After(2000000); |
|
443 return (KErrNone); |
|
444 break; |
|
445 |
|
446 |
|
447 // Manual Tests Follow... |
|
448 case 100: // Return how many manual tests are present |
|
449 { |
|
450 return 0; |
|
451 } |
|
452 break; |
|
453 |
|
454 default: |
|
455 iTest.Printf(_L("** Not implemented CSYB-%d **\n"), aTstNum); |
|
456 break; |
|
457 } |
|
458 |
|
459 return (ret); |
|
460 } |
|
461 |
|
462 |
|
463 TInt CCsy0710UnitTest::CsyCL(TInt aTstNum) |
|
464 /** |
|
465 * CSY Data Transmission Tests. |
|
466 * @param aTstNum test number |
|
467 * @return void |
|
468 */ |
|
469 { |
|
470 if (aTstNum != 0) |
|
471 iTest.Printf(_L("CSYC-%d\n"), aTstNum); |
|
472 |
|
473 TInt ret = KErrNone; |
|
474 |
|
475 SetTsIdentifier(_L("CSYC")); |
|
476 SetMethodName(_L("CSYC")); |
|
477 |
|
478 switch (aTstNum) |
|
479 { |
|
480 case 0: // Return how may auto tests are present |
|
481 return (4); |
|
482 break; |
|
483 |
|
484 case 1: // Check that information can be sent |
|
485 iTest.Printf(_L("Send command on Comm Port...\n")); |
|
486 SetFunIndex(1); |
|
487 |
|
488 // common test code |
|
489 TEST(LoadSerialDeviceDrivers()); |
|
490 ret = StartC32(); |
|
491 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
492 TEST(ret); |
|
493 TEST(iCommServer.Connect()); |
|
494 ret = iCommServer.LoadCommModule(KCsyName); |
|
495 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
496 |
|
497 // specific test code |
|
498 TEST(SendCmdOneCommPort(0)); |
|
499 User::After(1000000); |
|
500 iCommServer.UnloadCommModule(KCsyName); |
|
501 iCommServer.Close(); |
|
502 iTest.Printf(_L("Test 3-1 Passed\n")); |
|
503 User::After(3000000); |
|
504 return KErrNone; |
|
505 break; |
|
506 |
|
507 case 2: // Check that information can be sent |
|
508 iTest.Printf(_L("Send multiple commands on Comm Port...\n")); |
|
509 SetFunIndex(1); |
|
510 |
|
511 // common test code |
|
512 TEST(LoadSerialDeviceDrivers()); |
|
513 ret = StartC32(); |
|
514 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
515 TEST(ret); |
|
516 TEST(iCommServer.Connect()); |
|
517 ret = iCommServer.LoadCommModule(KCsyName); |
|
518 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
519 |
|
520 // specific test code |
|
521 SendCmdsOneCommPort(0); |
|
522 User::After(1000000); |
|
523 iCommServer.UnloadCommModule(KCsyName); |
|
524 iCommServer.Close(); |
|
525 iTest.Printf(_L("Test 3-2 Passed\n")); |
|
526 User::After(3000000); |
|
527 return (KErrNone); |
|
528 break; |
|
529 |
|
530 case 3: // check BP ack failure |
|
531 iTest.Printf(_L("Test 3-3 Passed\n")); |
|
532 SetFunIndex(1); |
|
533 User::After(3000000); |
|
534 return (KErrNone); |
|
535 |
|
536 case 4: // Check write cancel on outstanding cmd |
|
537 iTest.Printf(_L("Cancel Write Request on Comm Port...\n")); |
|
538 SetFunIndex(1); |
|
539 |
|
540 // common test code |
|
541 TEST(LoadSerialDeviceDrivers()); |
|
542 ret = StartC32(); |
|
543 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
544 TEST(ret); |
|
545 TEST(iCommServer.Connect()); |
|
546 ret = iCommServer.LoadCommModule(KCsyName); |
|
547 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
548 |
|
549 // specific test code |
|
550 CancelWriteOneCommPort(0); |
|
551 User::After(1000000); |
|
552 |
|
553 // common exit test code |
|
554 iCommServer.UnloadCommModule(KCsyName); |
|
555 iCommServer.Close(); |
|
556 iTest.Printf(_L("Test 3-4 Passed\n")); |
|
557 User::After(3000000); |
|
558 return (KErrNone); |
|
559 break; |
|
560 |
|
561 // Manual Tests Follow... |
|
562 case 100: // Return how many manual tests are present |
|
563 { |
|
564 return 0; |
|
565 } |
|
566 break; |
|
567 |
|
568 default: |
|
569 iTest.Printf(_L("** Not implemented CSYC-%d **\n"), aTstNum); |
|
570 break; |
|
571 } |
|
572 |
|
573 return (ret); |
|
574 } |
|
575 |
|
576 |
|
577 TInt CCsy0710UnitTest::CsyDL(TInt aTstNum) |
|
578 /** |
|
579 * CSY Tests for receive data on channels. |
|
580 * @param aTstNum test number |
|
581 * @return KErrNone or error code |
|
582 */ |
|
583 { |
|
584 TInt ret = KErrNone; |
|
585 |
|
586 if (aTstNum != 0) |
|
587 iTest.Printf(_L("CSYD-%d\n"), aTstNum); |
|
588 |
|
589 SetTsIdentifier(_L("CSYD")); |
|
590 SetMethodName(_L("CSYD")); |
|
591 |
|
592 switch (aTstNum) |
|
593 { |
|
594 case 0: // Return how may auto tests are present |
|
595 return (2); |
|
596 break; |
|
597 |
|
598 case 1: // Check that data can be received |
|
599 iTest.Printf(_L("Recv Data on Comm Port...\n")); |
|
600 SetFunIndex(1); |
|
601 |
|
602 // common test code |
|
603 TEST(LoadSerialDeviceDrivers()); |
|
604 ret = StartC32(); |
|
605 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
606 TEST(ret); |
|
607 TEST(iCommServer.Connect()); |
|
608 ret = iCommServer.LoadCommModule(KCsyName); |
|
609 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
610 |
|
611 // specific test code |
|
612 ret = iCommPort[0].Open(iCommServer, iCmdPortName[0], ECommShared); |
|
613 if (ret != KErrNone) return __LINE__; |
|
614 TEST(RecvDataOneCommPort(0)); |
|
615 iCommPort[0].Close(); |
|
616 iCommServer.UnloadCommModule(KCsyName); |
|
617 iCommServer.Close(); |
|
618 iTest.Printf(_L("Test 4-1 Passed\n")); |
|
619 User::After(3000000); |
|
620 return KErrNone; |
|
621 break; |
|
622 |
|
623 case 2: // Check that data is received and given to the correct port |
|
624 iTest.Printf(_L("Recv Data and Route to Correct Port...\n")); |
|
625 SetFunIndex(1); |
|
626 |
|
627 // common test code |
|
628 TEST(LoadSerialDeviceDrivers()); |
|
629 ret = StartC32(); |
|
630 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
631 TEST(ret); |
|
632 TEST(iCommServer.Connect()); |
|
633 ret = iCommServer.LoadCommModule(KCsyName); |
|
634 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
635 |
|
636 // specific test code |
|
637 ret = iCommPort[0].Open(iCommServer, iCmdPortName[0], ECommShared); |
|
638 if (ret != KErrNone) return __LINE__; |
|
639 ret = iCommPort[1].Open(iCommServer, iCmdPortName[1], ECommShared); |
|
640 if (ret != KErrNone) return __LINE__; |
|
641 ret = iCommPort[2].Open(iCommServer, iCmdPortName[1], ECommShared); |
|
642 if (ret != KErrNone) return __LINE__; |
|
643 ret = iCommPort[3].Open(iCommServer, iCmdPortName[1], ECommShared); |
|
644 if (ret != KErrNone) return __LINE__; |
|
645 |
|
646 TEST(RecvDataOneCommPort(0)); |
|
647 TEST(RecvDataOneCommPort(1)); |
|
648 TEST(RecvDataOneCommPort(2)); |
|
649 TEST(RecvDataOneCommPort(3)); |
|
650 |
|
651 ret = iCommPort[4].Open(iCommServer, iDataPort1Name, ECommShared); //data port |
|
652 if (ret != KErrNone) return __LINE__; |
|
653 TEST(RecvDataOneCommPort(4)); //newly open port will take away the control of the dlc |
|
654 iCommPort[4].Close(); |
|
655 // should return control of dlc |
|
656 |
|
657 TEST(RecvDataOneCommPort(0)); |
|
658 TEST(RecvDataOneCommPort(1)); |
|
659 TEST(RecvDataOneCommPort(2)); |
|
660 TEST(RecvDataOneCommPort(3)); |
|
661 |
|
662 iCommPort[3].Close(); |
|
663 iCommPort[2].Close(); |
|
664 iCommPort[1].Close(); |
|
665 iCommPort[0].Close(); |
|
666 User::After(1000000); |
|
667 iCommServer.UnloadCommModule(KCsyName); |
|
668 iCommServer.Close(); |
|
669 iTest.Printf(_L("Test 4-2 Passed\n")); |
|
670 User::After(3000000); |
|
671 return KErrNone; |
|
672 break; |
|
673 |
|
674 // Manual Tests Follow... |
|
675 case 100: // Return how many manual tests are present |
|
676 { |
|
677 return 0; |
|
678 } |
|
679 break; |
|
680 |
|
681 default: |
|
682 iTest.Printf(_L("** Not implemented CSYD-%d **\n"), aTstNum); |
|
683 break; |
|
684 } |
|
685 |
|
686 return (KErrNone); |
|
687 } |
|
688 |
|
689 |
|
690 TInt CCsy0710UnitTest::CsyEL(TInt aTstNum) |
|
691 /** |
|
692 * CSY Tests for flow control of data on logical ports. |
|
693 * @param aTstNum test number |
|
694 * @return KErrNone or error code |
|
695 */ |
|
696 { |
|
697 TInt ret = KErrNone; |
|
698 |
|
699 if (aTstNum != 0) |
|
700 iTest.Printf(_L("CSYE-%d\n"), aTstNum); |
|
701 |
|
702 SetTsIdentifier(_L("CSYE")); |
|
703 SetMethodName(_L("CSYE")); |
|
704 |
|
705 switch (aTstNum) |
|
706 { |
|
707 case 0: // Return how may auto tests are present |
|
708 return (1); |
|
709 break; |
|
710 |
|
711 case 1: // Check that flow control signals correct port |
|
712 iTest.Printf(_L("Verify Flow Control Signals to Correct Port...\n")); |
|
713 SetFunIndex(1); |
|
714 |
|
715 // common test code |
|
716 TEST(LoadSerialDeviceDrivers()); |
|
717 ret = StartC32(); |
|
718 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
719 TEST(ret); |
|
720 TEST(iCommServer.Connect()); |
|
721 ret = iCommServer.LoadCommModule(KCsyName); |
|
722 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
723 |
|
724 // specific test code |
|
725 ret = iCommPort[0].Open(iCommServer, iCmdPortName[0], ECommShared); |
|
726 if (ret != KErrNone) return __LINE__; |
|
727 ret = iCommPort[1].Open(iCommServer, iCmdPortName[1], ECommShared); |
|
728 if (ret != KErrNone) return __LINE__; |
|
729 ret = iCommPort[2].Open(iCommServer, iCmdPortName[2], ECommShared); |
|
730 if (ret != KErrNone) return __LINE__; |
|
731 ret = iCommPort[3].Open(iCommServer, iCmdPortName[3], ECommShared); |
|
732 if (ret != KErrNone) return __LINE__; |
|
733 |
|
734 TEST(VerifyFlowControl(0)); |
|
735 TEST(VerifyFlowControl(1)); |
|
736 TEST(VerifyFlowControl(2)); |
|
737 TEST(VerifyFlowControl(3)); |
|
738 |
|
739 iCommPort[3].Close(); |
|
740 iCommPort[2].Close(); |
|
741 iCommPort[1].Close(); |
|
742 iCommPort[0].Close(); |
|
743 User::After(1000000); |
|
744 iCommServer.UnloadCommModule(KCsyName); |
|
745 iCommServer.Close(); |
|
746 iTest.Printf(_L("Test 5-1 Passed\n")); |
|
747 User::After(3000000); |
|
748 return KErrNone; |
|
749 break; |
|
750 |
|
751 // Manual Tests Follow... |
|
752 case 100: // Return how many manual tests are present |
|
753 { |
|
754 return 0; |
|
755 } |
|
756 break; |
|
757 |
|
758 default: |
|
759 iTest.Printf(_L("** Not implemented CSYE-%d **\n"), aTstNum); |
|
760 break; |
|
761 } |
|
762 |
|
763 return (KErrNone); |
|
764 } |
|
765 |
|
766 |
|
767 TInt CCsy0710UnitTest::CsyFL(TInt aTstNum) |
|
768 /** |
|
769 * CSY Tests for 3GPP 27.010 compliance. |
|
770 * @param aTstNum test number |
|
771 * @return KErrNone or error code |
|
772 */ |
|
773 { |
|
774 if (aTstNum != 0) |
|
775 iTest.Printf(_L("CSYF-%d\n"), aTstNum); |
|
776 |
|
777 SetTsIdentifier(_L("CSYF")); |
|
778 SetMethodName(_L("CSYF")); |
|
779 |
|
780 iTest.Printf(_L("Verify 3GPP 27.010 Compliance\n")); |
|
781 |
|
782 switch (aTstNum) |
|
783 { |
|
784 case 0: // Return how may auto tests are present |
|
785 return (8); |
|
786 break; |
|
787 |
|
788 case 1: // Check that AT+CMUX is sent to enter mux mode |
|
789 iTest.Printf(_L("Verify AT+CMUX is sent to enter Mux mode...\n")); |
|
790 SetFunIndex(1); |
|
791 |
|
792 // common test code |
|
793 Verify0710Compliance(); |
|
794 iTest.Printf(_L("Test 6-1 Passed\n")); |
|
795 User::After(3000000); |
|
796 return KErrNone; |
|
797 break; |
|
798 |
|
799 case 2: // Check that frames are created correctly |
|
800 iTest.Printf(_L("Verify frames are created properly...\n")); |
|
801 SetFunIndex(1); |
|
802 |
|
803 // common test code |
|
804 Verify0710Compliance(); |
|
805 iTest.Printf(_L("Test 6-2 Passed\n")); |
|
806 User::After(2000000); |
|
807 return KErrNone; |
|
808 break; |
|
809 |
|
810 case 3: // Check that channels are created via SABM frames |
|
811 iTest.Printf(_L("Verify channels are created via SABM frames...\n")); |
|
812 SetFunIndex(1); |
|
813 |
|
814 // common test code |
|
815 Verify0710Compliance(); |
|
816 iTest.Printf(_L("Test 6-3 Passed\n")); |
|
817 User::After(3000000); |
|
818 return KErrNone; |
|
819 break; |
|
820 |
|
821 case 4: // Check that received frames are validated |
|
822 iTest.Printf(_L("Verify received frames are validated...\n")); |
|
823 SetFunIndex(1); |
|
824 |
|
825 // common test code |
|
826 Verify0710Compliance(); |
|
827 iTest.Printf(_L("Test 6-4 Passed\n")); |
|
828 User::After(3000000); |
|
829 return KErrNone; |
|
830 break; |
|
831 |
|
832 case 5: // Check that recv frames are ack'd with a UA frame |
|
833 iTest.Printf(_L("Verify received frames are ack'd with a UA frame...\n")); |
|
834 SetFunIndex(1); |
|
835 |
|
836 // common test code |
|
837 Verify0710Compliance(); |
|
838 iTest.Printf(_L("Test 6-5 Passed\n")); |
|
839 User::After(3000000); |
|
840 return KErrNone; |
|
841 break; |
|
842 |
|
843 case 6: // Check that received modem status control frames are processed correctly |
|
844 iTest.Printf(_L("Verify received modem status control frames are processed...\n")); |
|
845 SetFunIndex(1); |
|
846 |
|
847 // common test code |
|
848 Verify0710Compliance(); |
|
849 iTest.Printf(_L("Test 6-6 Passed\n")); |
|
850 User::After(3000000); |
|
851 return KErrNone; |
|
852 break; |
|
853 |
|
854 case 7: // Check that received flow control frames are processed correctly |
|
855 iTest.Printf(_L("Verify received flow control frames are processed...\n")); |
|
856 SetFunIndex(1); |
|
857 |
|
858 // common test code |
|
859 Verify0710Compliance(); |
|
860 iTest.Printf(_L("Test 6-7 Passed\n")); |
|
861 User::After(3000000); |
|
862 return KErrNone; |
|
863 break; |
|
864 |
|
865 case 8: // Check that channel is closed by sending a DISC frame |
|
866 iTest.Printf(_L("Verify channel is closed by when sending DISC frame...\n")); |
|
867 SetFunIndex(1); |
|
868 |
|
869 // common test code |
|
870 Verify0710Compliance(); |
|
871 iTest.Printf(_L("Test 6-8 Passed\n")); |
|
872 User::After(3000000); |
|
873 return KErrNone; |
|
874 break; |
|
875 |
|
876 // Manual Tests Follow... |
|
877 case 100: // Return how many manual tests are present |
|
878 return 0; |
|
879 break; |
|
880 |
|
881 default: |
|
882 iTest.Printf(_L("** Not implemented CSYF-%d **\n"), aTstNum); |
|
883 break; |
|
884 } |
|
885 |
|
886 return (KErrNone); |
|
887 } |
|
888 |
|
889 |
|
890 TInt CCsy0710UnitTest::CsyGL(TInt aTstNum) |
|
891 /** |
|
892 * CSY Tests |
|
893 * @param aTstNum test number |
|
894 * @return KErrNone or error code |
|
895 */ |
|
896 { |
|
897 if (aTstNum != 0) |
|
898 iTest.Printf(_L("CSYG-%d\n"), aTstNum); |
|
899 |
|
900 SetTsIdentifier(_L("CSYG")); |
|
901 SetMethodName(_L("CSYG")); |
|
902 |
|
903 switch (aTstNum) |
|
904 { |
|
905 case 0: // Return how may auto tests are present |
|
906 return (14); |
|
907 break; |
|
908 |
|
909 case 1: // Verify no memory allocation until 1st port is opened |
|
910 iTest.Printf(_L("Verify no memory allocation until 1st port is opened...\n")); |
|
911 SetFunIndex(1); |
|
912 |
|
913 // common test code |
|
914 VerifyStartup(); |
|
915 iTest.Printf(_L("Test 7-1 Passed\n")); |
|
916 User::After(3000000); |
|
917 return KErrNone; |
|
918 break; |
|
919 |
|
920 case 2: // Verify mux startup params are read |
|
921 iTest.Printf(_L("Verify mux startup params are read...\n")); |
|
922 SetFunIndex(1); |
|
923 |
|
924 // common test code |
|
925 VerifyStartup(); |
|
926 iTest.Printf(_L("Test 7-2 Passed\n")); |
|
927 User::After(3000000); |
|
928 return KErrNone; |
|
929 break; |
|
930 |
|
931 case 3: // Verify correct serial port PDD is loaded |
|
932 iTest.Printf(_L("Verify correct serial port PDD is loaded...\n")); |
|
933 SetFunIndex(1); |
|
934 |
|
935 // common test code |
|
936 VerifyStartup(); |
|
937 iTest.Printf(_L("Test 7-3 Passed\n")); |
|
938 User::After(3000000); |
|
939 return KErrNone; |
|
940 break; |
|
941 |
|
942 case 4: // Verify correct serial port LDD is loaded |
|
943 iTest.Printf(_L("Verify correct serial port LDD is loaded...\n")); |
|
944 SetFunIndex(1); |
|
945 |
|
946 // common test code |
|
947 VerifyStartup(); |
|
948 iTest.Printf(_L("Test 7-4 Passed\n")); |
|
949 User::After(3000000); |
|
950 return KErrNone; |
|
951 break; |
|
952 |
|
953 case 5: // Check serial port startup config |
|
954 iTest.Printf(_L("Verify serial port startup config...\n")); |
|
955 SetFunIndex(1); |
|
956 |
|
957 // common test code |
|
958 VerifyStartup(); |
|
959 iTest.Printf(_L("Test 7-5 Passed\n")); |
|
960 User::After(3000000); |
|
961 return KErrNone; |
|
962 break; |
|
963 |
|
964 case 6: // Check control channel 0 is created |
|
965 iTest.Printf(_L("Verify control channel 0 is created...\n")); |
|
966 SetFunIndex(1); |
|
967 |
|
968 // common test code |
|
969 VerifyStartup(); |
|
970 iTest.Printf(_L("Test 7-6 Passed\n")); |
|
971 User::After(3000000); |
|
972 return KErrNone; |
|
973 break; |
|
974 |
|
975 case 7: // Check command and data channels are created |
|
976 iTest.Printf(_L("Verify cmd and data channels are created...\n")); |
|
977 SetFunIndex(1); |
|
978 |
|
979 // common test code |
|
980 VerifyStartup(); |
|
981 iTest.Printf(_L("Test 7-7 Passed\n")); |
|
982 User::After(3000000); |
|
983 return KErrNone; |
|
984 break; |
|
985 |
|
986 case 8: // Verify enter mux AT command is issued to the BP |
|
987 iTest.Printf(_L("Verify enter mux AT command is issued to BP...\n")); |
|
988 SetFunIndex(1); |
|
989 |
|
990 // common test code |
|
991 VerifyStartup(); |
|
992 iTest.Printf(_L("Test 7-8 Passed\n")); |
|
993 User::After(3000000); |
|
994 return KErrNone; |
|
995 break; |
|
996 |
|
997 case 9: // Verify cmd channels are setup disable cmd echo |
|
998 iTest.Printf(_L("Verify cmd channels are setup to disable cmd echo...\n")); |
|
999 SetFunIndex(1); |
|
1000 |
|
1001 // common test code |
|
1002 VerifyStartup(); |
|
1003 iTest.Printf(_L("Test 7-9 Passed\n")); |
|
1004 User::After(3000000); |
|
1005 return KErrNone; |
|
1006 break; |
|
1007 |
|
1008 case 10: // Verify C32 is informed of the CSY's serial name of "gsm0710" |
|
1009 iTest.Printf(_L("Verify C32 is informed of the CSY's serial name of gsm0710...\n")); |
|
1010 SetFunIndex(1); |
|
1011 |
|
1012 // common test code |
|
1013 VerifyStartup(); |
|
1014 iTest.Printf(_L("Test 7-10 Passed\n")); |
|
1015 User::After(3000000); |
|
1016 return KErrNone; |
|
1017 break; |
|
1018 |
|
1019 case 11: // Verify flow control is set to Off after channel init |
|
1020 iTest.Printf(_L("Verify Verify flow control is set to Off after channel init...\n")); |
|
1021 SetFunIndex(1); |
|
1022 |
|
1023 // common test code |
|
1024 VerifyStartup(); |
|
1025 iTest.Printf(_L("Test 7-11 Passed\n")); |
|
1026 User::After(3000000); |
|
1027 return KErrNone; |
|
1028 break; |
|
1029 |
|
1030 case 12: // Verify NotifyFlowControlChange requests are accepted |
|
1031 iTest.Printf(_L("Verify NotifyFlowControlChange requests are accepted...\n")); |
|
1032 SetFunIndex(1); |
|
1033 |
|
1034 // common test code |
|
1035 VerifyStartup(); |
|
1036 iTest.Printf(_L("Test 7-12 Passed\n")); |
|
1037 User::After(3000000); |
|
1038 return KErrNone; |
|
1039 break; |
|
1040 |
|
1041 case 13: // Verify NotifyFlowControlChange request can be cancelled |
|
1042 iTest.Printf(_L("Verify NotifyFlowControlChange request can be cancelled...\n")); |
|
1043 SetFunIndex(1); |
|
1044 |
|
1045 // common test code |
|
1046 VerifyStartup(); |
|
1047 iTest.Printf(_L("Test 7-13 Passed\n")); |
|
1048 User::After(3000000); |
|
1049 return KErrNone; |
|
1050 break; |
|
1051 |
|
1052 case 14: // Verify NotifyFlowControlChange requests are completed properly |
|
1053 iTest.Printf(_L("Verify NotifyFlowControlChange requests are completed properly...\n")); |
|
1054 SetFunIndex(1); |
|
1055 |
|
1056 // common test code |
|
1057 VerifyStartup(); |
|
1058 iTest.Printf(_L("Test 7-14 Passed\n")); |
|
1059 User::After(3000000); |
|
1060 return KErrNone; |
|
1061 break; |
|
1062 |
|
1063 // Manual Tests Follow... |
|
1064 case 100: // Return how many manual tests are present |
|
1065 return 0; |
|
1066 break; |
|
1067 |
|
1068 default: |
|
1069 iTest.Printf(_L("** Not implemented CSYG-%d **\n"), aTstNum); |
|
1070 break; |
|
1071 } |
|
1072 |
|
1073 return (KErrNone); |
|
1074 } |
|
1075 |
|
1076 |
|
1077 TInt CCsy0710UnitTest::CsyHL(TInt aTstNum) |
|
1078 /** |
|
1079 * CSY Tests |
|
1080 * @param aTstNum test number |
|
1081 * @return KErrNone or error code |
|
1082 */ |
|
1083 { |
|
1084 if (aTstNum != 0) |
|
1085 iTest.Printf(_L("CSYH-%d\n"), aTstNum); |
|
1086 |
|
1087 SetTsIdentifier(_L("CSYH")); |
|
1088 SetMethodName(_L("CSYH")); |
|
1089 |
|
1090 switch (aTstNum) |
|
1091 { |
|
1092 case 0: // Return how may auto tests are present |
|
1093 return (5); |
|
1094 break; |
|
1095 |
|
1096 case 1: // Verify any active or outstanding requests are cancelled |
|
1097 iTest.Printf(_L("Verify any active or outstanding requests are cancelled...\n")); |
|
1098 SetFunIndex(1); |
|
1099 |
|
1100 // common test code |
|
1101 TEST(VerifyShutdown(1)); |
|
1102 iTest.Printf(_L("Test 8-1 Passed\n")); |
|
1103 User::After(3000000); |
|
1104 return KErrNone; |
|
1105 break; |
|
1106 |
|
1107 case 2: // Verify each command channel and control channel is disconnected by sending DISC frame to BP |
|
1108 iTest.Printf(_L("Verify channels are disconnected by sending DISC frame to BP...\n")); |
|
1109 SetFunIndex(1); |
|
1110 |
|
1111 // common test code |
|
1112 TEST(VerifyShutdown(2)); |
|
1113 iTest.Printf(_L("Test 8-2 Passed\n")); |
|
1114 User::After(3000000); |
|
1115 return KErrNone; |
|
1116 break; |
|
1117 |
|
1118 case 3: // Verify all memory allocated is deallocated |
|
1119 iTest.Printf(_L("Verify all memory allocated is deallocated...\n")); |
|
1120 SetFunIndex(1); |
|
1121 |
|
1122 // common test code |
|
1123 TEST(VerifyShutdown(3)); |
|
1124 iTest.Printf(_L("Test 8-3 Passed\n")); |
|
1125 User::After(3000000); |
|
1126 return KErrNone; |
|
1127 break; |
|
1128 |
|
1129 case 4: // Verify all created objects are deleted |
|
1130 iTest.Printf(_L("Verify all created objects are deleted...\n")); |
|
1131 SetFunIndex(1); |
|
1132 |
|
1133 // common test code |
|
1134 TEST(VerifyShutdown(4)); |
|
1135 iTest.Printf(_L("Test 8-4 Passed\n")); |
|
1136 User::After(3000000); |
|
1137 return KErrNone; |
|
1138 break; |
|
1139 |
|
1140 case 5: // Verify BP is returned to non-mux mode for AT commands. |
|
1141 iTest.Printf(_L("Verify BP is returned to non-mux mode for AT commands....\n")); |
|
1142 SetFunIndex(1); |
|
1143 |
|
1144 // common test code |
|
1145 TEST(VerifyShutdown(5)); |
|
1146 iTest.Printf(_L("Test 8-5 Passed\n")); |
|
1147 User::After(3000000); |
|
1148 return KErrNone; |
|
1149 break; |
|
1150 |
|
1151 // Manual Tests Follow... |
|
1152 case 100: // Return how many manual tests are present |
|
1153 return 0; |
|
1154 break; |
|
1155 |
|
1156 default: |
|
1157 iTest.Printf(_L("** Not implemented CSYH-%d **\n"), aTstNum); |
|
1158 break; |
|
1159 } |
|
1160 |
|
1161 return (KErrNone); |
|
1162 } |
|
1163 |
|
1164 |
|
1165 //////////////////// |
|
1166 // Helper classes |
|
1167 // |
|
1168 TInt CCsy0710UnitTest::LoadSerialDeviceDrivers() |
|
1169 { |
|
1170 #ifdef __WINS__ |
|
1171 TInt ret; |
|
1172 _LIT(KPDDName,"ECDRV"); |
|
1173 _LIT(KLDDName,"ECOMM"); |
|
1174 |
|
1175 ret= User::LoadPhysicalDevice(KPDDName); |
|
1176 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
1177 return (ret); |
|
1178 |
|
1179 ret = User::LoadLogicalDevice(KLDDName); |
|
1180 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
1181 return (ret); |
|
1182 #endif |
|
1183 |
|
1184 return (KErrNone); |
|
1185 } |
|
1186 |
|
1187 |
|
1188 TInt CCsy0710UnitTest::OpenAllCommPorts() |
|
1189 { |
|
1190 TInt ret; |
|
1191 |
|
1192 // Open RComm Ports |
|
1193 ret = iCommPort[0].Open(iCommServer, iCmdPortName[0], ECommShared); |
|
1194 if (ret != KErrNone) return __LINE__; |
|
1195 |
|
1196 // Open Port #2 |
|
1197 ret = iCommPort[1].Open(iCommServer, iCmdPortName[1], ECommShared); |
|
1198 if (ret != KErrNone) return __LINE__; |
|
1199 |
|
1200 // Open Port #3 |
|
1201 ret = iCommPort[2].Open(iCommServer, iCmdPortName[2], ECommShared); |
|
1202 if (ret != KErrNone) return __LINE__; |
|
1203 |
|
1204 // Open Port #4 |
|
1205 ret = iCommPort[3].Open(iCommServer, iCmdPortName[3], ECommShared); |
|
1206 if (ret != KErrNone) return __LINE__; |
|
1207 |
|
1208 return (KErrNone); |
|
1209 } |
|
1210 |
|
1211 |
|
1212 TInt CCsy0710UnitTest::CloseAllCommPorts() |
|
1213 { |
|
1214 iCommPort[0].Close(); |
|
1215 iCommPort[1].Close(); |
|
1216 iCommPort[2].Close(); |
|
1217 iCommPort[3].Close(); |
|
1218 |
|
1219 return (KErrNone); |
|
1220 } |
|
1221 |
|
1222 |
|
1223 TInt CCsy0710UnitTest::GetCsyInfo() |
|
1224 { |
|
1225 TInt ret; |
|
1226 TName csyName(_L("gsm0710")); |
|
1227 TSerialInfo serialInfo; |
|
1228 |
|
1229 ret = iCommServer.GetPortInfo(csyName, serialInfo); |
|
1230 if (ret == KErrNone) |
|
1231 { |
|
1232 iTest.Printf(_L(" Descrip = %S\n"), &serialInfo.iDescription); |
|
1233 iTest.Printf(_L(" Name = %S\n"), &serialInfo.iName); |
|
1234 iTest.Printf(_L(" Low Unit = %d\n"), serialInfo.iLowUnit); |
|
1235 iTest.Printf(_L(" High Unit = %d\n"), serialInfo.iHighUnit); |
|
1236 User::After(2000000); |
|
1237 } |
|
1238 return (ret); |
|
1239 } |
|
1240 |
|
1241 |
|
1242 TInt CCsy0710UnitTest::OpenCommPortFail() |
|
1243 { |
|
1244 TInt ret; |
|
1245 TName invalidName = _L("gsm0710::A"); |
|
1246 |
|
1247 ret = iCommPort[0].Open(iCommServer, invalidName, ECommShared); |
|
1248 if (ret == KErrNone) return __LINE__; |
|
1249 |
|
1250 return (KErrNone); |
|
1251 } |
|
1252 |
|
1253 |
|
1254 TInt CCsy0710UnitTest::OpenCmdPortTwice() |
|
1255 { |
|
1256 TInt ret; |
|
1257 |
|
1258 // Open RComm Port once |
|
1259 ret = iCommPort[0].Open(iCommServer, iCmdPortName[0], ECommExclusive); |
|
1260 if (ret != KErrNone) return __LINE__; |
|
1261 |
|
1262 // Open same RComm Port again |
|
1263 ret = iCommPort[1].Open(iCommServer, iCmdPortName[0], ECommExclusive); |
|
1264 if (ret != KErrNone) return __LINE__; |
|
1265 |
|
1266 iCommPort[0].Close(); |
|
1267 iCommPort[1].Close(); |
|
1268 |
|
1269 return (KErrNone); |
|
1270 } |
|
1271 |
|
1272 |
|
1273 TInt CCsy0710UnitTest::OpenCmdPortInvalidName() |
|
1274 { |
|
1275 TInt ret; |
|
1276 TName invalidName = _L("gsm0710::A"); |
|
1277 |
|
1278 ret = iCommPort[0].Open(iCommServer, invalidName, ECommShared); |
|
1279 if (ret == KErrNone) return __LINE__; |
|
1280 |
|
1281 return (KErrNone); |
|
1282 } |
|
1283 |
|
1284 |
|
1285 TInt CCsy0710UnitTest::SendCmdOneCommPort(TInt aPortNum) |
|
1286 { |
|
1287 TInt ret; |
|
1288 |
|
1289 // Open RComm Port |
|
1290 ret = iCommPort[aPortNum].Open(iCommServer, iCmdPortName[aPortNum], ECommShared); |
|
1291 if (ret != KErrNone) return __LINE__; |
|
1292 |
|
1293 // send data |
|
1294 TBuf8<32> buf; |
|
1295 buf.Copy(KATCommand1); |
|
1296 |
|
1297 TRequestStatus writeRequestStatus = KRequestPending; |
|
1298 iCommPort[aPortNum].Write(writeRequestStatus, buf, buf.Length()); |
|
1299 User::WaitForRequest(writeRequestStatus); |
|
1300 if (writeRequestStatus != KErrNone) return __LINE__; |
|
1301 |
|
1302 TEST(ReadDataFromCommPort(aPortNum)); |
|
1303 |
|
1304 iCommPort[aPortNum].Close(); |
|
1305 |
|
1306 return (KErrNone); |
|
1307 } |
|
1308 |
|
1309 |
|
1310 TInt CCsy0710UnitTest::SendCmdsOneCommPort(TInt aPortNum) |
|
1311 { |
|
1312 TInt ret; |
|
1313 |
|
1314 // Open RComm Port |
|
1315 ret = iCommPort[aPortNum].Open(iCommServer, iCmdPortName[aPortNum], ECommShared); |
|
1316 if (ret != KErrNone) return __LINE__; |
|
1317 |
|
1318 TRequestStatus writeRequestStatus; |
|
1319 TBuf8<32> buf; |
|
1320 |
|
1321 // send data |
|
1322 writeRequestStatus = KRequestPending; |
|
1323 buf.Copy(KATCommand1); |
|
1324 iCommPort[aPortNum].Write(writeRequestStatus, buf, buf.Length()); |
|
1325 User::WaitForRequest(writeRequestStatus); |
|
1326 if (writeRequestStatus != KErrNone) return __LINE__; |
|
1327 |
|
1328 TEST(ReadDataFromCommPort(aPortNum)); |
|
1329 |
|
1330 writeRequestStatus = KRequestPending; |
|
1331 buf.Copy(KATCommand2); |
|
1332 iCommPort[aPortNum].Write(writeRequestStatus, buf, buf.Length()); |
|
1333 User::WaitForRequest(writeRequestStatus); |
|
1334 if (writeRequestStatus != KErrNone) return __LINE__; |
|
1335 |
|
1336 TEST(ReadDataFromCommPort(aPortNum)); |
|
1337 |
|
1338 writeRequestStatus = KRequestPending; |
|
1339 buf.Copy(KATCommand3); |
|
1340 iCommPort[aPortNum].Write(writeRequestStatus, buf, buf.Length()); |
|
1341 User::WaitForRequest(writeRequestStatus); |
|
1342 if (writeRequestStatus != KErrNone) return __LINE__; |
|
1343 |
|
1344 TEST(ReadDataFromCommPort(aPortNum)); |
|
1345 |
|
1346 writeRequestStatus = KRequestPending; |
|
1347 buf.Copy(KATCommand4); |
|
1348 iCommPort[aPortNum].Write(writeRequestStatus, buf, buf.Length()); |
|
1349 User::WaitForRequest(writeRequestStatus); |
|
1350 if (writeRequestStatus != KErrNone) return __LINE__; |
|
1351 |
|
1352 TEST(ReadDataFromCommPort(aPortNum)); |
|
1353 |
|
1354 writeRequestStatus = KRequestPending; |
|
1355 buf.Copy(KATCommand5); |
|
1356 iCommPort[aPortNum].Write(writeRequestStatus, buf, buf.Length()); |
|
1357 User::WaitForRequest(writeRequestStatus); |
|
1358 if (writeRequestStatus != KErrNone) return __LINE__; |
|
1359 |
|
1360 TEST(ReadDataFromCommPort(aPortNum)); |
|
1361 |
|
1362 writeRequestStatus = KRequestPending; |
|
1363 buf.Copy(KATCommand6); |
|
1364 iCommPort[aPortNum].Write(writeRequestStatus, buf, buf.Length()); |
|
1365 User::WaitForRequest(writeRequestStatus); |
|
1366 if (writeRequestStatus != KErrNone) return __LINE__; |
|
1367 |
|
1368 TEST(ReadDataFromCommPort(aPortNum)); |
|
1369 |
|
1370 writeRequestStatus = KRequestPending; |
|
1371 buf.Copy(KATCommand7); |
|
1372 iCommPort[aPortNum].Write(writeRequestStatus, buf, buf.Length()); |
|
1373 User::WaitForRequest(writeRequestStatus); |
|
1374 if (writeRequestStatus != KErrNone) return __LINE__; |
|
1375 |
|
1376 TEST(ReadDataFromCommPort(aPortNum)); |
|
1377 |
|
1378 writeRequestStatus = KRequestPending; |
|
1379 buf.Copy(KATCommand8); |
|
1380 iCommPort[aPortNum].Write(writeRequestStatus, buf, buf.Length()); |
|
1381 User::WaitForRequest(writeRequestStatus); |
|
1382 if (writeRequestStatus != KErrNone) return __LINE__; |
|
1383 |
|
1384 TEST(ReadDataFromCommPort(aPortNum)); |
|
1385 |
|
1386 iCommPort[aPortNum].Close(); |
|
1387 |
|
1388 return (KErrNone); |
|
1389 } |
|
1390 |
|
1391 |
|
1392 TInt CCsy0710UnitTest::CancelWriteOneCommPort(TInt aPortNum) |
|
1393 { |
|
1394 TInt ret; |
|
1395 |
|
1396 // Open RComm Port |
|
1397 ret = iCommPort[aPortNum].Open(iCommServer, iCmdPortName[aPortNum], ECommShared); |
|
1398 if (ret != KErrNone) return __LINE__; |
|
1399 |
|
1400 // wait for CSY to initialize |
|
1401 // check current flow control state |
|
1402 TFlowControl flow; |
|
1403 iCommPort[aPortNum].GetFlowControlStatus(flow); |
|
1404 if (flow == EFlowControlOn) |
|
1405 { |
|
1406 // Port isn't active yet - wait for it to become active |
|
1407 //gTest.Printf(_L("Waiting for port 1 to become active...\n\n")); |
|
1408 TRequestStatus flowReqStatus; |
|
1409 iCommPort[aPortNum].NotifyFlowControlChange(flowReqStatus, flow); |
|
1410 User::WaitForRequest(flowReqStatus); |
|
1411 if (flow == EFlowControlOn) |
|
1412 { |
|
1413 iTest.Printf(_L("Incorrect flow %d\n"), flow); |
|
1414 iTest.Printf(_L("*** CSY did not init properly!! ***\n")); |
|
1415 } |
|
1416 } |
|
1417 |
|
1418 User::After(5000000); |
|
1419 |
|
1420 TRequestStatus writeRequestStatus; |
|
1421 TBuf8<100> buf; |
|
1422 |
|
1423 // send data |
|
1424 writeRequestStatus = KRequestPending; |
|
1425 buf.Copy(KATCommandToCancel); |
|
1426 iCommPort[aPortNum].Write(writeRequestStatus, buf, buf.Length()); |
|
1427 |
|
1428 // cancel write request |
|
1429 iCommPort[aPortNum].WriteCancel(); |
|
1430 User::WaitForRequest(writeRequestStatus); |
|
1431 if (writeRequestStatus != KErrCancel && writeRequestStatus != KErrNone) return __LINE__; |
|
1432 |
|
1433 if (writeRequestStatus == KErrNone) |
|
1434 { |
|
1435 TEST(ReadDataFromCommPort(aPortNum)); |
|
1436 } |
|
1437 |
|
1438 iCommPort[aPortNum].Close(); |
|
1439 |
|
1440 return (KErrNone); |
|
1441 } |
|
1442 |
|
1443 |
|
1444 TInt CCsy0710UnitTest::RecvDataOneCommPort(TInt aPortNum) |
|
1445 { |
|
1446 iTest.Printf(_L(" Port %d\n"), aPortNum); |
|
1447 |
|
1448 // wait for CSY to initialize |
|
1449 // check current flow control state |
|
1450 TFlowControl flow; |
|
1451 iCommPort[aPortNum].GetFlowControlStatus(flow); |
|
1452 if (flow == EFlowControlOn) |
|
1453 { |
|
1454 // Port isn't active yet - wait for it to become active |
|
1455 TRequestStatus flowReqStatus; |
|
1456 iCommPort[aPortNum].NotifyFlowControlChange(flowReqStatus, flow); |
|
1457 User::WaitForRequest(flowReqStatus); |
|
1458 if (flow == EFlowControlOn) return __LINE__; |
|
1459 } |
|
1460 |
|
1461 User::After(5000000); |
|
1462 |
|
1463 |
|
1464 // send data |
|
1465 TBuf8<32> buf; |
|
1466 buf.Copy(KATCommand1); |
|
1467 |
|
1468 TRequestStatus writeRequestStatus = KRequestPending; |
|
1469 iCommPort[aPortNum].Write(writeRequestStatus, buf, buf.Length()); |
|
1470 User::WaitForRequest(writeRequestStatus); |
|
1471 if (writeRequestStatus != KErrNone) return __LINE__; |
|
1472 |
|
1473 |
|
1474 // Recv Data |
|
1475 TRequestStatus readRequestStatus = KRequestPending; |
|
1476 TBuf8<80> respBuf; |
|
1477 // gTest.Printf(_L("Port 1 Read ...\n")); |
|
1478 iCommPort[aPortNum].ReadOneOrMore(readRequestStatus,respBuf); |
|
1479 User::WaitForRequest(readRequestStatus); |
|
1480 if (readRequestStatus != KErrNone) return __LINE__; |
|
1481 |
|
1482 User::After(100000); |
|
1483 |
|
1484 // see if there is any more data to read |
|
1485 TInt extraRecvData = 0; |
|
1486 while ((extraRecvData = iCommPort[aPortNum].QueryReceiveBuffer()) > 0) |
|
1487 { |
|
1488 respBuf.Zero(); |
|
1489 readRequestStatus = KRequestPending; |
|
1490 iCommPort[aPortNum].ReadOneOrMore(readRequestStatus, respBuf); |
|
1491 //iCommPort[aPortNum].Read(readRequestStatus, respBuf); |
|
1492 User::WaitForRequest(readRequestStatus); |
|
1493 if (readRequestStatus != KErrNone) return __LINE__; |
|
1494 } |
|
1495 |
|
1496 return (KErrNone); |
|
1497 } |
|
1498 |
|
1499 |
|
1500 TInt CCsy0710UnitTest::ReadDataFromCommPort(TInt aPortNum) |
|
1501 { |
|
1502 // Recv Data |
|
1503 TRequestStatus readRequestStatus = KRequestPending; |
|
1504 TBuf8<80> respBuf; |
|
1505 iCommPort[aPortNum].ReadOneOrMore(readRequestStatus, respBuf); |
|
1506 User::WaitForRequest(readRequestStatus); |
|
1507 if (readRequestStatus != KErrNone) return __LINE__; |
|
1508 |
|
1509 User::After(100000); |
|
1510 |
|
1511 // see if there is any more data to read |
|
1512 TInt extraRecvData = 0; |
|
1513 while ((extraRecvData = iCommPort[aPortNum].QueryReceiveBuffer()) > 0) |
|
1514 { |
|
1515 respBuf.Zero(); |
|
1516 readRequestStatus = KRequestPending; |
|
1517 iCommPort[aPortNum].ReadOneOrMore(readRequestStatus, respBuf); |
|
1518 User::WaitForRequest(readRequestStatus); |
|
1519 if (readRequestStatus != KErrNone) return __LINE__; |
|
1520 } |
|
1521 |
|
1522 return (KErrNone); |
|
1523 } |
|
1524 |
|
1525 |
|
1526 TInt CCsy0710UnitTest::VerifyFlowControl(TInt aPortNum) |
|
1527 { |
|
1528 iTest.Printf(_L(" Port %d\n"), aPortNum); |
|
1529 |
|
1530 // check current flow control state |
|
1531 TFlowControl flow; |
|
1532 iCommPort[aPortNum].GetFlowControlStatus(flow); |
|
1533 if (flow == EFlowControlOn) |
|
1534 { |
|
1535 // Port isn't active yet - wait for it to become active |
|
1536 TRequestStatus flowReqStatus; |
|
1537 iCommPort[aPortNum].NotifyFlowControlChange(flowReqStatus, flow); |
|
1538 User::WaitForRequest(flowReqStatus); |
|
1539 if (flow == EFlowControlOn) |
|
1540 { |
|
1541 iTest.Printf(_L("Incorrect flow %d\n"), flow); |
|
1542 iTest.Printf(_L("*** CSY did not init properly!! ***\n")); |
|
1543 } |
|
1544 } |
|
1545 return (KErrNone); |
|
1546 } |
|
1547 |
|
1548 |
|
1549 TInt CCsy0710UnitTest::Verify0710Compliance() |
|
1550 { |
|
1551 TInt ret; |
|
1552 |
|
1553 TEST(LoadSerialDeviceDrivers()); |
|
1554 ret = StartC32(); |
|
1555 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
1556 TEST(ret); |
|
1557 TEST(iCommServer.Connect()); |
|
1558 ret = iCommServer.LoadCommModule(KCsyName); |
|
1559 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
1560 |
|
1561 // specific test code |
|
1562 ret = iCommPort[0].Open(iCommServer, iCmdPortName[0], ECommShared); |
|
1563 if (ret != KErrNone) return __LINE__; |
|
1564 ret = iCommPort[1].Open(iCommServer, iCmdPortName[1], ECommShared); |
|
1565 if (ret != KErrNone) return __LINE__; |
|
1566 ret = iCommPort[2].Open(iCommServer, iCmdPortName[2], ECommShared); |
|
1567 if (ret != KErrNone) return __LINE__; |
|
1568 ret = iCommPort[3].Open(iCommServer, iCmdPortName[3], ECommShared); |
|
1569 if (ret != KErrNone) return __LINE__; |
|
1570 |
|
1571 TEST(VerifyFlowControl(0)); |
|
1572 TEST(VerifyFlowControl(1)); |
|
1573 TEST(VerifyFlowControl(2)); |
|
1574 TEST(VerifyFlowControl(3)); |
|
1575 |
|
1576 iCommPort[3].Close(); |
|
1577 iCommPort[2].Close(); |
|
1578 iCommPort[1].Close(); |
|
1579 iCommPort[0].Close(); |
|
1580 User::After(1000000); |
|
1581 iCommServer.UnloadCommModule(KCsyName); |
|
1582 iCommServer.Close(); |
|
1583 |
|
1584 return (KErrNone); |
|
1585 } |
|
1586 |
|
1587 |
|
1588 TInt CCsy0710UnitTest::VerifyStartup() |
|
1589 { |
|
1590 TInt ret; |
|
1591 |
|
1592 TEST(LoadSerialDeviceDrivers()); |
|
1593 ret = StartC32(); |
|
1594 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
1595 TEST(ret); |
|
1596 TEST(iCommServer.Connect()); |
|
1597 ret = iCommServer.LoadCommModule(KCsyName); |
|
1598 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
1599 |
|
1600 // specific test code |
|
1601 ret = iCommPort[0].Open(iCommServer, iCmdPortName[0], ECommShared); |
|
1602 if (ret != KErrNone) return __LINE__; |
|
1603 ret = iCommPort[1].Open(iCommServer, iCmdPortName[1], ECommShared); |
|
1604 if (ret != KErrNone) return __LINE__; |
|
1605 ret = iCommPort[2].Open(iCommServer, iCmdPortName[2], ECommShared); |
|
1606 if (ret != KErrNone) return __LINE__; |
|
1607 ret = iCommPort[3].Open(iCommServer, iCmdPortName[3], ECommShared); |
|
1608 if (ret != KErrNone) return __LINE__; |
|
1609 |
|
1610 TEST(VerifyStartupFlowControl(0)); |
|
1611 TEST(VerifyStartupFlowControl(1)); |
|
1612 TEST(VerifyStartupFlowControl(2)); |
|
1613 TEST(VerifyStartupFlowControl(3)); |
|
1614 |
|
1615 iCommPort[3].Close(); |
|
1616 iCommPort[2].Close(); |
|
1617 iCommPort[1].Close(); |
|
1618 iCommPort[0].Close(); |
|
1619 User::After(1000000); |
|
1620 iCommServer.UnloadCommModule(KCsyName); |
|
1621 iCommServer.Close(); |
|
1622 |
|
1623 return (KErrNone); |
|
1624 } |
|
1625 |
|
1626 |
|
1627 TInt CCsy0710UnitTest::VerifyStartupFlowControl(TInt aPortNum) |
|
1628 { |
|
1629 // check current flow control state |
|
1630 TFlowControl flow; |
|
1631 iCommPort[aPortNum].GetFlowControlStatus(flow); |
|
1632 if (flow == EFlowControlOn) |
|
1633 { |
|
1634 // Port isn't active yet - wait for it to become active |
|
1635 TRequestStatus flowReqStatus; |
|
1636 iCommPort[aPortNum].NotifyFlowControlChange(flowReqStatus, flow); |
|
1637 User::WaitForRequest(flowReqStatus); |
|
1638 if (flow == EFlowControlOn) |
|
1639 { |
|
1640 iTest.Printf(_L("Incorrect flow %d\n"), flow); |
|
1641 iTest.Printf(_L("*** CSY did not init properly!! ***\n")); |
|
1642 } |
|
1643 } |
|
1644 return (KErrNone); |
|
1645 } |
|
1646 |
|
1647 |
|
1648 TInt CCsy0710UnitTest::VerifyShutdown(TInt aTestSubset) |
|
1649 { |
|
1650 aTestSubset = aTestSubset; |
|
1651 TInt ret; |
|
1652 |
|
1653 TEST(LoadSerialDeviceDrivers()); |
|
1654 ret = StartC32(); |
|
1655 if ((ret != KErrNone) && (ret != KErrAlreadyExists)) |
|
1656 TEST(ret); |
|
1657 TEST(iCommServer.Connect()); |
|
1658 ret = iCommServer.LoadCommModule(KCsyName); |
|
1659 if (ret!=KErrNone && ret!=KErrAlreadyExists) return __LINE__; |
|
1660 |
|
1661 // specific test code |
|
1662 ret = iCommPort[0].Open(iCommServer, iCmdPortName[0], ECommShared); |
|
1663 if (ret != KErrNone) return __LINE__; |
|
1664 ret = iCommPort[1].Open(iCommServer, iCmdPortName[1], ECommShared); |
|
1665 if (ret != KErrNone) return __LINE__; |
|
1666 ret = iCommPort[2].Open(iCommServer, iCmdPortName[2], ECommShared); |
|
1667 if (ret != KErrNone) return __LINE__; |
|
1668 ret = iCommPort[3].Open(iCommServer, iCmdPortName[3], ECommShared); |
|
1669 if (ret != KErrNone) return __LINE__; |
|
1670 |
|
1671 TEST(VerifyStartupFlowControl(0)); |
|
1672 TEST(VerifyStartupFlowControl(1)); |
|
1673 TEST(VerifyStartupFlowControl(2)); |
|
1674 TEST(VerifyStartupFlowControl(3)); |
|
1675 |
|
1676 iCommPort[3].Close(); |
|
1677 iCommPort[2].Close(); |
|
1678 iCommPort[1].Close(); |
|
1679 iCommPort[0].Close(); |
|
1680 User::After(1000000); |
|
1681 iCommServer.UnloadCommModule(KCsyName); |
|
1682 iCommServer.Close(); |
|
1683 |
|
1684 return (KErrNone); |
|
1685 } |
|
1686 |
|
1687 |
|
1688 ///////////////////////////////////////////////// |
|
1689 //The following functions also need to be implemented by |
|
1690 //CUnitTestBase derived classes |
|
1691 |
|
1692 void CCsy0710UnitTest::CreateTestL() |
|
1693 /** |
|
1694 * |
|
1695 * |
|
1696 */ |
|
1697 { |
|
1698 CCsy0710UnitTest* unitTest=CCsy0710UnitTest::NewL( |
|
1699 KCsy0710UnitTest, KCsy0710UnitTestLog, KUnitTestSpec, KCsy0710UnitTestScript); |
|
1700 |
|
1701 CleanupStack::PushL(unitTest); |
|
1702 |
|
1703 TInt ret=unitTest->SetUpTest(); |
|
1704 |
|
1705 if(!ret) |
|
1706 { |
|
1707 unitTest->RunUnitTestsL(); |
|
1708 } |
|
1709 |
|
1710 unitTest->Test().End(); |
|
1711 |
|
1712 CleanupStack::PopAndDestroy(1); //unitTest |
|
1713 } |
|
1714 |
|
1715 |
|
1716 #ifndef _ACCEPTANCE_TESTS |
|
1717 |
|
1718 GLDEF_C TInt E32Main() |
|
1719 // |
|
1720 // Main entry point - make sure everything is going. |
|
1721 // |
|
1722 #ifdef BUILD_FOR_JETSTREAM |
|
1723 { |
|
1724 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
1725 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
1726 // We must include the brace in the #ifndef to allow the security |
|
1727 // checking script 'perl.txt' to pass. |
|
1728 #else |
|
1729 { |
|
1730 #endif // BUILD_FOR_JETSTREAM |
|
1731 CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack |
|
1732 |
|
1733 TRAPD(ret,CCsy0710UnitTest::CreateTestL()); |
|
1734 |
|
1735 delete cleanup; |
|
1736 return KErrNone; |
|
1737 } |
|
1738 |
|
1739 #endif //_ACCEPTANCE_TESTS |