os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/inc/PBASE-T_USBDI-0472.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 #ifndef __TEST_CASE_PBASE_T_USBDI_0472_H
     2 #define __TEST_CASE_PBASE_T_USBDI_0472_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-0472.h 
    19 * @internalComponent
    20 * 
    21 *
    22 */
    23 
    24 
    25 
    26 
    27 #include "BaseTestCase.h"
    28 #include "TestCaseFactory.h"
    29 #include <d32usbdi.h>
    30 #include "modelleddevices.h"
    31 #include "FDFActor.h"
    32 #include "controltransferrequests.h"
    33 
    34 namespace NUnitTesting_USBDI
    35 	{
    36 
    37 /**
    38 
    39 	
    40 	@SYMTestCaseID				PBASE-T_USBDI-0472
    41 	@SYMTestCaseDesc			Test for device attachement notification
    42 	@SYMFssID 
    43 	@SYMPREQ					1782
    44 	@SYMREQ						7072 [USBD : Device attachment notification]
    45 								7073 [USBD : Device removal notification]
    46 								7058 [USBD : Descriptor access]
    47 	@SYMTestType				UT
    48 	@SYMTestPriority			1 
    49 	@SYMTestActions 			1. Monitor for USB device connections
    50 								2. Once a device is connected wait for notification of removal
    51 								3. Monitor for device connection again and then succesfully cancel
    52 								   the notification.
    53 	@SYMTestExpectedResults 	Notification of correct device attached
    54 	@SYMTestStatus				Implemented
    55 	
    56 
    57 */	
    58 class CUT_PBASE_T_USBDI_0472 : public CBaseTestCase, public MUsbBusObserver, public MCommandObserver
    59 	{
    60 public:
    61 	static CUT_PBASE_T_USBDI_0472* NewL(TBool aHostRole);
    62 	~CUT_PBASE_T_USBDI_0472(); 
    63 
    64 public: // From MDeviceNotifier
    65 	void DeviceInsertedL(TUint aDeviceHandle);
    66 	void DeviceRemovedL(TUint aDeviceHandle);
    67 	void BusErrorL(TInt aError);
    68 	void DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,RUsbDevice::TDeviceState aNewState,
    69 		TInt aCompletionCode);
    70 
    71 public: // From MCommandObserver
    72 	void Ep0TransferCompleteL(TInt aCompletionCode);
    73 
    74 private:
    75 	CUT_PBASE_T_USBDI_0472(TBool aHostRole);
    76 	void ConstructL();
    77 	void ExecuteHostTestCaseL();
    78 	void ExecuteDeviceTestCaseL();
    79 	void HostDoCancel();
    80 	void DeviceDoCancel();
    81 	void HostRunL();
    82 	void DeviceRunL();
    83 	
    84 private:
    85 	enum TCaseSteps 
    86 		{
    87 		EConnectDevice,
    88 		ERemoveDevice,
    89 		EConnectCancelled,
    90 		EPassed,
    91 		EFailed
    92 		};
    93 		
    94 	RUsbDeviceVendor* iTestDevice;
    95 	CActorFDF* iActorFDF;
    96 	RUsbInterface iInterface0;
    97 	CEp0Transfer* iClientAction;
    98 	TCaseSteps iCaseStep;
    99 	
   100 private:
   101 	/**
   102 	The functor for this test case for the factory
   103 	*/
   104 	const static TFunctorTestCase<CUT_PBASE_T_USBDI_0472,TBool> iFunctor;
   105 	};
   106 
   107 	}
   108 	
   109 #endif // __TEST_CASE_PBASE_T_USBDI_0472_H