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 'disconnected' 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 "testcase0457.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 "testcase0457Traces.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 |
// the name below is used to add a pointer to our construction method to a pointer MAP in |
|
35 |
// the class factory |
|
36 |
_LIT(KTestCaseId,"PBASE-USB_OTGDI-0457"); |
|
37 |
const TTestCaseFactoryReceipt<CTestCase0457> CTestCase0457::iFactoryReceipt(KTestCaseId); |
|
38 |
||
39 |
// # times to repeat the steps |
|
40 |
#define OPEN_REPEATS gOpenIterations |
|
41 |
||
42 |
CTestCase0457* CTestCase0457::NewL(TBool aHost) |
|
43 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
44 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
45 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
46 |
OstTraceFunctionEntry0(CTESTCASE0457_NEWL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
47 |
} |
0 | 48 |
CTestCase0457* self = new (ELeave) CTestCase0457(aHost); |
49 |
CleanupStack::PushL(self); |
|
50 |
self->ConstructL(); |
|
51 |
CleanupStack::Pop(self); |
|
52 |
return self; |
|
53 |
} |
|
54 |
||
55 |
||
56 |
CTestCase0457::CTestCase0457(TBool aHost) |
|
57 |
: CTestCaseRoot(KTestCaseId, aHost) |
|
58 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
59 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
60 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
61 |
OstTraceFunctionEntry0(CTESTCASE0457_CTESTCASE0457); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
62 |
} |
0 | 63 |
} |
64 |
||
65 |
||
66 |
/** |
|
67 |
ConstructL |
|
68 |
*/ |
|
69 |
void CTestCase0457::ConstructL() |
|
70 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
71 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
72 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
73 |
OstTraceFunctionEntry0(CTESTCASE0457_CONSTRUCTL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
74 |
} |
0 | 75 |
iRepeats = OPEN_REPEATS; |
76 |
||
77 |
BaseConstructL(); |
|
78 |
} |
|
79 |
||
80 |
||
81 |
CTestCase0457::~CTestCase0457() |
|
82 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
83 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
84 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
85 |
OstTraceFunctionEntry0(CTESTCASE0457_DCTESTCASE0457); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
86 |
} |
0 | 87 |
|
88 |
Cancel(); |
|
89 |
} |
|
90 |
||
91 |
||
92 |
void CTestCase0457::ExecuteTestCaseL() |
|
93 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
94 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
95 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
96 |
OstTraceFunctionEntry0(CTESTCASE0457_EXECUTETESTCASEL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
97 |
} |
0 | 98 |
iCaseStep = EPreconditions; |
99 |
||
100 |
CActiveScheduler::Add(this); |
|
101 |
SelfComplete(); |
|
102 |
} |
|
103 |
||
104 |
||
105 |
void CTestCase0457::DescribePreconditions() |
|
106 |
{ |
|
107 |
test.Printf(_L("Remove any USB plug beforehand.\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
108 |
OstTrace0(TRACE_NORMAL, CTESTCASE0457_DESCRIBEPRECONDITIONS, "Remove any USB plug beforehand.\n"); |
0 | 109 |
} |
110 |
||
111 |
||
112 |
void CTestCase0457::DoCancel() |
|
113 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
114 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
115 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
116 |
OstTraceFunctionEntry0(CTESTCASE0457_DOCANCEL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
117 |
} |
0 | 118 |
|
119 |
// cancel our timer |
|
120 |
iTimer.Cancel(); |
|
121 |
} |
|
122 |
||
123 |
||
124 |
// handle event completion |
|
125 |
void CTestCase0457::RunStepL() |
|
126 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
127 |
if(gVerboseOutput) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
128 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
129 |
OstTraceFunctionEntry0(CTESTCASE0457_RUNSTEPL); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
130 |
} |
0 | 131 |
|
132 |
// Obtain the completion code for this CActive obj. |
|
133 |
TInt completionCode(iStatus.Int()); |
|
134 |
||
135 |
switch(iCaseStep) |
|
136 |
{ |
|
137 |
case EPreconditions: |
|
138 |
{ |
|
139 |
test.Printf(KPressAnyKeyToStart); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
140 |
OstTrace0(TRACE_NORMAL, CTESTCASE0457_RUNSTEPL_DUP01, KPressAnyKeyToStart); |
0 | 141 |
iCaseStep = ELoadLdd; |
142 |
RequestCharacter(); |
|
143 |
break; |
|
144 |
} |
|
145 |
||
146 |
case ELoadLdd: |
|
147 |
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
|
148 |
OstTraceExt2(TRACE_NORMAL, CTESTCASE0457_RUNSTEPL_DUP02, "Load the LDD iteration %d/%d\n", OPEN_REPEATS-iRepeats+1, OPEN_REPEATS); |
0 | 149 |
if (!StepLoadLDD()) |
150 |
{ |
|
151 |
break; |
|
152 |
} |
|
153 |
||
154 |
iCaseStep = EUnloadLdd; |
|
155 |
SelfComplete(); |
|
156 |
break; |
|
157 |
case EUnloadLdd: |
|
158 |
if (EFalse == StepUnloadLDD()) |
|
159 |
return TestFailed(KErrAbort,_L("Unload Ldd failure")); |
|
160 |
||
161 |
iCaseStep = ELoopDecrement; |
|
162 |
SelfComplete(); |
|
163 |
break; |
|
164 |
||
165 |
case ELoopDecrement: |
|
166 |
test.Printf(_L("Repeat test\n")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
167 |
OstTrace0(TRACE_NORMAL, CTESTCASE0457_RUNSTEPL_DUP03, "Repeat test\n"); |
0 | 168 |
|
169 |
if (--iRepeats) |
|
170 |
iCaseStep = ELoadLdd; |
|
171 |
else |
|
172 |
iCaseStep = ELastStep; |
|
173 |
SelfComplete(); |
|
174 |
break; |
|
175 |
||
176 |
// Finnished |
|
177 |
case ELastStep: |
|
178 |
// PASS |
|
179 |
return TestPassed(); |
|
180 |
||
181 |
||
182 |
default: |
|
183 |
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
|
184 |
OstTrace0(TRACE_NORMAL, CTESTCASE0457_RUNSTEPL_DUP04, "<Error> unknown test step"); |
0 | 185 |
Cancel(); |
186 |
TestPolicy().SignalTestComplete(KErrCorrupt); |
|
187 |
break; |
|
188 |
} |
|
189 |
||
190 |
||
191 |
} |
|
192 |
||
193 |