os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/inc/PBASE-T_USBDI-1235.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_1235_H
     2 #define __TEST_CASE_PBASE_T_USBDI_1235_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-1235.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 #include "basebulktestcase.h" // use the bulktransfertimer.
    36 #include "hosttransfers.h"
    37 
    38 namespace NUnitTesting_USBDI
    39 	{
    40 
    41 /**
    42 	
    43 	@SYMTestCaseID				PBASE-T_USBDI-1235
    44 	@SYMTestCaseDesc			Cancel immediately after requesting device suspension , do not care the devic's tate is suspend or resume.
    45 	@SYMFssID                   DEF126984
    46 	@SYMPREQ					BR2609
    47 
    48 	@SYMTestType				UT
    49 	@SYMTestPriority			1 
    50 	@SYMTestActions 			suspend device and immediately cancel suspend request.
    51 	@SYMTestExpectedResults 	Correct suspension and device resumption can be established
    52 	@SYMTestStatus				Implemented	
    53 
    54 */	
    55 
    56 	class CBulkTransfer;
    57 
    58 	class CUT_PBASE_T_USBDI_1235 : public CBaseTestCase,
    59 		public MUsbBusObserver, public MCommandObserver
    60 		
    61 		{
    62 public:
    63 		static CUT_PBASE_T_USBDI_1235* NewL(TBool aHostRole);
    64 		~CUT_PBASE_T_USBDI_1235();
    65 
    66 		static TInt Interface0ResumedL(TAny* aPtr);
    67 		static TInt Interface1ResumedL(TAny* aPtr);
    68 
    69 private:
    70 		enum TCaseSteps
    71 			{
    72 			EInProcess,
    73 			ECancelSuspendWhenInterfaceSuspension,
    74 			EValidCancelSuspendAfterInterfaceSuspend,
    75 			EFailed,
    76 			EPassed
    77 			};
    78 
    79 		enum TDeviceInsertedError
    80 			{
    81 			ENone,
    82 			EError,
    83 			EFatalError,
    84 			};
    85 
    86 public:
    87 		// From MUsbBusObserver
    88 		void DeviceInsertedL(TUint aDeviceHandle);
    89 		void DeviceRemovedL(TUint aDeviceHandle);
    90 		void BusErrorL(TInt aError);
    91 		void DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,
    92 				RUsbDevice::TDeviceState aNewState, TInt aCompletionCode);
    93 
    94 public:
    95 		// From MCommandObserver
    96 		void Ep0TransferCompleteL(TInt aCompletionCode);
    97 
    98 public:
    99 		
   100 
   101 public:
   102 	
   103 private:
   104 		CUT_PBASE_T_USBDI_1235(TBool aHostRole);
   105 		void ConstructL();
   106 		void ExecuteHostTestCaseL();
   107 		void ExecuteDeviceTestCaseL();
   108 		void HostDoCancel();
   109 		void DeviceDoCancel();
   110 		void HostRunL();
   111 		void DeviceRunL();
   112 
   113 	
   114 private:
   115 
   116 		void SuspendDeviceByInterfacesAndCancelWaitForResume();	
   117 		void SendEp0Request(); // for b device stop
   118 		
   119 
   120 private:
   121 
   122 		CActorFDF* iActorFDF;
   123 		CEp0Transfer* iControlEp0;
   124 		RUsbInterface iUsbInterface0;
   125 		RUsbInterface iUsbInterface1;
   126 		CInterfaceWatcher* iInterface0Watcher;
   127 		CInterfaceWatcher* iInterface1Watcher;
   128 		TBool iSuspendedI0;
   129 		TBool iSuspendedI1;
   130 		TUint iDeviceHandle;
   131 		
   132 		RUsbDeviceA* iTestDevice;					
   133 		TCaseSteps iCaseStep;
   134 
   135 
   136 private:
   137 		/**
   138 		 The functor for this test case for the factory
   139 		 */
   140 		const static TFunctorTestCase<CUT_PBASE_T_USBDI_1235,TBool> iFunctor;
   141 		};
   142 
   143 	}
   144 	
   145 #endif