kerneltest/e32test/usbho/t_otgdi/src/exampletestcase.cpp
changeset 253 d37db4dcc88d
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/usbho/t_otgdi/src/exampletestcase.cpp	Tue Aug 24 14:42:58 2010 +0100
+++ b/kerneltest/e32test/usbho/t_otgdi/src/exampletestcase.cpp	Tue Aug 24 14:49:21 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -27,6 +27,10 @@
 #include "testcasewd.h"
 #include "testcasefactory.h"
 #include "exampletestcase.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "exampletestcaseTraces.h"
+#endif
 
 
 
@@ -39,7 +43,10 @@
 
 CExampleTestCase* CExampleTestCase::NewL(TBool aHost)
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CEXAMPLETESTCASE_NEWL);
+	    }
 	CExampleTestCase* self = new (ELeave) CExampleTestCase(aHost);
 	CleanupStack::PushL(self);
 	self->ConstructL();
@@ -51,13 +58,19 @@
 CExampleTestCase::CExampleTestCase(TBool aHost)
 :	CTestCaseRoot(KTestCaseId, aHost)
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CEXAMPLETESTCASE_CEXAMPLETESTCASE);
+	    }
 	} 
 
 
 void CExampleTestCase::ConstructL()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CEXAMPLETESTCASE_CONSTRUCTL);
+	    }
 	BaseConstructL();
 	iWDTimer = CTestCaseWatchdog::NewL();
 	}
@@ -65,7 +78,10 @@
 
 CExampleTestCase::~CExampleTestCase()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CEXAMPLETESTCASE_DCEXAMPLETESTCASE);
+	    }
 
 	delete iWDTimer;
 	Cancel();
@@ -74,7 +90,10 @@
 
 void CExampleTestCase::ExecuteTestCaseL()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CEXAMPLETESTCASE_EXECUTETESTCASEL);
+	    }
 	iCaseStep = EFirstStep;
 
 	//	
@@ -87,11 +106,15 @@
 void CExampleTestCase::DescribePreconditions()
 	{
 	test.Printf(_L("This is an example test, there is nothing to do beforehand.\n"));
+	OstTrace0(TRACE_NORMAL, CEXAMPLETESTCASE_DESCRIBEPRECONDITIONS, "This is an example test, there is nothing to do beforehand.\n");
 	}
 	
 void CExampleTestCase::DoCancel()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CEXAMPLETESTCASE_DOCANCEL);
+	    }
 
 	}
 
@@ -107,6 +130,7 @@
 	CExampleTestCase * p = REINTERPRET_CAST(CExampleTestCase *,pThis);
 	// cancel any pending call, and then complete our active obj with a timeout value
 	test.Printf(_L("@@@ FuncA cancel a keyboard Read() @@@\n"));
+	OstTrace0(TRACE_NORMAL, CEXAMPLETESTCASE_FUNCA, "@@@ FuncA cancel a keyboard Read(@@@\n"));
 
 	p->iConsole->ReadCancel();
 
@@ -117,6 +141,7 @@
 	CExampleTestCase * p = REINTERPRET_CAST(CExampleTestCase *,pThis);
 	// cancel any pending call, and then complete our active obj with a timeout value
 	test.Printf(_L("@@@ FuncB cancel a 'B' keyboard Read() @@@\n"));
+	OstTrace0(TRACE_NORMAL, CEXAMPLETESTCASE_FUNCB, "@@@ FuncB cancel a 'B' keyboard Read(@@@\n"));
 
 	p->Cancel();
 	p->iConsole->ReadCancel();
@@ -133,43 +158,55 @@
 // handle event completion	
 void CExampleTestCase::RunStepL()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CEXAMPLETESTCASE_RUNSTEPL);
+	    }
 
 	// Obtain the completion code for this CActive obj.
 	TInt completionCode(iStatus.Int()); 
-	RDebug::Printf("Example test iStatus compl.=%d\n", completionCode);
-	//test.Printf(_L("Example test iStatus compl.=%d\n"), completionCode);
+	OstTrace1(TRACE_NORMAL, CEXAMPLETESTCASE_RUNSTEPL_DUP01, "Example test iStatus compl.=%d\n", completionCode);
 
 	switch(iCaseStep)
 		{
 		case EFirstStep:
 			iCaseStep=ESecondStep;
 			test.Printf(_L("Test step 1\n"));
+			OstTrace0(TRACE_NORMAL, CEXAMPLETESTCASE_RUNSTEPL_DUP03, "Test step 1\n");
 
 			SelfComplete();
 			break;
 		case ESecondStep:
 			iCaseStep=EThirdStep;
 			test.Printf(_L("Test step 2\n"));
+			OstTrace0(TRACE_NORMAL, CEXAMPLETESTCASE_RUNSTEPL_DUP04, "Test step 2\n");
 			test.Printf(_L("(this test step uses Keyboard)\n"));
+			OstTrace0(TRACE_NORMAL, CEXAMPLETESTCASE_RUNSTEPL_DUP05, "(this test step uses Keyboard\n"));
 			test.Printf(_L("Press ANY key once you have removed the 'A' connector...\n"));
+			OstTrace0(TRACE_NORMAL, CEXAMPLETESTCASE_RUNSTEPL_DUP06, "Press ANY key once you have removed the 'A' connector...\n");
 			RequestCharacter();
 			iWDTimer->IssueRequest(KDelayDurationForUserActivityMS, this, &FuncA);
 			break;
 		case EThirdStep:
 			test.Printf(_L("key was a '%c'\n"), iKeyCodeInput);
+			OstTrace1(TRACE_NORMAL, CEXAMPLETESTCASE_RUNSTEPL_DUP07, "key was a '%c'\n", iKeyCodeInput);
 			iWDTimer->Cancel();
 			iCaseStep=EFourthStep;
 			test.Printf(_L("Test step 3\n"));
+			OstTrace0(TRACE_NORMAL, CEXAMPLETESTCASE_RUNSTEPL_DUP08, "Test step 3\n");
 			test.Printf(_L("(this test step uses Keyboard)\n"));
+			OstTrace0(TRACE_NORMAL, CEXAMPLETESTCASE_RUNSTEPL_DUP09, "(this test step uses Keyboard\n"));
 			test.Printf(_L("Press <SPACE> key once you have removed the 'A' connector...\n"));
+			OstTrace0(TRACE_NORMAL, CEXAMPLETESTCASE_RUNSTEPL_DUP10, "Press <SPACE> key once you have removed the 'A' connector...\n");
 			RequestCharacter();
 			iWDTimer->IssueRequest(KDelayDurationForUserActivityMS, this, &FuncB);
 			
 			break;
 		case EFourthStep:
 			test.Printf(_L("key was a '%c'\n"), iKeyCodeInput);
+			OstTrace1(TRACE_NORMAL, CEXAMPLETESTCASE_RUNSTEPL_DUP11, "key was a '%c'\n", iKeyCodeInput);
 			test.Printf(_L("Test step 4\n"));
+			OstTrace0(TRACE_NORMAL, CEXAMPLETESTCASE_RUNSTEPL_DUP12, "Test step 4\n");
 			iWDTimer->Cancel();
 
 			iCaseStep=EFifthStep;
@@ -183,13 +220,16 @@
 		case EFifthStep:
 			iCaseStep=ESixthStep;
 			test.Printf(_L("Test step 5\n"));
+			OstTrace0(TRACE_NORMAL, CEXAMPLETESTCASE_RUNSTEPL_DUP13, "Test step 5\n");
 			test.Printf(_L("(this test uses a delay)\n"));
+			OstTrace0(TRACE_NORMAL, CEXAMPLETESTCASE_RUNSTEPL_DUP14, "(this test uses a delay\n"));
 			iTimer.After(iStatus, 500000);
 			SetActive();
 			break;
 		case ESixthStep:
 			iCaseStep=ELastStep;
 			test.Printf(_L("Test step 6(%d)\n"), completionCode);
+			OstTrace1(TRACE_NORMAL, CEXAMPLETESTCASE_RUNSTEPL_DUP15, "Test step 6(%d)\n", completionCode);
 			RequestCharacter();
 			iConsole->ReadCancel();
 			Cancel();
@@ -200,12 +240,12 @@
 		case ELastStep:
 			iCaseStep=ESecondStep;
 			test.Printf(_L("LAST step7 code (%d)\n"), completionCode);
+			OstTrace1(TRACE_NORMAL, CEXAMPLETESTCASE_RUNSTEPL_DUP16, "LAST step7 code (%d)\n", completionCode);
 			TestPolicy().SignalTestComplete(KErrNone);
 			return TestPassed();
 			//break;
 
 		default:
-			//test.Printf(_L("<Error> unknown test step"));
 			Cancel();
 			TestFailed(KErrCorrupt, _L("unknown test step"));
 			break;