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". |
21 #include <e32base.h> |
21 #include <e32base.h> |
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 "testcase0464.h" |
25 #include "testcase0464.h" |
|
26 #include "OstTraceDefinitions.h" |
|
27 #ifdef OST_TRACE_COMPILER_IN_USE |
|
28 #include "testcase0464Traces.h" |
|
29 #endif |
26 |
30 |
27 |
31 |
28 |
32 |
29 // 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 |
30 // the class factory |
34 // the class factory |
31 _LIT(KTestCaseId,"PBASE-USB_OTGDI-0464"); |
35 _LIT(KTestCaseId,"PBASE-USB_OTGDI-0464"); |
32 const TTestCaseFactoryReceipt<CTestCase0464> CTestCase0464::iFactoryReceipt(KTestCaseId); |
36 const TTestCaseFactoryReceipt<CTestCase0464> CTestCase0464::iFactoryReceipt(KTestCaseId); |
33 |
37 |
34 CTestCase0464* CTestCase0464::NewL(TBool aHost) |
38 CTestCase0464* CTestCase0464::NewL(TBool aHost) |
35 { |
39 { |
36 LOG_FUNC |
40 if(gVerboseOutput) |
|
41 { |
|
42 OstTraceFunctionEntry0(CTESTCASE0464_NEWL); |
|
43 } |
37 CTestCase0464* self = new (ELeave) CTestCase0464(aHost); |
44 CTestCase0464* self = new (ELeave) CTestCase0464(aHost); |
38 CleanupStack::PushL(self); |
45 CleanupStack::PushL(self); |
39 self->ConstructL(); |
46 self->ConstructL(); |
40 CleanupStack::Pop(self); |
47 CleanupStack::Pop(self); |
41 return self; |
48 return self; |
43 |
50 |
44 |
51 |
45 CTestCase0464::CTestCase0464(TBool aHost) |
52 CTestCase0464::CTestCase0464(TBool aHost) |
46 : CTestCaseRoot(KTestCaseId, aHost) |
53 : CTestCaseRoot(KTestCaseId, aHost) |
47 { |
54 { |
48 LOG_FUNC |
55 if(gVerboseOutput) |
|
56 { |
|
57 OstTraceFunctionEntry0(CTESTCASE0464_CTESTCASE0464); |
|
58 } |
49 |
59 |
50 } |
60 } |
51 |
61 |
52 |
62 |
53 /** |
63 /** |
54 ConstructL |
64 ConstructL |
55 */ |
65 */ |
56 void CTestCase0464::ConstructL() |
66 void CTestCase0464::ConstructL() |
57 { |
67 { |
58 LOG_FUNC |
68 if(gVerboseOutput) |
|
69 { |
|
70 OstTraceFunctionEntry0(CTESTCASE0464_CONSTRUCTL); |
|
71 } |
59 |
72 |
60 BaseConstructL(); |
73 BaseConstructL(); |
61 } |
74 } |
62 |
75 |
63 |
76 |
64 CTestCase0464::~CTestCase0464() |
77 CTestCase0464::~CTestCase0464() |
65 { |
78 { |
66 LOG_FUNC |
79 if(gVerboseOutput) |
|
80 { |
|
81 OstTraceFunctionEntry0(CTESTCASE0464_DCTESTCASE0464); |
|
82 } |
67 |
83 |
68 Cancel(); |
84 Cancel(); |
69 } |
85 } |
70 |
86 |
71 |
87 |
72 void CTestCase0464::ExecuteTestCaseL() |
88 void CTestCase0464::ExecuteTestCaseL() |
73 { |
89 { |
74 LOG_FUNC |
90 if(gVerboseOutput) |
|
91 { |
|
92 OstTraceFunctionEntry0(CTESTCASE0464_EXECUTETESTCASEL); |
|
93 } |
75 iCaseStep = EPreconditions; |
94 iCaseStep = EPreconditions; |
76 |
95 |
77 CActiveScheduler::Add(this); |
96 CActiveScheduler::Add(this); |
78 SelfComplete(); |
97 SelfComplete(); |
79 } |
98 } |
80 |
99 |
81 |
100 |
82 void CTestCase0464::DescribePreconditions() |
101 void CTestCase0464::DescribePreconditions() |
83 { |
102 { |
84 test.Printf(_L("Insert 'A' connector beforehand.\n")); |
103 test.Printf(_L("Insert 'A' connector beforehand.\n")); |
|
104 OstTrace0(TRACE_NORMAL, CTESTCASE0464_DESCRIBEPRECONDITIONS, "Insert 'A' connector beforehand.\n"); |
85 } |
105 } |
86 |
106 |
87 |
107 |
88 void CTestCase0464::DoCancel() |
108 void CTestCase0464::DoCancel() |
89 { |
109 { |
90 LOG_FUNC |
110 if(gVerboseOutput) |
|
111 { |
|
112 OstTraceFunctionEntry0(CTESTCASE0464_DOCANCEL); |
|
113 } |
91 |
114 |
92 // cancel our timer |
115 // cancel our timer |
93 iTimer.Cancel(); |
116 iTimer.Cancel(); |
94 } |
117 } |
95 |
118 |
105 |
128 |
106 |
129 |
107 // handle event completion |
130 // handle event completion |
108 void CTestCase0464::RunStepL() |
131 void CTestCase0464::RunStepL() |
109 { |
132 { |
110 LOG_FUNC |
133 if(gVerboseOutput) |
|
134 { |
|
135 OstTraceFunctionEntry0(CTESTCASE0464_RUNSTEPL); |
|
136 } |
111 // Obtain the completion code for this CActive obj. |
137 // Obtain the completion code for this CActive obj. |
112 TInt completionCode(iStatus.Int()); |
138 TInt completionCode(iStatus.Int()); |
113 TBuf<MAX_DSTRLEN> aDescription; |
139 TBuf<MAX_DSTRLEN> aDescription; |
114 TInt err(0); |
140 TInt err(0); |
115 |
141 |
123 SelfComplete(); |
149 SelfComplete(); |
124 break; |
150 break; |
125 } |
151 } |
126 // prompt to insert 'A' connector |
152 // prompt to insert 'A' connector |
127 test.Printf(KInsertAConnectorPrompt); |
153 test.Printf(KInsertAConnectorPrompt); |
|
154 OstTrace0(TRACE_NORMAL, CTESTCASE0464_RUNSTEPL_DUP01, KInsertAConnectorPrompt); |
128 test.Printf(KPressAnyKeyToContinue); |
155 test.Printf(KPressAnyKeyToContinue); |
|
156 OstTrace0(TRACE_NORMAL, CTESTCASE0464_RUNSTEPL_DUP02, KPressAnyKeyToContinue); |
129 RequestCharacter(); |
157 RequestCharacter(); |
130 break; |
158 break; |
131 |
159 |
132 case ELoadLdd: |
160 case ELoadLdd: |
133 if (!StepLoadLDD()) |
161 if (!StepLoadLDD()) |
150 SelfComplete(); |
182 SelfComplete(); |
151 break; |
183 break; |
152 |
184 |
153 case EUnloadLdd: |
185 case EUnloadLdd: |
154 LOG_VERBOSE1(_L("Unload.\n")) |
186 LOG_VERBOSE1(_L("Unload.\n")) |
|
187 if(gVerboseOutput) |
|
188 { |
|
189 OstTrace0(TRACE_VERBOSE, CTESTCASE0464_RUNSTEPL_DUP04, "Unload.\n"); |
|
190 } |
155 if (EFalse == StepUnloadLDD()) |
191 if (EFalse == StepUnloadLDD()) |
156 return TestFailed(KErrAbort,_L("unload Ldd failure")); |
192 return TestFailed(KErrAbort,_L("unload Ldd failure")); |
157 test.Printf(_L("Measure VBus =0 and then press Y or N to continue.")); |
193 test.Printf(_L("Measure VBus =0 and then press Y or N to continue.")); |
|
194 OstTrace0(TRACE_NORMAL, CTESTCASE0464_RUNSTEPL_DUP05, "Measure VBus =0 and then press Y or N to continue."); |
158 RequestCharacter(); |
195 RequestCharacter(); |
159 iCaseStep = EVerifyVBusGone; |
196 iCaseStep = EVerifyVBusGone; |
160 break; |
197 break; |
161 |
198 |
162 case EVerifyVBusGone: |
199 case EVerifyVBusGone: |
163 LOG_VERBOSE1(_L("Test !VBus after unload.\n")) |
200 LOG_VERBOSE1(_L("Test !VBus after unload.\n")) |
|
201 if(gVerboseOutput) |
|
202 { |
|
203 OstTrace0(TRACE_VERBOSE, CTESTCASE0464_RUNSTEPL_DUP06, "Test !VBus after unload.\n"); |
|
204 } |
164 // test key response (or via an API) |
205 // test key response (or via an API) |
165 if (('y' == iKeyCodeInput) ||('Y' == iKeyCodeInput)) |
206 if (('y' == iKeyCodeInput) ||('Y' == iKeyCodeInput)) |
166 { |
207 { |
167 test.Printf(_L("VBUS drop 'seen' \n")); |
208 test.Printf(_L("VBUS drop 'seen' \n")); |
|
209 OstTrace0(TRACE_NORMAL, CTESTCASE0464_RUNSTEPL_DUP07, "VBUS drop 'seen' \n"); |
168 SelfComplete(); |
210 SelfComplete(); |
169 } |
211 } |
170 else |
212 else |
171 { |
213 { |
172 return TestFailed(KErrAbort, _L("VBus drop not 'seen' - FAILED!")); |
214 return TestFailed(KErrAbort, _L("VBus drop not 'seen' - FAILED!")); |