os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/inc/PBASE-T_USBDI-1231.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/inc/PBASE-T_USBDI-1231.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,143 @@
     1.4 +#ifndef __TEST_CASE_PBASE_T_USBDI_1231_H
     1.5 +#define __TEST_CASE_PBASE_T_USBDI_1231_H
     1.6 +
     1.7 +/*
     1.8 +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.9 +* All rights reserved.
    1.10 +* This component and the accompanying materials are made available
    1.11 +* under the terms of the License "Eclipse Public License v1.0"
    1.12 +* which accompanies this distribution, and is available
    1.13 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.14 +*
    1.15 +* Initial Contributors:
    1.16 +* Nokia Corporation - initial contribution.
    1.17 +*
    1.18 +* Contributors:
    1.19 +*
    1.20 +* Description:
    1.21 +* @file PBASE-T_USBDI-1231.h
    1.22 +* @internalComponent
    1.23 +* 
    1.24 +*
    1.25 +*/
    1.26 +
    1.27 +
    1.28 +
    1.29 +
    1.30 +#include "BaseTestCase.h"
    1.31 +#include "TestCaseFactory.h"
    1.32 +#include <d32usbdi.h>
    1.33 +#include <d32usbdi_hubdriver.h>
    1.34 +#include "FDFActor.h"
    1.35 +#include "modelleddevices.h"
    1.36 +#include "controltransferrequests.h"
    1.37 +#include "basicwatcher.h"
    1.38 +#include "basebulktestcase.h" // use the bulktranfertimer.
    1.39 +#include "hosttransfers.h"
    1.40 +
    1.41 +namespace NUnitTesting_USBDI
    1.42 +	{
    1.43 +
    1.44 +/**
    1.45 +	
    1.46 +	@SYMTestCaseID				PBASE-T_USBDI-1231
    1.47 +	@SYMTestCaseDesc			Device suspension immediately resume 
    1.48 +	@SYMFssID                   DEF126984
    1.49 +	@SYMPREQ					BR2609
    1.50 +
    1.51 +	@SYMTestType				UT
    1.52 +	@SYMTestPriority			1 
    1.53 +	@SYMTestActions 			1. suspend device and immediately resume.
    1.54 +	@SYMTestExpectedResults 	Correct suspension and device resumption can be established
    1.55 +	@SYMTestStatus				Implemented	
    1.56 +
    1.57 +*/	
    1.58 +
    1.59 +	class CBulkTransfer;
    1.60 +
    1.61 +	class CUT_PBASE_T_USBDI_1231 : public CBaseTestCase,
    1.62 +		public MUsbBusObserver, public MCommandObserver
    1.63 +		
    1.64 +		{
    1.65 +public:
    1.66 +		static CUT_PBASE_T_USBDI_1231* NewL(TBool aHostRole);
    1.67 +		~CUT_PBASE_T_USBDI_1231();
    1.68 +
    1.69 +		static TInt Interface0ResumedL(TAny* aPtr);
    1.70 +		static TInt Interface1ResumedL(TAny* aPtr);
    1.71 +
    1.72 +private:
    1.73 +		enum TCaseSteps
    1.74 +			{
    1.75 +			EInProcess,
    1.76 +			EResumeWhenSuspending,
    1.77 +			EValidDeviceSuspend,
    1.78 +			EValidDeviceResume,
    1.79 +			EValidResumeWhenSuspending,
    1.80 +			EFailed,
    1.81 +			EPassed
    1.82 +			};
    1.83 +
    1.84 +		enum TDeviceInsertedError
    1.85 +			{
    1.86 +			ENone,
    1.87 +			EError,
    1.88 +			EFatalError,
    1.89 +			};
    1.90 +
    1.91 +public:
    1.92 +		// From MUsbBusObserver
    1.93 +		void DeviceInsertedL(TUint aDeviceHandle);
    1.94 +		void DeviceRemovedL(TUint aDeviceHandle);
    1.95 +		void BusErrorL(TInt aError);
    1.96 +		void DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,
    1.97 +				RUsbDevice::TDeviceState aNewState, TInt aCompletionCode);
    1.98 +
    1.99 +public:
   1.100 +		// From MCommandObserver
   1.101 +		void Ep0TransferCompleteL(TInt aCompletionCode);
   1.102 +
   1.103 +
   1.104 +	
   1.105 +private:
   1.106 +		CUT_PBASE_T_USBDI_1231(TBool aHostRole);
   1.107 +		void ConstructL();
   1.108 +		void ExecuteHostTestCaseL();
   1.109 +		void ExecuteDeviceTestCaseL();
   1.110 +		void HostDoCancel();
   1.111 +		void DeviceDoCancel();
   1.112 +		void HostRunL();
   1.113 +		void DeviceRunL();
   1.114 +
   1.115 +	
   1.116 +private:
   1.117 +
   1.118 +		void ResumeWhenSuspending();	
   1.119 +		void SendEp0Request(); // send control request
   1.120 +		
   1.121 +
   1.122 +private:
   1.123 +
   1.124 +		CActorFDF* iActorFDF;
   1.125 +		CEp0Transfer* iControlEp0;
   1.126 +		RUsbInterface iUsbInterface0;
   1.127 +		RUsbInterface iUsbInterface1;
   1.128 +		CInterfaceWatcher* iInterface0Watcher;
   1.129 +		CInterfaceWatcher* iInterface1Watcher;
   1.130 +		TUint iDeviceHandle;
   1.131 +		
   1.132 +		RUsbDeviceA* iTestDevice;					
   1.133 +		TCaseSteps iCaseStep;
   1.134 +
   1.135 +		TThreadPriority iPriority;
   1.136 +
   1.137 +private:
   1.138 +		/**
   1.139 +		 The functor for this test case for the factory
   1.140 +		 */
   1.141 +		const static TFunctorTestCase<CUT_PBASE_T_USBDI_1231,TBool> iFunctor;
   1.142 +		};
   1.143 +
   1.144 +	}
   1.145 +	
   1.146 +#endif