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