kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0479.cpp
changeset 259 57b9594f5772
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0479.cpp	Wed Aug 18 11:08:29 2010 +0300
+++ b/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0479.cpp	Thu Sep 02 21:54:16 2010 +0300
@@ -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"
@@ -19,6 +19,10 @@
 #include "PBASE-T_USBDI-0479.h"
 #include "testpolicy.h"
 #include "modelleddevices.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "PBASE-T_USBDI-0479Traces.h"
+#endif
 
 
 namespace NUnitTesting_USBDI
@@ -29,10 +33,12 @@
 
 CUT_PBASE_T_USBDI_0479* CUT_PBASE_T_USBDI_0479::NewL(TBool aHostRole)
 	{
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0479_NEWL_ENTRY, aHostRole );
 	CUT_PBASE_T_USBDI_0479* self = new (ELeave) CUT_PBASE_T_USBDI_0479(aHostRole);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_NEWL_EXIT, ( TUint )( self ) );
 	return self;
 	}
 	
@@ -41,19 +47,23 @@
 :	CBaseTestCase(KTestCaseId,aHostRole),
 	iCaseStep(EInProgress)
 	{
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0479_CUT_PBASE_T_USBDI_0479_ENTRY, this );
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_CUT_PBASE_T_USBDI_0479_EXIT, this );
 	} 
 
 
 void CUT_PBASE_T_USBDI_0479::ConstructL()
 	{
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0479_CONSTRUCTL_ENTRY, this );
 	iTestDevice = new RUsbDeviceVendor(this);
 	BaseConstructL();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_CONSTRUCTL_EXIT, this );
 	}
 
 
 CUT_PBASE_T_USBDI_0479::~CUT_PBASE_T_USBDI_0479()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0479_CUT_PBASE_T_USBDI_0479_ENTRY_DUP01, this );
 	
 	Cancel();
 	
@@ -67,56 +77,63 @@
 		iTestDevice->Close();
 		}		
 	delete iTestDevice;
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_CUT_PBASE_T_USBDI_0479_EXIT_DUP01, this );
 	}
 	
 void CUT_PBASE_T_USBDI_0479::ExecuteHostTestCaseL()	
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0479_EXECUTEHOSTTESTCASEL_ENTRY, this );
 	
 	iActorFDF = CActorFDF::NewL(*this);
 	iClientAction = new (ELeave) CEp0Transfer(iUsbInterface0);
 	iActorFDF->Monitor();
 	TimeoutIn(30);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_EXECUTEHOSTTESTCASEL_EXIT, this );
 	}
 	
 void CUT_PBASE_T_USBDI_0479::HostDoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0479_HOSTDOCANCEL_ENTRY, this );
 	
 	// Cancel timing out the test step
 	
 	CancelTimeout();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_HOSTDOCANCEL_EXIT, this );
 	}
 	
 	
 void CUT_PBASE_T_USBDI_0479::ExecuteDeviceTestCaseL()	
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0479_EXECUTEDEVICETESTCASEL_ENTRY, this );
 	
 	iTestDevice->OpenL(TestCaseId());
 	iTestDevice->SubscribeToReports(iStatus);
 	SetActive();
 	iTestDevice->SoftwareConnect();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_EXECUTEDEVICETESTCASEL_EXIT, this );
 	}
 	
 void CUT_PBASE_T_USBDI_0479::DeviceDoCancel()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0479_DEVICEDOCANCEL_ENTRY, this );
 	
 	// Cancel the device	
 	iTestDevice->CancelSubscriptionToReports();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_DEVICEDOCANCEL_EXIT, this );
 	}
 	
 	
 void CUT_PBASE_T_USBDI_0479::DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,
 	RUsbDevice::TDeviceState aNewState,TInt aCompletionCode)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0479_DEVICESTATECHANGEL_ENTRY, this );
 	Cancel();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_DEVICESTATECHANGEL_EXIT, this );
 	}
 	
 void CUT_PBASE_T_USBDI_0479::DeviceInsertedL(TUint aDeviceHandle)
 	{
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0479_DEVICEINSERTEDL_ENTRY, this );
 	Cancel();
 	TInt err(KErrNone);
 	
@@ -126,12 +143,13 @@
 		{
 		// Incorrect device for this test case	
 
-		RDebug::Printf("<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
-			KErrNotFound,&testDevice.SerialNumber(),&TestCaseId());
+		OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0479_DEVICEINSERTEDL, "<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
+			KErrNotFound,testDevice.SerialNumber(),TestCaseId());
 
 		// Start the connection timeout again
 
 		TimeoutIn(30);
+		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_DEVICEINSERTEDL_EXIT, this );
 		return;
 		}
 
@@ -141,13 +159,13 @@
 	err = testDevice.Device().GetTokenForInterface(0,validToken);
 	if(err != KErrNone)
 		{
-		RDebug::Printf("<Error %d> Token for interface could not be retrieved",err);
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0479_DEVICEINSERTEDL_DUP01, "<Error %d> Token for interface could not be retrieved",err);
 		return TestFailed(err);
 		}
 	err = iUsbInterface0.Open(validToken); // Default interface setting 0
 	if(err != KErrNone)
 		{
-		RDebug::Printf("<Error %d> Unable to open interface 0 using token %d",err,validToken);
+		OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_0479_DEVICEINSERTEDL_DUP02, "<Error %d> Unable to open interface 0 using token %d",err,validToken);
 		return TestFailed(err);
 		}
 	
@@ -156,54 +174,57 @@
 		{
 		TBuf<64> msg;
 		msg.Format(_L("<Error %d> Able to open an interface that is not present"),KErrCorrupt);
-		RDebug::Print(msg);
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0479_DEVICEINSERTEDL_DUP03, msg);
 		iCaseStep = EFailed;
 		TTestCaseFailed request(KErrCorrupt,msg);
 		iClientAction->SendRequest(request,this);
 		}
 	else
 		{
-		RDebug::Printf("Opening interface with invalid token failed with %d",err);
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0479_DEVICEINSERTEDL_DUP04, "Opening interface with invalid token failed with %d",err);
 		User::After(1000000);
 		iCaseStep = EPassed;
 		TTestCasePassed request;
 		iClientAction->SendRequest(request,this);	
 		}
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_DEVICEINSERTEDL_EXIT_DUP01, this );
 	}
 	
 	
 void CUT_PBASE_T_USBDI_0479::DeviceRemovedL(TUint aDeviceHandle)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0479_DEVICEREMOVEDL_ENTRY, this );
 	
 	// The test device should not be removed until the test case has passed
 	// so this test case has not completed, and state this event as an error
 
 	TestFailed(KErrDisconnected);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_DEVICEREMOVEDL_EXIT, this );
 	}
 	
 	
 void CUT_PBASE_T_USBDI_0479::BusErrorL(TInt aError)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0479_BUSERRORL_ENTRY, this );
 	
 	// This test case handles no failiures on the bus
 	
 	TestFailed(aError);	
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_BUSERRORL_EXIT, this );
 	}
 
 
 void CUT_PBASE_T_USBDI_0479::Ep0TransferCompleteL(TInt aCompletionCode)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0479_EP0TRANSFERCOMPLETEL_ENTRY, this );
 	
-	RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
+	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0479_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
 	
 	if(aCompletionCode != KErrNone)
 		{	
 		TBuf<256> msg;
 		msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode);
-		RDebug::Print(msg);
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0479_EP0TRANSFERCOMPLETEL_DUP01, msg);
 		}
 
 	if(iCaseStep == EPassed)
@@ -220,30 +241,33 @@
 		{
 		return TestFailed(KErrCompletion);
 		}
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_EP0TRANSFERCOMPLETEL_EXIT, this );
 	}
 	
 	
 void CUT_PBASE_T_USBDI_0479::HostRunL()
 	{
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0479_HOSTRUNL_ENTRY, this );
 	// Obtain the completion code
 	TInt completionCode(iStatus.Int());
 	
 	if(completionCode == KErrNone)
 		{
 		// Action timeout
-		RDebug::Printf("<Error> Action timeout");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0479_HOSTRUNL, "<Error> Action timeout");
 		TestFailed(KErrTimedOut);
 		}
 	else
 		{
-		RDebug::Printf("<Error %d> Timeout timer could not complete",completionCode);
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0479_HOSTRUNL_DUP01, "<Error %d> Timeout timer could not complete",completionCode);
 		TestFailed(completionCode);
 		}
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_HOSTRUNL_EXIT, this );
 	}
 
 void CUT_PBASE_T_USBDI_0479::DeviceRunL()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0479_DEVICERUNL_ENTRY, this );
 	
 	// Disconnect the device
 	
@@ -252,6 +276,7 @@
 	// Complete the test case request
 	
 	TestPolicy().SignalTestComplete(iStatus.Int());
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0479_DEVICERUNL_EXIT, this );
 	}