os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/inc/PBASE-T_USBDI-0486.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_0486_H
     2 #define __TEST_CASE_PBASE_T_USBDI_0486_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-0486.h
    19 * @internalComponent
    20 * 
    21 *
    22 */
    23 
    24 
    25 
    26  
    27 #include "BaseBulkTestCase.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 #include "hosttransfers.h"
    35 
    36 _LIT(KTestDeviceC_SN, "TestDeviceC - CUT_PBASE_T_USBDI_0486");
    37 
    38 namespace NUnitTesting_USBDI
    39 	{
    40 
    41 /**
    42 
    43 	
    44 	@SYMTestCaseID				PBASE-T_USBDI-0486
    45 	@SYMTestCaseDesc			Validation of opening interfaces after a device change
    46 	@SYMFssID 
    47 	@SYMPREQ					1782
    48 	@SYMREQ						7067 - [ USBD : Interface access: Changed device]
    49                                 7068 - [ USBD : Interface access: Consistency across device addition/removal]
    50                                 7069 - [ USBD : Interface access: Re-open an interface]
    51                                 7126 - [ USBD : Cancellation of transfer]
    52 	@SYMTestType				UT
    53 	@SYMTestPriority			1 
    54 	@SYMTestActions 			1.  Enumerate A
    55                                 2.  Get token for interface 0 (token 0) – save token 0
    56                                 3.  Open interface 0 with token 0
    57                                 4.  Get token for interface 1 (token 1)
    58                                 5.  Open interface 1 (token 1)
    59                                 6.  Open pipe on interface 1, endpoint 2
    60                                 7.  Queue bulk in transfer on pipe
    61                                 8.  Vendor dependant request : Disconnect A- Connect C sent to device A
    62                                 9.  Transfer completes with cancelled error code
    63                                 10. Close interface 0
    64                                 11. Enumerate C
    65                                 12. Try to open interface 0 with previous token 0, fails since token is invalid
    66                                 13. Get token for interface 0 (token 2) 
    67                                 14. Open interface 0 (token 2)
    68                                 15. Vendor dependant request : Disconnect C- Connect A sent to device C
    69                                 16. Close interface 0
    70                                 17. Enumerate A
    71                                 18. Get token for interface 0 (token 3)
    72                                 19. Open interface 0 with token 3
    73 	@SYMTestExpectedResults 	Unable to open any interface using expired token, Transfer cancelled on disconnection
    74 	@SYMTestStatus				Implemented
    75 	
    76 
    77 */
    78 class CUT_PBASE_T_USBDI_0486 :   public CBaseBulkTestCase,
    79 								 public MTransferObserver, 
    80 								 public MCommandObserver
    81 	{
    82 public:
    83 	static CUT_PBASE_T_USBDI_0486* NewL(TBool aHostRole);
    84 	~CUT_PBASE_T_USBDI_0486(); 
    85 
    86 public: // From MBusObserver
    87 	void DeviceInsertedL(TUint aDeviceHandle);
    88 	void DeviceRemovedL(TUint aDeviceHandle);
    89 			
    90 public: // From MTransferObserver
    91 	void TransferCompleteL(TInt aTransferId,TInt aCompletionCode);
    92 
    93 public: // From MCommandObserver
    94 	void Ep0TransferCompleteL(TInt aCompletionCode);
    95 
    96 private:
    97 	CUT_PBASE_T_USBDI_0486(TBool aHostRole);
    98 	void ConstructL();
    99 	void ExecuteDeviceTestCaseL();
   100 	void DeviceRunL();
   101 	void DeviceDoCancel();
   102 	TBool CheckSN(const TDesC16& aSerialNumberGot, const TDesC& aExpectedSerialNumber);
   103 
   104 private:
   105 
   106 	enum TCaseStep
   107 		{
   108 		EFailed,
   109 		EPassed,
   110 		EWaitForDeviceCConnection,
   111 		EDeviceCConnected,
   112 		EDeviceAConnected,
   113 		EWaitForDeviceCDisconnection,
   114 		EWaitForDeviceAConnection		
   115 		};
   116 
   117 	TCaseStep iCaseStep;	
   118 	TUint32 iToken0DeviceC;
   119 	RUsbDeviceC* iTestDeviceC;
   120 	
   121 	
   122 public :
   123 	RUsbDeviceC* TestDeviceC();
   124 	RUsbDeviceD* TestDeviceD();
   125 	void HandleDeviceDConnection();
   126 
   127 private:
   128 	/**
   129 	The functor to create this test case from the factory
   130 	*/
   131 	const static TFunctorTestCase<CUT_PBASE_T_USBDI_0486,TBool> iFunctor;
   132 	};
   133 
   134 	}
   135 
   136 
   137 #endif