os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/inc/PBASE-T_USBDI-0477.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_0477_H
     2 #define __TEST_CASE_PBASE_T_USBDI_0477_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-0477.h
    19 * @internalComponent
    20 * 
    21 *
    22 */
    23 
    24 
    25 
    26  
    27 #include "BaseTestCase.h" 
    28 #include "TestCaseFactory.h"
    29 #include "modelleddevices.h"
    30 #include <d32usbdi.h>
    31 #include <d32usbdi_hubdriver.h>
    32 #include "FDFActor.h"
    33 #include <d32usbc.h>
    34 #include "testdebug.h"
    35 #include "controltransferrequests.h"
    36  
    37 namespace NUnitTesting_USBDI
    38 	{
    39 
    40 /**
    41 
    42 	
    43 	@SYMTestCaseID				PBASE-T_USBDI-0477
    44 	@SYMTestCaseDesc			Selection of two alternate interface settings where the second selection
    45 								fails and the interface rolls back
    46 	@SYMFssID 
    47 	@SYMPREQ					1782
    48 	@SYMREQ						7046 [USBD : Changing alternate interface setting]
    49 								7047 [USBD : Roll-back of alternate interface setting]
    50 								7048 [USBD : Default Alternate Interface setting]
    51 								7049 [USBD : Establishment of pipes]
    52 								7050 [USBD : Closing of pipes]
    53 	@SYMTestType				UT
    54 	@SYMTestPriority			1 
    55 	@SYMTestActions 			1. Open interfaces on connected device
    56 								2. Open and close a bulk pipe on default setting 0
    57 								3. Select alternate interface setting 1 and establish a pipe then close it
    58 								4. If alternate interface selection fails, establish that the pipe previously 
    59 								   opened in step 2 can be opened again.
    60 	@SYMTestExpectedResults 	Pipes can be established in either interface setting
    61 	@SYMTestStatus				Implemented
    62 	
    63 
    64 */	
    65 class CUT_PBASE_T_USBDI_0477 : public CBaseTestCase, public MUsbBusObserver, public MCommandObserver
    66 	{
    67 public:
    68 	static CUT_PBASE_T_USBDI_0477* NewL(TBool aHostRole);
    69 	~CUT_PBASE_T_USBDI_0477(); 
    70 
    71 public: // From MUsbBusObserver
    72 	void DeviceInsertedL(TUint aDeviceHandle);
    73 	void DeviceRemovedL(TUint aDeviceHandle);
    74 	void BusErrorL(TInt aError);
    75 	void DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,RUsbDevice::TDeviceState aNewState,
    76 		TInt aCompletionCode);
    77 
    78 public: // From MCommandObserver
    79 	void Ep0TransferCompleteL(TInt aCompletionCode);
    80 	
    81 private:
    82 	CUT_PBASE_T_USBDI_0477(TBool aHostRole);
    83 	void ConstructL();
    84 	void ExecuteHostTestCaseL();
    85 	void ExecuteDeviceTestCaseL();
    86 	void HostDoCancel();
    87 	void DeviceDoCancel();
    88 	void HostRunL();
    89 	void DeviceRunL();
    90 	TBool CheckFirstInterfaceDescriptorDeviceA(TUsbInterfaceDescriptor& aIfDescriptor);
    91 
    92 private:
    93 	enum TCaseStep 
    94 		{
    95 		EInProgress,
    96 		EFailed,
    97 		EPassed
    98 		};
    99 		
   100 	CActorFDF* iActorFDF;
   101 	CEp0Transfer* iClientAction;
   102 	RUsbInterface iUsbInterface0;
   103 	RUsbInterface iUsbInterface1;
   104 	RUsbPipe iTestPipe;
   105 	TCaseStep iCaseStep;
   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_0477,TBool> iFunctor;
   114 	};
   115 
   116 	
   117 	}
   118 
   119 #endif