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