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 "testcase0671.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 "testcase0671Traces.h" |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
30 |
#endif |
0 | 31 |
|
32 |
||
33 |
||
34 |
// the name below is used to add a pointer to our construction method to a pointer MAP in |
|
35 |
// the class factory |
|
36 |
_LIT(KTestCaseId,"PBASE-USB_OTGDI-0671"); |
|
37 |
const TTestCaseFactoryReceipt<CTestCase0671> CTestCase0671::iFactoryReceipt(KTestCaseId); |
|
38 |
||
39 |
CTestCase0671* CTestCase0671::NewL(TBool aHost) |
|
40 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
41 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
42 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
43 |
OstTraceFunctionEntry0(CTESTCASE0671_NEWL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
44 |
} |
0 | 45 |
CTestCase0671* self = new (ELeave) CTestCase0671(aHost); |
46 |
CleanupStack::PushL(self); |
|
47 |
self->ConstructL(); |
|
48 |
CleanupStack::Pop(self); |
|
49 |
return self; |
|
50 |
} |
|
51 |
||
52 |
||
53 |
CTestCase0671::CTestCase0671(TBool aHost) |
|
54 |
: CTestCaseRoot(KTestCaseId, aHost) |
|
55 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
56 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
57 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
58 |
OstTraceFunctionEntry0(CTESTCASE0671_CTESTCASE0671); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
59 |
} |
0 | 60 |
|
61 |
} |
|
62 |
||
63 |
||
64 |
/** |
|
65 |
ConstructL |
|
66 |
*/ |
|
67 |
void CTestCase0671::ConstructL() |
|
68 |
{ |
|
69 |
iWDTimer = CTestCaseWatchdog::NewL(); |
|
70 |
||
71 |
BaseConstructL(); |
|
72 |
} |
|
73 |
||
74 |
||
75 |
CTestCase0671::~CTestCase0671() |
|
76 |
{ |
|
77 |
||
78 |
Cancel(); |
|
79 |
delete iWDTimer; |
|
80 |
} |
|
81 |
||
82 |
||
83 |
void CTestCase0671::ExecuteTestCaseL() |
|
84 |
{ |
|
85 |
iCaseStep = EPreconditions; |
|
86 |
iRepeats = KOperationRetriesMax; // VBus event rise retries |
|
87 |
CActiveScheduler::Add(this); |
|
88 |
SelfComplete(); |
|
89 |
||
90 |
} |
|
91 |
||
92 |
||
93 |
void CTestCase0671::DoCancel() |
|
94 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
95 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
96 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
97 |
OstTraceFunctionEntry0(CTESTCASE0671_DOCANCEL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
98 |
} |
0 | 99 |
|
100 |
// cancel our timer |
|
101 |
iTimer.Cancel(); |
|
102 |
} |
|
103 |
||
104 |
||
105 |
void CTestCase0671::CancelKB(CTestCaseRoot *pThis) |
|
106 |
{ |
|
107 |
CTestCase0671 * p = REINTERPRET_CAST(CTestCase0671 *,pThis); |
|
108 |
||
109 |
// cancel the pending call |
|
110 |
p->iConsole->ReadCancel(); |
|
111 |
} |
|
112 |
||
113 |
||
114 |
void CTestCase0671::CancelDrive(CTestCaseRoot *pThis) |
|
115 |
{ |
|
116 |
CTestCase0671 * p = REINTERPRET_CAST(CTestCase0671 *,pThis); |
|
117 |
// cancel any pending call, and then complete our active obj with a timeout value |
|
118 |
p->SelfComplete(KTestCaseWatchdogTO); |
|
119 |
} |
|
120 |
||
121 |
||
122 |
void CTestCase0671::DescribePreconditions() |
|
123 |
{ |
|
124 |
// H4 width **************************** |
|
125 |
test.Printf(_L("***************************\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
126 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_DESCRIBEPRECONDITIONS, "***************************\n"); |
0 | 127 |
test.Printf(_L("* This test uses a Mini-A *\n")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
128 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_DESCRIBEPRECONDITIONS_DUP01, "* This test uses a Mini-A *\n"); |
0 | 129 |
test.Printf(_L("* to Mini-B cable to link *\n")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
130 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_DESCRIBEPRECONDITIONS_DUP02, "* to Mini-B cable to link *\n"); |
0 | 131 |
test.Printf(_L("* the H4 board to the OPT *\n")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
132 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_DESCRIBEPRECONDITIONS_DUP03, "* the H4 board to the OPT *\n"); |
0 | 133 |
test.Printf(_L("* and makes use of the *\n")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
134 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_DESCRIBEPRECONDITIONS_DUP04, "* and makes use of the *\n"); |
0 | 135 |
test.Printf(_L("* USB OPT test code *\n")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
136 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_DESCRIBEPRECONDITIONS_DUP05, "* USB OPT test code *\n"); |
0 | 137 |
test.Printf(_L("***************************\n")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
138 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_DESCRIBEPRECONDITIONS_DUP06, "***************************\n"); |
0 | 139 |
} |
140 |
||
141 |
||
142 |
// handle event completion |
|
143 |
void CTestCase0671::RunStepL() |
|
144 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
145 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
146 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
147 |
OstTraceFunctionEntry0(CTESTCASE0671_RUNSTEPL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
148 |
} |
0 | 149 |
// Obtain the completion code for this CActive obj. |
150 |
TInt completionCode(iStatus.Int()); |
|
151 |
TBuf<MAX_DSTRLEN> aDescription; |
|
152 |
||
153 |
switch(iCaseStep) |
|
154 |
{ |
|
155 |
case EPreconditions: |
|
156 |
if (iAutomated) |
|
157 |
{ |
|
158 |
return TestFailed(KErrAbort,_L("This Test Cannot Run in Automated Mode")); |
|
159 |
} |
|
160 |
SelfComplete(); |
|
161 |
iCaseStep = ELoadWithOptTestMode; |
|
162 |
break; |
|
163 |
||
164 |
case ELoadWithOptTestMode: |
|
165 |
if (!StepLoadClient(0x0671/*use default settings for SRP/HNP support*/)) |
|
166 |
{ |
|
167 |
return TestFailed(KErrAbort,_L("Client Load Failure")); |
|
168 |
} |
|
169 |
StepSetOptActive(); |
|
170 |
if (!StepLoadLDD()) |
|
171 |
{ |
|
172 |
return TestFailed(KErrAbort,_L("OTG Load Failure")); |
|
173 |
} |
|
174 |
iCaseStep = EConnectAtoB; |
|
175 |
SelfComplete(); |
|
176 |
break; |
|
177 |
||
178 |
case EConnectAtoB: |
|
179 |
// H4 width **************************** |
|
180 |
test.Printf(_L("\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
181 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP01, "\n"); |
0 | 182 |
test.Printf(_L("***********************\n")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
183 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP02, "***********************\n"); |
0 | 184 |
test.Printf(_L("Connect H4(B) to OPT(A)\n")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
185 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP03, "Connect H4(Bto OPT(A)\n"); |
0 | 186 |
test.Printf(KPressAnyKeyToContinue); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
187 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP04, KPressAnyKeyToContinue); |
0 | 188 |
|
189 |
iCaseStep = EStartOptTD5_5; |
|
190 |
RequestCharacter(); |
|
191 |
break; |
|
192 |
||
193 |
case EStartOptTD5_5: |
|
194 |
// H4 width **************************** |
|
195 |
test.Printf(_L("On the OPT, select:\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
196 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP05, "On the OPT, select:\n"); |
0 | 197 |
test.Printf(_L(" Certified FS-B-UUT Test\n")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
198 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP06, " Certified FS-B-UUT Test\n"); |
0 | 199 |
test.Printf(_L(" Test TD.5.5\n")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
200 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP07, " Test TD.5.5\n"); |
0 | 201 |
test.Printf(_L(" And then Click 'Run' ")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
202 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP08, " And then Click 'Run' "); |
0 | 203 |
test.Printf(_L(" When test starts, press any key")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
204 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP09, " When test starts, press any key"); |
0 | 205 |
iCaseStep = EPromptYOpt5_5; |
206 |
RequestCharacter(); |
|
207 |
break; |
|
208 |
||
209 |
case EPromptYOpt5_5: |
|
210 |
iCaseStep = EConfirmOpt5_5; |
|
211 |
test.Printf(_L("Did it PASS (Y/N)?")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
212 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP10, "Did it PASS (Y/N?"); |
0 | 213 |
RequestCharacter(); // 30 seconds for user input |
214 |
iWDTimer->IssueRequest(KDelayDurationForTest4_5, this, &CancelKB); |
|
215 |
break; |
|
216 |
||
217 |
case EConfirmOpt5_5: |
|
218 |
// Check watchdog timeout, assume it failed |
|
219 |
if (KTestCaseWatchdogTO == iStatus.Int()) |
|
220 |
{ |
|
221 |
// H4 width **************************** |
|
222 |
return TestFailed(KErrAbort, _L("OPT timeout - Test Failed")); |
|
223 |
} |
|
224 |
iWDTimer->Cancel(); |
|
225 |
||
226 |
// Check user response, look only for 'Y' |
|
227 |
if (('y' == iKeyCodeInput) ||('Y' == iKeyCodeInput)) |
|
228 |
{ |
|
229 |
iCaseStep = EUnloadLdd; |
|
230 |
SelfComplete(); |
|
231 |
} |
|
232 |
else |
|
233 |
{ |
|
234 |
return TestFailed(KErrAbort, _L("TD.5.5 - FAILED!")); |
|
235 |
} |
|
236 |
break; |
|
237 |
||
238 |
case EUnloadLdd: |
|
239 |
// unload otg |
|
240 |
if (!StepUnloadLDD()) |
|
241 |
{ |
|
242 |
return TestFailed(KErrAbort,_L("OTG Unload Failure")); |
|
243 |
} |
|
244 |
// unload client |
|
245 |
if (!StepUnloadClient()) |
|
246 |
{ |
|
247 |
return TestFailed(KErrAbort,_L("Client Unload Failure")); |
|
248 |
} |
|
249 |
iCaseStep = ELastStep; |
|
250 |
SelfComplete(); |
|
251 |
break; |
|
252 |
||
253 |
case ELastStep: |
|
254 |
TestPassed(); |
|
255 |
break; |
|
256 |
||
257 |
default: |
|
258 |
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
|
259 |
OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP11, "<Error> unknown test step"); |
0 | 260 |
Cancel(); |
261 |
return (TestFailed(KErrCorrupt, _L("<Error> unknown test step"))); |
|
262 |
} |
|
263 |
} |
|
264 |