author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 02 Sep 2010 21:54:16 +0300 | |
changeset 259 | 57b9594f5772 |
parent 0 | a41df078684a |
child 257 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1 |
// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 2 |
// All rights reserved. |
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// @file PBASE-T_USBDI-1232.cpp |
|
15 |
// @internalComponent |
|
16 |
// |
|
17 |
// |
|
18 |
||
19 |
#include "PBASE-T_USBDI-1232.h" |
|
20 |
#include <d32usbc.h> |
|
21 |
#include "testdebug.h" |
|
22 |
#include "modelleddevices.h" |
|
23 |
#include "TestPolicy.h" |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
24 |
#include "OstTraceDefinitions.h" |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
25 |
#ifdef OST_TRACE_COMPILER_IN_USE |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
26 |
#include "PBASE-T_USBDI-1232Traces.h" |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
27 |
#endif |
0 | 28 |
|
29 |
namespace NUnitTesting_USBDI |
|
30 |
{ |
|
31 |
||
32 |
_LIT(KTestCaseId,"PBASE-T_USBDI-1232"); |
|
33 |
// the name is very important |
|
34 |
const TFunctorTestCase<CUT_PBASE_T_USBDI_1232,TBool> |
|
35 |
CUT_PBASE_T_USBDI_1232::iFunctor(KTestCaseId); |
|
36 |
||
37 |
CUT_PBASE_T_USBDI_1232* CUT_PBASE_T_USBDI_1232::NewL(TBool aHostRole) |
|
38 |
{ |
|
39 |
CUT_PBASE_T_USBDI_1232* self = new (ELeave) CUT_PBASE_T_USBDI_1232(aHostRole); |
|
40 |
CleanupStack::PushL(self); |
|
41 |
self->ConstructL(); |
|
42 |
CleanupStack::Pop(self); |
|
43 |
return self; |
|
44 |
} |
|
45 |
||
46 |
CUT_PBASE_T_USBDI_1232::CUT_PBASE_T_USBDI_1232(TBool aHostRole) : |
|
47 |
CBaseTestCase(KTestCaseId, aHostRole) |
|
48 |
{ |
|
49 |
} |
|
50 |
||
51 |
void CUT_PBASE_T_USBDI_1232::ConstructL() |
|
52 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
53 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_CUT_PBASE_T_USBDI_1232, "====> Constructor entry priority = %d", RThread().Priority()); |
0 | 54 |
|
55 |
// Collect existing thread priority (to reinstate later) |
|
56 |
iPriority = RThread().Priority(); |
|
57 |
||
58 |
iTestDevice = new RUsbDeviceA(this); |
|
59 |
BaseConstructL(); |
|
60 |
} |
|
61 |
||
62 |
CUT_PBASE_T_USBDI_1232::~CUT_PBASE_T_USBDI_1232() |
|
63 |
{ |
|
64 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
65 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232, "====> Destructor entry priority = %d", RThread().Priority()); |
0 | 66 |
|
67 |
// Reinstate original priority |
|
68 |
||
69 |
RThread().SetPriority(iPriority); |
|
70 |
||
71 |
// Cancel any async operations |
|
72 |
||
73 |
Cancel(); // Cancel host timer |
|
74 |
||
75 |
// Destroy the watchers |
|
76 |
// they still use opened interfaces to cancel the suspend if active |
|
77 |
delete iInterface1Watcher; |
|
78 |
delete iInterface0Watcher; |
|
79 |
||
80 |
// Close the interfaces |
|
81 |
iUsbInterface1.Close(); |
|
82 |
iUsbInterface0.Close(); |
|
83 |
||
84 |
delete iControlEp0; |
|
85 |
delete iActorFDF; |
|
86 |
if (!IsHost() && iTestDevice) |
|
87 |
{ |
|
88 |
iTestDevice->Close(); |
|
89 |
} |
|
90 |
delete iTestDevice; |
|
91 |
} |
|
92 |
||
93 |
void CUT_PBASE_T_USBDI_1232::ExecuteHostTestCaseL() |
|
94 |
{ |
|
95 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
96 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP01, "====> ExecuteHostTestCaseL entry priority = %d", |
0 | 97 |
RThread().Priority()); |
98 |
||
99 |
// Bump thread priority for this test only |
|
100 |
||
101 |
RThread().SetPriority(EPriorityAbsoluteHigh); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
102 |
OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP02, "Thread priority raised %d->%d", iPriority, RThread().Priority()); |
0 | 103 |
|
104 |
iCaseStep = EInProcess; |
|
105 |
iActorFDF = CActorFDF::NewL(*this); |
|
106 |
iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0); |
|
107 |
iInterface0Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface0,TCallBack(CUT_PBASE_T_USBDI_1232::Interface0ResumedL,this)); |
|
108 |
iInterface1Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface1,TCallBack(CUT_PBASE_T_USBDI_1232::Interface1ResumedL,this)); |
|
109 |
||
110 |
// Monitor for device connections |
|
111 |
iActorFDF->Monitor(); |
|
112 |
||
113 |
// Start the connection timeout |
|
114 |
TimeoutIn(30); |
|
115 |
} |
|
116 |
||
117 |
void CUT_PBASE_T_USBDI_1232::ExecuteDeviceTestCaseL() |
|
118 |
{ |
|
119 |
||
120 |
// Construct the device for the test case |
|
121 |
iTestDevice->OpenL(TestCaseId()); |
|
122 |
iTestDevice->SubscribeToReports(iStatus); |
|
123 |
SetActive(); |
|
124 |
||
125 |
// Connect the test device |
|
126 |
iTestDevice->SoftwareConnect(); |
|
127 |
} |
|
128 |
||
129 |
void CUT_PBASE_T_USBDI_1232::HostDoCancel() |
|
130 |
{ |
|
131 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
132 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP03, "====> HostDoCancel entry priority = %d", RThread().Priority()); |
0 | 133 |
|
134 |
// Cancel the timeout timer |
|
135 |
CancelTimeout(); |
|
136 |
} |
|
137 |
||
138 |
void CUT_PBASE_T_USBDI_1232::DeviceDoCancel() |
|
139 |
{ |
|
140 |
||
141 |
// Cancel the device |
|
142 |
iTestDevice->CancelSubscriptionToReports(); |
|
143 |
} |
|
144 |
||
145 |
void CUT_PBASE_T_USBDI_1232::DeviceInsertedL(TUint aDeviceHandle) |
|
146 |
{ |
|
147 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
148 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP04, "====> DeviceInsertedL entry priority = %d", RThread().Priority()); |
0 | 149 |
|
150 |
Cancel(); // Cancel the timer |
|
151 |
TInt err(KErrNone); |
|
152 |
iDeviceHandle = aDeviceHandle; |
|
153 |
iActorFDF->Monitor(); |
|
154 |
||
155 |
// Validate that device is as expected |
|
156 |
CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle); |
|
157 |
if (testDevice.SerialNumber().Compare(TestCaseId()) != 0) |
|
158 |
{ |
|
159 |
// Incorrect device for this test case |
|
160 |
||
161 |
RDebug::Printf( |
|
162 |
"<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)", |
|
163 |
KErrNotFound, &testDevice.SerialNumber(), &TestCaseId()); |
|
164 |
||
165 |
// Start the connection timeout again |
|
166 |
TimeoutIn(30); |
|
167 |
return; |
|
168 |
} |
|
169 |
// Check tree now |
|
170 |
CHECK(CheckTreeAfterDeviceInsertion(testDevice, _L("RDeviceA")) == KErrNone); |
|
171 |
||
172 |
// Perform the correct test step |
|
173 |
switch (iCaseStep) |
|
174 |
{ |
|
175 |
case EInProcess: |
|
176 |
{ |
|
177 |
TUint32 token1(0); |
|
178 |
TUint32 token2(0); |
|
179 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
180 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP05, "Obtaining token for interface 0"); |
0 | 181 |
err = testDevice.Device().GetTokenForInterface(0, token1); |
182 |
if (err != KErrNone) |
|
183 |
{ |
|
184 |
RDebug::Printf( |
|
185 |
"<Error %d> Token for interface 0 could not be retrieved", |
|
186 |
err); |
|
187 |
return TestFailed(err); |
|
188 |
} |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
189 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP06, "Token 1 (%d) retrieved", token1); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
190 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP07, "Opening interface 0"); |
0 | 191 |
err = iUsbInterface0.Open(token1); // Alternate interface setting 0 |
192 |
if (err != KErrNone) |
|
193 |
{ |
|
194 |
RDebug::Printf( |
|
195 |
"<Error %d> Interface 0 could not be opened", err); |
|
196 |
return TestFailed(err); |
|
197 |
} |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
198 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP08, "Interface 0 opened"); |
0 | 199 |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
200 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP09, "Obtaining token for interface 1"); |
0 | 201 |
err = testDevice.Device().GetTokenForInterface(1, token2); |
202 |
if (err != KErrNone) |
|
203 |
{ |
|
204 |
RDebug::Printf( |
|
205 |
"<Error %d> Token for interface 1 could not be retrieved", |
|
206 |
err); |
|
207 |
return TestFailed(err); |
|
208 |
} |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
209 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP10, "Opening interface 1"); |
0 | 210 |
err = iUsbInterface1.Open(token2); // Alternate interface setting 0 |
211 |
if (err != KErrNone) |
|
212 |
{ |
|
213 |
RDebug::Printf( |
|
214 |
"<Error %d> Interface 1 could not be opened", err); |
|
215 |
return TestFailed(err); |
|
216 |
} |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
217 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP11, "Interface 1 opened"); |
0 | 218 |
|
219 |
// device go to suspend |
|
220 |
// Suspend interface 0 |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
221 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP12, "Suspending interface 0"); |
0 | 222 |
iInterface0Watcher->SuspendAndWatch(); |
223 |
||
224 |
// Suspend interface 1 |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
225 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP13, "Suspending interface 1"); |
0 | 226 |
iInterface1Watcher->SuspendAndWatch(); |
227 |
||
228 |
iCaseStep = ESuspendWhenResuming; |
|
229 |
||
230 |
TimeoutIn(10); // Give 10 seconds for device to suspend |
|
231 |
||
232 |
||
233 |
iUsbInterface0.CancelWaitForResume(); // a tricky way to close the watcher of interface |
|
234 |
iUsbInterface1.CancelWaitForResume(); |
|
235 |
} |
|
236 |
break; |
|
237 |
||
238 |
default: |
|
239 |
TestFailed(KErrCorrupt); |
|
240 |
break; |
|
241 |
} |
|
242 |
} |
|
243 |
||
244 |
TInt CUT_PBASE_T_USBDI_1232::Interface0ResumedL(TAny* aPtr) |
|
245 |
{ |
|
246 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
247 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP14, "====> Interface0ResumedL entry priority = %d", RThread().Priority()); |
0 | 248 |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
249 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP15, " -Interface 0 resumed"); |
0 | 250 |
CUT_PBASE_T_USBDI_1232* self = |
251 |
reinterpret_cast<CUT_PBASE_T_USBDI_1232*>(aPtr); |
|
252 |
TInt completionCode = self->iInterface0Watcher->CompletionCode(); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
253 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP16, " -watcher 0 iStatus=%d",completionCode); |
0 | 254 |
|
255 |
switch (self->iCaseStep) |
|
256 |
{ |
|
257 |
||
258 |
case EPassed: |
|
259 |
{ |
|
260 |
if (completionCode == KErrNone) |
|
261 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
262 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP17, "Device resume successed,test passed!"); |
0 | 263 |
self->SendEp0Request(); // stop client site |
264 |
} |
|
265 |
else |
|
266 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
267 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP18, "Device resume failed, err = %d ",completionCode); |
0 | 268 |
self->iCaseStep = EFailed; |
269 |
self->SendEp0Request(); |
|
270 |
} |
|
271 |
} |
|
272 |
break; |
|
273 |
case EFailed: |
|
274 |
self->SendEp0Request(); |
|
275 |
break; |
|
276 |
||
277 |
default: |
|
278 |
break; |
|
279 |
}; |
|
280 |
||
281 |
return KErrNone; |
|
282 |
} |
|
283 |
||
284 |
TInt CUT_PBASE_T_USBDI_1232::Interface1ResumedL(TAny* aPtr) |
|
285 |
{ |
|
286 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
287 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP19, "====> Interface1ResumedL entry priority = %d", RThread().Priority()); |
0 | 288 |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
289 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP20, "Interface 1 resumed"); |
0 | 290 |
CUT_PBASE_T_USBDI_1232* self = |
291 |
reinterpret_cast<CUT_PBASE_T_USBDI_1232*>(aPtr); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
292 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP21, "watcher 1 iStatus=%d", self->iInterface1Watcher->CompletionCode()); |
0 | 293 |
return KErrNone; |
294 |
} |
|
295 |
||
296 |
void CUT_PBASE_T_USBDI_1232::DeviceRemovedL(TUint aDeviceHandle) |
|
297 |
{ |
|
298 |
||
299 |
// The test device should not be removed until the test case has passed |
|
300 |
// so this test case has not completed, and state this event as an error |
|
301 |
||
302 |
TestFailed(KErrDisconnected); |
|
303 |
} |
|
304 |
||
305 |
void CUT_PBASE_T_USBDI_1232::BusErrorL(TInt aError) |
|
306 |
{ |
|
307 |
||
308 |
// This test case handles no failiures on the bus |
|
309 |
||
310 |
TestFailed(aError); |
|
311 |
} |
|
312 |
||
313 |
void CUT_PBASE_T_USBDI_1232::DeviceStateChangeL( |
|
314 |
RUsbDevice::TDeviceState aPreviousState, |
|
315 |
RUsbDevice::TDeviceState aNewState, TInt aCompletionCode) |
|
316 |
{ |
|
317 |
Cancel(); |
|
318 |
||
319 |
// test RInterface , the RUsbDevice notification logic not used . |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
320 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP22, " -Device State change from err=%d",aCompletionCode); |
0 | 321 |
|
322 |
switch (iCaseStep) |
|
323 |
{ |
|
324 |
case ESuspendWhenResuming: |
|
325 |
if (aNewState == RUsbDevice::EDeviceSuspended) |
|
326 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
327 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP23, "====> device has suspended!"); |
0 | 328 |
|
329 |
SuspendWhenResuming(); |
|
330 |
} |
|
331 |
break; |
|
332 |
case EValidSuspendWhenResuming: |
|
333 |
if (aPreviousState == RUsbDevice::EDeviceSuspended&&aNewState |
|
334 |
== RUsbDevice::EDeviceSuspended) |
|
335 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
336 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP24, "====> device suspended again,suspend while resuming succeed!"); |
0 | 337 |
iCaseStep = EPassed; |
338 |
iUsbInterface0.CancelPermitSuspend(); |
|
339 |
} |
|
340 |
else |
|
341 |
{ |
|
342 |
iCaseStep = EFailed; |
|
343 |
iUsbInterface0.CancelPermitSuspend(); |
|
344 |
} |
|
345 |
||
346 |
break; |
|
347 |
default: |
|
348 |
break; |
|
349 |
} |
|
350 |
||
351 |
} |
|
352 |
||
353 |
void CUT_PBASE_T_USBDI_1232::Ep0TransferCompleteL(TInt aCompletionCode) |
|
354 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
355 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP25, "Ep0TransferCompleteL with aCompletionCode = %d", |
0 | 356 |
aCompletionCode); |
357 |
switch (iCaseStep) |
|
358 |
{ |
|
359 |
||
360 |
default: |
|
361 |
case EFailed: |
|
362 |
TestFailed(KErrCompletion); |
|
363 |
break; |
|
364 |
||
365 |
case EPassed: |
|
366 |
TestPassed(); |
|
367 |
break; |
|
368 |
} |
|
369 |
} |
|
370 |
||
371 |
void CUT_PBASE_T_USBDI_1232::HostRunL() |
|
372 |
{ |
|
373 |
||
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
374 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP26, "====> HostRunL entry priority = %d", RThread().Priority()); |
0 | 375 |
|
376 |
// Obtain the completion code |
|
377 |
TInt completionCode(iStatus.Int()); |
|
378 |
||
379 |
if (completionCode == KErrNone) |
|
380 |
{ |
|
381 |
// Action timeout |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
382 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP27, "<Error> Action timeout"); |
0 | 383 |
TestFailed(KErrTimedOut); |
384 |
} |
|
385 |
else |
|
386 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
387 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP28, "<Error %d> Timeout timer could not complete", |
0 | 388 |
completionCode); |
389 |
TestFailed(completionCode); |
|
390 |
} |
|
391 |
} |
|
392 |
||
393 |
void CUT_PBASE_T_USBDI_1232::DeviceRunL() |
|
394 |
{ |
|
395 |
||
396 |
// Disconnect the device |
|
397 |
||
398 |
iTestDevice->SoftwareDisconnect(); |
|
399 |
||
400 |
// Complete the test case request |
|
401 |
||
402 |
TestPolicy().SignalTestComplete(iStatus.Int()); |
|
403 |
} |
|
404 |
||
405 |
void CUT_PBASE_T_USBDI_1232::SuspendWhenResuming() |
|
406 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
407 |
OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP29, "====> SuspendWhenResuming entry priority = %d", |
0 | 408 |
RThread().Priority()); |
409 |
||
410 |
// Cancel suspend-in-progress |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
411 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP30, "Cancel Suspend interface 0"); |
0 | 412 |
|
413 |
iUsbInterface0.CancelPermitSuspend(); |
|
414 |
||
415 |
// how to prove, see log? |
|
416 |
// Suspend interface 0 |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
417 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP31, "Suspending interface 0"); |
0 | 418 |
iInterface0Watcher->SuspendAndWatch(); |
419 |
||
420 |
// Suspend interface 1 |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
421 |
OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1232_DCUT_PBASE_T_USBDI_1232_DUP32, "Suspending interface 1"); |
0 | 422 |
iInterface1Watcher->SuspendAndWatch(); |
423 |
||
424 |
iCaseStep = EValidSuspendWhenResuming; |
|
425 |
||
426 |
TimeoutIn(10); // Give 10 seconds for device to suspend |
|
427 |
||
428 |
} |
|
429 |
||
430 |
void CUT_PBASE_T_USBDI_1232::SendEp0Request() |
|
431 |
{ |
|
432 |
TTestCasePassed request; |
|
433 |
iControlEp0->SendRequest(request, this); |
|
434 |
} |
|
435 |
||
436 |
}//end namespace |
|
437 |
||
438 |