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 "testcase0464.h" |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
26 |
#include "OstTraceDefinitions.h" |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
27 |
#ifdef OST_TRACE_COMPILER_IN_USE |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
28 |
#include "testcase0464Traces.h" |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
29 |
#endif |
0 | 30 |
|
31 |
||
32 |
||
33 |
// the name below is used to add a pointer to our construction method to a pointer MAP in |
|
34 |
// the class factory |
|
35 |
_LIT(KTestCaseId,"PBASE-USB_OTGDI-0464"); |
|
36 |
const TTestCaseFactoryReceipt<CTestCase0464> CTestCase0464::iFactoryReceipt(KTestCaseId); |
|
37 |
||
38 |
CTestCase0464* CTestCase0464::NewL(TBool aHost) |
|
39 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
40 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
41 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
42 |
OstTraceFunctionEntry0(CTESTCASE0464_NEWL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
43 |
} |
0 | 44 |
CTestCase0464* self = new (ELeave) CTestCase0464(aHost); |
45 |
CleanupStack::PushL(self); |
|
46 |
self->ConstructL(); |
|
47 |
CleanupStack::Pop(self); |
|
48 |
return self; |
|
49 |
} |
|
50 |
||
51 |
||
52 |
CTestCase0464::CTestCase0464(TBool aHost) |
|
53 |
: CTestCaseRoot(KTestCaseId, aHost) |
|
54 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
55 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
56 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
57 |
OstTraceFunctionEntry0(CTESTCASE0464_CTESTCASE0464); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
58 |
} |
0 | 59 |
|
60 |
} |
|
61 |
||
62 |
||
63 |
/** |
|
64 |
ConstructL |
|
65 |
*/ |
|
66 |
void CTestCase0464::ConstructL() |
|
67 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
68 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
69 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
70 |
OstTraceFunctionEntry0(CTESTCASE0464_CONSTRUCTL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
71 |
} |
0 | 72 |
|
73 |
BaseConstructL(); |
|
74 |
} |
|
75 |
||
76 |
||
77 |
CTestCase0464::~CTestCase0464() |
|
78 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
79 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
80 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
81 |
OstTraceFunctionEntry0(CTESTCASE0464_DCTESTCASE0464); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
82 |
} |
0 | 83 |
|
84 |
Cancel(); |
|
85 |
} |
|
86 |
||
87 |
||
88 |
void CTestCase0464::ExecuteTestCaseL() |
|
89 |
{ |
|
43
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(CTESTCASE0464_EXECUTETESTCASEL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
93 |
} |
0 | 94 |
iCaseStep = EPreconditions; |
95 |
||
96 |
CActiveScheduler::Add(this); |
|
97 |
SelfComplete(); |
|
98 |
} |
|
99 |
||
100 |
||
101 |
void CTestCase0464::DescribePreconditions() |
|
102 |
{ |
|
103 |
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
|
104 |
OstTrace0(TRACE_NORMAL, CTESTCASE0464_DESCRIBEPRECONDITIONS, "Insert 'A' connector beforehand.\n"); |
0 | 105 |
} |
106 |
||
107 |
||
108 |
void CTestCase0464::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(CTESTCASE0464_DOCANCEL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
113 |
} |
0 | 114 |
|
115 |
// cancel our timer |
|
116 |
iTimer.Cancel(); |
|
117 |
} |
|
118 |
||
119 |
||
120 |
void CTestCase0464::CancelKB(CTestCaseRoot *pThis) |
|
121 |
{ |
|
122 |
CTestCase0464 * p = REINTERPRET_CAST(CTestCase0464 *,pThis); |
|
123 |
// cancel any pending call, and then complete our active obj with a timeout value |
|
124 |
||
125 |
p->iConsole->ReadCancel(); |
|
126 |
||
127 |
} |
|
128 |
||
129 |
||
130 |
// handle event completion |
|
131 |
void CTestCase0464::RunStepL() |
|
132 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
133 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
134 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
135 |
OstTraceFunctionEntry0(CTESTCASE0464_RUNSTEPL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
136 |
} |
0 | 137 |
// Obtain the completion code for this CActive obj. |
138 |
TInt completionCode(iStatus.Int()); |
|
139 |
TBuf<MAX_DSTRLEN> aDescription; |
|
140 |
TInt err(0); |
|
141 |
||
142 |
switch(iCaseStep) |
|
143 |
{ |
|
144 |
case EPreconditions: |
|
145 |
iCaseStep = ELoadLdd; |
|
146 |
if (iAutomated) |
|
147 |
{ |
|
148 |
iCaseStep = ELoadLdd; |
|
149 |
SelfComplete(); |
|
150 |
break; |
|
151 |
} |
|
152 |
// prompt to insert 'A' connector |
|
153 |
test.Printf(KInsertAConnectorPrompt); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
154 |
OstTrace0(TRACE_NORMAL, CTESTCASE0464_RUNSTEPL_DUP01, KInsertAConnectorPrompt); |
0 | 155 |
test.Printf(KPressAnyKeyToContinue); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
156 |
OstTrace0(TRACE_NORMAL, CTESTCASE0464_RUNSTEPL_DUP02, KPressAnyKeyToContinue); |
0 | 157 |
RequestCharacter(); |
158 |
break; |
|
159 |
||
160 |
case ELoadLdd: |
|
161 |
if (!StepLoadLDD()) |
|
162 |
{ |
|
163 |
break; |
|
164 |
} |
|
165 |
||
166 |
iCaseStep = EDriveBus; |
|
167 |
SelfComplete(); |
|
168 |
break; |
|
169 |
||
170 |
case EDriveBus: |
|
171 |
LOG_VERBOSE1(_L("Turn ON VBus\n")) |
|
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 |
OstTrace0(TRACE_VERBOSE, CTESTCASE0464_RUNSTEPL_DUP03, "Turn ON VBus\n"); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
175 |
} |
0 | 176 |
err = otgBusRequest(); |
177 |
if (KErrNone != err) |
|
178 |
{ |
|
179 |
return TestFailed(KErrAbort, _L("Raise VBus - RUsbOtgDriver::BusRequest() FAILED!")); |
|
180 |
} |
|
181 |
iCaseStep = EUnloadLdd; |
|
182 |
SelfComplete(); |
|
183 |
break; |
|
184 |
||
185 |
case EUnloadLdd: |
|
186 |
LOG_VERBOSE1(_L("Unload.\n")) |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
187 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
188 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
189 |
OstTrace0(TRACE_VERBOSE, CTESTCASE0464_RUNSTEPL_DUP04, "Unload.\n"); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
190 |
} |
0 | 191 |
if (EFalse == StepUnloadLDD()) |
192 |
return TestFailed(KErrAbort,_L("unload Ldd failure")); |
|
193 |
test.Printf(_L("Measure VBus =0 and then press Y or N to continue.")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
194 |
OstTrace0(TRACE_NORMAL, CTESTCASE0464_RUNSTEPL_DUP05, "Measure VBus =0 and then press Y or N to continue."); |
0 | 195 |
RequestCharacter(); |
196 |
iCaseStep = EVerifyVBusGone; |
|
197 |
break; |
|
198 |
||
199 |
case EVerifyVBusGone: |
|
200 |
LOG_VERBOSE1(_L("Test !VBus after unload.\n")) |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
201 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
202 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
203 |
OstTrace0(TRACE_VERBOSE, CTESTCASE0464_RUNSTEPL_DUP06, "Test !VBus after unload.\n"); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
204 |
} |
0 | 205 |
// test key response (or via an API) |
206 |
if (('y' == iKeyCodeInput) ||('Y' == iKeyCodeInput)) |
|
207 |
{ |
|
208 |
test.Printf(_L("VBUS drop 'seen' \n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
209 |
OstTrace0(TRACE_NORMAL, CTESTCASE0464_RUNSTEPL_DUP07, "VBUS drop 'seen' \n"); |
0 | 210 |
SelfComplete(); |
211 |
} |
|
212 |
else |
|
213 |
{ |
|
214 |
return TestFailed(KErrAbort, _L("VBus drop not 'seen' - FAILED!")); |
|
215 |
} |
|
216 |
iCaseStep = ELastStep; |
|
217 |
break; |
|
218 |
||
219 |
case ELastStep: |
|
220 |
return TestPassed(); |
|
221 |
||
222 |
default: |
|
223 |
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
|
224 |
OstTrace0(TRACE_NORMAL, CTESTCASE0464_RUNSTEPL_DUP08, "<Error> unknown test step"); |
0 | 225 |
Cancel(); |
226 |
return (TestFailed(KErrCorrupt, _L("<Error> unknown test step"))); |
|
227 |
||
228 |
} |
|
229 |
} |
|
230 |
||
231 |