|
1 #ifndef __TEST_CASE_PBASE_T_USBDI_1232_H |
|
2 #define __TEST_CASE_PBASE_T_USBDI_1232_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-1232.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-1232 |
|
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_1232 : public CBaseTestCase, |
|
59 public MUsbBusObserver, public MCommandObserver |
|
60 |
|
61 { |
|
62 public: |
|
63 static CUT_PBASE_T_USBDI_1232* NewL(TBool aHostRole); |
|
64 ~CUT_PBASE_T_USBDI_1232(); |
|
65 |
|
66 static TInt Interface0ResumedL(TAny* aPtr); |
|
67 static TInt Interface1ResumedL(TAny* aPtr); |
|
68 |
|
69 private: |
|
70 enum TCaseSteps |
|
71 { |
|
72 EInProcess, |
|
73 ESuspendWhenResuming, |
|
74 EValidSuspendWhenResuming, |
|
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 |
|
99 |
|
100 private: |
|
101 CUT_PBASE_T_USBDI_1232(TBool aHostRole); |
|
102 void ConstructL(); |
|
103 void ExecuteHostTestCaseL(); |
|
104 void ExecuteDeviceTestCaseL(); |
|
105 void HostDoCancel(); |
|
106 void DeviceDoCancel(); |
|
107 void HostRunL(); |
|
108 void DeviceRunL(); |
|
109 |
|
110 |
|
111 private: |
|
112 |
|
113 void SuspendWhenResuming(); |
|
114 void SendEp0Request(); // send control request |
|
115 |
|
116 |
|
117 private: |
|
118 |
|
119 CActorFDF* iActorFDF; |
|
120 CEp0Transfer* iControlEp0; |
|
121 RUsbInterface iUsbInterface0; |
|
122 RUsbInterface iUsbInterface1; |
|
123 CInterfaceWatcher* iInterface0Watcher; |
|
124 CInterfaceWatcher* iInterface1Watcher; |
|
125 TUint iDeviceHandle; |
|
126 |
|
127 RUsbDeviceA* iTestDevice; |
|
128 TCaseSteps iCaseStep; |
|
129 |
|
130 TThreadPriority iPriority; |
|
131 |
|
132 private: |
|
133 /** |
|
134 The functor for this test case for the factory |
|
135 */ |
|
136 const static TFunctorTestCase<CUT_PBASE_T_USBDI_1232,TBool> iFunctor; |
|
137 }; |
|
138 |
|
139 } |
|
140 |
|
141 #endif |