46 } |
50 } |
47 |
51 |
48 |
52 |
49 void CTestCaseRoot::BaseConstructL() |
53 void CTestCaseRoot::BaseConstructL() |
50 { |
54 { |
51 LOG_FUNC |
55 if(gVerboseOutput) |
|
56 { |
|
57 OstTraceFunctionEntry0(CTESTCASEROOT_BASECONSTRUCTL); |
|
58 } |
52 |
59 |
53 |
60 |
54 TInt err(iTimer.CreateLocal()); |
61 TInt err(iTimer.CreateLocal()); |
55 if (err == KErrNone) |
62 if (err == KErrNone) |
56 { |
63 { |
57 LOG_VERBOSE1(_L("Test case timer created")); |
64 LOG_VERBOSE1(_L("Test case timer created")); |
|
65 if(gVerboseOutput) |
|
66 { |
|
67 OstTrace0(TRACE_VERBOSE, CTESTCASEROOT_BASECONSTRUCTL_DUP01, "Test case timer created"); |
|
68 } |
58 } |
69 } |
59 else |
70 else |
60 { |
71 { |
61 RDebug::Printf("<Error %d> Test case timer could not be created",err); |
72 OstTrace1(TRACE_NORMAL, CTESTCASEROOT_BASECONSTRUCTL_DUP02, "<Error %d> Test case timer could not be created",err); |
62 User::Leave(err); |
73 User::Leave(err); |
63 } |
74 } |
64 // |
75 // |
65 iConsole = test.Console(); |
76 iConsole = test.Console(); |
66 iRequestedChar = EFalse; |
77 iRequestedChar = EFalse; |
67 } |
78 } |
68 |
79 |
69 |
80 |
70 CTestCaseRoot::~CTestCaseRoot() |
81 CTestCaseRoot::~CTestCaseRoot() |
71 { |
82 { |
72 LOG_FUNC |
83 if(gVerboseOutput) |
|
84 { |
|
85 OstTraceFunctionEntry0(CTESTCASEROOT_DCTESTCASEROOT); |
|
86 } |
73 Cancel(); |
87 Cancel(); |
74 } |
88 } |
75 |
89 |
76 // utility GUI methods |
90 // utility GUI methods |
77 void CTestCaseRoot::DisplayTestCaseOptions() |
91 void CTestCaseRoot::DisplayTestCaseOptions() |
78 { |
92 { |
79 LOG_FUNC |
93 if(gVerboseOutput) |
|
94 { |
|
95 OstTraceFunctionEntry0(CTESTCASEROOT_DISPLAYTESTCASEOPTIONS); |
|
96 } |
80 |
97 |
81 // commonly overridden to display any options for that test |
98 // commonly overridden to display any options for that test |
82 test.Printf(_L("Press <ESC> to end the test.\n")); |
99 test.Printf(_L("Press <ESC> to end the test.\n")); |
|
100 OstTrace0(TRACE_NORMAL, CTESTCASEROOT_DISPLAYTESTCASEOPTIONS_DUP01, "Press <ESC> to end the test.\n"); |
83 } |
101 } |
84 |
102 |
85 |
103 |
86 /***********************************************************************/ |
104 /***********************************************************************/ |
87 // |
105 // |
222 } |
264 } |
223 |
265 |
224 |
266 |
225 void CTestCaseRoot::TestFailed(TInt aFailResult, const TDesC &aErrorDescription) |
267 void CTestCaseRoot::TestFailed(TInt aFailResult, const TDesC &aErrorDescription) |
226 { |
268 { |
227 LOG_FUNC |
269 if(gVerboseOutput) |
|
270 { |
|
271 OstTraceFunctionEntry0(CTESTCASEROOT_TESTFAILED); |
|
272 } |
228 iTestResult = aFailResult; |
273 iTestResult = aFailResult; |
229 test.Printf(_L("Test %S\n"), &TestCaseId()); |
274 test.Printf(_L("Test %S\n"), &TestCaseId()); |
|
275 OstTraceExt1(TRACE_NORMAL, CTESTCASEROOT_TESTFAILED_DUP01, "Test %S\n", TestCaseId()); |
230 test.Printf(_L("Failed (%d)\n"), aFailResult); |
276 test.Printf(_L("Failed (%d)\n"), aFailResult); |
|
277 OstTrace1(TRACE_NORMAL, CTESTCASEROOT_TESTFAILED_DUP02, "Failed (%d)\n", aFailResult); |
231 test.Printf(_L("%S!\n"), &aErrorDescription); |
278 test.Printf(_L("%S!\n"), &aErrorDescription); |
|
279 OstTraceExt1(TRACE_NORMAL, CTESTCASEROOT_TESTFAILED_DUP03, "%S!\n", aErrorDescription); |
232 if (!iAutomated) |
280 if (!iAutomated) |
233 { |
281 { |
234 test.Printf(_L("\n")); |
282 test.Printf(_L("\n")); |
|
283 OstTrace0(TRACE_NORMAL, CTESTCASEROOT_TESTFAILED_DUP04, "\n"); |
235 test.Printf(KPressAnyKeyToContinue); |
284 test.Printf(KPressAnyKeyToContinue); |
|
285 OstTrace0(TRACE_NORMAL, CTESTCASEROOT_TESTFAILED_DUP05, KPressAnyKeyToContinue); |
236 iConsole->Getch(); |
286 iConsole->Getch(); |
237 } |
287 } |
238 // the next call panics the framework! |
288 // the next call panics the framework! |
239 TestPolicy().SignalTestComplete(iTestResult); |
289 TestPolicy().SignalTestComplete(iTestResult); |
240 } |
290 } |
241 |
291 |
242 |
292 |
243 void CTestCaseRoot::TestFailed2(TInt aFailResult, const TDesC &aErrorDescription, TInt errorCode) |
293 void CTestCaseRoot::TestFailed2(TInt aFailResult, const TDesC &aErrorDescription, TInt errorCode) |
244 { |
294 { |
245 LOG_FUNC |
295 if(gVerboseOutput) |
|
296 { |
|
297 OstTraceFunctionEntry0(CTESTCASEROOT_TESTFAILED2); |
|
298 } |
246 iTestResult = aFailResult; |
299 iTestResult = aFailResult; |
247 test.Printf(_L("Test %S FAILED %d '%S %d'!\n"), |
300 test.Printf(_L("Test %S FAILED %d '%S %d'!\n"), |
248 &TestCaseId(), |
301 &TestCaseId(), |
249 aFailResult, |
302 aFailResult, |
250 &aErrorDescription, |
303 &aErrorDescription, |
251 errorCode); |
304 errorCode); |
|
305 OstTraceExt4(TRACE_NORMAL, CTESTCASEROOT_TESTFAILED2_DUP01, "Test %S FAILED %d '%S %d'!\n", |
|
306 TestCaseId(), |
|
307 aFailResult, |
|
308 aErrorDescription, |
|
309 errorCode); |
252 // the next call panics the framework! |
310 // the next call panics the framework! |
253 TestPolicy().SignalTestComplete(iTestResult); |
311 TestPolicy().SignalTestComplete(iTestResult); |
254 } |
312 } |
255 |
313 |
256 |
314 |
257 |
315 |
258 void CTestCaseRoot::TestPassed() |
316 void CTestCaseRoot::TestPassed() |
259 { |
317 { |
260 LOG_FUNC |
318 if(gVerboseOutput) |
|
319 { |
|
320 OstTraceFunctionEntry0(CTESTCASEROOT_TESTPASSED); |
|
321 } |
261 iTestResult = KErrNone; |
322 iTestResult = KErrNone; |
262 TestPolicy().SignalTestComplete(iTestResult); |
323 TestPolicy().SignalTestComplete(iTestResult); |
263 } |
324 } |
264 |
325 |
265 |
326 |
283 void CTestCaseRoot::PrintStepName(const TDesC &aStepName) |
344 void CTestCaseRoot::PrintStepName(const TDesC &aStepName) |
284 { |
345 { |
285 if (gVerboseOutput) |
346 if (gVerboseOutput) |
286 { |
347 { |
287 test.Printf(_L("--------------\n %S "), &aStepName); |
348 test.Printf(_L("--------------\n %S "), &aStepName); |
|
349 OstTraceExt1(TRACE_NORMAL, CTESTCASEROOT_PRINTSTEPNAME, "--------------\n %S ", aStepName); |
288 // B2B class method dumps the engine state |
350 // B2B class method dumps the engine state |
289 // |
351 // |
290 test.Printf(_L("\n--------------\n")); |
352 test.Printf(_L("\n--------------\n")); |
|
353 OstTrace0(TRACE_NORMAL, CTESTCASEROOT_PRINTSTEPNAME_DUP01, "\n--------------\n"); |
291 } |
354 } |
292 } |
355 } |
293 |
356 |
294 |
357 |
295 /* ************************************************************************************** |
358 /* ************************************************************************************** |
296 * |
359 * |
297 */ |
360 */ |
298 CTestCaseB2BRoot::CTestCaseB2BRoot(const TDesC& aTestCaseId, TBool aHost, TRequestStatus &aStatus) |
361 CTestCaseB2BRoot::CTestCaseB2BRoot(const TDesC& aTestCaseId, TBool aHost, TRequestStatus &aStatus) |
299 : CTestCaseRoot(aTestCaseId, aHost) , iCollector(aStatus) |
362 : CTestCaseRoot(aTestCaseId, aHost) , iCollector(aStatus) |
300 { |
363 { |
301 LOG_FUNC |
364 if(gVerboseOutput) |
|
365 { |
|
366 OstTraceFunctionEntry0(CTESTCASEB2BROOT_CTESTCASEB2BROOT); |
|
367 } |
302 |
368 |
303 } |
369 } |
304 |
370 |
305 |
371 |
306 CTestCaseB2BRoot::~CTestCaseB2BRoot() |
372 CTestCaseB2BRoot::~CTestCaseB2BRoot() |
307 { |
373 { |
308 LOG_FUNC |
374 if(gVerboseOutput) |
|
375 { |
|
376 OstTraceFunctionEntry0(CTESTCASEB2BROOT_DCTESTCASEB2BROOT); |
|
377 } |
309 |
378 |
310 } |
379 } |
311 |
380 |
312 /* Print step name : B2B override displays the OTG Engine state as well |
381 /* Print step name : B2B override displays the OTG Engine state as well |
313 */ |
382 */ |
314 void CTestCaseB2BRoot::PrintStepName(const TDesC &aStepName) |
383 void CTestCaseB2BRoot::PrintStepName(const TDesC &aStepName) |
315 { |
384 { |
316 if (gVerboseOutput) |
385 if (gVerboseOutput) |
317 { |
386 { |
318 test.Printf(_L("--------------\n %S "), &aStepName); |
387 test.Printf(_L("--------------\n %S "), &aStepName); |
|
388 OstTraceExt1(TRACE_NORMAL, CTESTCASEB2BROOT_PRINTSTEPNAME, "--------------\n %S ", aStepName); |
319 // engine state |
389 // engine state |
320 CNotifyWatcherBase *pWatcher = iCollector.GetWatcher(EWatcherState); |
390 CNotifyWatcherBase *pWatcher = iCollector.GetWatcher(EWatcherState); |
321 if (pWatcher) |
391 if (pWatcher) |
322 { |
392 { |
323 TBuf<MAX_DSTRLEN> aDescription; |
393 TBuf<MAX_DSTRLEN> aDescription; |
324 RUsbOtgDriver::TOtgState aState = static_cast<RUsbOtgDriver::TOtgState>(pWatcher->GetEventValue()); |
394 RUsbOtgDriver::TOtgState aState = static_cast<RUsbOtgDriver::TOtgState>(pWatcher->GetEventValue()); |
325 |
395 |
326 OtgStateString(aState, aDescription); |
396 OtgStateString(aState, aDescription); |
327 LOG_VERBOSE3(_L("OTGState %d '%S' \n"), aState, &aDescription); |
397 LOG_VERBOSE3(_L("OTGState %d '%S' \n"), aState, &aDescription); |
|
398 if(gVerboseOutput) |
|
399 { |
|
400 OstTraceExt2(TRACE_VERBOSE, CTESTCASEB2BROOT_PRINTSTEPNAME_DUP01, "OTGState %d '%S' \n", aState, aDescription); |
|
401 } |
328 } |
402 } |
329 test.Printf(_L(" : time = %dms\n--------------\n"), iCollector.DurationElapsed()); |
403 test.Printf(_L(" : time = %dms\n--------------\n"), iCollector.DurationElapsed()); |
|
404 OstTrace1(TRACE_NORMAL, CTESTCASEB2BROOT_PRINTSTEPNAME_DUP02, " : time = %dms\n--------------\n", iCollector.DurationElapsed()); |
330 } |
405 } |
331 } |
406 } |
332 |
407 |
333 /* Default implementation which describes this as a B2B test-case |
408 /* Default implementation which describes this as a B2B test-case |
334 */ |
409 */ |
335 void CTestCaseB2BRoot::DescribePreconditions() |
410 void CTestCaseB2BRoot::DescribePreconditions() |
336 { |
411 { |
337 test.Printf(KTestTypeB2BMsg); // B2B |
412 test.Printf(KTestTypeB2BMsg); // B2B |
|
413 OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_DESCRIBEPRECONDITIONS, KTestTypeB2BMsg); // B2B |
338 if (gTestRoleMaster) |
414 if (gTestRoleMaster) |
|
415 { |
339 test.Printf(KRoleMasterMsg); |
416 test.Printf(KRoleMasterMsg); |
|
417 OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_DESCRIBEPRECONDITIONS_DUP01, KRoleMasterMsg); |
|
418 } |
340 else |
419 else |
|
420 { |
341 test.Printf(KRoleSlaveMsg); |
421 test.Printf(KRoleSlaveMsg); |
|
422 OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_DESCRIBEPRECONDITIONS_DUP02, KRoleSlaveMsg); |
|
423 } |
342 } |
424 } |
343 |
425 |
344 |
426 |
345 void CTestCaseB2BRoot::StepB2BPreconditions() |
427 void CTestCaseB2BRoot::StepB2BPreconditions() |
346 { |
428 { |
347 // prompt to insert connector |
429 // prompt to insert connector |
348 if (gTestRoleMaster) |
430 if (gTestRoleMaster) |
349 { // "B" device |
431 { // "B" device |
350 test.Printf(KInsertBCablePrompt); |
432 test.Printf(KInsertBCablePrompt); |
|
433 OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_STEPB2BPRECONDITIONS, KInsertBCablePrompt); |
351 } |
434 } |
352 else |
435 else |
353 { |
436 { |
354 test.Printf(KInsertACablePrompt); |
437 test.Printf(KInsertACablePrompt); |
|
438 OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_STEPB2BPRECONDITIONS_DUP01, KInsertACablePrompt); |
355 } |
439 } |
356 if (iAutomated) |
440 if (iAutomated) |
357 { |
441 { |
358 |
442 |
359 SelfComplete(); |
443 SelfComplete(); |
360 return; |
444 return; |
361 } |
445 } |
362 test.Printf(KPressAnyKeyToContinue); |
446 test.Printf(KPressAnyKeyToContinue); |
|
447 OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_STEPB2BPRECONDITIONS_DUP02, KPressAnyKeyToContinue); |
363 RequestCharacter(); |
448 RequestCharacter(); |
364 } |
449 } |
365 |
450 |
366 |
451 |
367 /* Test for A or B plug as relevant for MASTER/SLAVE role, fail the test if wrong |
452 /* Test for A or B plug as relevant for MASTER/SLAVE role, fail the test if wrong |
390 /* Clears the expected event Q just before calling the step, but not the |
477 /* Clears the expected event Q just before calling the step, but not the |
391 * recieved Q since the step may still inspect it using the EventReceivedAlready() method. |
478 * recieved Q since the step may still inspect it using the EventReceivedAlready() method. |
392 */ |
479 */ |
393 void CTestCaseB2BRoot::PreRunStep() |
480 void CTestCaseB2BRoot::PreRunStep() |
394 { |
481 { |
395 LOG_FUNC |
482 if(gVerboseOutput) |
|
483 { |
|
484 OstTraceFunctionEntry0(CTESTCASEB2BROOT_PRERUNSTEP); |
|
485 } |
396 |
486 |
397 iCollector.ClearAllEvents(EFalse, ETrue); |
487 iCollector.ClearAllEvents(EFalse, ETrue); |
398 } |
488 } |
399 |
489 |
400 |
490 |
401 void CTestCaseB2BRoot::PostRunStep() |
491 void CTestCaseB2BRoot::PostRunStep() |
402 { |
492 { |
403 LOG_FUNC |
493 if(gVerboseOutput) |
|
494 { |
|
495 OstTraceFunctionEntry0(CTESTCASEB2BROOT_POSTRUNSTEP); |
|
496 } |
404 // clear the recieved event Q, but not the expected Q |
497 // clear the recieved event Q, but not the expected Q |
405 iCollector.ClearAllEvents(ETrue, EFalse); |
498 iCollector.ClearAllEvents(ETrue, EFalse); |
406 |
499 |
407 } |
500 } |
408 |
501 |