os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/inc/PBASE-T_USBDI-0473.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_0473_H
     2 #define __TEST_CASE_PBASE_T_USBDI_0473_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-0473.h
    19 * @internalComponent
    20 * 
    21 *
    22 */
    23 
    24 
    25 
    26 
    27 #include "BaseTestCase.h"
    28 #include "TestCaseFactory.h"
    29 #include <d32usbdi.h>
    30 #include <d32usbdi_hubdriver.h>
    31 #include "FDFActor.h"
    32 #include "modelleddevices.h"
    33 #include "controltransferrequests.h"
    34 #include "basicwatcher.h"
    35 
    36 namespace NUnitTesting_USBDI
    37 	{
    38 
    39 /**
    40 
    41 	
    42 	@SYMTestCaseID				PBASE-T_USBDI-0473
    43 	@SYMTestCaseDesc			Device suspension, Resumption and remote wakeup (multiple interfaces)
    44 	@SYMFssID 
    45 	@SYMPREQ					1782
    46 	@SYMREQ						7074 [USBD : Device suspension]
    47 								7075 [USBD : Device suspension: multiple interfaces]
    48 								7076 [USBD : Device resume]
    49 								7077 [USBD : Remote wakeup]
    50 								7078 [USBD : Suspend following a wake up]
    51 	@SYMTestType				UT
    52 	@SYMTestPriority			1 
    53 	@SYMTestActions 			1. Suspend a connected device through its interfaces
    54 								2. Resume a interface
    55 								3. Once device is resumed, enable remote wake-up and suspend all interfaces again 
    56 								4. Remote wake up device
    57 								5. Following a remote wake-up, suspend device again
    58 	@SYMTestExpectedResults 	Correct suspension and device resumption can be established
    59 	@SYMTestStatus				Implemented
    60 	
    61 
    62 */	
    63 class CUT_PBASE_T_USBDI_0473 : public CBaseTestCase, public MUsbBusObserver, public MCommandObserver
    64 	{
    65 public:
    66 	static CUT_PBASE_T_USBDI_0473* NewL(TBool aHostRole);
    67 	~CUT_PBASE_T_USBDI_0473(); 
    68 
    69 	static TInt Interface0ResumedL(TAny* aPtr);
    70 	static TInt Interface1ResumedL(TAny* aPtr);
    71 	TInt CheckForAllResumedNotificationsAndContinueFSM();
    72 	TInt ContinueFSMAfterAllResumedNotifications();
    73 	
    74 private: 
    75 	enum TCaseSteps
    76 		{
    77 		EStepSuspend,
    78 		EValidateSuspendingInterfaces,
    79 		EValidateResumptionAfterInterfaceSuspension,
    80 		ESuspendForRemoteWakeup,
    81 		EValidateSuspendForRemoteWakeup,
    82 		EValidateResumptionAfterWakeup,
    83 		EValidateSuspendAfterWakeup,
    84 		EFailed,
    85 		EPassed
    86 		};
    87 
    88 public: // From MUsbBusObserver
    89 	void DeviceInsertedL(TUint aDeviceHandle);
    90 	void DeviceRemovedL(TUint aDeviceHandle);
    91 	void BusErrorL(TInt aError);
    92 	void DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,RUsbDevice::TDeviceState aNewState,
    93 		TInt aCompletionCode);
    94 	
    95 public: // From MCommandObserver
    96 	void Ep0TransferCompleteL(TInt aCompletionCode);
    97 
    98 private:
    99 	CUT_PBASE_T_USBDI_0473(TBool aHostRole);
   100 	void ConstructL();
   101 	void ExecuteHostTestCaseL();
   102 	void ExecuteDeviceTestCaseL();
   103 	void HostDoCancel();
   104 	void DeviceDoCancel();
   105 	void HostRunL();
   106 	void DeviceRunL();
   107 
   108 private:
   109 
   110 	CActorFDF* iActorFDF;
   111 	CEp0Transfer* iControlEp0;
   112 	RUsbInterface iUsbInterface0;
   113 	RUsbInterface iUsbInterface1;
   114 	CInterfaceWatcher* iInterface0Watcher;
   115 	CInterfaceWatcher* iInterface1Watcher;
   116 	TBool iSuspendedI0;
   117 	TBool iSuspendedI1;	
   118 	TUint iDeviceHandle;
   119 
   120 	TCaseSteps iCaseStep;
   121 	
   122 	RUsbDeviceA* iTestDevice;
   123 	RUsbDevice::TDeviceState iStoredNewState;
   124 	TBool iDeviceNotificationPending;
   125 private:
   126 	/**
   127 	The functor for this test case for the factory
   128 	*/
   129 	const static TFunctorTestCase<CUT_PBASE_T_USBDI_0473,TBool> iFunctor;
   130 	};
   131 
   132 	}
   133 	
   134 #endif