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 |
// @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 "testcase0468.h" |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
27 |
#include "OstTraceDefinitions.h" |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
28 |
#ifdef OST_TRACE_COMPILER_IN_USE |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
29 |
#include "testcase0468Traces.h" |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
30 |
#endif |
0 | 31 |
|
32 |
#define _REPEATS (oOpenIterations*3) |
|
33 |
||
34 |
||
35 |
||
36 |
// the name below is used to add a pointer to our construction method to a pointer MAP in |
|
37 |
// the class factory |
|
38 |
_LIT(KTestCaseId,"PBASE-USB_OTGDI-0468"); |
|
39 |
const TTestCaseFactoryReceipt<CTestCase0468> CTestCase0468::iFactoryReceipt(KTestCaseId); |
|
40 |
||
41 |
CTestCase0468* CTestCase0468::NewL(TBool aHost) |
|
42 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
43 |
if(gVerboseOutput) |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
44 |
{ |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
45 |
OstTraceFunctionEntry0(CTESTCASE0468_NEWL); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
46 |
} |
0 | 47 |
CTestCase0468* self = new (ELeave) CTestCase0468(aHost); |
48 |
CleanupStack::PushL(self); |
|
49 |
self->ConstructL(); |
|
50 |
CleanupStack::Pop(self); |
|
51 |
return self; |
|
52 |
} |
|
53 |
||
54 |
||
55 |
CTestCase0468::CTestCase0468(TBool aHost) |
|
56 |
: CTestCaseRoot(KTestCaseId, aHost) |
|
57 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
58 |
if(gVerboseOutput) |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
59 |
{ |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
60 |
OstTraceFunctionEntry0(CTESTCASE0468_CTESTCASE0468); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
61 |
} |
0 | 62 |
|
63 |
} |
|
64 |
||
65 |
||
66 |
/** |
|
67 |
ConstructL |
|
68 |
*/ |
|
69 |
void CTestCase0468::ConstructL() |
|
70 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
71 |
if(gVerboseOutput) |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
72 |
{ |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
73 |
OstTraceFunctionEntry0(CTESTCASE0468_CONSTRUCTL); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
74 |
} |
0 | 75 |
iWDTimer = CTestCaseWatchdog::NewL(); |
76 |
iRepeats = OPEN_REPEATS; |
|
77 |
||
78 |
BaseConstructL(); |
|
79 |
} |
|
80 |
||
81 |
||
82 |
CTestCase0468::~CTestCase0468() |
|
83 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
84 |
if(gVerboseOutput) |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
85 |
{ |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
86 |
OstTraceFunctionEntry0(CTESTCASE0468_DCTESTCASE0468); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
87 |
} |
0 | 88 |
|
89 |
Cancel(); |
|
90 |
delete iWDTimer; |
|
91 |
||
92 |
} |
|
93 |
||
94 |
||
95 |
void CTestCase0468::ExecuteTestCaseL() |
|
96 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
97 |
if(gVerboseOutput) |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
98 |
{ |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
99 |
OstTraceFunctionEntry0(CTESTCASE0468_EXECUTETESTCASEL); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
100 |
} |
0 | 101 |
iCaseStep = EPreconditions; |
102 |
||
103 |
iRepeats = KOperationRetriesMax; // VBus event rise retries |
|
104 |
||
105 |
CActiveScheduler::Add(this); |
|
106 |
SelfComplete(); |
|
107 |
||
108 |
} |
|
109 |
||
110 |
||
111 |
void CTestCase0468::DoCancel() |
|
112 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
113 |
if(gVerboseOutput) |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
114 |
{ |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
115 |
OstTraceFunctionEntry0(CTESTCASE0468_DOCANCEL); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
116 |
} |
0 | 117 |
|
118 |
// cancel our timer |
|
119 |
iTimer.Cancel(); |
|
120 |
} |
|
121 |
||
122 |
||
123 |
void CTestCase0468::CancelKB(CTestCaseRoot *pThis) |
|
124 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
125 |
if(gVerboseOutput) |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
126 |
{ |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
127 |
OstTraceFunctionEntry0(CTESTCASE0468_CANCELKB); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
128 |
} |
0 | 129 |
CTestCase0468 * p = REINTERPRET_CAST(CTestCase0468 *,pThis); |
130 |
// cancel any pending call, and then complete our active obj with a cancel value |
|
131 |
p->iConsole->ReadCancel(); |
|
132 |
||
133 |
} |
|
134 |
||
135 |
||
136 |
void CTestCase0468::CancelNotify(CTestCaseRoot *pThis) |
|
137 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
138 |
if(gVerboseOutput) |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
139 |
{ |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
140 |
OstTraceFunctionEntry0(CTESTCASE0468_CANCELNOTIFY); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
141 |
} |
0 | 142 |
CTestCase0468 * p = REINTERPRET_CAST(CTestCase0468 *,pThis); |
143 |
// cancel any pending call, and then complete our active obj with a timeout value |
|
144 |
p->otgCancelOtgVbusNotification(); |
|
145 |
p->SelfComplete(KTestCaseWatchdogTO); |
|
146 |
} |
|
147 |
||
148 |
||
149 |
// This test result depends on all the ID detection tests and the VBus driving and dropping tests have not yet passed |
|
150 |
void CTestCase0468::DescribePreconditions() |
|
151 |
{ |
|
152 |
test.Printf(_L("Insert 'A' connector beforehand.\n")); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
153 |
OstTrace0(TRACE_NORMAL, CTESTCASE0468_DESCRIBEPRECONDITIONS, "Insert 'A' connector beforehand.\n"); |
0 | 154 |
test.Printf(_L("ID_PIN detection and VBus driving tests must already pass.\n")); |
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
155 |
OstTrace0(TRACE_NORMAL, CTESTCASE0468_DESCRIBEPRECONDITIONS_DUP01, "ID_PIN detection and VBus driving tests must already pass.\n"); |
0 | 156 |
} |
157 |
||
158 |
void CTestCase0468::ContinueAfter(TTimeIntervalMicroSeconds32 aMicroSecs, TCaseSteps aStep) |
|
159 |
{ |
|
160 |
LOG_VERBOSE2(_L("Wait %dms before drop VBus"), (TInt)(aMicroSecs.Int()/1000)); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
161 |
if(gVerboseOutput) |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
162 |
{ |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
163 |
OstTrace1(TRACE_VERBOSE, CTESTCASE0468_CONTINUEAFTER, "Wait %dms before drop VBus", (TInt)(aMicroSecs.Int()/1000));; |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
164 |
} |
0 | 165 |
iTimer.After(iStatus, aMicroSecs); |
166 |
iCaseStep = aStep; |
|
167 |
SetActive(); |
|
168 |
} |
|
169 |
||
170 |
// handle event completion |
|
171 |
void CTestCase0468::RunStepL() |
|
172 |
{ |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
173 |
if(gVerboseOutput) |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
174 |
{ |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
175 |
OstTraceFunctionEntry0(CTESTCASE0468_RUNSTEPL); |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
176 |
} |
0 | 177 |
// Obtain the completion code for this CActive obj. |
178 |
TInt completionCode(iStatus.Int()); |
|
179 |
TBuf<MAX_DSTRLEN> aDescription; |
|
180 |
TInt err(0); |
|
181 |
||
182 |
||
183 |
switch(iCaseStep) |
|
184 |
{ |
|
185 |
case EPreconditions: |
|
186 |
iCaseStep = ELoadLdd; |
|
187 |
if (iAutomated) |
|
188 |
{ |
|
189 |
iCaseStep = ELoadLdd; |
|
190 |
SelfComplete(); |
|
191 |
break; |
|
192 |
} |
|
193 |
// prompt to insert connector |
|
194 |
test.Printf(KInsertAConnectorPrompt); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
195 |
OstTrace0(TRACE_NORMAL, CTESTCASE0468_RUNSTEPL_DUP01, KInsertAConnectorPrompt); |
0 | 196 |
test.Printf(KPressAnyKeyToContinue); |
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
197 |
OstTrace0(TRACE_NORMAL, CTESTCASE0468_RUNSTEPL_DUP02, KPressAnyKeyToContinue); |
0 | 198 |
RequestCharacter(); |
199 |
break; |
|
200 |
||
201 |
case ELoadLdd: |
|
202 |
// 1. load the LDD and init. |
|
203 |
if (!StepLoadLDD()) |
|
204 |
{ |
|
205 |
break; |
|
206 |
} |
|
207 |
iCaseStep = EDetectAPlug; |
|
208 |
SelfComplete(); |
|
209 |
break; |
|
210 |
||
211 |
// 2. detect 'A' plug now |
|
212 |
case EDetectAPlug: |
|
213 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
|
214 |
{ |
|
215 |
return TestFailed(KErrAbort, _L("User response too slow - FAILED!")); |
|
216 |
} |
|
217 |
||
218 |
// if doing this test in /AUTO mode, we would fail this now |
|
219 |
// however if we can control ID_PIN through an API in future, we turn in on now. |
|
220 |
if (!otgIdPinPresent()) |
|
221 |
{ |
|
222 |
test.Printf(KInsertAConnectorPrompt); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
223 |
OstTrace0(TRACE_NORMAL, CTESTCASE0468_RUNSTEPL_DUP03, KInsertAConnectorPrompt); |
0 | 224 |
test.Printf(KPressAnyKeyToContinue); |
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
225 |
OstTrace0(TRACE_NORMAL, CTESTCASE0468_RUNSTEPL_DUP04, KPressAnyKeyToContinue); |
0 | 226 |
RequestCharacter(); |
227 |
||
228 |
iCaseStep = EDetectAPlug; |
|
229 |
} |
|
230 |
else |
|
231 |
{ |
|
232 |
iCaseStep = ELoopDriveVBus; |
|
233 |
SelfComplete(); |
|
234 |
} |
|
235 |
break; |
|
236 |
||
237 |
// 3. Control/branch step in the loop |
|
238 |
case ELoopControl: |
|
239 |
if (--iRepeats) |
|
240 |
{ |
|
241 |
iCaseStep = ELoopDriveVBus; |
|
242 |
} |
|
243 |
else |
|
244 |
{ |
|
245 |
iCaseStep = EUnloadLdd; |
|
246 |
} |
|
247 |
SelfComplete(); |
|
248 |
break; |
|
249 |
||
250 |
case ELoopDriveVBus: |
|
251 |
// 4. DRIVE VBUS |
|
252 |
iWDTimer->Cancel(); |
|
253 |
test.Printf(_L("Drive VBus, iteration %d/%d\n"), OPEN_REPEATS-iRepeats+1, OPEN_REPEATS); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
254 |
OstTraceExt2(TRACE_NORMAL, CTESTCASE0468_RUNSTEPL_DUP05, "Drive VBus, iteration %d/%d\n", OPEN_REPEATS-iRepeats+1, OPEN_REPEATS); |
0 | 255 |
// test for VBus rise next |
256 |
test.Printf(_L("Waiting for VBus Event\n")); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
257 |
OstTrace0(TRACE_NORMAL, CTESTCASE0468_RUNSTEPL_DUP06, "Waiting for VBus Event\n"); |
0 | 258 |
iStatus = KRequestPending; |
259 |
otgQueueOtgVbusNotification( iOTGVBus, iStatus ); |
|
260 |
||
261 |
// turn on VBus, since the call is not a Queing a-sync call we do this after the async call |
|
262 |
err = otgBusRequest(); // ok to turn on VBus now |
|
263 |
if (KErrNone != err) |
|
264 |
{ |
|
265 |
return TestFailed(KErrAbort, _L("Raise Vbus - RUsbOtgDriver::BusRequest() FAILED!")); |
|
266 |
} |
|
267 |
iCaseStep = ELoopVerifyVBus; |
|
268 |
iWDTimer->IssueRequest(KDelayDurationForLocalTrigger, this, &CancelNotify); |
|
269 |
SetActive(); |
|
270 |
break; |
|
271 |
||
272 |
case ELoopVerifyVBus: |
|
273 |
// 5. get VBus rise event |
|
274 |
LOG_VERBOSE2(_L("Post notification val=%d\n\n"), iOTGVBus); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
275 |
if(gVerboseOutput) |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
276 |
{ |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
277 |
OstTrace1(TRACE_VERBOSE, CTESTCASE0468_RUNSTEPL_DUP07, "Post notification val=%d\n\n", iOTGVBus);; |
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
278 |
} |
0 | 279 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
280 |
{ |
|
281 |
return TestFailed(KErrAbort, _L("Vbus rise not signalled in time - FAILED!")); |
|
282 |
} |
|
283 |
iWDTimer->Cancel(); |
|
284 |
||
285 |
// fetch the current value |
|
286 |
otgQueueOtgVbusNotification( iOTGVBus, iStatus ); |
|
287 |
otgCancelOtgVbusNotification(); |
|
288 |
User::WaitForRequest(iStatus); |
|
289 |
||
290 |
if (iOTGVBus != RUsbOtgDriver::EVbusHigh) |
|
291 |
{ |
|
292 |
||
293 |
return TestFailed(KErrAbort, _L("Vbus rise NOT 'seen' - FAILED!")); |
|
294 |
} |
|
295 |
||
296 |
// Double-check using the API in a syncronous way too |
|
297 |
// NOTE: once again this is to explore timing issues |
|
298 |
if (!otgVbusPresent()) |
|
299 |
{ |
|
300 |
return TestFailed(KErrAbort, _L("Vbus syncronous call error - FAILED!")); |
|
301 |
} |
|
302 |
iCaseStep = ELoopWait; |
|
303 |
SelfComplete(); |
|
304 |
break; |
|
305 |
||
306 |
case ELoopWait: // 6. wait 50ms after applying Vbus before we are allowed to |
|
307 |
ContinueAfter(KDelayBeforeBusDropUs, ELoopDropVBus); |
|
308 |
break; |
|
309 |
||
310 |
case ELoopDropVBus: |
|
311 |
// 7. drop Bus |
|
312 |
otgQueueOtgVbusNotification(iOTGVBus, iStatus ); |
|
313 |
// drop Vbus now, since the call is not a Queing a-sync call we do this after the async call |
|
314 |
otgBusDrop(); |
|
315 |
SetActive(); |
|
316 |
iCaseStep = ELoopVerifyDrop; |
|
317 |
iWDTimer->IssueRequest(KDelayDurationForLocalTrigger, this, &CancelNotify); |
|
318 |
break; |
|
319 |
||
320 |
case ELoopVerifyDrop: |
|
321 |
// 8. get Vbus low event |
|
322 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
|
323 |
{ |
|
324 |
return TestFailed(KErrAbort, _L("Vbus drop not signalled in time - FAILED!")); |
|
325 |
} |
|
326 |
iWDTimer->Cancel(); |
|
327 |
||
328 |
// fetch the value |
|
329 |
otgQueueOtgVbusNotification( iOTGVBus, iStatus ); |
|
330 |
otgCancelOtgVbusNotification(); |
|
331 |
User::WaitForRequest(iStatus); |
|
332 |
||
333 |
if (iOTGVBus != RUsbOtgDriver::EVbusLow) |
|
334 |
{ |
|
335 |
return TestFailed(KErrAbort, _L("Vbus drop NOT 'seen' - FAILED!")); |
|
336 |
} |
|
337 |
||
338 |
// test again using the 'syncronous' variation |
|
339 |
if (otgVbusPresent()) |
|
340 |
{ |
|
341 |
return TestFailed(KErrAbort, _L("Vbus syncronous call error - FAILED!")); |
|
342 |
} |
|
343 |
||
344 |
// wait 50ms and then go back to beginning |
|
345 |
ContinueAfter(KDelayBeforeBusDropUs, ELoopControl); |
|
346 |
break; |
|
347 |
||
348 |
case EUnloadLdd: |
|
349 |
// 9. unload |
|
350 |
if (EFalse == StepUnloadLDD()) |
|
351 |
return TestFailed(KErrAbort,_L("unload Ldd failure")); |
|
352 |
||
353 |
iCaseStep = ELastStep; |
|
354 |
SelfComplete(); |
|
355 |
break; |
|
356 |
||
357 |
case ELastStep: |
|
358 |
TestPassed(); |
|
359 |
break; |
|
360 |
||
361 |
default: |
|
362 |
test.Printf(_L("<Error> unknown test step")); |
|
259
57b9594f5772
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
363 |
OstTrace0(TRACE_NORMAL, CTESTCASE0468_RUNSTEPL_DUP08, "<Error> unknown test step"); |
0 | 364 |
Cancel(); |
365 |
return (TestFailed(KErrCorrupt, _L("<Error> unknown test step"))); |
|
366 |
} |
|
367 |
} |
|
368 |
||
369 |