diff -r a179b74831c9 -r c1f20ce4abcf kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0472.cpp --- a/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0472.cpp Thu Aug 19 11:14:22 2010 +0300 +++ b/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0472.cpp Tue Aug 31 16:34:26 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" @@ -22,6 +22,10 @@ #include #include "UsbDescriptorOffsets.h" #include "TestPolicy.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "PBASE-T_USBDI-0472Traces.h" +#endif namespace NUnitTesting_USBDI { @@ -31,10 +35,12 @@ CUT_PBASE_T_USBDI_0472* CUT_PBASE_T_USBDI_0472::NewL(TBool aHostRole) { + OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_NEWL_ENTRY, aHostRole ); CUT_PBASE_T_USBDI_0472* self = new (ELeave) CUT_PBASE_T_USBDI_0472(aHostRole); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(self); + OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_NEWL_EXIT, ( TUint )( self ) ); return self; } @@ -42,19 +48,23 @@ CUT_PBASE_T_USBDI_0472::CUT_PBASE_T_USBDI_0472(TBool aHostRole) : CBaseTestCase(KTestCaseId,aHostRole) { + OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0472_CUT_PBASE_T_USBDI_0472_ENTRY, this ); + OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_CUT_PBASE_T_USBDI_0472_EXIT, this ); } void CUT_PBASE_T_USBDI_0472::ConstructL() { + OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_CONSTRUCTL_ENTRY, this ); iTestDevice = new RUsbDeviceVendor(this); BaseConstructL(); + OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_CONSTRUCTL_EXIT, this ); } CUT_PBASE_T_USBDI_0472::~CUT_PBASE_T_USBDI_0472() { - LOG_FUNC + OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_CUT_PBASE_T_USBDI_0472_ENTRY_DUP01, this ); Cancel(); delete iClientAction; @@ -64,52 +74,57 @@ iTestDevice->Close(); } delete iTestDevice; + OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_CUT_PBASE_T_USBDI_0472_EXIT_DUP01, this ); } void CUT_PBASE_T_USBDI_0472::ExecuteHostTestCaseL() { - LOG_FUNC + OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_EXECUTEHOSTTESTCASEL_ENTRY, this ); iActorFDF = CActorFDF::NewL(*this); iClientAction = new (ELeave) CEp0Transfer(iInterface0); iCaseStep = EConnectDevice; iActorFDF->Monitor(); TimeoutIn(30); + OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_EXECUTEHOSTTESTCASEL_EXIT, this ); } void CUT_PBASE_T_USBDI_0472::ExecuteDeviceTestCaseL() { - LOG_FUNC + OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_EXECUTEDEVICETESTCASEL_ENTRY, this ); iTestDevice->OpenL(TestCaseId()); iTestDevice->SubscribeToReports(iStatus); SetActive(); iTestDevice->SoftwareConnect(); + OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_EXECUTEDEVICETESTCASEL_EXIT, this ); } void CUT_PBASE_T_USBDI_0472::HostDoCancel() { - LOG_FUNC + OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_HOSTDOCANCEL_ENTRY, this ); // Cancel the test step action timeout timer CancelTimeout(); + OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_HOSTDOCANCEL_EXIT, this ); } void CUT_PBASE_T_USBDI_0472::DeviceDoCancel() { - LOG_FUNC + OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_DEVICEDOCANCEL_ENTRY, this ); // Cancel the test device iTestDevice->CancelSubscriptionToReports(); + OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_DEVICEDOCANCEL_EXIT, this ); } void CUT_PBASE_T_USBDI_0472::DeviceInsertedL(TUint aDeviceHandle) { - LOG_FUNC + OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_ENTRY, this ); Cancel(); TInt err(KErrNone); @@ -121,12 +136,13 @@ { // Incorrect device for this test case - RDebug::Printf(" Incorrect device serial number (%S) connected for this test case (%S)", - KErrNotFound,&testDevice.SerialNumber(),&TestCaseId()); + OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL, " 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_0472_DEVICEINSERTEDL_EXIT, this ); return; } @@ -137,50 +153,50 @@ case EConnectDevice: { // Validate vendor identity - RDebug::Printf("Vendor identity: 0x%04x",testDevice.VendorId()); + OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP01, "Vendor identity: 0x%04x",testDevice.VendorId()); if(testDevice.VendorId() != 0x0E22) { - RDebug::Printf(" Vendor identity is not 0x0E22"); + OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP02, " Vendor identity is not 0x0E22"); return TestFailed(KErrCorrupt); } // Validate product information - RDebug::Printf("Usb device supported specification: 0x%04x",testDevice.DeviceSpec()); + OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP03, "Usb device supported specification: 0x%04x",testDevice.DeviceSpec()); if(testDevice.DeviceSpec() != 0x0200) { - RDebug::Printf(" Usb device supported specification is not 2.0"); + OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP04, " Usb device supported specification is not 2.0"); return TestFailed(KErrCorrupt); } - RDebug::Printf("Usb product identity: 0x%04x",testDevice.ProductId()); + OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP05, "Usb product identity: 0x%04x",testDevice.ProductId()); if(testDevice.ProductId() != 0x0040) { - RDebug::Printf(" Usb product idenity is not 0x0040"); + OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP06, " Usb product idenity is not 0x0040"); return TestFailed(KErrCorrupt); } - RDebug::Printf("testDevice.ConfigurationString() = %S",&testDevice.ConfigurationString()); + OstTraceExt1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP07, "testDevice.ConfigurationString() = %S",testDevice.ConfigurationString()); gtest(KErrNone == testDevice.ConfigurationString().Compare(KConfigurationString())); - RDebug::Printf("testDevice.Manufacturer() = %S",&testDevice.Manufacturer()); + OstTraceExt1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP08, "testDevice.Manufacturer() = %S",testDevice.Manufacturer()); gtest(KErrNone == testDevice.Manufacturer().Compare(KManufacturer())); - RDebug::Printf("testDevice.SerialNumber = %s",&testDevice.SerialNumber()); + OstTraceExt1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP09, "testDevice.SerialNumber = %s",testDevice.SerialNumber()); gtest(KErrNone == testDevice.SerialNumber().Compare(KTestCaseId())); - RDebug::Printf("Waiting for device removal"); + OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP10, "Waiting for device removal"); iCaseStep = ERemoveDevice; TUint32 token; err = testDevice.Device().GetTokenForInterface(0,token); if(err != KErrNone) { - RDebug::Printf(" Unable to get token for interface 0",err); + OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP11, " Unable to get token for interface 0",err); return TestFailed(err); } err = iInterface0.Open(token); if(err != KErrNone) { - RDebug::Printf(" Unable to open interface 0",err); + OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP12, " Unable to open interface 0",err); return TestFailed(err); } @@ -197,7 +213,7 @@ break; case EConnectCancelled: - RDebug::Printf(" Bus event cancellation not successful"); + OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP13, " Bus event cancellation not successful"); TestFailed(KErrCorrupt); break; @@ -207,13 +223,13 @@ err = testDevice.Device().GetTokenForInterface(0,token); if(err != KErrNone) { - RDebug::Printf(" Unable to get token for interface 0",err); + OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP14, " Unable to get token for interface 0",err); return TestFailed(err); } err = iInterface0.Open(token); if(err != KErrNone) { - RDebug::Printf(" Unable to open interface 0",err); + OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP15, " Unable to open interface 0",err); return TestFailed(err); } @@ -224,16 +240,17 @@ break; default: - RDebug::Printf(" Test case actions out of sync"); + OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP16, " Test case actions out of sync"); TestFailed(KErrCorrupt); break; } + OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_EXIT_DUP01, this ); } void CUT_PBASE_T_USBDI_0472::Ep0TransferCompleteL(TInt aCompletionCode) { - LOG_FUNC + OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0472_EP0TRANSFERCOMPLETEL_ENTRY, this ); switch(iCaseStep) { @@ -256,16 +273,17 @@ break; default: - RDebug::Printf(" Unknown test step",KErrCorrupt); + OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_EP0TRANSFERCOMPLETEL, " Unknown test step",KErrCorrupt); TestFailed(KErrCorrupt); break; } + OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_EP0TRANSFERCOMPLETEL_EXIT, this ); } void CUT_PBASE_T_USBDI_0472::DeviceRemovedL(TUint aDeviceHandle) { - LOG_FUNC + OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0472_DEVICEREMOVEDL_ENTRY, this ); Cancel(); @@ -281,28 +299,32 @@ break; default: - RDebug::Printf(" Test case actions out of sync"); + OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEREMOVEDL, " Test case actions out of sync"); TestFailed(KErrCorrupt); break; } + OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_DEVICEREMOVEDL_EXIT, this ); } void CUT_PBASE_T_USBDI_0472::BusErrorL(TInt aError) { + OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0472_BUSERRORL_ENTRY, this ); // This test case handles no failiures on the bus TestFailed(aError); + OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_BUSERRORL_EXIT, this ); } void CUT_PBASE_T_USBDI_0472::DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState, RUsbDevice::TDeviceState aNewState,TInt aCompletionCode) { - LOG_FUNC + OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0472_DEVICESTATECHANGEL_ENTRY, this ); + OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_DEVICESTATECHANGEL_EXIT, this ); } void CUT_PBASE_T_USBDI_0472::HostRunL() { - LOG_FUNC + OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_HOSTRUNL_ENTRY, this ); // Obtain the completion code TInt completionCode(iStatus.Int()); @@ -312,28 +334,29 @@ if(iCaseStep == EConnectCancelled) { // not a time-out - RDebug::Printf("Timer elapsed, reactivating notifications now"); + OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_HOSTRUNL, "Timer elapsed, reactivating notifications now"); iCaseStep = EPassed; iActorFDF->Monitor(); } else { // Action timeout - RDebug::Printf(" Action timeout"); + OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_HOSTRUNL_DUP01, " Action timeout"); TestFailed(KErrTimedOut); } } else { - RDebug::Printf(" Timeout timer could not complete",completionCode); + OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_HOSTRUNL_DUP02, " Timeout timer could not complete",completionCode); TestFailed(completionCode); } + OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_HOSTRUNL_EXIT, this ); } void CUT_PBASE_T_USBDI_0472::DeviceRunL() { - LOG_FUNC + OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_DEVICERUNL_ENTRY, this ); // Disconnect the device @@ -342,6 +365,7 @@ // Complete the test case request TestPolicy().SignalTestComplete(iStatus.Int()); + OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_DEVICERUNL_EXIT, this ); }