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 "testcase0675.h" |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
27 |
#include "OstTraceDefinitions.h" |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
28 |
#ifdef OST_TRACE_COMPILER_IN_USE |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
29 |
#include "testcase0675Traces.h" |
c1f20ce4abcf
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-0675"); |
|
39 |
const TTestCaseFactoryReceipt<CTestCase0675> CTestCase0675::iFactoryReceipt(KTestCaseId); |
|
40 |
||
41 |
CTestCase0675* CTestCase0675::NewL(TBool aHost) |
|
42 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
43 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
44 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
45 |
OstTraceFunctionEntry0(CTESTCASE0675_NEWL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
46 |
} |
0 | 47 |
CTestCase0675* self = new (ELeave) CTestCase0675(aHost); |
48 |
CleanupStack::PushL(self); |
|
49 |
self->ConstructL(); |
|
50 |
CleanupStack::Pop(self); |
|
51 |
return self; |
|
52 |
} |
|
53 |
||
54 |
||
55 |
CTestCase0675::CTestCase0675(TBool aHost) |
|
56 |
: CTestCaseRoot(KTestCaseId, aHost) |
|
57 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
58 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
59 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
60 |
OstTraceFunctionEntry0(CTESTCASE0675_CTESTCASE0675); |
c1f20ce4abcf
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 CTestCase0675::ConstructL() |
|
70 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
71 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
72 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
73 |
OstTraceFunctionEntry0(CTESTCASE0675_CONSTRUCTL); |
c1f20ce4abcf
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 |
CTestCase0675::~CTestCase0675() |
|
83 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
84 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
85 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
86 |
OstTraceFunctionEntry0(CTESTCASE0675_DCTESTCASE0675); |
c1f20ce4abcf
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 CTestCase0675::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(CTESTCASE0675_EXECUTETESTCASEL); |
c1f20ce4abcf
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 CTestCase0675::DoCancel() |
|
112 |
{ |
|
43
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(CTESTCASE0675_DOCANCEL); |
c1f20ce4abcf
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 CTestCase0675::CancelKB(CTestCaseRoot *pThis) |
|
124 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
125 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
126 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
127 |
OstTraceFunctionEntry0(CTESTCASE0675_CANCELKB); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
128 |
} |
0 | 129 |
CTestCase0675 * p = REINTERPRET_CAST(CTestCase0675 *,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 CTestCase0675::CancelNotify(CTestCaseRoot *pThis) |
|
137 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
138 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
139 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
140 |
OstTraceFunctionEntry0(CTESTCASE0675_CANCELNOTIFY); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
141 |
} |
0 | 142 |
CTestCase0675 * p = REINTERPRET_CAST(CTestCase0675 *,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 CTestCase0675::DescribePreconditions() |
|
151 |
{ |
|
152 |
test.Printf(_L("Insert 'A' connector beforehand.\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
153 |
OstTrace0(TRACE_NORMAL, CTESTCASE0675_DESCRIBEPRECONDITIONS, "Insert 'A' connector beforehand.\n"); |
0 | 154 |
|
155 |
} |
|
156 |
||
157 |
void CTestCase0675::ContinueAfter(TTimeIntervalMicroSeconds32 aMicroSecs, TCaseSteps aStep) |
|
158 |
{ |
|
159 |
LOG_VERBOSE2(_L("Wait %dms before drop VBus"), (TInt)(aMicroSecs.Int()/1000)); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
160 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
161 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
162 |
OstTrace1(TRACE_VERBOSE, CTESTCASE0675_CONTINUEAFTER, "Wait %dms before drop VBus", (TInt)(aMicroSecs.Int()/1000));; |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
163 |
} |
0 | 164 |
iTimer.After(iStatus, aMicroSecs); |
165 |
iCaseStep = aStep; |
|
166 |
SetActive(); |
|
167 |
} |
|
168 |
||
169 |
// handle event completion |
|
170 |
void CTestCase0675::RunStepL() |
|
171 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
172 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
173 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
174 |
OstTraceFunctionEntry0(CTESTCASE0675_RUNSTEPL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
175 |
} |
0 | 176 |
// Obtain the completion code for this CActive obj. |
177 |
TInt completionCode(iStatus.Int()); |
|
178 |
TBuf<MAX_DSTRLEN> aDescription; |
|
179 |
TInt err(0); |
|
180 |
||
181 |
||
182 |
switch(iCaseStep) |
|
183 |
{ |
|
184 |
case EPreconditions: |
|
185 |
iCaseStep = ELoadLdd; |
|
186 |
if (iAutomated) |
|
187 |
{ |
|
188 |
iCaseStep = ELoadLdd; |
|
189 |
SelfComplete(); |
|
190 |
break; |
|
191 |
} |
|
192 |
// prompt to insert connector |
|
193 |
test.Printf(KInsertAConnectorPrompt); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
194 |
OstTrace0(TRACE_NORMAL, CTESTCASE0675_RUNSTEPL_DUP01, KInsertAConnectorPrompt); |
0 | 195 |
test.Printf(KPressAnyKeyToContinue); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
196 |
OstTrace0(TRACE_NORMAL, CTESTCASE0675_RUNSTEPL_DUP02, KPressAnyKeyToContinue); |
0 | 197 |
RequestCharacter(); |
198 |
break; |
|
199 |
||
200 |
// 1. load the LDD and init. |
|
201 |
case ELoadLdd: |
|
202 |
if (!StepLoadLDD()) |
|
203 |
{ |
|
204 |
break; |
|
205 |
} |
|
206 |
if (iAutomated) |
|
207 |
iCaseStep = ELoopDriveVBus1; |
|
208 |
else |
|
209 |
iCaseStep = EDetectAPlug; |
|
210 |
SelfComplete(); |
|
211 |
break; |
|
212 |
||
213 |
// 2. detect 'A' plug now |
|
214 |
case EDetectAPlug: |
|
215 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
|
216 |
{ |
|
217 |
return TestFailed(KErrAbort, _L("User response too slow - FAILED!")); |
|
218 |
} |
|
219 |
if (!otgIdPinPresent()) |
|
220 |
{ |
|
221 |
test.Printf(KInsertAConnectorPrompt); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
222 |
OstTrace0(TRACE_NORMAL, CTESTCASE0675_RUNSTEPL_DUP03, KInsertAConnectorPrompt); |
0 | 223 |
test.Printf(KPressAnyKeyToContinue); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
224 |
OstTrace0(TRACE_NORMAL, CTESTCASE0675_RUNSTEPL_DUP04, KPressAnyKeyToContinue); |
0 | 225 |
RequestCharacter(); |
226 |
iCaseStep = EDetectAPlug; |
|
227 |
} |
|
228 |
else |
|
229 |
{ |
|
230 |
iCaseStep = ELoopDriveVBus1; |
|
231 |
SelfComplete(); |
|
232 |
} |
|
233 |
break; |
|
234 |
||
235 |
// 3. Control/branch step in the loop |
|
236 |
case ELoopControl: |
|
237 |
if (--iRepeats) |
|
238 |
{ |
|
239 |
iCaseStep = ELoopDriveVBus1; |
|
240 |
} |
|
241 |
else |
|
242 |
{ |
|
243 |
iCaseStep = EUnloadLdd; |
|
244 |
} |
|
245 |
SelfComplete(); |
|
246 |
break; |
|
247 |
||
248 |
// 4. DRIVE VBUS |
|
249 |
case ELoopDriveVBus1: |
|
250 |
iWDTimer->Cancel(); |
|
251 |
test.Printf(_L("Drive VBus, iteration %d/%d\n"), OPEN_REPEATS-iRepeats+1, OPEN_REPEATS); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
252 |
OstTraceExt2(TRACE_NORMAL, CTESTCASE0675_RUNSTEPL_DUP05, "Drive VBus, iteration %d/%d\n", OPEN_REPEATS-iRepeats+1, OPEN_REPEATS); |
0 | 253 |
// test for VBus rise next |
254 |
test.Printf(_L("Waiting for VBus Event\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
255 |
OstTrace0(TRACE_NORMAL, CTESTCASE0675_RUNSTEPL_DUP06, "Waiting for VBus Event\n"); |
0 | 256 |
iStatus = KRequestPending; |
257 |
otgQueueOtgVbusNotification( iOTGVBus, iStatus ); |
|
258 |
SetActive(); |
|
259 |
||
260 |
// turn on VBus, since the call is not a Queing a-sync call we do this after the async call |
|
261 |
err = otgBusRequest(); // ok to turn on VBus now |
|
262 |
if (KErrNone != err) |
|
263 |
{ |
|
264 |
return TestFailed(KErrAbort, _L("Raise Vbus - RUsbOtgDriver::BusRequest() FAILED!")); |
|
265 |
} |
|
266 |
iCaseStep = ELoopVerifyVBus1; |
|
267 |
iWDTimer->IssueRequest(KDelayDurationForLocalTrigger, this, &CancelNotify); |
|
268 |
||
269 |
break; |
|
270 |
||
271 |
// 5. get VBus rise event |
|
272 |
case ELoopVerifyVBus1: |
|
273 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
|
274 |
{ |
|
275 |
return TestFailed(KErrAbort, _L("Vbus rise not signalled in time - FAILED!")); |
|
276 |
} |
|
277 |
iWDTimer->Cancel(); |
|
278 |
||
279 |
// check using the API in a syncronous way too |
|
280 |
if (!otgVbusPresent()) |
|
281 |
{ |
|
282 |
return TestFailed(KErrAbort, _L("Vbus syncronous call error - FAILED!")); |
|
283 |
} |
|
284 |
iCaseStep = ELoopWait; |
|
285 |
SelfComplete(); |
|
286 |
break; |
|
287 |
||
288 |
// 6. DRIVE/claim VBUS 2nd time |
|
289 |
case ELoopDriveVBus2: |
|
290 |
iWDTimer->Cancel(); |
|
291 |
test.Printf(_L("Drive VBus double, iteration %d/%d\n"), OPEN_REPEATS-iRepeats+1, OPEN_REPEATS); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
292 |
OstTraceExt2(TRACE_NORMAL, CTESTCASE0675_RUNSTEPL_DUP07, "Drive VBus double, iteration %d/%d\n", OPEN_REPEATS-iRepeats+1, OPEN_REPEATS); |
0 | 293 |
|
294 |
err = otgBusRequest(); // duplicate turn on VBus, we expect an error |
|
295 |
if (KErrUsbOtgVbusAlreadyRaised != err) |
|
296 |
{ |
|
297 |
return TestFailed(KErrAbort, _L("Raise Vbus - RUsbOtgDriver::BusRequest() unexpected result!")); |
|
298 |
} |
|
299 |
iCaseStep = ELoopVerifyVBus2; |
|
300 |
SelfComplete(); |
|
301 |
SetActive(); |
|
302 |
break; |
|
303 |
||
304 |
// 7 - make sure that the error did not end up killing the bus |
|
305 |
case ELoopVerifyVBus2: |
|
306 |
if (!otgVbusPresent()) |
|
307 |
{ |
|
308 |
return TestFailed(KErrAbort, _L("Raise Vbus twice resulted in session drop")); |
|
309 |
} |
|
310 |
iCaseStep = ELoopWait; |
|
311 |
SelfComplete(); |
|
312 |
SetActive(); |
|
313 |
break; |
|
314 |
||
315 |
// 9. wait 50ms after applying Vbus before we are allowed to drop again |
|
316 |
case ELoopWait: |
|
317 |
ContinueAfter(KDelayBeforeBusDropUs, ELoopDropVBus); |
|
318 |
break; |
|
319 |
||
320 |
case ELoopDropVBus: |
|
321 |
// 10. drop Bus |
|
322 |
otgQueueOtgVbusNotification(iOTGVBus, iStatus ); |
|
323 |
// drop Vbus now, since the call is not a Queing a-sync call we do this after the async call |
|
324 |
otgBusDrop(); |
|
325 |
SetActive(); |
|
326 |
iCaseStep = ELoopVerifyDrop; |
|
327 |
iWDTimer->IssueRequest(KDelayDurationForLocalTrigger, this, &CancelNotify); |
|
328 |
break; |
|
329 |
||
330 |
case ELoopVerifyDrop: |
|
331 |
// 11. get Vbus low event |
|
332 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
|
333 |
{ |
|
334 |
return TestFailed(KErrAbort, _L("Vbus drop not signalled in time - FAILED!")); |
|
335 |
} |
|
336 |
iWDTimer->Cancel(); |
|
337 |
||
338 |
// fetch the value |
|
339 |
otgQueueOtgVbusNotification( iOTGVBus, iStatus ); |
|
340 |
otgCancelOtgVbusNotification(); |
|
341 |
User::WaitForRequest(iStatus); |
|
342 |
||
343 |
if (iOTGVBus != RUsbOtgDriver::EVbusLow) |
|
344 |
{ |
|
345 |
return TestFailed(KErrAbort, _L("Vbus drop NOT 'seen' - FAILED!")); |
|
346 |
} |
|
347 |
||
348 |
// test again using the 'syncronous' variation |
|
349 |
if (otgVbusPresent()) |
|
350 |
{ |
|
351 |
return TestFailed(KErrAbort, _L("Vbus syncronous call error - FAILED!")); |
|
352 |
} |
|
353 |
||
354 |
// wait 50ms and then go back to beginning |
|
355 |
ContinueAfter(KDelayBeforeBusDropUs, ELoopControl); |
|
356 |
break; |
|
357 |
||
358 |
case EUnloadLdd: |
|
359 |
// 12. unload |
|
360 |
if (EFalse == StepUnloadLDD()) |
|
361 |
return TestFailed(KErrAbort,_L("unload Ldd failure")); |
|
362 |
||
363 |
iCaseStep = ELastStep; |
|
364 |
SelfComplete(); |
|
365 |
break; |
|
366 |
||
367 |
case ELastStep: |
|
368 |
TestPassed(); |
|
369 |
break; |
|
370 |
||
371 |
default: |
|
372 |
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
|
373 |
OstTrace0(TRACE_NORMAL, CTESTCASE0675_RUNSTEPL_DUP08, "<Error> unknown test step"); |
0 | 374 |
Cancel(); |
375 |
return (TestFailed(KErrCorrupt, _L("<Error> unknown test step"))); |
|
376 |
} |
|
377 |
} |
|
378 |
||
379 |