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