os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/inc/PBASE-T_USBDI-0479.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_0479_H
     2 #define __TEST_CASE_PBASE_T_USBDI_0479_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-0479.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 <e32debug.h>
    34 #include <d32usbdi.h>
    35 
    36 namespace NUnitTesting_USBDI
    37 	{
    38 
    39 /**
    40 
    41 	
    42 	@SYMTestCaseID				PBASE-T_USBDI-0479
    43 	@SYMTestCaseDesc			Validation of interface ownership
    44 	@SYMFssID 
    45 	@SYMPREQ					1782
    46 	@SYMREQ						7044 [USBD : Controlled access to 'owned' interfaces]
    47 	@SYMTestType				UT
    48 	@SYMTestPriority			1 
    49 	@SYMTestActions 			1. Open interfaces on connected device
    50 								2. Attempt to open an interface with a token
    51 								   that is known to be invalid
    52 	@SYMTestExpectedResults 	Error from opening an interface with an invalid token
    53 	@SYMTestStatus				Implemented
    54 	
    55 
    56 */
    57 class CUT_PBASE_T_USBDI_0479 : public CBaseTestCase, public MUsbBusObserver, public MCommandObserver
    58 	{
    59 public:
    60 	static CUT_PBASE_T_USBDI_0479* NewL(TBool aHostRole);
    61 	~CUT_PBASE_T_USBDI_0479(); 
    62 
    63 public: // From MUsbBusObserver
    64 	void DeviceInsertedL(TUint aDeviceHandle);
    65 	void DeviceRemovedL(TUint aDeviceHandle);
    66 	void BusErrorL(TInt aError);
    67 	void DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,RUsbDevice::TDeviceState aNewState,
    68 		TInt aCompletionCode);
    69 		
    70 public: // From MCommandObserver
    71 	void Ep0TransferCompleteL(TInt aCompletionCode);
    72 	
    73 private:
    74 	CUT_PBASE_T_USBDI_0479(TBool aHostRole);
    75 	void ConstructL();
    76 	void ExecuteHostTestCaseL();
    77 	void ExecuteDeviceTestCaseL();
    78 	void HostDoCancel();
    79 	void DeviceDoCancel();
    80 	void HostRunL();
    81 	void DeviceRunL();
    82 
    83 private:
    84 	enum TCaseStep
    85 		{
    86 		EInProgress,
    87 		EFailed,
    88 		EPassed
    89 		};
    90 	
    91 	CActorFDF* iActorFDF;
    92 	RUsbInterface iUsbInterface0;
    93 	RUsbInterface iDuplicateUsbInterface0;
    94 	CEp0Transfer* iClientAction;
    95 	
    96 	TCaseStep iCaseStep;
    97 	
    98 	RUsbDeviceVendor* iTestDevice;
    99 
   100 private:
   101 	/**
   102 	The functor for this test case for the factory
   103 	*/
   104 	const static TFunctorTestCase<CUT_PBASE_T_USBDI_0479,TBool> iFunctor;
   105 	};
   106 
   107 	}
   108 
   109 
   110 #endif