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 |
// Open/Close 'powered peripheral' test |
|
16 |
// |
|
17 |
// |
|
18 |
||
19 |
#include <e32std.h> |
|
20 |
#include <e32std_private.h> |
|
21 |
#include <u32std.h> // unicode builds |
|
22 |
#include <e32base.h> |
|
23 |
#include <e32base_private.h> |
|
24 |
#include <e32Test.h> // RTest headder |
|
25 |
#include "testcaseroot.h" |
|
26 |
#include "testcase0458.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 "testcase0458Traces.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 |
||
35 |
// the name below is used to add a pointer to our construction method to a pointer MAP in |
|
36 |
// the class factory |
|
37 |
_LIT(KTestCaseId,"PBASE-USB_OTGDI-0458"); |
|
38 |
const TTestCaseFactoryReceipt<CTestCase0458> CTestCase0458::iFactoryReceipt(KTestCaseId); |
|
39 |
||
40 |
||
41 |
CTestCase0458* CTestCase0458::NewL(TBool aHost) |
|
42 |
{ |
|
43 |
CTestCase0458* self = new (ELeave) CTestCase0458(aHost); |
|
44 |
CleanupStack::PushL(self); |
|
45 |
self->ConstructL(); |
|
46 |
CleanupStack::Pop(self); |
|
47 |
return self; |
|
48 |
} |
|
49 |
||
50 |
||
51 |
CTestCase0458::CTestCase0458(TBool aHost) |
|
52 |
: CTestCaseRoot(KTestCaseId, aHost) |
|
53 |
{ |
|
54 |
} |
|
55 |
||
56 |
||
57 |
/** |
|
58 |
ConstructL |
|
59 |
*/ |
|
60 |
void CTestCase0458::ConstructL() |
|
61 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
62 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
63 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
64 |
OstTraceFunctionEntry0(CTESTCASE0458_CONSTRUCTL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
65 |
} |
0 | 66 |
iRepeats = OPEN_REPEATS; |
67 |
||
68 |
BaseConstructL(); |
|
69 |
} |
|
70 |
||
71 |
||
72 |
CTestCase0458::~CTestCase0458() |
|
73 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
74 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
76 |
OstTraceFunctionEntry0(CTESTCASE0458_DCTESTCASE0458); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
77 |
} |
0 | 78 |
|
79 |
Cancel(); |
|
80 |
} |
|
81 |
||
82 |
||
83 |
void CTestCase0458::ExecuteTestCaseL() |
|
84 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
85 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
86 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
87 |
OstTraceFunctionEntry0(CTESTCASE0458_EXECUTETESTCASEL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
88 |
} |
0 | 89 |
iCaseStep = EPreconditions; |
90 |
||
91 |
CActiveScheduler::Add(this); |
|
92 |
SelfComplete(); |
|
93 |
||
94 |
} |
|
95 |
||
96 |
void CTestCase0458::DescribePreconditions() |
|
97 |
{ |
|
98 |
test.Printf(_L("Insert 'B' connector from cable\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
99 |
OstTrace0(TRACE_NORMAL, CTESTCASE0458_DESCRIBEPRECONDITIONS, "Insert 'B' connector from cable\n"); |
0 | 100 |
test.Printf(_L("attached to powered host beforehand.\n")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
101 |
OstTrace0(TRACE_NORMAL, CTESTCASE0458_DESCRIBEPRECONDITIONS_DUP01, "attached to powered host beforehand.\n"); |
0 | 102 |
} |
103 |
||
104 |
||
105 |
void CTestCase0458::DoCancel() |
|
106 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
107 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
108 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
109 |
OstTraceFunctionEntry0(CTESTCASE0458_DOCANCEL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
110 |
} |
0 | 111 |
|
112 |
// cancel our timer |
|
113 |
iTimer.Cancel(); |
|
114 |
} |
|
115 |
||
116 |
||
117 |
// handle event completion |
|
118 |
void CTestCase0458::RunStepL() |
|
119 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
120 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
121 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
122 |
OstTraceFunctionEntry0(CTESTCASE0458_RUNSTEPL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
123 |
} |
0 | 124 |
|
125 |
// Obtain the completion code for this CActive obj. |
|
126 |
TInt completionCode(iStatus.Int()); |
|
127 |
||
128 |
switch(iCaseStep) |
|
129 |
{ |
|
130 |
case EPreconditions: |
|
131 |
{ |
|
132 |
test.Printf(KPressAnyKeyToStart); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
133 |
OstTrace0(TRACE_NORMAL, CTESTCASE0458_RUNSTEPL_DUP01, KPressAnyKeyToStart); |
0 | 134 |
iCaseStep = ELoadLdd; |
135 |
RequestCharacter(); |
|
136 |
break; |
|
137 |
} |
|
138 |
||
139 |
case ELoadLdd: |
|
140 |
test.Printf(_L("Load the LDD iteration %d/%d\n"), OPEN_REPEATS-iRepeats+1, OPEN_REPEATS); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
141 |
OstTraceExt2(TRACE_NORMAL, CTESTCASE0458_RUNSTEPL_DUP02, "Load the LDD iteration %d/%d\n", OPEN_REPEATS-iRepeats+1, OPEN_REPEATS); |
0 | 142 |
if (!StepLoadLDD()) |
143 |
{ |
|
144 |
break; |
|
145 |
} |
|
146 |
||
147 |
iCaseStep = EUnloadLdd; |
|
148 |
SelfComplete(); |
|
149 |
break; |
|
150 |
case EUnloadLdd: |
|
151 |
if (EFalse == StepUnloadLDD()) |
|
152 |
return TestFailed(KErrAbort,_L("Unload Ldd failure")); |
|
153 |
||
154 |
iCaseStep = ELoopDecrement; |
|
155 |
SelfComplete(); |
|
156 |
break; |
|
157 |
||
158 |
case ELoopDecrement: |
|
159 |
test.Printf(_L("Repeat test\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
160 |
OstTrace0(TRACE_NORMAL, CTESTCASE0458_RUNSTEPL_DUP03, "Repeat test\n"); |
0 | 161 |
|
162 |
if (--iRepeats) |
|
163 |
{ |
|
164 |
iCaseStep = ELoadLdd; |
|
165 |
} |
|
166 |
else |
|
167 |
{ |
|
168 |
iCaseStep = ELastStep; |
|
169 |
} |
|
170 |
SelfComplete(); |
|
171 |
break; |
|
172 |
||
173 |
// Finnished |
|
174 |
case ELastStep: |
|
175 |
// PASS |
|
176 |
return TestPassed(); |
|
177 |
||
178 |
||
179 |
default: |
|
180 |
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
|
181 |
OstTrace0(TRACE_NORMAL, CTESTCASE0458_RUNSTEPL_DUP04, "<Error> unknown test step"); |
0 | 182 |
Cancel(); |
183 |
TestPolicy().SignalTestComplete(KErrCorrupt); |
|
184 |
break; |
|
185 |
} |
|
186 |
||
187 |
} |
|
188 |
||
189 |