kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0472.cpp
changeset 253 d37db4dcc88d
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
252:0a40b8675b23 253:d37db4dcc88d
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    20 #include <e32test.h>
    20 #include <e32test.h>
    21 #include <d32usbc.h>
    21 #include <d32usbc.h>
    22 #include <e32debug.h>
    22 #include <e32debug.h>
    23 #include "UsbDescriptorOffsets.h"
    23 #include "UsbDescriptorOffsets.h"
    24 #include "TestPolicy.h"
    24 #include "TestPolicy.h"
       
    25 #include "OstTraceDefinitions.h"
       
    26 #ifdef OST_TRACE_COMPILER_IN_USE
       
    27 #include "PBASE-T_USBDI-0472Traces.h"
       
    28 #endif
    25 
    29 
    26 namespace NUnitTesting_USBDI
    30 namespace NUnitTesting_USBDI
    27 	{
    31 	{
    28 	
    32 	
    29 _LIT(KTestCaseId,"PBASE-T_USBDI-0472");
    33 _LIT(KTestCaseId,"PBASE-T_USBDI-0472");
    30 const TFunctorTestCase<CUT_PBASE_T_USBDI_0472,TBool> CUT_PBASE_T_USBDI_0472::iFunctor(KTestCaseId);	
    34 const TFunctorTestCase<CUT_PBASE_T_USBDI_0472,TBool> CUT_PBASE_T_USBDI_0472::iFunctor(KTestCaseId);	
    31 
    35 
    32 CUT_PBASE_T_USBDI_0472* CUT_PBASE_T_USBDI_0472::NewL(TBool aHostRole)
    36 CUT_PBASE_T_USBDI_0472* CUT_PBASE_T_USBDI_0472::NewL(TBool aHostRole)
    33 	{
    37 	{
       
    38 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_NEWL_ENTRY, aHostRole );
    34 	CUT_PBASE_T_USBDI_0472* self = new (ELeave) CUT_PBASE_T_USBDI_0472(aHostRole);
    39 	CUT_PBASE_T_USBDI_0472* self = new (ELeave) CUT_PBASE_T_USBDI_0472(aHostRole);
    35 	CleanupStack::PushL(self);
    40 	CleanupStack::PushL(self);
    36 	self->ConstructL();
    41 	self->ConstructL();
    37 	CleanupStack::Pop(self);
    42 	CleanupStack::Pop(self);
       
    43 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_NEWL_EXIT, ( TUint )( self ) );
    38 	return self;
    44 	return self;
    39 	}
    45 	}
    40 	
    46 	
    41 
    47 
    42 CUT_PBASE_T_USBDI_0472::CUT_PBASE_T_USBDI_0472(TBool aHostRole)
    48 CUT_PBASE_T_USBDI_0472::CUT_PBASE_T_USBDI_0472(TBool aHostRole)
    43 :	CBaseTestCase(KTestCaseId,aHostRole)
    49 :	CBaseTestCase(KTestCaseId,aHostRole)
    44 	{
    50 	{
       
    51 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0472_CUT_PBASE_T_USBDI_0472_ENTRY, this );
       
    52 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_CUT_PBASE_T_USBDI_0472_EXIT, this );
    45 	} 
    53 	} 
    46 
    54 
    47 
    55 
    48 void CUT_PBASE_T_USBDI_0472::ConstructL()
    56 void CUT_PBASE_T_USBDI_0472::ConstructL()
    49 	{
    57 	{
       
    58 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_CONSTRUCTL_ENTRY, this );
    50 	iTestDevice = new RUsbDeviceVendor(this);
    59 	iTestDevice = new RUsbDeviceVendor(this);
    51 	BaseConstructL();
    60 	BaseConstructL();
       
    61 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_CONSTRUCTL_EXIT, this );
    52 	}
    62 	}
    53 
    63 
    54 
    64 
    55 CUT_PBASE_T_USBDI_0472::~CUT_PBASE_T_USBDI_0472()
    65 CUT_PBASE_T_USBDI_0472::~CUT_PBASE_T_USBDI_0472()
    56 	{
    66 	{
    57 	LOG_FUNC
    67 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_CUT_PBASE_T_USBDI_0472_ENTRY_DUP01, this );
    58 	Cancel();
    68 	Cancel();
    59 
    69 
    60 	delete iClientAction;
    70 	delete iClientAction;
    61 	delete iActorFDF;
    71 	delete iActorFDF;
    62 	if(!IsHost() && iTestDevice)
    72 	if(!IsHost() && iTestDevice)
    63 		{
    73 		{
    64 		iTestDevice->Close();
    74 		iTestDevice->Close();
    65 		}		
    75 		}		
    66 	delete iTestDevice;
    76 	delete iTestDevice;
       
    77 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_CUT_PBASE_T_USBDI_0472_EXIT_DUP01, this );
    67 	}
    78 	}
    68 
    79 
    69 
    80 
    70 void CUT_PBASE_T_USBDI_0472::ExecuteHostTestCaseL()
    81 void CUT_PBASE_T_USBDI_0472::ExecuteHostTestCaseL()
    71 	{
    82 	{
    72 	LOG_FUNC
    83 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_EXECUTEHOSTTESTCASEL_ENTRY, this );
    73 	iActorFDF = CActorFDF::NewL(*this);
    84 	iActorFDF = CActorFDF::NewL(*this);
    74 	iClientAction = new (ELeave) CEp0Transfer(iInterface0);
    85 	iClientAction = new (ELeave) CEp0Transfer(iInterface0);
    75 	iCaseStep = EConnectDevice;
    86 	iCaseStep = EConnectDevice;
    76 	iActorFDF->Monitor();
    87 	iActorFDF->Monitor();
    77 	TimeoutIn(30);
    88 	TimeoutIn(30);
       
    89 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_EXECUTEHOSTTESTCASEL_EXIT, this );
    78 	}
    90 	}
    79 
    91 
    80 void CUT_PBASE_T_USBDI_0472::ExecuteDeviceTestCaseL()
    92 void CUT_PBASE_T_USBDI_0472::ExecuteDeviceTestCaseL()
    81 	{
    93 	{
    82 	LOG_FUNC
    94 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_EXECUTEDEVICETESTCASEL_ENTRY, this );
    83 	
    95 	
    84 	iTestDevice->OpenL(TestCaseId());
    96 	iTestDevice->OpenL(TestCaseId());
    85 	iTestDevice->SubscribeToReports(iStatus);	
    97 	iTestDevice->SubscribeToReports(iStatus);	
    86 	SetActive();
    98 	SetActive();
    87 	iTestDevice->SoftwareConnect();
    99 	iTestDevice->SoftwareConnect();
       
   100 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_EXECUTEDEVICETESTCASEL_EXIT, this );
    88 	}
   101 	}
    89 	
   102 	
    90 void CUT_PBASE_T_USBDI_0472::HostDoCancel()
   103 void CUT_PBASE_T_USBDI_0472::HostDoCancel()
    91 	{
   104 	{
    92 	LOG_FUNC
   105 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_HOSTDOCANCEL_ENTRY, this );
    93 	
   106 	
    94 	// Cancel the test step action timeout timer
   107 	// Cancel the test step action timeout timer
    95 	
   108 	
    96 	CancelTimeout();
   109 	CancelTimeout();
       
   110 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_HOSTDOCANCEL_EXIT, this );
    97 	}
   111 	}
    98 
   112 
    99 
   113 
   100 void CUT_PBASE_T_USBDI_0472::DeviceDoCancel()
   114 void CUT_PBASE_T_USBDI_0472::DeviceDoCancel()
   101 	{
   115 	{
   102 	LOG_FUNC
   116 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_DEVICEDOCANCEL_ENTRY, this );
   103 	
   117 	
   104 	// Cancel the test device
   118 	// Cancel the test device
   105 	
   119 	
   106 	iTestDevice->CancelSubscriptionToReports();
   120 	iTestDevice->CancelSubscriptionToReports();
       
   121 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_DEVICEDOCANCEL_EXIT, this );
   107 	}
   122 	}
   108 	
   123 	
   109 	
   124 	
   110 void CUT_PBASE_T_USBDI_0472::DeviceInsertedL(TUint aDeviceHandle)
   125 void CUT_PBASE_T_USBDI_0472::DeviceInsertedL(TUint aDeviceHandle)
   111 	{
   126 	{
   112 	LOG_FUNC
   127     OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_ENTRY, this );
   113 
   128 
   114 	Cancel();
   129 	Cancel();
   115 	TInt err(KErrNone);
   130 	TInt err(KErrNone);
   116 	
   131 	
   117 	// Validate that device is as expected
   132 	// Validate that device is as expected
   119 	CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle);
   134 	CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle);
   120 	if(testDevice.SerialNumber().Compare(TestCaseId()) != 0)
   135 	if(testDevice.SerialNumber().Compare(TestCaseId()) != 0)
   121 		{
   136 		{
   122 		// Incorrect device for this test case	
   137 		// Incorrect device for this test case	
   123 
   138 
   124 		RDebug::Printf("<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
   139 		OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL, "<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
   125 			KErrNotFound,&testDevice.SerialNumber(),&TestCaseId());
   140 			KErrNotFound,testDevice.SerialNumber(),TestCaseId());
   126 
   141 
   127 		// Start the connection timeout again
   142 		// Start the connection timeout again
   128 
   143 
   129 		TimeoutIn(30);
   144 		TimeoutIn(30);
       
   145 		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_EXIT, this );
   130 		return;
   146 		return;
   131 		}	
   147 		}	
   132 		
   148 		
   133 	// Perform the correct test step
   149 	// Perform the correct test step
   134 		
   150 		
   135 	switch(iCaseStep)
   151 	switch(iCaseStep)
   136 		{
   152 		{
   137 		case EConnectDevice:
   153 		case EConnectDevice:
   138 			{
   154 			{
   139 			// Validate vendor identity
   155 			// Validate vendor identity
   140 			RDebug::Printf("Vendor identity: 0x%04x",testDevice.VendorId());
   156 			OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP01, "Vendor identity: 0x%04x",testDevice.VendorId());
   141 			if(testDevice.VendorId() != 0x0E22)
   157 			if(testDevice.VendorId() != 0x0E22)
   142 				{
   158 				{
   143 				RDebug::Printf("<Error> Vendor identity is not 0x0E22");
   159 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP02, "<Error> Vendor identity is not 0x0E22");
   144 				return TestFailed(KErrCorrupt);
   160 				return TestFailed(KErrCorrupt);
   145 				}
   161 				}
   146 				
   162 				
   147 			// Validate product information
   163 			// Validate product information
   148 			RDebug::Printf("Usb device supported specification: 0x%04x",testDevice.DeviceSpec());
   164 			OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP03, "Usb device supported specification: 0x%04x",testDevice.DeviceSpec());
   149 			if(testDevice.DeviceSpec() != 0x0200)
   165 			if(testDevice.DeviceSpec() != 0x0200)
   150 				{
   166 				{
   151 				RDebug::Printf("<Error> Usb device supported specification is not 2.0");
   167 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP04, "<Error> Usb device supported specification is not 2.0");
   152 				return TestFailed(KErrCorrupt);
   168 				return TestFailed(KErrCorrupt);
   153 				}
   169 				}
   154 			RDebug::Printf("Usb product identity: 0x%04x",testDevice.ProductId());
   170 			OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP05, "Usb product identity: 0x%04x",testDevice.ProductId());
   155 			if(testDevice.ProductId() != 0x0040)
   171 			if(testDevice.ProductId() != 0x0040)
   156 				{
   172 				{
   157 				RDebug::Printf("<Error> Usb product idenity is not 0x0040");
   173 				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP06, "<Error> Usb product idenity is not 0x0040");
   158 				return TestFailed(KErrCorrupt);
   174 				return TestFailed(KErrCorrupt);
   159 				}
   175 				}
   160 		
   176 		
   161 			RDebug::Printf("testDevice.ConfigurationString() = %S",&testDevice.ConfigurationString());		
   177 			OstTraceExt1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP07, "testDevice.ConfigurationString() = %S",testDevice.ConfigurationString());		
   162 			gtest(KErrNone == testDevice.ConfigurationString().Compare(KConfigurationString()));		
   178 			gtest(KErrNone == testDevice.ConfigurationString().Compare(KConfigurationString()));		
   163 					
   179 					
   164 			RDebug::Printf("testDevice.Manufacturer() = %S",&testDevice.Manufacturer());
   180 			OstTraceExt1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP08, "testDevice.Manufacturer() = %S",testDevice.Manufacturer());
   165 			gtest(KErrNone == testDevice.Manufacturer().Compare(KManufacturer()));
   181 			gtest(KErrNone == testDevice.Manufacturer().Compare(KManufacturer()));
   166 			
   182 			
   167 			RDebug::Printf("testDevice.SerialNumber = %s",&testDevice.SerialNumber());	
   183 			OstTraceExt1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP09, "testDevice.SerialNumber = %s",testDevice.SerialNumber());	
   168 			gtest(KErrNone == testDevice.SerialNumber().Compare(KTestCaseId()));
   184 			gtest(KErrNone == testDevice.SerialNumber().Compare(KTestCaseId()));
   169 		
   185 		
   170 			RDebug::Printf("Waiting for device removal");
   186 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP10, "Waiting for device removal");
   171 			iCaseStep = ERemoveDevice;
   187 			iCaseStep = ERemoveDevice;
   172 			
   188 			
   173 			TUint32 token;
   189 			TUint32 token;
   174 			err = testDevice.Device().GetTokenForInterface(0,token);
   190 			err = testDevice.Device().GetTokenForInterface(0,token);
   175 			if(err != KErrNone)
   191 			if(err != KErrNone)
   176 				{
   192 				{
   177 				RDebug::Printf("<Error %d> Unable to get token for interface 0",err);
   193 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP11, "<Error %d> Unable to get token for interface 0",err);
   178 				return TestFailed(err);
   194 				return TestFailed(err);
   179 				}
   195 				}
   180 			err = iInterface0.Open(token);
   196 			err = iInterface0.Open(token);
   181 			if(err != KErrNone)
   197 			if(err != KErrNone)
   182 				{
   198 				{
   183 				RDebug::Printf("<Error %d> Unable to open interface 0",err);
   199 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP12, "<Error %d> Unable to open interface 0",err);
   184 				return TestFailed(err);
   200 				return TestFailed(err);
   185 				}
   201 				}
   186 			
   202 			
   187 			// Send request to client to reconnect in 3 seconds
   203 			// Send request to client to reconnect in 3 seconds
   188 			
   204 			
   195 			TimeoutIn(30);
   211 			TimeoutIn(30);
   196 			}
   212 			}
   197 			break;
   213 			break;
   198 			
   214 			
   199 		case EConnectCancelled:
   215 		case EConnectCancelled:
   200 			RDebug::Printf("<Error> Bus event cancellation not successful");
   216 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP13, "<Error> Bus event cancellation not successful");
   201 			TestFailed(KErrCorrupt);
   217 			TestFailed(KErrCorrupt);
   202 			break;
   218 			break;
   203 			
   219 			
   204 		case EPassed:	// Test case has been successfully concluded
   220 		case EPassed:	// Test case has been successfully concluded
   205 			{
   221 			{
   206 			TUint32 token;
   222 			TUint32 token;
   207 			err = testDevice.Device().GetTokenForInterface(0,token);
   223 			err = testDevice.Device().GetTokenForInterface(0,token);
   208 			if(err != KErrNone)
   224 			if(err != KErrNone)
   209 				{
   225 				{
   210 				RDebug::Printf("<Error %d> Unable to get token for interface 0",err);
   226 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP14, "<Error %d> Unable to get token for interface 0",err);
   211 				return TestFailed(err);
   227 				return TestFailed(err);
   212 				}
   228 				}
   213 			err = iInterface0.Open(token);
   229 			err = iInterface0.Open(token);
   214 			if(err != KErrNone)
   230 			if(err != KErrNone)
   215 				{
   231 				{
   216 				RDebug::Printf("<Error %d> Unable to open interface 0",err);
   232 				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP15, "<Error %d> Unable to open interface 0",err);
   217 				return TestFailed(err);
   233 				return TestFailed(err);
   218 				}
   234 				}
   219 	
   235 	
   220 			// Send test case passed request to client
   236 			// Send test case passed request to client
   221 			TTestCasePassed request;
   237 			TTestCasePassed request;
   222 			iClientAction->SendRequest(request,this);
   238 			iClientAction->SendRequest(request,this);
   223 			}
   239 			}
   224 			break;
   240 			break;
   225 			
   241 			
   226 		default:
   242 		default:
   227 			RDebug::Printf("<Error> Test case actions out of sync");
   243 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_DUP16, "<Error> Test case actions out of sync");
   228 			TestFailed(KErrCorrupt);
   244 			TestFailed(KErrCorrupt);
   229 			break;
   245 			break;
   230 		}
   246 		}
       
   247 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_DEVICEINSERTEDL_EXIT_DUP01, this );
   231 	}
   248 	}
   232 
   249 
   233 
   250 
   234 void CUT_PBASE_T_USBDI_0472::Ep0TransferCompleteL(TInt aCompletionCode)
   251 void CUT_PBASE_T_USBDI_0472::Ep0TransferCompleteL(TInt aCompletionCode)
   235 	{
   252 	{
   236 	LOG_FUNC
   253 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0472_EP0TRANSFERCOMPLETEL_ENTRY, this );
   237 	
   254 	
   238 	switch(iCaseStep)
   255 	switch(iCaseStep)
   239 		{
   256 		{
   240 		case EPassed:
   257 		case EPassed:
   241 			{
   258 			{
   254 			// Doing nothing, client should be re-connecting
   271 			// Doing nothing, client should be re-connecting
   255 			}
   272 			}
   256 			break;
   273 			break;
   257 			
   274 			
   258 		default:
   275 		default:
   259 			RDebug::Printf("<Error %d> Unknown test step",KErrCorrupt);
   276 			OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_EP0TRANSFERCOMPLETEL, "<Error %d> Unknown test step",KErrCorrupt);
   260 			TestFailed(KErrCorrupt);
   277 			TestFailed(KErrCorrupt);
   261 			break;
   278 			break;
   262 		}
   279 		}
       
   280 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_EP0TRANSFERCOMPLETEL_EXIT, this );
   263 	}
   281 	}
   264 	
   282 	
   265 	
   283 	
   266 void CUT_PBASE_T_USBDI_0472::DeviceRemovedL(TUint aDeviceHandle)
   284 void CUT_PBASE_T_USBDI_0472::DeviceRemovedL(TUint aDeviceHandle)
   267 	{
   285 	{
   268 	LOG_FUNC
   286     OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0472_DEVICEREMOVEDL_ENTRY, this );
   269 
   287 
   270 	Cancel();
   288 	Cancel();
   271 	
   289 	
   272 	switch(iCaseStep)
   290 	switch(iCaseStep)
   273 		{
   291 		{
   279 			TimeoutIn(5);		
   297 			TimeoutIn(5);		
   280 			}
   298 			}
   281 			break;
   299 			break;
   282 			
   300 			
   283 		default:
   301 		default:
   284 			RDebug::Printf("<Error> Test case actions out of sync");
   302 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_DEVICEREMOVEDL, "<Error> Test case actions out of sync");
   285 			TestFailed(KErrCorrupt);
   303 			TestFailed(KErrCorrupt);
   286 			break;
   304 			break;
   287 		}
   305 		}
       
   306 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_DEVICEREMOVEDL_EXIT, this );
   288 	}
   307 	}
   289 	
   308 	
   290 void CUT_PBASE_T_USBDI_0472::BusErrorL(TInt aError)
   309 void CUT_PBASE_T_USBDI_0472::BusErrorL(TInt aError)
   291 	{
   310 	{
       
   311 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0472_BUSERRORL_ENTRY, this );
   292 	// This test case handles no failiures on the bus
   312 	// This test case handles no failiures on the bus
   293 
   313 
   294 	TestFailed(aError);
   314 	TestFailed(aError);
       
   315 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_BUSERRORL_EXIT, this );
   295 	}
   316 	}
   296 
   317 
   297 void CUT_PBASE_T_USBDI_0472::DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,
   318 void CUT_PBASE_T_USBDI_0472::DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,
   298 	RUsbDevice::TDeviceState aNewState,TInt aCompletionCode)
   319 	RUsbDevice::TDeviceState aNewState,TInt aCompletionCode)
   299 	{
   320 	{
   300 	LOG_FUNC
   321 	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0472_DEVICESTATECHANGEL_ENTRY, this );
       
   322 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_DEVICESTATECHANGEL_EXIT, this );
   301 	}
   323 	}
   302 	
   324 	
   303 void CUT_PBASE_T_USBDI_0472::HostRunL()
   325 void CUT_PBASE_T_USBDI_0472::HostRunL()
   304 	{
   326 	{
   305 	LOG_FUNC
   327 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_HOSTRUNL_ENTRY, this );
   306 	
   328 	
   307 	// Obtain the completion code
   329 	// Obtain the completion code
   308 	TInt completionCode(iStatus.Int());
   330 	TInt completionCode(iStatus.Int());
   309 	
   331 	
   310 	if(completionCode == KErrNone)
   332 	if(completionCode == KErrNone)
   311 		{		
   333 		{		
   312 		if(iCaseStep == EConnectCancelled)
   334 		if(iCaseStep == EConnectCancelled)
   313 			{
   335 			{
   314 			// not a time-out 
   336 			// not a time-out 
   315 			RDebug::Printf("Timer elapsed, reactivating notifications now");
   337 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_HOSTRUNL, "Timer elapsed, reactivating notifications now");
   316 			iCaseStep = EPassed;			
   338 			iCaseStep = EPassed;			
   317 			iActorFDF->Monitor();
   339 			iActorFDF->Monitor();
   318 			}
   340 			}
   319 		else
   341 		else
   320 			{
   342 			{
   321 			// Action timeout
   343 			// Action timeout
   322 			RDebug::Printf("<Error> Action timeout");
   344 			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_HOSTRUNL_DUP01, "<Error> Action timeout");
   323 			TestFailed(KErrTimedOut);
   345 			TestFailed(KErrTimedOut);
   324 			}	
   346 			}	
   325 		}
   347 		}
   326 	else
   348 	else
   327 		{
   349 		{
   328 		RDebug::Printf("<Error %d> Timeout timer could not complete",completionCode);
   350 		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0472_HOSTRUNL_DUP02, "<Error %d> Timeout timer could not complete",completionCode);
   329 		TestFailed(completionCode);
   351 		TestFailed(completionCode);
   330 		}
   352 		}
       
   353 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_HOSTRUNL_EXIT, this );
   331 	}
   354 	}
   332 	
   355 	
   333 
   356 
   334 void CUT_PBASE_T_USBDI_0472::DeviceRunL()
   357 void CUT_PBASE_T_USBDI_0472::DeviceRunL()
   335 	{
   358 	{
   336 	LOG_FUNC
   359 	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0472_DEVICERUNL_ENTRY, this );
   337 	
   360 	
   338 	// Disconnect the device
   361 	// Disconnect the device
   339 	
   362 	
   340 	iTestDevice->SoftwareDisconnect();
   363 	iTestDevice->SoftwareDisconnect();
   341 	
   364 	
   342 	// Complete the test case request
   365 	// Complete the test case request
   343 	
   366 	
   344 	TestPolicy().SignalTestComplete(iStatus.Int());
   367 	TestPolicy().SignalTestComplete(iStatus.Int());
       
   368 	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0472_DEVICERUNL_EXIT, this );
   345 	}	
   369 	}	
   346 	
   370 	
   347 
   371 
   348 	}
   372 	}
   349 	
   373