os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/inc/PBASE-T_USBDI-0481.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_0481_H
     2 #define __TEST_CASE_PBASE_T_USBDI_0481_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-0481.h
    19 * @internalComponent
    20 * 
    21 *
    22 */
    23 
    24 
    25 
    26  
    27 #include "BaseTestCase.h"
    28 #include "TestCaseFactory.h"
    29 #include "FDFActor.h"
    30 #include "modelleddevices.h"
    31 #include "controltransferrequests.h"
    32 #include <d32usbc.h>
    33 #include "testdebug.h"
    34 
    35 namespace NUnitTesting_USBDI
    36 	{
    37 
    38 /**
    39 
    40 	
    41 	@SYMTestCaseID				PBASE-T_USBDI-0481
    42 	@SYMTestCaseDesc			Validation of error codes when re-opening interfaces.
    43 	@SYMFssID 
    44 	@SYMPREQ					1782
    45 	@SYMREQ						7066 - [ USBD : Interface access: Two attempted concurrent opens]
    46                                 7126 - [ USBD : Cancellation of transfer]
    47 	@SYMTestType				UT
    48 	@SYMTestPriority			1 
    49 	@SYMTestActions 			1. Enumerate A
    50                                 2. Get the token for interface 0
    51                                 3. Open interface 0
    52                                 4. Get the token for interface 1
    53                                 5. Open interface 1
    54                                 6. Get the token for interface 1 again, validate error code
    55                                 7. Open interface 1 again, validate error code
    56 
    57 	@SYMTestExpectedResults 	Error codes validated 
    58 	@SYMTestStatus				Implemented
    59 	
    60 
    61 */
    62 class CUT_PBASE_T_USBDI_0481 : public CBaseTestCase, public MUsbBusObserver, public MCommandObserver
    63 	{
    64 public:
    65 	static CUT_PBASE_T_USBDI_0481* NewL(TBool aHostRole);
    66 	~CUT_PBASE_T_USBDI_0481(); 
    67 
    68 public: // From MBusObserver
    69 	void DeviceInsertedL(TUint aDeviceHandle);
    70 	void DeviceRemovedL(TUint aDeviceHandle);
    71 	void BusErrorL(TInt aError);
    72 	void DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,RUsbDevice::TDeviceState aNewState,
    73 			TInt aCompletionCode);
    74 
    75 public: // From MCommandObserver
    76 	void Ep0TransferCompleteL(TInt aCompletionCode);
    77 
    78 private:
    79 	CUT_PBASE_T_USBDI_0481(TBool aHostRole);
    80 	void ConstructL();
    81 	void ExecuteHostTestCaseL();
    82 	void ExecuteDeviceTestCaseL();
    83 	void HostDoCancel();
    84 	void DeviceDoCancel();
    85 	void HostRunL();
    86 	void DeviceRunL();
    87 
    88 private:
    89 
    90 	enum TCaseStep
    91 		{
    92 		EInProgress,
    93 		EFailed,
    94 		EPassed
    95 		};
    96 
    97 	CActorFDF* iActorFDF;
    98 	
    99 	CEp0Transfer* iControlEp0;
   100 	RUsbInterface iUsbInterface0;
   101 	RUsbInterface iUsbInterface1;
   102 	TUint32 iToken0;
   103 
   104 	TCaseStep iCaseStep;
   105 	
   106 	RUsbDeviceA* iTestDevice;
   107 	
   108 private:
   109 	/**
   110 	The functor to create this test case from the factory
   111 	*/
   112 	const static TFunctorTestCase<CUT_PBASE_T_USBDI_0481,TBool> iFunctor;
   113 	};
   114 
   115 	}
   116 
   117 
   118 #endif