kerneltest/e32test/usbho/t_usbdi/inc/PBASE-T_USBDI-0488.h
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 #ifndef __TEST_CASE_PBASE_T_USBDI_0488_H
       
     2 #define __TEST_CASE_PBASE_T_USBDI_0488_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-0488.h
       
    19 * @internalComponent
       
    20 * 
       
    21 *
       
    22 */
       
    23 
       
    24 
       
    25  
       
    26 #include "basetestcase.h"
       
    27 #include "testcasefactory.h"
       
    28 #include "modelleddevices.h"
       
    29 #include "FDFActor.h"
       
    30 #include <d32usbc.h>
       
    31 #include <e32debug.h>
       
    32 #include <d32usbdi.h>
       
    33 #include "hosttransfers.h"
       
    34 #include "controltransferrequests.h"
       
    35 
       
    36 namespace NUnitTesting_USBDI
       
    37 	{
       
    38 
       
    39 /**
       
    40 
       
    41 	
       
    42 	@SYMTestCaseID				PBASE-T_USBDI-0488
       
    43 	@SYMTestCaseDesc			Resource cleanup following panic in client.
       
    44 	@SYMFssID 
       
    45 	@SYMPREQ					1782
       
    46 	@SYMREQ						7065 - [ USBD : Closing interface handles: Unclean shutdown (ie. kernel closes handle]
       
    47 	@SYMTestType				UT
       
    48 	@SYMTestPriority			1 
       
    49 	@SYMTestActions 			1. Enumerate
       
    50                                 2. Add heap mark
       
    51                                 3. Select alternate setting 1
       
    52                                 4. Open pipe for endpoint on interface 1
       
    53                                 5. Select alternate setting 0
       
    54                                 6. Validate panic cause (Interface setting changed while pipe is opened on other alternate setting)
       
    55                                 7. Close interface 1
       
    56                                 8. Check heap mark is equal to original mark
       
    57     @SYMTestExpectedResults     Resources successfully cleaned up following a specific panic.	
       
    58 	@SYMTestStatus				Implemented
       
    59 	
       
    60 
       
    61 */
       
    62 class CUT_PBASE_T_USBDI_0488 : public CBaseTestCase, public MUsbBusObserver, public MCommandObserver
       
    63 	{
       
    64 public:
       
    65 	static CUT_PBASE_T_USBDI_0488* NewL(TBool aHostRole);
       
    66 	~CUT_PBASE_T_USBDI_0488(); 
       
    67 
       
    68 public: // From MUsbBusObserver
       
    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 
       
    76 public: // From MCommandObserver
       
    77 	void Ep0TransferCompleteL(TInt aCompletionCode);
       
    78 	
       
    79 private:
       
    80 	CUT_PBASE_T_USBDI_0488(TBool aHostRole);
       
    81 	void ConstructL();
       
    82 	void ExecuteHostTestCaseL();
       
    83 	void ExecuteDeviceTestCaseL();
       
    84 	void HostDoCancel();
       
    85 	void DeviceDoCancel();
       
    86 	void HostRunL();
       
    87 	void DeviceRunL();
       
    88 
       
    89 private:
       
    90 	enum TCaseStep 
       
    91 		{
       
    92 		EInProgress,
       
    93 		EFailed,
       
    94 		EPassed
       
    95 		};
       
    96 		
       
    97 public :
       
    98 
       
    99 	RUsbInterface iUsbInterface1;
       
   100 	
       
   101 	
       
   102 private:	
       
   103 	
       
   104 	CEp0Transfer* iControlEp0;
       
   105 	CActorFDF* iActorFDF;	
       
   106 	RUsbInterface iUsbInterface0;
       
   107 	RUsbPipe iInPipe;
       
   108 	// The current test case step
       
   109 	TCaseStep iCaseStep;
       
   110 	
       
   111 	// The test device for this test case
       
   112 	RUsbDeviceA* iTestDevice;
       
   113 	
       
   114 
       
   115 	
       
   116 private:
       
   117 	/**
       
   118 	The functor for this test case for the factory
       
   119 	*/
       
   120 	const static TFunctorTestCase<CUT_PBASE_T_USBDI_0488,TBool> iFunctor;
       
   121 	
       
   122 	/** 
       
   123 	static method, function of spawned thread.
       
   124 	@param[in] aTestCase pointer
       
   125 	*/	 
       
   126 	static TInt TestSelectAlternateInterfaceThenPanic(TAny* aTest);
       
   127 	};
       
   128 	
       
   129 	}
       
   130 
       
   131 
       
   132 #endif