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 "b2bwatchers.h" |
25 #include "b2bwatchers.h" |
26 #include "testcase1233.h" |
26 #include "testcase1233.h" |
27 #include "OstTraceDefinitions.h" |
|
28 #ifdef OST_TRACE_COMPILER_IN_USE |
|
29 #include "testcase1233Traces.h" |
|
30 #endif |
|
31 |
27 |
32 #include <e32debug.h> |
28 #include <e32debug.h> |
33 |
29 |
34 #define LOG_INTO_STEP(a) test.Printf(_L("\nInto Step [%S]\n\n"), &a); |
30 #define LOG_INTO_STEP(a) test.Printf(_L("\nInto Step [%S]\n\n"), &a); |
35 |
|
36 |
31 |
37 /* ************************************************************************************** |
32 /* ************************************************************************************** |
38 * the name below is used to add a pointer to our construction method to a pointer MAP in |
33 * the name below is used to add a pointer to our construction method to a pointer MAP in |
39 * the class factory |
34 * the class factory |
40 */ |
35 */ |
41 _LIT(KTestCaseId,"PBASE-USB_OTGDI-1233"); |
36 _LIT(KTestCaseId,"PBASE-USB_OTGDI-1233"); |
42 const TTestCaseFactoryReceipt<CTestCase1233> CTestCase1233::iFactoryReceipt(KTestCaseId); |
37 const TTestCaseFactoryReceipt<CTestCase1233> CTestCase1233::iFactoryReceipt(KTestCaseId); |
43 |
38 |
44 CTestCase1233* CTestCase1233::NewL(TBool aHost) |
39 CTestCase1233* CTestCase1233::NewL(TBool aHost) |
45 { |
40 { |
46 if(gVerboseOutput) |
41 LOG_FUNC |
47 { |
|
48 OstTraceFunctionEntry0(CTESTCASE1233_NEWL); |
|
49 } |
|
50 CTestCase1233* self = new (ELeave) CTestCase1233(aHost); |
42 CTestCase1233* self = new (ELeave) CTestCase1233(aHost); |
51 CleanupStack::PushL(self); |
43 CleanupStack::PushL(self); |
52 self->ConstructL(); |
44 self->ConstructL(); |
53 CleanupStack::Pop(self); |
45 CleanupStack::Pop(self); |
54 return self; |
46 return self; |
56 |
48 |
57 |
49 |
58 CTestCase1233::CTestCase1233(TBool aHost) |
50 CTestCase1233::CTestCase1233(TBool aHost) |
59 : CTestCaseB2BRoot(KTestCaseId, aHost, iStatus) |
51 : CTestCaseB2BRoot(KTestCaseId, aHost, iStatus) |
60 { |
52 { |
61 if(gVerboseOutput) |
53 LOG_FUNC |
62 { |
|
63 OstTraceFunctionEntry0(CTESTCASE1233_CTESTCASE1233); |
|
64 } |
|
65 |
54 |
66 } |
55 } |
67 |
56 |
68 |
57 |
69 /** |
58 /** |
70 ConstructL |
59 ConstructL |
71 */ |
60 */ |
72 void CTestCase1233::ConstructL() |
61 void CTestCase1233::ConstructL() |
73 { |
62 { |
74 if(gVerboseOutput) |
63 LOG_FUNC |
75 { |
|
76 OstTraceFunctionEntry0(CTESTCASE1233_CONSTRUCTL); |
|
77 } |
|
78 |
64 |
79 iTestVID = 0x0E22; // Symbian |
65 iTestVID = 0x0E22; // Symbian |
80 iTestPID = 0xF000 + 1233; // Test 1233 |
66 iTestPID = 0xF000 + 1233; // Test 1233 |
81 |
67 |
82 BaseConstructL(); |
68 BaseConstructL(); |
83 } |
69 } |
84 |
70 |
85 |
71 |
86 CTestCase1233::~CTestCase1233() |
72 CTestCase1233::~CTestCase1233() |
87 { |
73 { |
88 if(gVerboseOutput) |
74 LOG_FUNC |
89 { |
|
90 OstTraceFunctionEntry0(CTESTCASE1233_DCTESTCASE1233); |
|
91 } |
|
92 iCollector.DestroyObservers(); |
75 iCollector.DestroyObservers(); |
93 Cancel(); |
76 Cancel(); |
94 } |
77 } |
95 |
78 |
96 |
79 |
97 void CTestCase1233::ExecuteTestCaseL() |
80 void CTestCase1233::ExecuteTestCaseL() |
98 { |
81 { |
99 if(gVerboseOutput) |
82 LOG_FUNC |
100 { |
|
101 OstTraceFunctionEntry0(CTESTCASE1233_EXECUTETESTCASEL); |
|
102 } |
|
103 iCaseStep = EPreconditions; |
83 iCaseStep = EPreconditions; |
104 CActiveScheduler::Add(this); |
84 CActiveScheduler::Add(this); |
105 SelfComplete(); |
85 SelfComplete(); |
106 } |
86 } |
107 |
87 |
108 |
88 |
109 void CTestCase1233::DoCancel() |
89 void CTestCase1233::DoCancel() |
110 { |
90 { |
111 if(gVerboseOutput) |
91 LOG_FUNC |
112 { |
|
113 OstTraceFunctionEntry0(CTESTCASE1233_DOCANCEL); |
|
114 } |
|
115 // cancel our timer |
92 // cancel our timer |
116 iTimer.Cancel(); |
93 iTimer.Cancel(); |
117 } |
94 } |
118 |
95 |
119 |
96 |
120 void CTestCase1233::RunStepL() |
97 void CTestCase1233::RunStepL() |
121 { |
98 { |
122 if(gVerboseOutput) |
99 LOG_FUNC |
123 { |
|
124 OstTraceFunctionEntry0(CTESTCASE1233_RUNSTEPL); |
|
125 } |
|
126 |
100 |
127 // Obtain the completion code for this CActive obj. |
101 // Obtain the completion code for this CActive obj. |
128 TInt completionCode(iStatus.Int()); |
102 TInt completionCode(iStatus.Int()); |
129 TBuf<MAX_DSTRLEN> aDescription; |
103 TBuf<MAX_DSTRLEN> aDescription; |
130 |
104 |
210 iTestPID++; |
184 iTestPID++; |
211 |
185 |
212 if ( iTestPID > 0x0108 ) |
186 if ( iTestPID > 0x0108 ) |
213 { |
187 { |
214 test.Printf(_L("All VID/PID pairs done\n")); |
188 test.Printf(_L("All VID/PID pairs done\n")); |
215 OstTrace0(TRACE_NORMAL, CTESTCASE1233_RUNSTEPL_DUP01, "All VID/PID pairs done\n"); |
|
216 |
189 |
217 iCaseStep = EUnloadLdd; |
190 iCaseStep = EUnloadLdd; |
218 } |
191 } |
219 else |
192 else |
220 { |
193 { |
221 if(gTestRoleMaster) |
194 if(gTestRoleMaster) |
222 { |
195 { |
223 // B |
196 // B |
224 test.Printf(_L("Setting VID/PID of 0x%04x/0x%04x\n"),iTestVID,iTestPID); |
197 test.Printf(_L("Setting VID/PID of 0x%04x/0x%04x\n"),iTestVID,iTestPID); |
225 OstTraceExt2(TRACE_NORMAL, CTESTCASE1233_RUNSTEPL_DUP02, "Setting VID/PID of 0x%04x/0x%04x\n",(TUint32)iTestVID,(TUint32)iTestPID); |
|
226 |
198 |
227 if (!StepChangeVidPid(iTestVID,iTestPID)) |
199 if (!StepChangeVidPid(iTestVID,iTestPID)) |
228 { |
200 { |
229 return TestFailed(KErrAbort, _L("VID/PID Change Failure")); |
201 return TestFailed(KErrAbort, _L("VID/PID Change Failure")); |
230 } |
202 } |
231 } |
203 } |
232 else |
204 else |
233 { |
205 { |
234 // A |
206 // A |
235 test.Printf(_L("Expecting VID/PID of 0x%04x/0x%04x\n"),iTestVID,iTestPID); |
207 test.Printf(_L("Expecting VID/PID of 0x%04x/0x%04x\n"),iTestVID,iTestPID); |
236 OstTraceExt2(TRACE_NORMAL, CTESTCASE1233_RUNSTEPL_DUP03, "Expecting VID/PID of 0x%04x/0x%04x\n",(TUint32)iTestVID,(TUint32)iTestPID); |
|
237 } |
208 } |
238 |
209 |
239 iCollector.ClearAllEvents(); |
210 iCollector.ClearAllEvents(); |
240 iCaseStep = ERaiseVBus; |
211 iCaseStep = ERaiseVBus; |
241 } |
212 } |
266 } |
237 } |
267 else |
238 else |
268 { |
239 { |
269 // A device |
240 // A device |
270 test.Printf(_L("Raising VBUS for VID/PID = 0x%04x/0x%04x\n"),iTestVID,iTestPID); |
241 test.Printf(_L("Raising VBUS for VID/PID = 0x%04x/0x%04x\n"),iTestVID,iTestPID); |
271 OstTraceExt2(TRACE_NORMAL, CTESTCASE1233_RUNSTEPL_DUP04, "Raising VBUS for VID/PID = 0x%04x/0x%04x\n",(TUint32)iTestVID,(TUint32)iTestPID); |
|
272 |
242 |
273 if ( otgBusRequest() != KErrNone ) |
243 if ( otgBusRequest() != KErrNone ) |
274 { |
244 { |
275 return TestFailed(KErrAbort, _L("Raise Vbus - RUsbOtgDriver::BusRequest() FAILED!")); |
245 return TestFailed(KErrAbort, _L("Raise Vbus - RUsbOtgDriver::BusRequest() FAILED!")); |
276 } |
246 } |
295 } |
265 } |
296 |
266 |
297 if ( otgVbusPresent() ) |
267 if ( otgVbusPresent() ) |
298 { |
268 { |
299 test.Printf(_L("...VBUS is UP\n")); |
269 test.Printf(_L("...VBUS is UP\n")); |
300 OstTrace0(TRACE_NORMAL, CTESTCASE1233_RUNSTEPL_DUP05, "...VBUS is UP\n"); |
|
301 iCaseStep = EDropVBus; |
270 iCaseStep = EDropVBus; |
302 } |
271 } |
303 else |
272 else |
304 { |
273 { |
305 test.Printf(_L("...VBUS is DOWN\n")); |
274 test.Printf(_L("...VBUS is DOWN\n")); |
306 OstTrace0(TRACE_NORMAL, CTESTCASE1233_RUNSTEPL_DUP06, "...VBUS is DOWN\n"); |
|
307 return TestFailed(KErrAbort, _L("Vbus did not rise - FAILED!")); |
275 return TestFailed(KErrAbort, _L("Vbus did not rise - FAILED!")); |
308 } |
276 } |
309 |
277 |
310 if (gTestRoleMaster) |
278 if (gTestRoleMaster) |
311 { |
279 { |
374 } |
342 } |
375 |
343 |
376 if ( otgVbusPresent() ) |
344 if ( otgVbusPresent() ) |
377 { |
345 { |
378 test.Printf(_L("...VBUS is UP\n")); |
346 test.Printf(_L("...VBUS is UP\n")); |
379 OstTrace0(TRACE_NORMAL, CTESTCASE1233_RUNSTEPL_DUP07, "...VBUS is UP\n"); |
|
380 return TestFailed(KErrAbort, _L("Vbus did not rise - FAILED!")); |
347 return TestFailed(KErrAbort, _L("Vbus did not rise - FAILED!")); |
381 } |
348 } |
382 else |
349 else |
383 { |
350 { |
384 test.Printf(_L("...VBUS is DOWN\n")); |
351 test.Printf(_L("...VBUS is DOWN\n")); |
385 OstTrace0(TRACE_NORMAL, CTESTCASE1233_RUNSTEPL_DUP08, "...VBUS is DOWN\n"); |
|
386 iCaseStep = ELoopToNextPID; |
352 iCaseStep = ELoopToNextPID; |
387 } |
353 } |
388 |
354 |
389 SelfComplete(); |
355 SelfComplete(); |
390 break; |
356 break; |