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