os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/inc/PBASE-T_USBDI-0480.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 #ifndef __TEST_CASE_PBASE_T_USBDI_0480_H
     2 #define __TEST_CASE_PBASE_T_USBDI_0480_H
     3 
     4 /*
     5 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     6 * All rights reserved.
     7 * This component and the accompanying materials are made available
     8 * under the terms of the License "Eclipse Public License v1.0"
     9 * which accompanies this distribution, and is available
    10 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    11 *
    12 * Initial Contributors:
    13 * Nokia Corporation - initial contribution.
    14 *
    15 * Contributors:
    16 *
    17 * Description:
    18 * @file PBASE-T_USBDI-0480.h
    19 * @internalComponent
    20 * 
    21 *
    22 */
    23 
    24 
    25  
    26 #include "basetestcase.h"
    27 #include "testcasefactory.h"
    28 #include "fdfactor.h"
    29 #include "controltransferrequests.h"
    30 #include "modelleddevices.h"
    31 #include "hosttransfers.h"
    32 #include <d32usbc.h>
    33 #include <e32debug.h>
    34 #include <d32usbdi.h>
    35 #include <d32usbtransfers.h>
    36 
    37 namespace NUnitTesting_USBDI
    38 	{
    39 
    40 /**
    41 
    42 	
    43 	@SYMTestCaseID				PBASE-T_USBDI-0480
    44 	@SYMTestCaseDesc			Validation of USB control transfers to/from connected device
    45 	@SYMFssID 
    46 	@SYMPREQ					1782
    47 	@SYMREQ						7053 [USBD : Control transfers]
    48 								7071 [USBD : Querying packet sizes for transfers]
    49 	@SYMTestType				UT
    50 	@SYMTestPriority			1 
    51 	@SYMTestActions 			1. Open interfaces on connected device
    52 								2. Send control transfers to endpoint0
    53 									- Empty control transfers
    54 									- Device and Interface directed (with/without payload)
    55 	@SYMTestExpectedResults 	3. Client USB device providing appropriate response
    56 	@SYMTestStatus				Implemented
    57 	
    58 
    59 */
    60 class CUT_PBASE_T_USBDI_0480 : public CBaseTestCase, public MUsbBusObserver, public MCommandObserver
    61 	{
    62 public:
    63 	static CUT_PBASE_T_USBDI_0480* NewL(TBool aHostRole);
    64 	~CUT_PBASE_T_USBDI_0480(); 
    65 
    66 public: // From MUsbBusObserver
    67 	void DeviceInsertedL(TUint aDeviceHandle);
    68 	void DeviceRemovedL(TUint aDeviceHandle);
    69 	void BusErrorL(TInt aError);
    70 	void DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,RUsbDevice::TDeviceState aNewState,
    71 		TInt aCompletionCode);
    72 		
    73 public: // From MCommandObserver
    74 	void Ep0TransferCompleteL(TInt aCompletionCode);
    75 
    76 private:
    77 	CUT_PBASE_T_USBDI_0480(TBool aHostRole);
    78 	void ConstructL();
    79 	void ExecuteHostTestCaseL();
    80 	void ExecuteDeviceTestCaseL();
    81 	void HostDoCancel();
    82 	void DeviceDoCancel();
    83 	void HostRunL();
    84 	void DeviceRunL();
    85 
    86 private:
    87 	enum TCaseSteps 
    88 		{
    89 		EEmptyDeviceXfer,
    90 		EEmptyInterfaceXfer,
    91 		EDataPutDeviceXfer,
    92 		EDataGetDeviceXfer,
    93 		EDataPutInterfaceXfer,
    94 		EDataGetInterfaceXfer,
    95 		EFailed,
    96 		EPassed
    97 		};
    98 
    99 	CActorFDF* iActorFDF;
   100 	CEp0Transfer* iControlEp0;
   101 	RUsbInterface iUsbInterface0;
   102 	RUsbInterface iUsbInterface1;
   103 	TCaseSteps iCaseStep;
   104 	HBufC8* iTemp;
   105 	TPtr8 iPtrTemp;
   106 		
   107 	RUsbDeviceA* iTestDevice;
   108 	
   109 private:
   110 	/**
   111 	The functor for this test case for the factory
   112 	*/
   113 	const static TFunctorTestCase<CUT_PBASE_T_USBDI_0480,TBool> iFunctor;
   114 	};
   115 
   116 	}
   117 
   118 
   119 #endif