2
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: CUIEngineRunner: This object executes test cases
|
|
15 |
* from STIF Test Framework.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <e32base.h>
|
|
21 |
#include <e32svr.h>
|
|
22 |
#include <stifinternal/UIEngineContainer.h>
|
|
23 |
#include "UIEngineRunner.h"
|
|
24 |
#include "Logging.h"
|
|
25 |
|
|
26 |
|
|
27 |
// EXTERNAL DATA STRUCTURES
|
|
28 |
// None
|
|
29 |
|
|
30 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
31 |
// None
|
|
32 |
|
|
33 |
// CONSTANTS
|
|
34 |
// None
|
|
35 |
|
|
36 |
// MACROS
|
|
37 |
#ifdef LOGGER
|
|
38 |
#undef LOGGER
|
|
39 |
#endif
|
|
40 |
#define LOGGER iUIEngineContainer->iUIEngine->iLogger
|
|
41 |
|
|
42 |
|
|
43 |
// LOCAL CONSTANTS AND MACROS
|
|
44 |
// None
|
|
45 |
|
|
46 |
// MODULE DATA STRUCTURES
|
|
47 |
// None
|
|
48 |
|
|
49 |
// LOCAL FUNCTION PROTOTYPES
|
|
50 |
// None
|
|
51 |
|
|
52 |
// FORWARD DECLARATIONS
|
|
53 |
// None
|
|
54 |
|
|
55 |
|
|
56 |
// ==================== LOCAL FUNCTIONS =======================================
|
|
57 |
// None
|
|
58 |
|
|
59 |
// ================= MEMBER FUNCTIONS =========================================
|
|
60 |
|
|
61 |
/*
|
|
62 |
-------------------------------------------------------------------------------
|
|
63 |
|
|
64 |
Class: CUIEngineRunner
|
|
65 |
|
|
66 |
Method: CUIEngineRunner
|
|
67 |
|
|
68 |
Description: Default constructor
|
|
69 |
|
|
70 |
C++ default constructor can NOT contain any code, that
|
|
71 |
might leave.
|
|
72 |
|
|
73 |
Parameters: None
|
|
74 |
|
|
75 |
Return Values: None
|
|
76 |
|
|
77 |
Errors/Exceptions: None
|
|
78 |
|
|
79 |
Status: Draft
|
|
80 |
|
|
81 |
-------------------------------------------------------------------------------
|
|
82 |
*/
|
|
83 |
CUIEngineRunner::CUIEngineRunner( CUIEngineContainer* aUIEngineContainer) :
|
|
84 |
CActive( CActive::EPriorityStandard ),
|
|
85 |
iUIEngineContainer( aUIEngineContainer ),
|
|
86 |
iFullTestResultPckg( iFullTestResult )
|
|
87 |
{
|
|
88 |
__TRACE( KPrint, ( _L( "CUIEngineRunner::CUIEngineRunner") ) );
|
|
89 |
__ASSERT_ALWAYS( aUIEngineContainer, User::Panic( _L("Null pointer"), KErrGeneral ) );
|
|
90 |
|
|
91 |
CActiveScheduler::Add( this );
|
|
92 |
}
|
|
93 |
|
|
94 |
|
|
95 |
/*
|
|
96 |
-------------------------------------------------------------------------------
|
|
97 |
|
|
98 |
Class: CUIEngineRunner
|
|
99 |
|
|
100 |
Method: ConstructL
|
|
101 |
|
|
102 |
Description: Symbian OS second phase constructor
|
|
103 |
|
|
104 |
Symbian OS default constructor can leave.
|
|
105 |
|
|
106 |
Parameters: None
|
|
107 |
|
|
108 |
Return Values: None
|
|
109 |
|
|
110 |
Errors/Exceptions: Leaves if called Open method returns error
|
|
111 |
|
|
112 |
Status: Approved
|
|
113 |
|
|
114 |
-------------------------------------------------------------------------------
|
|
115 |
*/
|
|
116 |
void CUIEngineRunner::ConstructL()
|
|
117 |
{
|
|
118 |
|
|
119 |
}
|
|
120 |
|
|
121 |
|
|
122 |
/*
|
|
123 |
-------------------------------------------------------------------------------
|
|
124 |
|
|
125 |
Class: CUIEngineRunner
|
|
126 |
|
|
127 |
Method: NewL
|
|
128 |
|
|
129 |
Description: Two-phased constructor.
|
|
130 |
|
|
131 |
Parameters: CUIEngineContainer* CUIEngineContainer: in: Pointer to CUIEngineContainer Interface
|
|
132 |
TTestInfo& aTestInfo: in: Test info
|
|
133 |
|
|
134 |
Return Values: CUIEngineRunner* : Pointer to created runner object
|
|
135 |
|
|
136 |
Errors/Exceptions: Leaves if memory allocation for CUIEngineRunner fails
|
|
137 |
Leaves if ConstructL leaves
|
|
138 |
|
|
139 |
Status: Draft
|
|
140 |
|
|
141 |
-------------------------------------------------------------------------------
|
|
142 |
*/
|
|
143 |
CUIEngineRunner* CUIEngineRunner::NewL( CUIEngineContainer* aUIEngineContainer )
|
|
144 |
{
|
|
145 |
CUIEngineRunner* self =
|
|
146 |
new ( ELeave ) CUIEngineRunner( aUIEngineContainer );
|
|
147 |
CleanupStack::PushL( self );
|
|
148 |
self->ConstructL();
|
|
149 |
CleanupStack::Pop();
|
|
150 |
return self;
|
|
151 |
}
|
|
152 |
|
|
153 |
|
|
154 |
/*
|
|
155 |
-------------------------------------------------------------------------------
|
|
156 |
|
|
157 |
Class: CUIEngineRunner
|
|
158 |
|
|
159 |
Method: ~CUIEngineRunner
|
|
160 |
|
|
161 |
Description: Destructor
|
|
162 |
|
|
163 |
Parameters: None
|
|
164 |
|
|
165 |
Return Values: None
|
|
166 |
|
|
167 |
Errors/Exceptions: None
|
|
168 |
|
|
169 |
Status: Draft
|
|
170 |
|
|
171 |
-------------------------------------------------------------------------------
|
|
172 |
*/
|
|
173 |
CUIEngineRunner::~CUIEngineRunner()
|
|
174 |
{
|
|
175 |
__TRACE( KPrint, ( _L( "CUIEngineRunner::~CUIEngineRunner()") ) );
|
|
176 |
Cancel();
|
|
177 |
|
|
178 |
}
|
|
179 |
|
|
180 |
|
|
181 |
/*
|
|
182 |
-------------------------------------------------------------------------------
|
|
183 |
|
|
184 |
Class: CUIEngineRunner
|
|
185 |
|
|
186 |
Method: StartTestL
|
|
187 |
|
|
188 |
Description: Starts testing
|
|
189 |
|
|
190 |
Parameters: RTestCase& aTestCase: in: Handle to test case
|
|
191 |
TFullTestResultPckg& aFullTestResultPckg: in: Handle to TFullTestResultPckg
|
|
192 |
|
|
193 |
Return Values: None
|
|
194 |
|
|
195 |
Errors/Exceptions: None
|
|
196 |
|
|
197 |
Status: Draft
|
|
198 |
|
|
199 |
-------------------------------------------------------------------------------
|
|
200 |
*/
|
|
201 |
void CUIEngineRunner::StartL( RTestCase& aTestCase )
|
|
202 |
{
|
|
203 |
__TRACE( KPrint, ( _L( "CUIEngineRunner::StartTestL") ) );
|
|
204 |
|
|
205 |
iTestCase = aTestCase;
|
|
206 |
|
|
207 |
if ( IsActive() )
|
|
208 |
User::Leave( KErrInUse );
|
|
209 |
|
|
210 |
SetActive();
|
|
211 |
iTestCase.RunTestCase( iFullTestResultPckg, iStatus );
|
|
212 |
}
|
|
213 |
|
|
214 |
/*
|
|
215 |
-------------------------------------------------------------------------------
|
|
216 |
|
|
217 |
Class: CUIEngineRunner
|
|
218 |
|
|
219 |
Method: RunL
|
|
220 |
|
|
221 |
Description: RunL handles completed requests.
|
|
222 |
|
|
223 |
Parameters: None
|
|
224 |
|
|
225 |
Return Values: None
|
|
226 |
|
|
227 |
Errors/Exceptions: Leaves if iStatus is not KErrNone, error is handled in
|
|
228 |
RunError called by CActiveObject
|
|
229 |
|
|
230 |
Status: Draft
|
|
231 |
|
|
232 |
-------------------------------------------------------------------------------
|
|
233 |
*/
|
|
234 |
void CUIEngineRunner::RunL()
|
|
235 |
{
|
|
236 |
__TRACE( KPrint, ( _L( "CUIEngineRunner::RunL") ) );
|
|
237 |
|
|
238 |
// Complete with the result of the test case
|
|
239 |
iUIEngineContainer->TestCaseExecuted( iFullTestResult, iStatus.Int() );
|
|
240 |
|
|
241 |
}
|
|
242 |
|
|
243 |
/*
|
|
244 |
-------------------------------------------------------------------------------
|
|
245 |
|
|
246 |
Class: CUIEngineRunner
|
|
247 |
|
|
248 |
Method: DoCancel
|
|
249 |
|
|
250 |
Description: Cancel active request.
|
|
251 |
|
|
252 |
Parameters: None
|
|
253 |
|
|
254 |
Return Values: None
|
|
255 |
|
|
256 |
Errors/Exceptions: None
|
|
257 |
|
|
258 |
Status: Draft
|
|
259 |
|
|
260 |
-------------------------------------------------------------------------------
|
|
261 |
*/
|
|
262 |
void CUIEngineRunner::DoCancel()
|
|
263 |
{
|
|
264 |
|
|
265 |
__TRACE( KPrint, ( _L( "CUIEngineRunner::DoCancel") ) );
|
|
266 |
iTestCase.CancelAsyncRequest( RTestCase::ERunTestCase );
|
|
267 |
|
|
268 |
}
|
|
269 |
|
|
270 |
/*
|
|
271 |
-------------------------------------------------------------------------------
|
|
272 |
|
|
273 |
DESCRIPTION
|
|
274 |
|
|
275 |
CActiveTimer: This object prints running seconds to console screen.
|
|
276 |
|
|
277 |
-------------------------------------------------------------------------------
|
|
278 |
*/
|
|
279 |
|
|
280 |
// ================= MEMBER FUNCTIONS =========================================
|
|
281 |
|
|
282 |
|
|
283 |
|
|
284 |
|
|
285 |
// ================= OTHER EXPORTED FUNCTIONS =================================
|
|
286 |
// None
|
|
287 |
|
|
288 |
// End of File
|