author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:34:26 +0300 | |
branch | RCL_3 |
changeset 43 | c1f20ce4abcf |
parent 0 | a41df078684a |
child 44 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
43
c1f20ce4abcf
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 |
// @internalComponent |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#include <e32std.h> |
|
19 |
#include <e32std_private.h> |
|
20 |
#include <u32std.h> // unicode builds |
|
21 |
#include <e32base.h> |
|
22 |
#include <e32base_private.h> |
|
23 |
#include <e32Test.h> // RTest headder |
|
24 |
#include "testcaseroot.h" |
|
25 |
//#include "testcasewd.h" |
|
26 |
#include "b2bwatchers.h" |
|
27 |
#include "testcase0683.h" |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
28 |
#include "OstTraceDefinitions.h" |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
29 |
#ifdef OST_TRACE_COMPILER_IN_USE |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
30 |
#include "testcase0683Traces.h" |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
31 |
#endif |
0 | 32 |
|
33 |
#define _REPEATS (oOpenIterations*3) |
|
34 |
||
35 |
||
36 |
/* ************************************************************************************** |
|
37 |
* the name below is used to add a pointer to our construction method to a pointer MAP in |
|
38 |
* the class factory |
|
39 |
*/ |
|
40 |
_LIT(KTestCaseId,"PBASE-USB_OTGDI-0683"); |
|
41 |
const TTestCaseFactoryReceipt<CTestCase0683> CTestCase0683::iFactoryReceipt(KTestCaseId); |
|
42 |
||
43 |
CTestCase0683* CTestCase0683::NewL(TBool aHost) |
|
44 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
45 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
46 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
47 |
OstTraceFunctionEntry0(CTESTCASE0683_NEWL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
48 |
} |
0 | 49 |
CTestCase0683* self = new (ELeave) CTestCase0683(aHost); |
50 |
CleanupStack::PushL(self); |
|
51 |
self->ConstructL(); |
|
52 |
CleanupStack::Pop(self); |
|
53 |
return self; |
|
54 |
} |
|
55 |
||
56 |
||
57 |
CTestCase0683::CTestCase0683(TBool aHost) |
|
58 |
: CTestCaseB2BRoot(KTestCaseId, aHost, iStatus) |
|
59 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
60 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
61 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
62 |
OstTraceFunctionEntry0(CTESTCASE0683_CTESTCASE0683); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
63 |
} |
0 | 64 |
|
65 |
} |
|
66 |
||
67 |
||
68 |
/** |
|
69 |
ConstructL |
|
70 |
*/ |
|
71 |
void CTestCase0683::ConstructL() |
|
72 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
73 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
74 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
OstTraceFunctionEntry0(CTESTCASE0683_CONSTRUCTL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
76 |
} |
0 | 77 |
|
78 |
iDualRoleCase = ETrue; // another back-back |
|
79 |
||
80 |
BaseConstructL(); |
|
81 |
} |
|
82 |
||
83 |
||
84 |
CTestCase0683::~CTestCase0683() |
|
85 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
86 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
87 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
88 |
OstTraceFunctionEntry0(CTESTCASE0683_DCTESTCASE0683); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
89 |
} |
0 | 90 |
iCollector.DestroyObservers(); |
91 |
Cancel(); |
|
92 |
} |
|
93 |
||
94 |
||
95 |
void CTestCase0683::ExecuteTestCaseL() |
|
96 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
97 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
98 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
99 |
OstTraceFunctionEntry0(CTESTCASE0683_EXECUTETESTCASEL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
100 |
} |
0 | 101 |
iCaseStep = EPreconditions; |
102 |
iHNPCounter = 3; // To be decremented to govern the number of times we do HNP. |
|
103 |
CActiveScheduler::Add(this); |
|
104 |
SelfComplete(); |
|
105 |
} |
|
106 |
||
107 |
||
108 |
void CTestCase0683::DoCancel() |
|
109 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
110 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
111 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
112 |
OstTraceFunctionEntry0(CTESTCASE0683_DOCANCEL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
113 |
} |
0 | 114 |
// cancel our timer |
115 |
iTimer.Cancel(); |
|
116 |
} |
|
117 |
||
118 |
||
119 |
// handle event completion |
|
120 |
void CTestCase0683::RunStepL() |
|
121 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
122 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
123 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
124 |
OstTraceFunctionEntry0(CTESTCASE0683_RUNSTEPL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
125 |
} |
0 | 126 |
// Obtain the completion code for this CActive obj. |
127 |
TInt completionCode(iStatus.Int()); |
|
128 |
TBuf<MAX_DSTRLEN> aDescription; |
|
129 |
TInt err(0); |
|
130 |
||
131 |
switch(iCaseStep) |
|
132 |
{ |
|
133 |
case EPreconditions: |
|
134 |
{ |
|
135 |
LOG_STEPNAME(_L("EPreconditions")) |
|
136 |
iCaseStep = ELoadLdd; |
|
137 |
StepB2BPreconditions(); |
|
138 |
break; |
|
139 |
} |
|
140 |
||
141 |
// 1. Load the Client LDD |
|
142 |
case ELoadLdd: |
|
143 |
{ |
|
144 |
LOG_STEPNAME(_L("ELoadLdd")) |
|
145 |
if (!StepLoadClient(0xF678/*use default settings for SRP/HNP support*/)) |
|
146 |
{ |
|
147 |
return TestFailed(KErrAbort, _L("Client Load Failure")); |
|
148 |
} |
|
149 |
// load OTG ldd and init. |
|
150 |
if (!StepLoadLDD()) |
|
151 |
{ |
|
152 |
return TestFailed(KErrAbort, _L("OTG Load Failure")); |
|
153 |
} |
|
154 |
||
155 |
if(otgActivateFdfActor()!=KErrNone) |
|
156 |
{ |
|
157 |
return TestFailed(KErrAbort, _L("Couldn't load FDF Actor")); |
|
158 |
} |
|
159 |
||
160 |
// test that the right cable is in |
|
161 |
CheckRoleConnections(); |
|
162 |
||
163 |
// subscribe to OTG states,events and messages now that it has loaded OK |
|
164 |
TRAPD(result, iCollector.CreateObserversL(*this)); |
|
165 |
if (KErrNone != result) |
|
166 |
return(TestFailed(KErrNoMemory, _L("Unable to create observers"))); |
|
167 |
iCollector.ClearAllEvents(); |
|
168 |
iCaseStep = EReadyToRaiseVBus; |
|
169 |
SelfComplete(); |
|
170 |
break; |
|
171 |
} |
|
172 |
||
173 |
case EReadyToRaiseVBus: |
|
174 |
{ |
|
175 |
if (gTestRoleMaster) |
|
176 |
{ |
|
177 |
// wait for Vbus to be raised |
|
178 |
iCollector.AddRequiredNotification(EWatcherState, RUsbOtgDriver::EStateBIdle); |
|
179 |
iCollector.AddRequiredNotification(EWatcherEvent, RUsbOtgDriver::EEventVbusRaised); |
|
180 |
iCollector.AddRequiredNotification(EWatcherState, RUsbOtgDriver::EStateBPeripheral); |
|
181 |
// All as usual - we should report a failure if the B-Device ever reports "busy" |
|
182 |
iCollector.AddFailureNotification(EWatcherAConnectionIdle, RUsbOtgDriver::EConnectionBusy); |
|
183 |
} |
|
184 |
else |
|
185 |
{ // slave "A" |
|
186 |
// Raise VBus, then wait for default role |
|
187 |
err = otgBusRequest(); // ok to turn on VBus now |
|
188 |
if (KErrNone != err) |
|
189 |
{ |
|
190 |
return TestFailed(KErrAbort, _L("Raise Vbus - RUsbOtgDriver::BusRequest() FAILED!")); |
|
191 |
} |
|
192 |
||
193 |
// we might also wait for and EStateAIdle |
|
194 |
iCollector.AddRequiredNotification(EWatcherState, RUsbOtgDriver::EStateAIdle); |
|
195 |
iCollector.AddRequiredNotification(EWatcherEvent, RUsbOtgDriver::EEventVbusRaised); |
|
196 |
iCollector.AddRequiredNotification(EWatcherEvent, RUsbOtgDriver::EEventRoleChangedToHost); |
|
197 |
iCollector.AddRequiredNotification(EWatcherAConnectionIdle, RUsbOtgDriver::EConnectionBusy); |
|
198 |
} |
|
199 |
iCaseStep = EDefaultRoles; |
|
200 |
const TInt KTestCase0683Timeout = 30000; // 30 seconds, should be plenty of time for 3 role swaps |
|
201 |
iCollector.AddStepTimeout(KTestCase0683Timeout); |
|
202 |
SetActive(); |
|
203 |
break; |
|
204 |
} |
|
205 |
||
206 |
case EDefaultRoles: |
|
207 |
{ |
|
208 |
test.Printf(_L("Into EDefaultRoles step...\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
209 |
OstTrace0(TRACE_NORMAL, CTESTCASE0683_RUNSTEPL_DUP01, "Into EDefaultRoles step...\n"); |
0 | 210 |
|
211 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
|
212 |
{ |
|
213 |
iCollector.DestroyObservers(); |
|
214 |
return TestFailed(KErrAbort, _L("Timeout")); |
|
215 |
} |
|
216 |
||
217 |
if ( --iHNPCounter > 0) |
|
218 |
{ |
|
219 |
// We want to do further role swapping |
|
220 |
if (gTestRoleMaster) |
|
221 |
{ |
|
222 |
// B-Device should now wait until it is configured |
|
223 |
iCollector.AddRequiredNotification(EWatcherPeripheralState, EUsbcDeviceStateConfigured); |
|
224 |
iCaseStep = EBConfigured; |
|
225 |
} |
|
226 |
else |
|
227 |
{ |
|
228 |
iCollector.AddRequiredNotification(EWatcherAConnectionIdle, RUsbOtgDriver::EConnectionIdle); |
|
229 |
iCaseStep = EAIdleHostPriorToAPeripheral; |
|
230 |
} |
|
231 |
SetActive(); |
|
232 |
} |
|
233 |
else |
|
234 |
{ |
|
235 |
// We've done 3 x HNP cycles back to default roles. |
|
236 |
// This time, we want A-Host to suspend B-Peripheral, |
|
237 |
// have the B-Peripheral *not* do a bus request, then |
|
238 |
// have the A-Device detect idle and shut down VBus. |
|
239 |
if (gTestRoleMaster) |
|
240 |
{ |
|
241 |
// B-Device should now wait until it is configured (for the last time this test) |
|
242 |
iCollector.AddRequiredNotification(EWatcherPeripheralState, EUsbcDeviceStateConfigured); |
|
243 |
iCaseStep = EBConfigured; |
|
244 |
} |
|
245 |
else |
|
246 |
{ |
|
247 |
iCollector.AddRequiredNotification(EWatcherAConnectionIdle, RUsbOtgDriver::EConnectionIdle); |
|
248 |
iCaseStep = EAIdleHostPriorToVBusDown; |
|
249 |
} |
|
250 |
SetActive(); |
|
251 |
} |
|
252 |
break; |
|
253 |
} |
|
254 |
||
255 |
case EBConfigured: // A B-Device only step! |
|
256 |
{ |
|
257 |
test.Printf(_L("Into EBConfigured step...\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
258 |
OstTrace0(TRACE_NORMAL, CTESTCASE0683_RUNSTEPL_DUP02, "Into EBConfigured step...\n"); |
0 | 259 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
260 |
{ |
|
261 |
iCollector.DestroyObservers(); |
|
262 |
return TestFailed(KErrAbort, _L("Timeout")); |
|
263 |
} |
|
264 |
iCollector.AddRequiredNotification(EWatcherPeripheralState, EUsbcDeviceStateSuspended); |
|
265 |
iCaseStep = EBSuspended; |
|
266 |
SetActive(); |
|
267 |
break; |
|
268 |
} |
|
269 |
||
270 |
case EBSuspended: |
|
271 |
{ |
|
272 |
test.Printf(_L("Into EBSuspended step...\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
273 |
OstTrace0(TRACE_NORMAL, CTESTCASE0683_RUNSTEPL_DUP03, "Into EBSuspended step...\n"); |
0 | 274 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
275 |
{ |
|
276 |
iCollector.DestroyObservers(); |
|
277 |
return TestFailed(KErrAbort, _L("Timeout")); |
|
278 |
} |
|
279 |
||
280 |
if (iHNPCounter > 0) |
|
281 |
{ |
|
282 |
// issue bus request to trigger HNP |
|
283 |
test.Printf(_L("VBus present, attempting a swap.\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
284 |
OstTrace0(TRACE_NORMAL, CTESTCASE0683_RUNSTEPL_DUP04, "VBus present, attempting a swap.\n"); |
0 | 285 |
iCollector.AddRequiredNotification(EWatcherState, RUsbOtgDriver::EStateBHost); |
286 |
||
287 |
err = otgBusRequest(); // Request the host role |
|
288 |
if (KErrNone != err) |
|
289 |
{ |
|
290 |
test.Printf(_L("BusRequest returned %d\n"),err); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
291 |
OstTrace1(TRACE_NORMAL, CTESTCASE0683_RUNSTEPL_DUP05, "BusRequest returned %d\n",err); |
0 | 292 |
return TestFailed(KErrAbort, _L("BusRequest() failed!")); |
293 |
} |
|
294 |
||
295 |
iCaseStep = ESwappedRoles; |
|
296 |
SetActive(); |
|
297 |
} |
|
298 |
else |
|
299 |
{ |
|
300 |
// We've done all the role-swapping we want. Now just wait for |
|
301 |
// A-Host to drop VBus... |
|
302 |
iCaseStep = EDropVBus; |
|
303 |
SelfComplete(); |
|
304 |
} |
|
305 |
||
306 |
break; |
|
307 |
} |
|
308 |
||
309 |
case EAIdleHostPriorToAPeripheral: // an "A-Device only" step |
|
310 |
{ |
|
311 |
test.Printf(_L("Into EAIdleHostPriorToAPeripheral step...\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
312 |
OstTrace0(TRACE_NORMAL, CTESTCASE0683_RUNSTEPL_DUP06, "Into EAIdleHostPriorToAPeripheral step...\n"); |
0 | 313 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
314 |
{ |
|
315 |
iCollector.DestroyObservers(); |
|
316 |
return TestFailed(KErrAbort, _L("Timeout")); |
|
317 |
} |
|
318 |
||
319 |
// A-Device should expect nothing more until it becomes A-Peripheral |
|
320 |
iCollector.AddRequiredNotification(EWatcherState, RUsbOtgDriver::EStateAPeripheral); |
|
321 |
iCollector.AddRequiredNotification(EWatcherAConnectionIdle, RUsbOtgDriver::EConnectionBusy); |
|
322 |
iCaseStep = ESwappedRoles; |
|
323 |
SetActive(); |
|
324 |
break; |
|
325 |
} |
|
326 |
||
327 |
case ESwappedRoles: |
|
328 |
{ |
|
329 |
test.Printf(_L("Into ESwappedRoles step...\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
330 |
OstTrace0(TRACE_NORMAL, CTESTCASE0683_RUNSTEPL_DUP07, "Into ESwappedRoles step...\n"); |
0 | 331 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
332 |
{ |
|
333 |
iCollector.DestroyObservers(); |
|
334 |
return TestFailed(KErrAbort, _L("Timeout")); |
|
335 |
} |
|
336 |
||
337 |
if (gTestRoleMaster) |
|
338 |
{ |
|
339 |
// B-Device should now wait until it is back to B-Peripheral |
|
340 |
iCollector.AddRequiredNotification(EWatcherState, RUsbOtgDriver::EStateBPeripheral); |
|
341 |
iCaseStep = EDefaultRoles; |
|
342 |
} |
|
343 |
else |
|
344 |
{ |
|
345 |
// A-Device should wait to become a configured A-Peripheral |
|
346 |
iCollector.AddRequiredNotification(EWatcherPeripheralState, EUsbcDeviceStateConfigured); |
|
347 |
iCaseStep = EAConfigured; |
|
348 |
} |
|
349 |
SetActive(); |
|
350 |
break; |
|
351 |
} |
|
352 |
||
353 |
case EAConfigured: // A-Device only step |
|
354 |
{ |
|
355 |
test.Printf(_L("Into EAConfigured step...\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
356 |
OstTrace0(TRACE_NORMAL, CTESTCASE0683_RUNSTEPL_DUP08, "Into EAConfigured step...\n"); |
0 | 357 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
358 |
{ |
|
359 |
iCollector.DestroyObservers(); |
|
360 |
return TestFailed(KErrAbort, _L("Timeout")); |
|
361 |
} |
|
362 |
||
363 |
iCollector.AddRequiredNotification(EWatcherAConnectionIdle, RUsbOtgDriver::EConnectionIdle); |
|
364 |
iCollector.AddRequiredNotification(EWatcherPeripheralState, EUsbcDeviceStateSuspended); |
|
365 |
iCaseStep = EASuspended; |
|
366 |
SetActive(); |
|
367 |
break; |
|
368 |
} |
|
369 |
||
370 |
case EASuspended: // A-Device only step |
|
371 |
{ |
|
372 |
test.Printf(_L("Into EASuspended step...\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
373 |
OstTrace0(TRACE_NORMAL, CTESTCASE0683_RUNSTEPL_DUP09, "Into EASuspended step...\n"); |
0 | 374 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
375 |
{ |
|
376 |
iCollector.DestroyObservers(); |
|
377 |
return TestFailed(KErrAbort, _L("Timeout")); |
|
378 |
} |
|
379 |
||
380 |
iCollector.AddRequiredNotification(EWatcherAConnectionIdle, RUsbOtgDriver::EConnectionBusy); |
|
381 |
iCollector.AddRequiredNotification(EWatcherState, RUsbOtgDriver::EStateAHost); // Swapping back to default role |
|
382 |
||
383 |
iCaseStep = EDefaultRoles; |
|
384 |
SetActive(); |
|
385 |
break; |
|
386 |
} |
|
387 |
||
388 |
case EAIdleHostPriorToVBusDown: |
|
389 |
{ |
|
390 |
test.Printf(_L("Into EAIdleHostPriorToVBusDown step...\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
391 |
OstTrace0(TRACE_NORMAL, CTESTCASE0683_RUNSTEPL_DUP10, "Into EAIdleHostPriorToVBusDown step...\n"); |
0 | 392 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
393 |
{ |
|
394 |
iCollector.DestroyObservers(); |
|
395 |
return TestFailed(KErrAbort, _L("Timeout")); |
|
396 |
} |
|
397 |
||
398 |
iCaseStep = EDropVBus; |
|
399 |
SelfComplete(); |
|
400 |
break; |
|
401 |
} |
|
402 |
||
403 |
case EDropVBus: |
|
404 |
LOG_STEPNAME(_L("EDropVBus")) |
|
405 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
|
406 |
{ |
|
407 |
iCollector.DestroyObservers(); |
|
408 |
return TestFailed(KErrAbort, _L("Timeout")); |
|
409 |
} |
|
410 |
||
411 |
iCollector.AddRequiredNotification(EWatcherEvent, RUsbOtgDriver::EEventVbusDropped); |
|
412 |
if ( gTestRoleMaster) |
|
413 |
{ |
|
414 |
iCollector.AddRequiredNotification(EWatcherState, RUsbOtgDriver::EStateBIdle); |
|
415 |
} |
|
416 |
else |
|
417 |
{ // SLAVE "A" |
|
418 |
otgBusDrop(); |
|
419 |
iCollector.AddRequiredNotification(EWatcherState, RUsbOtgDriver::EStateAIdle); |
|
420 |
} |
|
421 |
iCaseStep = EVBusDropped; |
|
422 |
SetActive(); |
|
423 |
break; |
|
424 |
||
425 |
case EVBusDropped: |
|
426 |
LOG_STEPNAME(_L("ELoopVerifyDrop")) |
|
427 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
|
428 |
{ |
|
429 |
return TestFailed(KErrAbort, _L("Timeout")); |
|
430 |
} |
|
431 |
||
432 |
if (otgVbusPresent()) |
|
433 |
{ |
|
434 |
return TestFailed(KErrAbort, _L("Vbus did not drop - FAILED!")); |
|
435 |
} |
|
436 |
iCaseStep = EUnloadLdd; |
|
437 |
SelfComplete(); |
|
438 |
break; |
|
439 |
||
440 |
case EUnloadLdd: |
|
441 |
LOG_STEPNAME(_L("EUnloadLdd")) |
|
442 |
otgDeactivateFdfActor(); |
|
443 |
iCollector.DestroyObservers(); |
|
444 |
if (EFalse == StepUnloadLDD()) |
|
445 |
return TestFailed(KErrAbort,_L("unload Ldd failure")); |
|
446 |
if (!StepUnloadClient()) |
|
447 |
return TestFailed(KErrAbort,_L("Client Unload Failure")); |
|
448 |
||
449 |
iCaseStep = ELastStep; |
|
450 |
SelfComplete(); |
|
451 |
break; |
|
452 |
||
453 |
case ELastStep: |
|
454 |
LOG_STEPNAME(_L("ELastStep")) |
|
455 |
TestPassed(); |
|
456 |
break; |
|
457 |
||
458 |
default: |
|
459 |
test.Printf(_L("<Error> unknown test step")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
460 |
OstTrace0(TRACE_NORMAL, CTESTCASE0683_RUNSTEPL_DUP11, "<Error> unknown test step"); |
0 | 461 |
Cancel(); |
462 |
return (TestFailed(KErrCorrupt, _L("<Error> unknown test step"))); |
|
463 |
} |
|
464 |
} |
|
465 |