os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/inc/PBASE-T_USBDI-1234.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_1234_H
     2 #define __TEST_CASE_PBASE_T_USBDI_1234_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-1234.h
    19 * @internalComponent
    20 * 
    21 *
    22 */
    23 
    24 
    25 
    26 #include "BaseBulkTestCase.h"
    27 #include "basicwatcher.h"
    28 
    29 namespace NUnitTesting_USBDI
    30 	{
    31 
    32 	/**
    33 	 
    34 	 @SYMTestCaseID				PBASE-T_USBDI-1234
    35 	 @SYMTestCaseDesc			Device suspend and resume only depend on the RUsbInterface 
    36 	 @SYMFssID                  Def126984
    37      @SYMPREQ					BR2609
    38 	 @SYMTestType				UT
    39 	 @SYMTestPriority			1 
    40 	 @SYMTestActions 			1. after device suspended,call resume interface and immediately do some bulk transfer operation  
    41 	 @SYMTestExpectedResults 	Correct suspension and device resumption can be established
    42 	 @SYMTestStatus				Implemented	
    43 
    44 	 */
    45 	class CUT_PBASE_T_USBDI_1234 : public CBaseBulkTestCase,
    46 		public MTransferObserver, public MCommandObserver
    47 
    48 		{
    49 public:
    50 		static CUT_PBASE_T_USBDI_1234* NewL(TBool aHostRole);
    51 		~CUT_PBASE_T_USBDI_1234();
    52 
    53 		static TInt Interface0ResumedL(TAny* aPtr);
    54 		static TInt Interface1ResumedL(TAny* aPtr);
    55 		static TInt Interface2ResumedL(TAny* aPtr);
    56 
    57 private:
    58 	      enum TCaseSteps
    59 			{
    60 			EInProgress,
    61 			ESuspendDevice,
    62 			EValidateResumebyInterface,
    63 			EBulkTransferOutWhenResume,
    64 			EValidBulkTransfeOut,   // tranfer in read 
    65 			EFailed,
    66 			EPassed
    67 			};
    68 
    69 	      enum TDeviceInsertedError
    70 			{
    71 			ENone,
    72 			EError,
    73 			EFatalError,
    74 			};
    75 
    76 public:
    77 		// From MUsbBusObserver
    78 		void DeviceInsertedL(TUint aDeviceHandle);
    79 		void DeviceStateChangeL(RUsbDevice::TDeviceState aPreviousState,
    80 				RUsbDevice::TDeviceState aNewState, TInt aCompletionCode);
    81 
    82 public:
    83 		// From MCommandObserver
    84 		void Ep0TransferCompleteL(TInt aCompletionCode);
    85 
    86 public:
    87 		// From MTransferObserver
    88 		void TransferCompleteL(TInt aTransferId, TInt aCompletionCode);
    89 		
    90 
    91 private:
    92 		CUT_PBASE_T_USBDI_1234(TBool aHostRole);
    93 		void ConstructL();
    94 		void ExecuteHostTestCaseL();
    95 
    96 private:
    97 
    98 	
    99 
   100 private:
   101 
   102 		void TrySuspendDeviceByInterfaces();
   103 		
   104 		void SendEpRequest();
   105 		void SendEpTransferRequest();
   106 		
   107 		TInt DoBulkOutTransfer(TInt aTransferId, TInt aCompletionCode,
   108 				TDes & aMsg);		
   109 		void TryResumeTransferImmediately(RUsbDevice::TDeviceState aState);
   110 		
   111 
   112 private:
   113 		
   114 		CInterfaceWatcher* iInterface0Watcher;
   115 		CInterfaceWatcher* iInterface1Watcher;
   116 		CInterfaceWatcher* iInterface2Watcher;
   117 		
   118 		TBool iSuspendedI0;
   119 		TBool iSuspendedI1;
   120 		TBool iSuspendedI2;
   121 
   122 		TCaseSteps iCaseStep;
   123 	
   124 
   125 private:
   126 		/**
   127 		 The functor for this test case for the factory
   128 		 */
   129 		const static TFunctorTestCase<CUT_PBASE_T_USBDI_1234,TBool> iFunctor;
   130 		};
   131 
   132 	}
   133 
   134 #endif