os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/inc/PBASE-T_USBDI-1231.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_1231_H
     2 #define __TEST_CASE_PBASE_T_USBDI_1231_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-1231.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 bulktranfertimer.
    36 #include "hosttransfers.h"
    37 
    38 namespace NUnitTesting_USBDI
    39 	{
    40 
    41 /**
    42 	
    43 	@SYMTestCaseID				PBASE-T_USBDI-1231
    44 	@SYMTestCaseDesc			Device suspension immediately resume 
    45 	@SYMFssID                   DEF126984
    46 	@SYMPREQ					BR2609
    47 
    48 	@SYMTestType				UT
    49 	@SYMTestPriority			1 
    50 	@SYMTestActions 			1. suspend device and immediately resume.
    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_1231 : public CBaseTestCase,
    59 		public MUsbBusObserver, public MCommandObserver
    60 		
    61 		{
    62 public:
    63 		static CUT_PBASE_T_USBDI_1231* NewL(TBool aHostRole);
    64 		~CUT_PBASE_T_USBDI_1231();
    65 
    66 		static TInt Interface0ResumedL(TAny* aPtr);
    67 		static TInt Interface1ResumedL(TAny* aPtr);
    68 
    69 private:
    70 		enum TCaseSteps
    71 			{
    72 			EInProcess,
    73 			EResumeWhenSuspending,
    74 			EValidDeviceSuspend,
    75 			EValidDeviceResume,
    76 			EValidResumeWhenSuspending,
    77 			EFailed,
    78 			EPassed
    79 			};
    80 
    81 		enum TDeviceInsertedError
    82 			{
    83 			ENone,
    84 			EError,
    85 			EFatalError,
    86 			};
    87 
    88 public:
    89 		// From MUsbBusObserver
    90 		void DeviceInsertedL(TUint aDeviceHandle);
    91 		void DeviceRemovedL(TUint aDeviceHandle);
    92 		void BusErrorL(TInt aError);
    93 		void DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,
    94 				RUsbDevice::TDeviceState aNewState, TInt aCompletionCode);
    95 
    96 public:
    97 		// From MCommandObserver
    98 		void Ep0TransferCompleteL(TInt aCompletionCode);
    99 
   100 
   101 	
   102 private:
   103 		CUT_PBASE_T_USBDI_1231(TBool aHostRole);
   104 		void ConstructL();
   105 		void ExecuteHostTestCaseL();
   106 		void ExecuteDeviceTestCaseL();
   107 		void HostDoCancel();
   108 		void DeviceDoCancel();
   109 		void HostRunL();
   110 		void DeviceRunL();
   111 
   112 	
   113 private:
   114 
   115 		void ResumeWhenSuspending();	
   116 		void SendEp0Request(); // send control request
   117 		
   118 
   119 private:
   120 
   121 		CActorFDF* iActorFDF;
   122 		CEp0Transfer* iControlEp0;
   123 		RUsbInterface iUsbInterface0;
   124 		RUsbInterface iUsbInterface1;
   125 		CInterfaceWatcher* iInterface0Watcher;
   126 		CInterfaceWatcher* iInterface1Watcher;
   127 		TUint iDeviceHandle;
   128 		
   129 		RUsbDeviceA* iTestDevice;					
   130 		TCaseSteps iCaseStep;
   131 
   132 		TThreadPriority iPriority;
   133 
   134 private:
   135 		/**
   136 		 The functor for this test case for the factory
   137 		 */
   138 		const static TFunctorTestCase<CUT_PBASE_T_USBDI_1231,TBool> iFunctor;
   139 		};
   140 
   141 	}
   142 	
   143 #endif