1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of the License "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
22 #include <e32base_private.h> |
22 #include <e32base_private.h> |
23 #include <e32Test.h> // RTest headder |
23 #include <e32Test.h> // RTest headder |
24 #include "testcaseroot.h" |
24 #include "testcaseroot.h" |
25 #include "testcasewd.h" |
25 #include "testcasewd.h" |
26 #include "testcase0466.h" |
26 #include "testcase0466.h" |
27 #include "OstTraceDefinitions.h" |
|
28 #ifdef OST_TRACE_COMPILER_IN_USE |
|
29 #include "testcase0466Traces.h" |
|
30 #endif |
|
31 |
27 |
32 |
28 |
33 |
29 |
34 // the name below is used to add a pointer to our construction method to a pointer MAP in |
30 // the name below is used to add a pointer to our construction method to a pointer MAP in |
35 // the class factory |
31 // the class factory |
36 _LIT(KTestCaseId,"PBASE-USB_OTGDI-0466"); |
32 _LIT(KTestCaseId,"PBASE-USB_OTGDI-0466"); |
37 const TTestCaseFactoryReceipt<CTestCase0466> CTestCase0466::iFactoryReceipt(KTestCaseId); |
33 const TTestCaseFactoryReceipt<CTestCase0466> CTestCase0466::iFactoryReceipt(KTestCaseId); |
38 |
34 |
39 CTestCase0466* CTestCase0466::NewL(TBool aHost) |
35 CTestCase0466* CTestCase0466::NewL(TBool aHost) |
40 { |
36 { |
41 if(gVerboseOutput) |
37 LOG_FUNC |
42 { |
|
43 OstTraceFunctionEntry0(CTESTCASE0466_NEWL); |
|
44 } |
|
45 CTestCase0466* self = new (ELeave) CTestCase0466(aHost); |
38 CTestCase0466* self = new (ELeave) CTestCase0466(aHost); |
46 CleanupStack::PushL(self); |
39 CleanupStack::PushL(self); |
47 self->ConstructL(); |
40 self->ConstructL(); |
48 CleanupStack::Pop(self); |
41 CleanupStack::Pop(self); |
49 return self; |
42 return self; |
51 |
44 |
52 |
45 |
53 CTestCase0466::CTestCase0466(TBool aHost) |
46 CTestCase0466::CTestCase0466(TBool aHost) |
54 : CTestCaseRoot(KTestCaseId, aHost) |
47 : CTestCaseRoot(KTestCaseId, aHost) |
55 { |
48 { |
56 if(gVerboseOutput) |
49 LOG_FUNC |
57 { |
|
58 OstTraceFunctionEntry0(CTESTCASE0466_CTESTCASE0466); |
|
59 } |
|
60 |
50 |
61 } |
51 } |
62 |
52 |
63 |
53 |
64 /** |
54 /** |
65 ConstructL |
55 ConstructL |
66 */ |
56 */ |
67 void CTestCase0466::ConstructL() |
57 void CTestCase0466::ConstructL() |
68 { |
58 { |
69 if(gVerboseOutput) |
59 LOG_FUNC |
70 { |
|
71 OstTraceFunctionEntry0(CTESTCASE0466_CONSTRUCTL); |
|
72 } |
|
73 iWDTimer = CTestCaseWatchdog::NewL(); |
60 iWDTimer = CTestCaseWatchdog::NewL(); |
74 |
61 |
75 BaseConstructL(); |
62 BaseConstructL(); |
76 } |
63 } |
77 |
64 |
78 |
65 |
79 CTestCase0466::~CTestCase0466() |
66 CTestCase0466::~CTestCase0466() |
80 { |
67 { |
81 if(gVerboseOutput) |
68 LOG_FUNC |
82 { |
|
83 OstTraceFunctionEntry0(CTESTCASE0466_DCTESTCASE0466); |
|
84 } |
|
85 |
69 |
86 Cancel(); |
70 Cancel(); |
87 delete iWDTimer; |
71 delete iWDTimer; |
88 } |
72 } |
89 |
73 |
90 |
74 |
91 void CTestCase0466::ExecuteTestCaseL() |
75 void CTestCase0466::ExecuteTestCaseL() |
92 { |
76 { |
93 if(gVerboseOutput) |
77 LOG_FUNC |
94 { |
|
95 OstTraceFunctionEntry0(CTESTCASE0466_EXECUTETESTCASEL); |
|
96 } |
|
97 iCaseStep = EPreconditions; |
78 iCaseStep = EPreconditions; |
98 |
79 |
99 iRepeats = KOperationRetriesMax; |
80 iRepeats = KOperationRetriesMax; |
100 |
81 |
101 CActiveScheduler::Add(this); |
82 CActiveScheduler::Add(this); |
105 |
86 |
106 |
87 |
107 void CTestCase0466::DescribePreconditions() |
88 void CTestCase0466::DescribePreconditions() |
108 { |
89 { |
109 test.Printf(_L("BEFORE running this test\n")); |
90 test.Printf(_L("BEFORE running this test\n")); |
110 OstTrace0(TRACE_NORMAL, CTESTCASE0466_DESCRIBEPRECONDITIONS, "BEFORE running this test\n"); |
91 test.Printf(_L("\n")); |
111 test.Printf(_L("\n")); |
|
112 OstTrace0(TRACE_NORMAL, CTESTCASE0466_DESCRIBEPRECONDITIONS_DUP01, "\n"); |
|
113 test.Printf(_L("Insert the connector\n")); |
92 test.Printf(_L("Insert the connector\n")); |
114 OstTrace0(TRACE_NORMAL, CTESTCASE0466_DESCRIBEPRECONDITIONS_DUP02, "Insert the connector\n"); |
|
115 test.Printf(_L("from the OET with SW9\n")); |
93 test.Printf(_L("from the OET with SW9\n")); |
116 OstTrace0(TRACE_NORMAL, CTESTCASE0466_DESCRIBEPRECONDITIONS_DUP03, "from the OET with SW9\n"); |
|
117 test.Printf(_L("set to 'A-DEVICE' and\n")); |
94 test.Printf(_L("set to 'A-DEVICE' and\n")); |
118 OstTrace0(TRACE_NORMAL, CTESTCASE0466_DESCRIBEPRECONDITIONS_DUP04, "set to 'A-DEVICE' and\n"); |
|
119 test.Printf(_L("all other switches OFF\n")); |
95 test.Printf(_L("all other switches OFF\n")); |
120 OstTrace0(TRACE_NORMAL, CTESTCASE0466_DESCRIBEPRECONDITIONS_DUP05, "all other switches OFF\n"); |
96 test.Printf(_L("\n")); |
121 test.Printf(_L("\n")); |
|
122 OstTrace0(TRACE_NORMAL, CTESTCASE0466_DESCRIBEPRECONDITIONS_DUP06, "\n"); |
|
123 test.Printf(_L("Confirm passing tests\n")); |
97 test.Printf(_L("Confirm passing tests\n")); |
124 OstTrace0(TRACE_NORMAL, CTESTCASE0466_DESCRIBEPRECONDITIONS_DUP07, "Confirm passing tests\n"); |
98 test.Printf(_L("\n")); |
125 test.Printf(_L("\n")); |
|
126 OstTrace0(TRACE_NORMAL, CTESTCASE0466_DESCRIBEPRECONDITIONS_DUP08, "\n"); |
|
127 test.Printf(_L("ID_PIN detection\n")); |
99 test.Printf(_L("ID_PIN detection\n")); |
128 OstTrace0(TRACE_NORMAL, CTESTCASE0466_DESCRIBEPRECONDITIONS_DUP09, "ID_PIN detection\n"); |
|
129 test.Printf(_L("VBus Driving\n")); |
100 test.Printf(_L("VBus Driving\n")); |
130 OstTrace0(TRACE_NORMAL, CTESTCASE0466_DESCRIBEPRECONDITIONS_DUP10, "VBus Driving\n"); |
101 test.Printf(_L("\n")); |
131 test.Printf(_L("\n")); |
|
132 OstTrace0(TRACE_NORMAL, CTESTCASE0466_DESCRIBEPRECONDITIONS_DUP11, "\n"); |
|
133 } |
102 } |
134 |
103 |
135 |
104 |
136 void CTestCase0466::DoCancel() |
105 void CTestCase0466::DoCancel() |
137 { |
106 { |
138 if(gVerboseOutput) |
107 LOG_FUNC |
139 { |
|
140 OstTraceFunctionEntry0(CTESTCASE0466_DOCANCEL); |
|
141 } |
|
142 |
108 |
143 // cancel our timer |
109 // cancel our timer |
144 iTimer.Cancel(); |
110 iTimer.Cancel(); |
145 } |
111 } |
146 |
112 |
176 SelfComplete(); |
139 SelfComplete(); |
177 break; |
140 break; |
178 } |
141 } |
179 // prompt to insert connector |
142 // prompt to insert connector |
180 test.Printf(_L("\n")); |
143 test.Printf(_L("\n")); |
181 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP01, "\n"); |
|
182 test.Printf(KInsertAConnectorPrompt); |
144 test.Printf(KInsertAConnectorPrompt); |
183 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP02, KInsertAConnectorPrompt); |
145 test.Printf(_L("\n")); |
184 test.Printf(_L("\n")); |
|
185 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP03, "\n"); |
|
186 test.Printf(KPressAnyKeyToContinue); |
146 test.Printf(KPressAnyKeyToContinue); |
187 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP04, KPressAnyKeyToContinue); |
147 test.Printf(_L("\n")); |
188 test.Printf(_L("\n")); |
|
189 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP05, "\n"); |
|
190 RequestCharacter(); |
148 RequestCharacter(); |
191 break; |
149 break; |
192 |
150 |
193 case ELoadLdd: |
151 case ELoadLdd: |
194 if (!StepLoadLDD()) |
152 if (!StepLoadLDD()) |
222 otgQueueOtgMessageRequest(iOTGMessage, iStatus); |
180 otgQueueOtgMessageRequest(iOTGMessage, iStatus); |
223 SetActive(); |
181 SetActive(); |
224 |
182 |
225 // ...and tell user to apply load |
183 // ...and tell user to apply load |
226 test.Printf(_L("\n")); |
184 test.Printf(_L("\n")); |
227 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP06, "\n"); |
185 test.Printf(_L("************************\n")); |
228 test.Printf(_L("************************\n")); |
|
229 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP07, "************************\n"); |
|
230 test.Printf(_L("* Using SW4 on the OET *\n")); |
186 test.Printf(_L("* Using SW4 on the OET *\n")); |
231 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP08, "* Using SW4 on the OET *\n"); |
|
232 test.Printf(_L("* Apply 100mA LOAD now *\n")); |
187 test.Printf(_L("* Apply 100mA LOAD now *\n")); |
233 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP09, "* Apply 100mA LOAD now *\n"); |
188 test.Printf(_L("************************\n")); |
234 test.Printf(_L("************************\n")); |
189 test.Printf(_L("\n")); |
235 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP10, "************************\n"); |
|
236 test.Printf(_L("\n")); |
|
237 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP11, "\n"); |
|
238 |
190 |
239 iCaseStep = EVerifyBusFail; |
191 iCaseStep = EVerifyBusFail; |
240 |
192 |
241 break; |
193 break; |
242 |
194 |
243 case EVerifyBusFail: |
195 case EVerifyBusFail: |
244 |
196 |
245 OtgMessageString(iOTGMessage, aDescription); |
197 OtgMessageString(iOTGMessage, aDescription); |
246 test.Printf(_L("Received message %d '%S' status(%d)\n"), iOTGMessage, &aDescription, completionCode); |
198 test.Printf(_L("Received message %d '%S' status(%d)\n"), iOTGMessage, &aDescription, completionCode); |
247 OstTraceExt3(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP12, "Received message %d '%S' status(%d)\n", iOTGMessage, aDescription, completionCode); |
|
248 |
199 |
249 if (RUsbOtgDriver::EMessageVbusError == iOTGMessage) |
200 if (RUsbOtgDriver::EMessageVbusError == iOTGMessage) |
250 { |
201 { |
251 err = otgBusClearError(); |
202 err = otgBusClearError(); |
252 |
203 |
281 return TestFailed(KErrAbort,_L("unload Ldd failure")); |
232 return TestFailed(KErrAbort,_L("unload Ldd failure")); |
282 } |
233 } |
283 |
234 |
284 // remove 100ma Load - this reminds the user |
235 // remove 100ma Load - this reminds the user |
285 test.Printf(_L("\n")); |
236 test.Printf(_L("\n")); |
286 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP13, "\n"); |
237 test.Printf(_L("************************\n")); |
287 test.Printf(_L("************************\n")); |
|
288 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP14, "************************\n"); |
|
289 test.Printf(_L("* Using SW4 on the OET *\n")); |
238 test.Printf(_L("* Using SW4 on the OET *\n")); |
290 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP15, "* Using SW4 on the OET *\n"); |
|
291 test.Printf(_L("* Remove 100mA LOAD! *\n")); |
239 test.Printf(_L("* Remove 100mA LOAD! *\n")); |
292 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP16, "* Remove 100mA LOAD! *\n"); |
240 test.Printf(_L("************************\n")); |
293 test.Printf(_L("************************\n")); |
241 test.Printf(_L("\n")); |
294 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP17, "************************\n"); |
|
295 test.Printf(_L("\n")); |
|
296 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP18, "\n"); |
|
297 |
242 |
298 iCaseStep = ELastStep; |
243 iCaseStep = ELastStep; |
299 // press any key |
244 // press any key |
300 test.Printf(KPressAnyKeyToContinue); |
245 test.Printf(KPressAnyKeyToContinue); |
301 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP19, KPressAnyKeyToContinue); |
|
302 RequestCharacter(); |
246 RequestCharacter(); |
303 break; |
247 break; |
304 |
248 |
305 case ELastStep: |
249 case ELastStep: |
306 return TestPassed(); |
250 return TestPassed(); |
307 |
251 |
308 default: |
252 default: |
309 test.Printf(_L("<Error> unknown test step")); |
253 test.Printf(_L("<Error> unknown test step")); |
310 OstTrace0(TRACE_NORMAL, CTESTCASE0466_RUNSTEPL_DUP20, "<Error> unknown test step"); |
|
311 Cancel(); |
254 Cancel(); |
312 return (TestFailed(KErrCorrupt, _L("<Error> unknown test step"))); |
255 return (TestFailed(KErrCorrupt, _L("<Error> unknown test step"))); |
313 |
256 |
314 } |
257 } |
315 |
258 |