sl@0
|
1 |
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// See the test specification for details of what these test cases do.
|
sl@0
|
15 |
|
sl@0
|
16 |
#include "teststepcomsdbg.h"
|
sl@0
|
17 |
#include "step_027_xx.h"
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <comms-infras/commsdebugutility.h>
|
sl@0
|
20 |
|
sl@0
|
21 |
|
sl@0
|
22 |
/**
|
sl@0
|
23 |
* Function Name : CFloggerTest027_01
|
sl@0
|
24 |
* Input parameters : None
|
sl@0
|
25 |
* Output parameters : None
|
sl@0
|
26 |
* Description : This is the constructor
|
sl@0
|
27 |
*/
|
sl@0
|
28 |
|
sl@0
|
29 |
|
sl@0
|
30 |
CFloggerTest027_01::CFloggerTest027_01()
|
sl@0
|
31 |
{
|
sl@0
|
32 |
// Store the name of this test case
|
sl@0
|
33 |
SetTestStepName(_L("step_027_01"));
|
sl@0
|
34 |
}
|
sl@0
|
35 |
|
sl@0
|
36 |
|
sl@0
|
37 |
/**
|
sl@0
|
38 |
* Function Name :~ CFloggerTest027_01
|
sl@0
|
39 |
* Input parameters : None
|
sl@0
|
40 |
* Output parameters : None
|
sl@0
|
41 |
* Description : This is the Destructor
|
sl@0
|
42 |
*/
|
sl@0
|
43 |
|
sl@0
|
44 |
|
sl@0
|
45 |
CFloggerTest027_01::~CFloggerTest027_01()
|
sl@0
|
46 |
{
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
|
sl@0
|
50 |
/**
|
sl@0
|
51 |
* Function Name : doTestStepL
|
sl@0
|
52 |
* Input parameters : None
|
sl@0
|
53 |
* Output parameters : TVerdict
|
sl@0
|
54 |
* Description : This function returns whether the test case 027_01 has
|
sl@0
|
55 |
* passed or failed
|
sl@0
|
56 |
|
sl@0
|
57 |
*/
|
sl@0
|
58 |
|
sl@0
|
59 |
|
sl@0
|
60 |
TVerdict CFloggerTest027_01::doTestStepL( )
|
sl@0
|
61 |
{
|
sl@0
|
62 |
if ( executeStepL() == KErrNone )
|
sl@0
|
63 |
SetTestStepResult(EPass);
|
sl@0
|
64 |
|
sl@0
|
65 |
else
|
sl@0
|
66 |
SetTestStepResult(EFail);
|
sl@0
|
67 |
|
sl@0
|
68 |
|
sl@0
|
69 |
|
sl@0
|
70 |
return TestStepResult();
|
sl@0
|
71 |
}
|
sl@0
|
72 |
|
sl@0
|
73 |
|
sl@0
|
74 |
/**
|
sl@0
|
75 |
* Function Name : executeStepL
|
sl@0
|
76 |
* Input parameters : None
|
sl@0
|
77 |
* Output parameters : TInt
|
sl@0
|
78 |
* Description : This function calls the Connect twice
|
sl@0
|
79 |
|
sl@0
|
80 |
*/
|
sl@0
|
81 |
|
sl@0
|
82 |
|
sl@0
|
83 |
TInt CFloggerTest027_01::executeStepL(TBool)
|
sl@0
|
84 |
{
|
sl@0
|
85 |
return KErrGeneral;
|
sl@0
|
86 |
}
|
sl@0
|
87 |
/**
|
sl@0
|
88 |
* Function Name : executeStepL
|
sl@0
|
89 |
* Input parameters : None
|
sl@0
|
90 |
* Output parameters : TInt
|
sl@0
|
91 |
* Description : This function calls the Connect twice
|
sl@0
|
92 |
|
sl@0
|
93 |
*/
|
sl@0
|
94 |
|
sl@0
|
95 |
|
sl@0
|
96 |
TInt CFloggerTest027_01::executeStepL()
|
sl@0
|
97 |
{
|
sl@0
|
98 |
TInt numSuccess = 0;
|
sl@0
|
99 |
TInt ret;
|
sl@0
|
100 |
RFileLogger flogger;
|
sl@0
|
101 |
ret = flogger.Connect();
|
sl@0
|
102 |
|
sl@0
|
103 |
if (ret == KErrNone)
|
sl@0
|
104 |
{
|
sl@0
|
105 |
numSuccess++;
|
sl@0
|
106 |
}
|
sl@0
|
107 |
|
sl@0
|
108 |
//Call Connect() twice this will cause 2nd one ot return KErrorAlreadyExists and nothing to happen.
|
sl@0
|
109 |
ret = flogger.Connect();
|
sl@0
|
110 |
|
sl@0
|
111 |
if (ret == KErrAlreadyExists)
|
sl@0
|
112 |
{
|
sl@0
|
113 |
numSuccess++;
|
sl@0
|
114 |
}
|
sl@0
|
115 |
|
sl@0
|
116 |
|
sl@0
|
117 |
if (numSuccess == 2)
|
sl@0
|
118 |
{
|
sl@0
|
119 |
return KErrNone;
|
sl@0
|
120 |
}
|
sl@0
|
121 |
|
sl@0
|
122 |
return KErrBadHandle;
|
sl@0
|
123 |
}
|
sl@0
|
124 |
|
sl@0
|
125 |
|
sl@0
|
126 |
|
sl@0
|
127 |
|
sl@0
|
128 |
/**
|
sl@0
|
129 |
* Function Name : CFloggerTest027_02
|
sl@0
|
130 |
* Input parameters : None
|
sl@0
|
131 |
* Output parameters : None
|
sl@0
|
132 |
* Description : This is the constructor
|
sl@0
|
133 |
*/
|
sl@0
|
134 |
|
sl@0
|
135 |
|
sl@0
|
136 |
CFloggerTest027_02::CFloggerTest027_02()
|
sl@0
|
137 |
{
|
sl@0
|
138 |
// Store the name of this test case
|
sl@0
|
139 |
SetTestStepName(_L("step_027_02"));
|
sl@0
|
140 |
}
|
sl@0
|
141 |
|
sl@0
|
142 |
|
sl@0
|
143 |
/**
|
sl@0
|
144 |
* Function Name :~ CFloggerTest027_02
|
sl@0
|
145 |
* Input parameters : None
|
sl@0
|
146 |
* Output parameters : None
|
sl@0
|
147 |
* Description : This is the Destructor
|
sl@0
|
148 |
*/
|
sl@0
|
149 |
|
sl@0
|
150 |
|
sl@0
|
151 |
CFloggerTest027_02::~CFloggerTest027_02()
|
sl@0
|
152 |
{
|
sl@0
|
153 |
}
|
sl@0
|
154 |
|
sl@0
|
155 |
|
sl@0
|
156 |
/**
|
sl@0
|
157 |
* Function Name : doTestStepL
|
sl@0
|
158 |
* Input parameters : None
|
sl@0
|
159 |
* Output parameters : TVerdict
|
sl@0
|
160 |
* Description : This function returns whether the test case 027_02 has
|
sl@0
|
161 |
* passed or failed
|
sl@0
|
162 |
|
sl@0
|
163 |
*/
|
sl@0
|
164 |
|
sl@0
|
165 |
|
sl@0
|
166 |
TVerdict CFloggerTest027_02::doTestStepL( )
|
sl@0
|
167 |
{
|
sl@0
|
168 |
|
sl@0
|
169 |
INFO_PRINTF1(_L("Step 027.02 called "));
|
sl@0
|
170 |
TRAPD(res ,executeStepL());
|
sl@0
|
171 |
if (res == KErrNone )
|
sl@0
|
172 |
SetTestStepResult(EPass);
|
sl@0
|
173 |
|
sl@0
|
174 |
else
|
sl@0
|
175 |
SetTestStepResult(EFail);
|
sl@0
|
176 |
|
sl@0
|
177 |
INFO_PRINTF1(_L("leaving Step 027.02 "));
|
sl@0
|
178 |
User::After(KTimeForDisplay);
|
sl@0
|
179 |
|
sl@0
|
180 |
|
sl@0
|
181 |
return TestStepResult();
|
sl@0
|
182 |
}
|
sl@0
|
183 |
|
sl@0
|
184 |
/**
|
sl@0
|
185 |
* Function Name : executeStepL
|
sl@0
|
186 |
* Input parameters : None
|
sl@0
|
187 |
* Output parameters : TInt
|
sl@0
|
188 |
* Description : This function leaves without calling CleanupStack::PopAndDestroy()
|
sl@0
|
189 |
|
sl@0
|
190 |
*/
|
sl@0
|
191 |
|
sl@0
|
192 |
|
sl@0
|
193 |
TInt CFloggerTest027_02::executeStepL(TBool)
|
sl@0
|
194 |
{
|
sl@0
|
195 |
return KErrGeneral;
|
sl@0
|
196 |
}
|
sl@0
|
197 |
|
sl@0
|
198 |
/**
|
sl@0
|
199 |
* Function Name : executeStepL
|
sl@0
|
200 |
* Input parameters : None
|
sl@0
|
201 |
* Output parameters : TInt
|
sl@0
|
202 |
* Description : This function leaves without calling CleanupStack::PopAndDestroy()
|
sl@0
|
203 |
|
sl@0
|
204 |
*/
|
sl@0
|
205 |
|
sl@0
|
206 |
|
sl@0
|
207 |
TInt CFloggerTest027_02::executeStepL()
|
sl@0
|
208 |
{
|
sl@0
|
209 |
TInt r = KErrNone;
|
sl@0
|
210 |
TPtrC8 ptrSubSystem;
|
sl@0
|
211 |
TPtrC8 ptrComponent;
|
sl@0
|
212 |
ptrSubSystem.Set(_L8("SubSystem"));
|
sl@0
|
213 |
ptrComponent.Set(_L8("Component"));
|
sl@0
|
214 |
__FLOG_DECLARATION_MEMBER;
|
sl@0
|
215 |
__FLOG_OPENC(ptrSubSystem, ptrComponent);
|
sl@0
|
216 |
User::Leave(r);
|
sl@0
|
217 |
return KErrNone;
|
sl@0
|
218 |
}
|
sl@0
|
219 |
|
sl@0
|
220 |
|
sl@0
|
221 |
|
sl@0
|
222 |
/**
|
sl@0
|
223 |
* Function Name : CFloggerTest027_03
|
sl@0
|
224 |
* Input parameters : None
|
sl@0
|
225 |
* Output parameters : None
|
sl@0
|
226 |
* Description : This is the constructor
|
sl@0
|
227 |
*/
|
sl@0
|
228 |
|
sl@0
|
229 |
|
sl@0
|
230 |
CFloggerTest027_03::CFloggerTest027_03()
|
sl@0
|
231 |
{
|
sl@0
|
232 |
// Store the name of this test case
|
sl@0
|
233 |
SetTestStepName(_L("step_027_03"));
|
sl@0
|
234 |
}
|
sl@0
|
235 |
|
sl@0
|
236 |
|
sl@0
|
237 |
/**
|
sl@0
|
238 |
* Function Name :~ CFloggerTest027_03
|
sl@0
|
239 |
* Input parameters : None
|
sl@0
|
240 |
* Output parameters : None
|
sl@0
|
241 |
* Description : This is the Destructor
|
sl@0
|
242 |
*/
|
sl@0
|
243 |
|
sl@0
|
244 |
|
sl@0
|
245 |
CFloggerTest027_03::~CFloggerTest027_03()
|
sl@0
|
246 |
{
|
sl@0
|
247 |
}
|
sl@0
|
248 |
|
sl@0
|
249 |
|
sl@0
|
250 |
/**
|
sl@0
|
251 |
* Function Name : doTestStepL
|
sl@0
|
252 |
* Input parameters : None
|
sl@0
|
253 |
* Output parameters : TVerdict
|
sl@0
|
254 |
* Description : This function returns whether the test case 027_03 has
|
sl@0
|
255 |
* passed or failed
|
sl@0
|
256 |
|
sl@0
|
257 |
*/
|
sl@0
|
258 |
|
sl@0
|
259 |
|
sl@0
|
260 |
TVerdict CFloggerTest027_03::doTestStepL( )
|
sl@0
|
261 |
{
|
sl@0
|
262 |
INFO_PRINTF1(_L("Step 027.03 called "));
|
sl@0
|
263 |
TRAPD(ret, executeStepL());
|
sl@0
|
264 |
if (ret == KErrNone )
|
sl@0
|
265 |
SetTestStepResult(EPass);
|
sl@0
|
266 |
|
sl@0
|
267 |
else
|
sl@0
|
268 |
SetTestStepResult(EFail);
|
sl@0
|
269 |
|
sl@0
|
270 |
INFO_PRINTF1(_L("leaving Step 027.02 "));
|
sl@0
|
271 |
User::After(KTimeForDisplay);
|
sl@0
|
272 |
|
sl@0
|
273 |
|
sl@0
|
274 |
return TestStepResult();
|
sl@0
|
275 |
}
|
sl@0
|
276 |
|
sl@0
|
277 |
|
sl@0
|
278 |
/**
|
sl@0
|
279 |
* Function Name : executeStepL
|
sl@0
|
280 |
* Input parameters : None
|
sl@0
|
281 |
* Output parameters : TInt
|
sl@0
|
282 |
* Description : This function calls CleanupStack::PopAndDestroy() to check whether the flogger is pushed to the stack
|
sl@0
|
283 |
|
sl@0
|
284 |
*/
|
sl@0
|
285 |
|
sl@0
|
286 |
|
sl@0
|
287 |
TInt CFloggerTest027_03::executeStepL()
|
sl@0
|
288 |
{
|
sl@0
|
289 |
TPtrC8 ptrSubSystem;
|
sl@0
|
290 |
TPtrC8 ptrComponent;
|
sl@0
|
291 |
ptrSubSystem.Set(_L8("SubSystem"));
|
sl@0
|
292 |
ptrComponent.Set(_L8("Component"));
|
sl@0
|
293 |
__FLOG_DECLARATION_MEMBER;
|
sl@0
|
294 |
__FLOG_OPENC(ptrSubSystem, ptrComponent);
|
sl@0
|
295 |
CleanupStack::PopAndDestroy();
|
sl@0
|
296 |
return KErrNone;
|
sl@0
|
297 |
}
|
sl@0
|
298 |
|
sl@0
|
299 |
/**
|
sl@0
|
300 |
* Function Name : executeStepL
|
sl@0
|
301 |
* Input parameters : None
|
sl@0
|
302 |
* Output parameters : TInt
|
sl@0
|
303 |
* Description : This function calls CleanupStack::PopAndDestroy() to check whether the flogger is pushed to the stack
|
sl@0
|
304 |
|
sl@0
|
305 |
*/
|
sl@0
|
306 |
|
sl@0
|
307 |
|
sl@0
|
308 |
TInt CFloggerTest027_03::executeStepL(TBool)
|
sl@0
|
309 |
{
|
sl@0
|
310 |
return KErrGeneral;
|
sl@0
|
311 |
}
|
sl@0
|
312 |
|
sl@0
|
313 |
/**
|
sl@0
|
314 |
* Function Name : CFloggerTest027_04
|
sl@0
|
315 |
* Input parameters : None
|
sl@0
|
316 |
* Output parameters : None
|
sl@0
|
317 |
* Description : This is the constructor
|
sl@0
|
318 |
*/
|
sl@0
|
319 |
|
sl@0
|
320 |
|
sl@0
|
321 |
CFloggerTest027_04::CFloggerTest027_04()
|
sl@0
|
322 |
{
|
sl@0
|
323 |
// Store the name of this test case
|
sl@0
|
324 |
SetTestStepName(_L("step_027_04"));
|
sl@0
|
325 |
}
|
sl@0
|
326 |
|
sl@0
|
327 |
|
sl@0
|
328 |
/**
|
sl@0
|
329 |
* Function Name :~ CFloggerTest027_04
|
sl@0
|
330 |
* Input parameters : None
|
sl@0
|
331 |
* Output parameters : None
|
sl@0
|
332 |
* Description : This is the Destructor
|
sl@0
|
333 |
*/
|
sl@0
|
334 |
|
sl@0
|
335 |
|
sl@0
|
336 |
CFloggerTest027_04::~CFloggerTest027_04()
|
sl@0
|
337 |
{
|
sl@0
|
338 |
}
|
sl@0
|
339 |
|
sl@0
|
340 |
|
sl@0
|
341 |
/**
|
sl@0
|
342 |
* Function Name : doTestStepL
|
sl@0
|
343 |
* Input parameters : None
|
sl@0
|
344 |
* Output parameters : TVerdict
|
sl@0
|
345 |
* Description : This function returns whether the test case 027_04 has
|
sl@0
|
346 |
* passed or failed
|
sl@0
|
347 |
|
sl@0
|
348 |
*/
|
sl@0
|
349 |
|
sl@0
|
350 |
|
sl@0
|
351 |
TVerdict CFloggerTest027_04::doTestStepL( )
|
sl@0
|
352 |
{
|
sl@0
|
353 |
INFO_PRINTF1(_L("Step 027.04 called "));
|
sl@0
|
354 |
if ( executeStepL() == KErrNone )
|
sl@0
|
355 |
SetTestStepResult(EPass);
|
sl@0
|
356 |
|
sl@0
|
357 |
else
|
sl@0
|
358 |
SetTestStepResult(EFail);
|
sl@0
|
359 |
|
sl@0
|
360 |
|
sl@0
|
361 |
return TestStepResult();
|
sl@0
|
362 |
}
|
sl@0
|
363 |
|
sl@0
|
364 |
|
sl@0
|
365 |
/**
|
sl@0
|
366 |
* Function Name : executeStepL
|
sl@0
|
367 |
* Input parameters : None
|
sl@0
|
368 |
* Output parameters : TInt
|
sl@0
|
369 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
370 |
|
sl@0
|
371 |
*/
|
sl@0
|
372 |
|
sl@0
|
373 |
|
sl@0
|
374 |
TInt CFloggerTest027_04::executeStepL(TBool)
|
sl@0
|
375 |
{
|
sl@0
|
376 |
return KErrGeneral;
|
sl@0
|
377 |
}
|
sl@0
|
378 |
/**
|
sl@0
|
379 |
* Function Name : executeStepL
|
sl@0
|
380 |
* Input parameters : None
|
sl@0
|
381 |
* Output parameters : TInt
|
sl@0
|
382 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
383 |
|
sl@0
|
384 |
*/
|
sl@0
|
385 |
|
sl@0
|
386 |
|
sl@0
|
387 |
TInt CFloggerTest027_04::executeStepL()
|
sl@0
|
388 |
{
|
sl@0
|
389 |
TInt ret = KErrNone;
|
sl@0
|
390 |
ret = DoTestWrite();
|
sl@0
|
391 |
if ( ret == KErrNone)
|
sl@0
|
392 |
{
|
sl@0
|
393 |
TRAPD(r, ret = DoTestCheckWriteL());
|
sl@0
|
394 |
if ( r != KErrNone)
|
sl@0
|
395 |
ret = r;
|
sl@0
|
396 |
}
|
sl@0
|
397 |
return ret;
|
sl@0
|
398 |
}
|
sl@0
|
399 |
|
sl@0
|
400 |
|
sl@0
|
401 |
TInt CFloggerTest027_04::DoTestWrite()
|
sl@0
|
402 |
{
|
sl@0
|
403 |
_LIT8(KTestMessage,"TC 27_04: The is Test for macros");
|
sl@0
|
404 |
TPtrC8 ptrSubSystem;
|
sl@0
|
405 |
TPtrC8 ptrComponent;
|
sl@0
|
406 |
ptrSubSystem.Set(_L8("SubSystem"));
|
sl@0
|
407 |
ptrComponent.Set(_L8("Component"));
|
sl@0
|
408 |
__FLOG_DECLARATION_MEMBER;
|
sl@0
|
409 |
__FLOG_OPEN(ptrSubSystem, ptrComponent);
|
sl@0
|
410 |
__FLOG_CLEAR;
|
sl@0
|
411 |
__FLOG_0(KTestMessage);
|
sl@0
|
412 |
__FLOG_CLOSE;
|
sl@0
|
413 |
return KErrNone;
|
sl@0
|
414 |
}
|
sl@0
|
415 |
|
sl@0
|
416 |
|
sl@0
|
417 |
/**
|
sl@0
|
418 |
* Function Name : DoTestCheckWriteL
|
sl@0
|
419 |
* Input parameters : None
|
sl@0
|
420 |
* Output parameters : TInt
|
sl@0
|
421 |
* Description : This function checks whether test data was written
|
sl@0
|
422 |
in to the log file or not.
|
sl@0
|
423 |
|
sl@0
|
424 |
*/
|
sl@0
|
425 |
|
sl@0
|
426 |
|
sl@0
|
427 |
TInt CFloggerTest027_04::DoTestCheckWriteL()
|
sl@0
|
428 |
{
|
sl@0
|
429 |
User::After(KTimeToLog);
|
sl@0
|
430 |
RFile theFile;
|
sl@0
|
431 |
HBufC8 * hBuffer;
|
sl@0
|
432 |
TInt listfilesize;
|
sl@0
|
433 |
TInt returnCode;
|
sl@0
|
434 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
435 |
_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
|
sl@0
|
436 |
|
sl@0
|
437 |
_LIT8(KTestMessage,"TC 27_04: The is Test for macros");
|
sl@0
|
438 |
|
sl@0
|
439 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
440 |
|
sl@0
|
441 |
//Open the file in the read mode
|
sl@0
|
442 |
User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
|
sl@0
|
443 |
|
sl@0
|
444 |
CleanupClosePushL(theFile);
|
sl@0
|
445 |
|
sl@0
|
446 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
447 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
448 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
449 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
450 |
|
sl@0
|
451 |
// Read from position 0: start of file
|
sl@0
|
452 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
453 |
|
sl@0
|
454 |
returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
|
sl@0
|
455 |
//from the file
|
sl@0
|
456 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
457 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
458 |
if (returnCode > 0)
|
sl@0
|
459 |
return KErrNone;
|
sl@0
|
460 |
else
|
sl@0
|
461 |
return KErrGeneral;
|
sl@0
|
462 |
}
|
sl@0
|
463 |
|
sl@0
|
464 |
|
sl@0
|
465 |
|
sl@0
|
466 |
/**
|
sl@0
|
467 |
* Function Name : CFloggerTest027_05
|
sl@0
|
468 |
* Input parameters : None
|
sl@0
|
469 |
* Output parameters : None
|
sl@0
|
470 |
* Description : This is the constructor
|
sl@0
|
471 |
*/
|
sl@0
|
472 |
|
sl@0
|
473 |
|
sl@0
|
474 |
CFloggerTest027_05::CFloggerTest027_05()
|
sl@0
|
475 |
{
|
sl@0
|
476 |
// Store the name of this test case
|
sl@0
|
477 |
SetTestStepName(_L("step_027_05"));
|
sl@0
|
478 |
}
|
sl@0
|
479 |
|
sl@0
|
480 |
|
sl@0
|
481 |
/**
|
sl@0
|
482 |
* Function Name :~ CFloggerTest027_05
|
sl@0
|
483 |
* Input parameters : None
|
sl@0
|
484 |
* Output parameters : None
|
sl@0
|
485 |
* Description : This is the Destructor
|
sl@0
|
486 |
*/
|
sl@0
|
487 |
|
sl@0
|
488 |
|
sl@0
|
489 |
CFloggerTest027_05::~CFloggerTest027_05()
|
sl@0
|
490 |
{
|
sl@0
|
491 |
}
|
sl@0
|
492 |
|
sl@0
|
493 |
|
sl@0
|
494 |
/**
|
sl@0
|
495 |
* Function Name : doTestStepL
|
sl@0
|
496 |
* Input parameters : None
|
sl@0
|
497 |
* Output parameters : TVerdict
|
sl@0
|
498 |
* Description : This function returns whether the test case 027_05 has
|
sl@0
|
499 |
* passed or failed
|
sl@0
|
500 |
|
sl@0
|
501 |
*/
|
sl@0
|
502 |
|
sl@0
|
503 |
|
sl@0
|
504 |
TVerdict CFloggerTest027_05::doTestStepL( )
|
sl@0
|
505 |
{
|
sl@0
|
506 |
INFO_PRINTF1(_L("Step 027.05 called "));
|
sl@0
|
507 |
if ( executeStepL() == KErrNone )
|
sl@0
|
508 |
SetTestStepResult(EPass);
|
sl@0
|
509 |
|
sl@0
|
510 |
else
|
sl@0
|
511 |
SetTestStepResult(EFail);
|
sl@0
|
512 |
|
sl@0
|
513 |
|
sl@0
|
514 |
return TestStepResult();
|
sl@0
|
515 |
}
|
sl@0
|
516 |
/**
|
sl@0
|
517 |
* Function Name : executeStepL
|
sl@0
|
518 |
* Input parameters : None
|
sl@0
|
519 |
* Output parameters : TInt
|
sl@0
|
520 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
521 |
|
sl@0
|
522 |
*/
|
sl@0
|
523 |
|
sl@0
|
524 |
|
sl@0
|
525 |
TInt CFloggerTest027_05::executeStepL(TBool)
|
sl@0
|
526 |
{
|
sl@0
|
527 |
return KErrGeneral;
|
sl@0
|
528 |
}
|
sl@0
|
529 |
|
sl@0
|
530 |
/**
|
sl@0
|
531 |
* Function Name : executeStepL
|
sl@0
|
532 |
* Input parameters : None
|
sl@0
|
533 |
* Output parameters : TInt
|
sl@0
|
534 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
535 |
|
sl@0
|
536 |
*/
|
sl@0
|
537 |
|
sl@0
|
538 |
|
sl@0
|
539 |
TInt CFloggerTest027_05::executeStepL()
|
sl@0
|
540 |
{
|
sl@0
|
541 |
TInt ret = KErrNone;
|
sl@0
|
542 |
ret = DoTestWrite();
|
sl@0
|
543 |
if ( ret == KErrNone)
|
sl@0
|
544 |
{
|
sl@0
|
545 |
TRAPD(r, ret = DoTestCheckWriteL());
|
sl@0
|
546 |
if ( r != KErrNone)
|
sl@0
|
547 |
ret = r;
|
sl@0
|
548 |
}
|
sl@0
|
549 |
return ret;
|
sl@0
|
550 |
}
|
sl@0
|
551 |
|
sl@0
|
552 |
|
sl@0
|
553 |
TInt CFloggerTest027_05::DoTestWrite()
|
sl@0
|
554 |
{
|
sl@0
|
555 |
_LIT8(KTestMessageOne,"TC 27_05: The value of test integer variable :%d");
|
sl@0
|
556 |
TPtrC8 ptrSubSystem;
|
sl@0
|
557 |
TPtrC8 ptrComponent;
|
sl@0
|
558 |
ptrSubSystem.Set(_L8("SubSystem"));
|
sl@0
|
559 |
ptrComponent.Set(_L8("Component"));
|
sl@0
|
560 |
__FLOG_DECLARATION_MEMBER;
|
sl@0
|
561 |
__FLOG_OPEN(ptrSubSystem, ptrComponent);
|
sl@0
|
562 |
__FLOG_CLEAR;
|
sl@0
|
563 |
__FLOG_1(KTestMessageOne, 100);
|
sl@0
|
564 |
__FLOG_CLOSE;
|
sl@0
|
565 |
return KErrNone;
|
sl@0
|
566 |
}
|
sl@0
|
567 |
|
sl@0
|
568 |
|
sl@0
|
569 |
/**
|
sl@0
|
570 |
* Function Name : DoTestCheckWriteL
|
sl@0
|
571 |
* Input parameters : None
|
sl@0
|
572 |
* Output parameters : TInt
|
sl@0
|
573 |
* Description : This function checks whether test data was written
|
sl@0
|
574 |
in to the log file or not.
|
sl@0
|
575 |
|
sl@0
|
576 |
*/
|
sl@0
|
577 |
|
sl@0
|
578 |
|
sl@0
|
579 |
TInt CFloggerTest027_05::DoTestCheckWriteL()
|
sl@0
|
580 |
{
|
sl@0
|
581 |
User::After(KTimeToLog);
|
sl@0
|
582 |
RFile theFile;
|
sl@0
|
583 |
HBufC8 * hBuffer;
|
sl@0
|
584 |
TInt listfilesize;
|
sl@0
|
585 |
TInt returnCode;
|
sl@0
|
586 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
587 |
_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
|
sl@0
|
588 |
|
sl@0
|
589 |
TBuf8<256> testData; //To hold the test descriptor
|
sl@0
|
590 |
|
sl@0
|
591 |
_LIT8(KTestMessageOne,"TC 27_05: The value of test integer variable :%d");
|
sl@0
|
592 |
testData.Format(KTestMessageOne,100);
|
sl@0
|
593 |
|
sl@0
|
594 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
595 |
|
sl@0
|
596 |
//Open the file in the read mode
|
sl@0
|
597 |
User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
|
sl@0
|
598 |
|
sl@0
|
599 |
CleanupClosePushL(theFile);
|
sl@0
|
600 |
|
sl@0
|
601 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
602 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
603 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
604 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
605 |
|
sl@0
|
606 |
// Read from position 0: start of file
|
sl@0
|
607 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
608 |
if (returnCode == KErrNone)
|
sl@0
|
609 |
returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
|
sl@0
|
610 |
//from the file
|
sl@0
|
611 |
|
sl@0
|
612 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
613 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
614 |
if (returnCode > 0)
|
sl@0
|
615 |
return KErrNone;
|
sl@0
|
616 |
else
|
sl@0
|
617 |
return KErrGeneral;
|
sl@0
|
618 |
}
|
sl@0
|
619 |
|
sl@0
|
620 |
|
sl@0
|
621 |
|
sl@0
|
622 |
/**
|
sl@0
|
623 |
* Function Name : CFloggerTest027_06
|
sl@0
|
624 |
* Input parameters : None
|
sl@0
|
625 |
* Output parameters : None
|
sl@0
|
626 |
* Description : This is the constructor
|
sl@0
|
627 |
*/
|
sl@0
|
628 |
|
sl@0
|
629 |
|
sl@0
|
630 |
CFloggerTest027_06::CFloggerTest027_06()
|
sl@0
|
631 |
{
|
sl@0
|
632 |
// Store the name of this test case
|
sl@0
|
633 |
SetTestStepName(_L("step_027_06"));
|
sl@0
|
634 |
}
|
sl@0
|
635 |
|
sl@0
|
636 |
|
sl@0
|
637 |
/**
|
sl@0
|
638 |
* Function Name :~ CFloggerTest027_06
|
sl@0
|
639 |
* Input parameters : None
|
sl@0
|
640 |
* Output parameters : None
|
sl@0
|
641 |
* Description : This is the Destructor
|
sl@0
|
642 |
*/
|
sl@0
|
643 |
|
sl@0
|
644 |
|
sl@0
|
645 |
CFloggerTest027_06::~CFloggerTest027_06()
|
sl@0
|
646 |
{
|
sl@0
|
647 |
}
|
sl@0
|
648 |
|
sl@0
|
649 |
|
sl@0
|
650 |
/**
|
sl@0
|
651 |
* Function Name : doTestStepL
|
sl@0
|
652 |
* Input parameters : None
|
sl@0
|
653 |
* Output parameters : TVerdict
|
sl@0
|
654 |
* Description : This function returns whether the test case 027_06 has
|
sl@0
|
655 |
* passed or failed
|
sl@0
|
656 |
|
sl@0
|
657 |
*/
|
sl@0
|
658 |
|
sl@0
|
659 |
|
sl@0
|
660 |
TVerdict CFloggerTest027_06::doTestStepL( )
|
sl@0
|
661 |
{
|
sl@0
|
662 |
INFO_PRINTF1(_L("Step 027.06 called "));
|
sl@0
|
663 |
if ( executeStepL() == KErrNone )
|
sl@0
|
664 |
SetTestStepResult(EPass);
|
sl@0
|
665 |
|
sl@0
|
666 |
else
|
sl@0
|
667 |
SetTestStepResult(EFail);
|
sl@0
|
668 |
|
sl@0
|
669 |
|
sl@0
|
670 |
return TestStepResult();
|
sl@0
|
671 |
}
|
sl@0
|
672 |
|
sl@0
|
673 |
|
sl@0
|
674 |
/**
|
sl@0
|
675 |
* Function Name : executeStepL
|
sl@0
|
676 |
* Input parameters : None
|
sl@0
|
677 |
* Output parameters : TInt
|
sl@0
|
678 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
679 |
|
sl@0
|
680 |
*/
|
sl@0
|
681 |
|
sl@0
|
682 |
|
sl@0
|
683 |
TInt CFloggerTest027_06::executeStepL()
|
sl@0
|
684 |
{
|
sl@0
|
685 |
TInt ret = KErrNone;
|
sl@0
|
686 |
ret = DoTestWrite();
|
sl@0
|
687 |
if ( ret == KErrNone)
|
sl@0
|
688 |
{
|
sl@0
|
689 |
TRAPD(r, ret = DoTestCheckWriteL());
|
sl@0
|
690 |
if ( r != KErrNone)
|
sl@0
|
691 |
ret = r;
|
sl@0
|
692 |
}
|
sl@0
|
693 |
return ret;
|
sl@0
|
694 |
}
|
sl@0
|
695 |
|
sl@0
|
696 |
/**
|
sl@0
|
697 |
* Function Name : executeStepL
|
sl@0
|
698 |
* Input parameters : None
|
sl@0
|
699 |
* Output parameters : TInt
|
sl@0
|
700 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
701 |
|
sl@0
|
702 |
*/
|
sl@0
|
703 |
|
sl@0
|
704 |
|
sl@0
|
705 |
TInt CFloggerTest027_06::executeStepL(TBool)
|
sl@0
|
706 |
{
|
sl@0
|
707 |
return KErrGeneral;
|
sl@0
|
708 |
}
|
sl@0
|
709 |
|
sl@0
|
710 |
TInt CFloggerTest027_06::DoTestWrite()
|
sl@0
|
711 |
{
|
sl@0
|
712 |
TPtrC8 ptrSubSystem;
|
sl@0
|
713 |
TPtrC8 ptrComponent;
|
sl@0
|
714 |
ptrSubSystem.Set(_L8("SubSystem"));
|
sl@0
|
715 |
ptrComponent.Set(_L8("Component"));
|
sl@0
|
716 |
_LIT8(descTxt,"TC 27_6:Test Msg");
|
sl@0
|
717 |
|
sl@0
|
718 |
__FLOG_DECLARATION_MEMBER;
|
sl@0
|
719 |
__FLOG_OPEN(ptrSubSystem, ptrComponent);
|
sl@0
|
720 |
__FLOG_CLEAR;
|
sl@0
|
721 |
__FLOG_HEXDUMP ( (descTxt) );
|
sl@0
|
722 |
__FLOG_CLOSE;
|
sl@0
|
723 |
return KErrNone;
|
sl@0
|
724 |
}
|
sl@0
|
725 |
|
sl@0
|
726 |
|
sl@0
|
727 |
/**
|
sl@0
|
728 |
* Function Name : DoTestCheckWriteL
|
sl@0
|
729 |
* Input parameters : None
|
sl@0
|
730 |
* Output parameters : TInt
|
sl@0
|
731 |
* Description : This function checks whether test data was written
|
sl@0
|
732 |
in to the log file or not.
|
sl@0
|
733 |
|
sl@0
|
734 |
*/
|
sl@0
|
735 |
|
sl@0
|
736 |
|
sl@0
|
737 |
TInt CFloggerTest027_06::DoTestCheckWriteL()
|
sl@0
|
738 |
{
|
sl@0
|
739 |
User::After(KTimeToLog);
|
sl@0
|
740 |
RFile theFile;
|
sl@0
|
741 |
HBufC8 * hBuffer;
|
sl@0
|
742 |
TInt listfilesize;
|
sl@0
|
743 |
TInt returnCode;
|
sl@0
|
744 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
745 |
_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
|
sl@0
|
746 |
|
sl@0
|
747 |
_LIT8(KBodyTxt,"TC 27_6:Test Msg");// Test body descriptor
|
sl@0
|
748 |
|
sl@0
|
749 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
750 |
|
sl@0
|
751 |
//Open the file in the read mode
|
sl@0
|
752 |
User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
|
sl@0
|
753 |
|
sl@0
|
754 |
CleanupClosePushL(theFile);
|
sl@0
|
755 |
|
sl@0
|
756 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
757 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
758 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
759 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
760 |
|
sl@0
|
761 |
// Read from position 0: start of file
|
sl@0
|
762 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
763 |
if (returnCode == KErrNone)
|
sl@0
|
764 |
returnCode = ptrString.Find(KBodyTxt);
|
sl@0
|
765 |
|
sl@0
|
766 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
767 |
CleanupStack::PopAndDestroy(); //theFile
|
sl@0
|
768 |
if (returnCode > 0)
|
sl@0
|
769 |
return KErrNone;
|
sl@0
|
770 |
else
|
sl@0
|
771 |
return KErrGeneral;
|
sl@0
|
772 |
}
|
sl@0
|
773 |
|
sl@0
|
774 |
|
sl@0
|
775 |
|
sl@0
|
776 |
/**
|
sl@0
|
777 |
* Function Name : CFloggerTest027_07
|
sl@0
|
778 |
* Input parameters : None
|
sl@0
|
779 |
* Output parameters : None
|
sl@0
|
780 |
* Description : This is the constructor
|
sl@0
|
781 |
*/
|
sl@0
|
782 |
|
sl@0
|
783 |
|
sl@0
|
784 |
CFloggerTest027_07::CFloggerTest027_07()
|
sl@0
|
785 |
{
|
sl@0
|
786 |
// Store the name of this test case
|
sl@0
|
787 |
SetTestStepName(_L("step_027_07"));
|
sl@0
|
788 |
}
|
sl@0
|
789 |
|
sl@0
|
790 |
|
sl@0
|
791 |
/**
|
sl@0
|
792 |
* Function Name :~ CFloggerTest027_07
|
sl@0
|
793 |
* Input parameters : None
|
sl@0
|
794 |
* Output parameters : None
|
sl@0
|
795 |
* Description : This is the Destructor
|
sl@0
|
796 |
*/
|
sl@0
|
797 |
|
sl@0
|
798 |
|
sl@0
|
799 |
CFloggerTest027_07::~CFloggerTest027_07()
|
sl@0
|
800 |
{
|
sl@0
|
801 |
}
|
sl@0
|
802 |
|
sl@0
|
803 |
|
sl@0
|
804 |
/**
|
sl@0
|
805 |
* Function Name : doTestStepL
|
sl@0
|
806 |
* Input parameters : None
|
sl@0
|
807 |
* Output parameters : TVerdict
|
sl@0
|
808 |
* Description : This function returns whether the test case 027_07 has
|
sl@0
|
809 |
* passed or failed
|
sl@0
|
810 |
|
sl@0
|
811 |
*/
|
sl@0
|
812 |
|
sl@0
|
813 |
|
sl@0
|
814 |
TVerdict CFloggerTest027_07::doTestStepL( )
|
sl@0
|
815 |
{
|
sl@0
|
816 |
INFO_PRINTF1(_L("Step 027.07 called "));
|
sl@0
|
817 |
if ( executeStepL() == KErrNone )
|
sl@0
|
818 |
SetTestStepResult(EPass);
|
sl@0
|
819 |
|
sl@0
|
820 |
else
|
sl@0
|
821 |
SetTestStepResult(EFail);
|
sl@0
|
822 |
|
sl@0
|
823 |
|
sl@0
|
824 |
return TestStepResult();
|
sl@0
|
825 |
}
|
sl@0
|
826 |
|
sl@0
|
827 |
|
sl@0
|
828 |
/**
|
sl@0
|
829 |
* Function Name : executeStepL
|
sl@0
|
830 |
* Input parameters : None
|
sl@0
|
831 |
* Output parameters : TInt
|
sl@0
|
832 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
833 |
|
sl@0
|
834 |
*/
|
sl@0
|
835 |
|
sl@0
|
836 |
|
sl@0
|
837 |
TInt CFloggerTest027_07::executeStepL()
|
sl@0
|
838 |
{
|
sl@0
|
839 |
TInt ret = KErrNone;
|
sl@0
|
840 |
ret = DoTestWrite();
|
sl@0
|
841 |
if ( ret == KErrNone)
|
sl@0
|
842 |
{
|
sl@0
|
843 |
TRAPD(r, ret = DoTestCheckWriteL());
|
sl@0
|
844 |
if ( r != KErrNone)
|
sl@0
|
845 |
ret = r;
|
sl@0
|
846 |
}
|
sl@0
|
847 |
return ret;
|
sl@0
|
848 |
}
|
sl@0
|
849 |
/**
|
sl@0
|
850 |
* Function Name : executeStepL
|
sl@0
|
851 |
* Input parameters : None
|
sl@0
|
852 |
* Output parameters : TInt
|
sl@0
|
853 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
854 |
|
sl@0
|
855 |
*/
|
sl@0
|
856 |
|
sl@0
|
857 |
|
sl@0
|
858 |
TInt CFloggerTest027_07::executeStepL(TBool)
|
sl@0
|
859 |
{
|
sl@0
|
860 |
return KErrGeneral;
|
sl@0
|
861 |
}
|
sl@0
|
862 |
|
sl@0
|
863 |
TInt CFloggerTest027_07::DoTestWrite()
|
sl@0
|
864 |
{
|
sl@0
|
865 |
TPtrC8 ptrSubSystem;
|
sl@0
|
866 |
TPtrC8 ptrComponent;
|
sl@0
|
867 |
ptrSubSystem.Set(_L8("SubSystem"));
|
sl@0
|
868 |
ptrComponent.Set(_L8("Component"));
|
sl@0
|
869 |
__FLOG_DECLARATION_MEMBER;
|
sl@0
|
870 |
__FLOG_OPEN(ptrSubSystem, ptrComponent);
|
sl@0
|
871 |
__FLOG_CLEAR;
|
sl@0
|
872 |
_LIT8(KTestMessage ,"TC no 27.7: This is test message");
|
sl@0
|
873 |
__FLOG_BINARY(KTestMessage); //Write 8 bit test descriptor
|
sl@0
|
874 |
__FLOG_CLOSE;
|
sl@0
|
875 |
return KErrNone;
|
sl@0
|
876 |
}
|
sl@0
|
877 |
|
sl@0
|
878 |
|
sl@0
|
879 |
/**
|
sl@0
|
880 |
* Function Name : DoTestCheckWriteL
|
sl@0
|
881 |
* Input parameters : None
|
sl@0
|
882 |
* Output parameters : TInt
|
sl@0
|
883 |
* Description : This function checks whether test data was written
|
sl@0
|
884 |
in to the log file or not.
|
sl@0
|
885 |
|
sl@0
|
886 |
*/
|
sl@0
|
887 |
|
sl@0
|
888 |
|
sl@0
|
889 |
TInt CFloggerTest027_07::DoTestCheckWriteL()
|
sl@0
|
890 |
{
|
sl@0
|
891 |
User::After(KTimeToLog);
|
sl@0
|
892 |
RFile theFile;
|
sl@0
|
893 |
HBufC8 * hBuffer;
|
sl@0
|
894 |
TInt listfilesize;
|
sl@0
|
895 |
TInt returnCode;
|
sl@0
|
896 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
897 |
_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
|
sl@0
|
898 |
|
sl@0
|
899 |
_LIT8(KTestMessage ,"TC no 27.7: This is test message");
|
sl@0
|
900 |
|
sl@0
|
901 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
902 |
|
sl@0
|
903 |
//Open the file in the read mode
|
sl@0
|
904 |
User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
|
sl@0
|
905 |
|
sl@0
|
906 |
CleanupClosePushL(theFile);
|
sl@0
|
907 |
|
sl@0
|
908 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
909 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
910 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
911 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
912 |
|
sl@0
|
913 |
// Read from position 0: start of file
|
sl@0
|
914 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
915 |
|
sl@0
|
916 |
returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
|
sl@0
|
917 |
//from the file
|
sl@0
|
918 |
|
sl@0
|
919 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
920 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
921 |
if (returnCode > 0)
|
sl@0
|
922 |
return KErrNone;
|
sl@0
|
923 |
else
|
sl@0
|
924 |
return KErrGeneral;
|
sl@0
|
925 |
}
|
sl@0
|
926 |
|
sl@0
|
927 |
|
sl@0
|
928 |
|
sl@0
|
929 |
|
sl@0
|
930 |
/**
|
sl@0
|
931 |
* Function Name : CFloggerTest027_08
|
sl@0
|
932 |
* Input parameters : None
|
sl@0
|
933 |
* Output parameters : None
|
sl@0
|
934 |
* Description : This is the constructor
|
sl@0
|
935 |
*/
|
sl@0
|
936 |
|
sl@0
|
937 |
|
sl@0
|
938 |
CFloggerTest027_08::CFloggerTest027_08()
|
sl@0
|
939 |
{
|
sl@0
|
940 |
// Store the name of this test case
|
sl@0
|
941 |
SetTestStepName(_L("step_027_08"));
|
sl@0
|
942 |
}
|
sl@0
|
943 |
|
sl@0
|
944 |
|
sl@0
|
945 |
/**
|
sl@0
|
946 |
* Function Name :~ CFloggerTest027_08
|
sl@0
|
947 |
* Input parameters : None
|
sl@0
|
948 |
* Output parameters : None
|
sl@0
|
949 |
* Description : This is the Destructor
|
sl@0
|
950 |
*/
|
sl@0
|
951 |
|
sl@0
|
952 |
|
sl@0
|
953 |
CFloggerTest027_08::~CFloggerTest027_08()
|
sl@0
|
954 |
{
|
sl@0
|
955 |
}
|
sl@0
|
956 |
|
sl@0
|
957 |
|
sl@0
|
958 |
/**
|
sl@0
|
959 |
* Function Name : doTestStepL
|
sl@0
|
960 |
* Input parameters : None
|
sl@0
|
961 |
* Output parameters : TVerdict
|
sl@0
|
962 |
* Description : This function returns whether the test case 027_07 has
|
sl@0
|
963 |
* passed or failed
|
sl@0
|
964 |
|
sl@0
|
965 |
*/
|
sl@0
|
966 |
|
sl@0
|
967 |
|
sl@0
|
968 |
TVerdict CFloggerTest027_08::doTestStepL( )
|
sl@0
|
969 |
{
|
sl@0
|
970 |
INFO_PRINTF1(_L("Step 027.08 called "));
|
sl@0
|
971 |
if ( executeStepL() == KErrNone )
|
sl@0
|
972 |
SetTestStepResult(EPass);
|
sl@0
|
973 |
|
sl@0
|
974 |
else
|
sl@0
|
975 |
SetTestStepResult(EFail);
|
sl@0
|
976 |
|
sl@0
|
977 |
|
sl@0
|
978 |
return TestStepResult();
|
sl@0
|
979 |
}
|
sl@0
|
980 |
|
sl@0
|
981 |
/**
|
sl@0
|
982 |
* Function Name : executeStepL
|
sl@0
|
983 |
* Input parameters : None
|
sl@0
|
984 |
* Output parameters : TInt
|
sl@0
|
985 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
986 |
*/
|
sl@0
|
987 |
|
sl@0
|
988 |
|
sl@0
|
989 |
TInt CFloggerTest027_08::executeStepL(TBool)
|
sl@0
|
990 |
{
|
sl@0
|
991 |
return KErrGeneral;
|
sl@0
|
992 |
}
|
sl@0
|
993 |
|
sl@0
|
994 |
/**
|
sl@0
|
995 |
* Function Name : executeStepL
|
sl@0
|
996 |
* Input parameters : None
|
sl@0
|
997 |
* Output parameters : TInt
|
sl@0
|
998 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
999 |
*/
|
sl@0
|
1000 |
|
sl@0
|
1001 |
|
sl@0
|
1002 |
TInt CFloggerTest027_08::executeStepL()
|
sl@0
|
1003 |
{
|
sl@0
|
1004 |
TInt ret = KErrNone;
|
sl@0
|
1005 |
ret = DoTestWrite();
|
sl@0
|
1006 |
if ( ret == KErrNone)
|
sl@0
|
1007 |
{
|
sl@0
|
1008 |
TRAPD(r, ret = DoTestCheckWriteL());
|
sl@0
|
1009 |
if ( r != KErrNone)
|
sl@0
|
1010 |
ret = r;
|
sl@0
|
1011 |
}
|
sl@0
|
1012 |
return ret;
|
sl@0
|
1013 |
}
|
sl@0
|
1014 |
|
sl@0
|
1015 |
|
sl@0
|
1016 |
TInt CFloggerTest027_08::DoTestWrite()
|
sl@0
|
1017 |
{
|
sl@0
|
1018 |
_LIT8(ptrSubSystem,"SubSystem");
|
sl@0
|
1019 |
_LIT8(ptrComponent,"Component");
|
sl@0
|
1020 |
_LIT8(KTestMessage ,"TC no 27.8: This is test message");
|
sl@0
|
1021 |
__FLOG_STATIC0(ptrSubSystem, ptrComponent, KTestMessage);
|
sl@0
|
1022 |
return KErrNone;
|
sl@0
|
1023 |
}
|
sl@0
|
1024 |
|
sl@0
|
1025 |
|
sl@0
|
1026 |
/**
|
sl@0
|
1027 |
* Function Name : DoTestCheckWriteL
|
sl@0
|
1028 |
* Input parameters : None
|
sl@0
|
1029 |
* Output parameters : TInt
|
sl@0
|
1030 |
* Description : This function checks whether test data was written
|
sl@0
|
1031 |
in to the log file or not.
|
sl@0
|
1032 |
|
sl@0
|
1033 |
*/
|
sl@0
|
1034 |
|
sl@0
|
1035 |
|
sl@0
|
1036 |
TInt CFloggerTest027_08::DoTestCheckWriteL()
|
sl@0
|
1037 |
{
|
sl@0
|
1038 |
User::After(KTimeToLog);
|
sl@0
|
1039 |
RFile theFile;
|
sl@0
|
1040 |
HBufC8 * hBuffer;
|
sl@0
|
1041 |
TInt listfilesize;
|
sl@0
|
1042 |
TInt returnCode;
|
sl@0
|
1043 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
1044 |
_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
|
sl@0
|
1045 |
|
sl@0
|
1046 |
_LIT8(KTestMessage ,"TC no 27.8: This is test message");
|
sl@0
|
1047 |
|
sl@0
|
1048 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
1049 |
|
sl@0
|
1050 |
//Open the file in the read mode
|
sl@0
|
1051 |
User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
|
sl@0
|
1052 |
|
sl@0
|
1053 |
CleanupClosePushL(theFile);
|
sl@0
|
1054 |
|
sl@0
|
1055 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
1056 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
1057 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
1058 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
1059 |
|
sl@0
|
1060 |
// Read from position 0: start of file
|
sl@0
|
1061 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
1062 |
|
sl@0
|
1063 |
returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
|
sl@0
|
1064 |
//from the file
|
sl@0
|
1065 |
|
sl@0
|
1066 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
1067 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
1068 |
if (returnCode > 0)
|
sl@0
|
1069 |
return KErrNone;
|
sl@0
|
1070 |
else
|
sl@0
|
1071 |
return KErrGeneral;
|
sl@0
|
1072 |
}
|
sl@0
|
1073 |
|
sl@0
|
1074 |
|
sl@0
|
1075 |
|
sl@0
|
1076 |
|
sl@0
|
1077 |
/**
|
sl@0
|
1078 |
* Function Name : CFloggerTest027_09
|
sl@0
|
1079 |
* Input parameters : None
|
sl@0
|
1080 |
* Output parameters : None
|
sl@0
|
1081 |
* Description : This is the constructor
|
sl@0
|
1082 |
*/
|
sl@0
|
1083 |
|
sl@0
|
1084 |
|
sl@0
|
1085 |
CFloggerTest027_09::CFloggerTest027_09()
|
sl@0
|
1086 |
{
|
sl@0
|
1087 |
// Store the name of this test case
|
sl@0
|
1088 |
SetTestStepName(_L("step_027_09"));
|
sl@0
|
1089 |
}
|
sl@0
|
1090 |
|
sl@0
|
1091 |
|
sl@0
|
1092 |
/**
|
sl@0
|
1093 |
* Function Name :~ CFloggerTest027_09
|
sl@0
|
1094 |
* Input parameters : None
|
sl@0
|
1095 |
* Output parameters : None
|
sl@0
|
1096 |
* Description : This is the Destructor
|
sl@0
|
1097 |
*/
|
sl@0
|
1098 |
|
sl@0
|
1099 |
|
sl@0
|
1100 |
CFloggerTest027_09::~CFloggerTest027_09()
|
sl@0
|
1101 |
{
|
sl@0
|
1102 |
}
|
sl@0
|
1103 |
|
sl@0
|
1104 |
|
sl@0
|
1105 |
/**
|
sl@0
|
1106 |
* Function Name : doTestStepL
|
sl@0
|
1107 |
* Input parameters : None
|
sl@0
|
1108 |
* Output parameters : TVerdict
|
sl@0
|
1109 |
* Description : This function returns whether the test case 027_09 has
|
sl@0
|
1110 |
* passed or failed
|
sl@0
|
1111 |
|
sl@0
|
1112 |
*/
|
sl@0
|
1113 |
|
sl@0
|
1114 |
|
sl@0
|
1115 |
TVerdict CFloggerTest027_09::doTestStepL( )
|
sl@0
|
1116 |
{
|
sl@0
|
1117 |
INFO_PRINTF1(_L("Step 027.09 called "));
|
sl@0
|
1118 |
if ( executeStepL() == KErrNone )
|
sl@0
|
1119 |
SetTestStepResult(EPass);
|
sl@0
|
1120 |
|
sl@0
|
1121 |
else
|
sl@0
|
1122 |
SetTestStepResult(EFail);
|
sl@0
|
1123 |
|
sl@0
|
1124 |
|
sl@0
|
1125 |
return TestStepResult();
|
sl@0
|
1126 |
}
|
sl@0
|
1127 |
/**
|
sl@0
|
1128 |
* Function Name : executeStepL
|
sl@0
|
1129 |
* Input parameters : None
|
sl@0
|
1130 |
* Output parameters : TInt
|
sl@0
|
1131 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
1132 |
|
sl@0
|
1133 |
*/
|
sl@0
|
1134 |
|
sl@0
|
1135 |
|
sl@0
|
1136 |
TInt CFloggerTest027_09::executeStepL(TBool)
|
sl@0
|
1137 |
{
|
sl@0
|
1138 |
return KErrGeneral;
|
sl@0
|
1139 |
}
|
sl@0
|
1140 |
|
sl@0
|
1141 |
/**
|
sl@0
|
1142 |
* Function Name : executeStepL
|
sl@0
|
1143 |
* Input parameters : None
|
sl@0
|
1144 |
* Output parameters : TInt
|
sl@0
|
1145 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
1146 |
|
sl@0
|
1147 |
*/
|
sl@0
|
1148 |
|
sl@0
|
1149 |
|
sl@0
|
1150 |
TInt CFloggerTest027_09::executeStepL()
|
sl@0
|
1151 |
{
|
sl@0
|
1152 |
TInt ret = KErrNone;
|
sl@0
|
1153 |
ret = DoTestWrite();
|
sl@0
|
1154 |
if ( ret == KErrNone)
|
sl@0
|
1155 |
{
|
sl@0
|
1156 |
TRAPD(r, ret = DoTestCheckWriteL());
|
sl@0
|
1157 |
if ( r != KErrNone)
|
sl@0
|
1158 |
ret = r;
|
sl@0
|
1159 |
}
|
sl@0
|
1160 |
return ret;
|
sl@0
|
1161 |
}
|
sl@0
|
1162 |
|
sl@0
|
1163 |
|
sl@0
|
1164 |
TInt CFloggerTest027_09::DoTestWrite()
|
sl@0
|
1165 |
{
|
sl@0
|
1166 |
_LIT8(ptrSubSystem,"SubSystem");
|
sl@0
|
1167 |
_LIT8(ptrComponent,"Component");
|
sl@0
|
1168 |
_LIT8(KTestMessageOne,"TEST 27.09: The value of test integer variable :%d");
|
sl@0
|
1169 |
__FLOG_STATIC1(ptrSubSystem, ptrComponent, KTestMessageOne, 100);
|
sl@0
|
1170 |
return KErrNone;
|
sl@0
|
1171 |
}
|
sl@0
|
1172 |
|
sl@0
|
1173 |
|
sl@0
|
1174 |
/**
|
sl@0
|
1175 |
* Function Name : DoTestCheckWriteL
|
sl@0
|
1176 |
* Input parameters : None
|
sl@0
|
1177 |
* Output parameters : TInt
|
sl@0
|
1178 |
* Description : This function checks whether test data was written
|
sl@0
|
1179 |
in to the log file or not.
|
sl@0
|
1180 |
|
sl@0
|
1181 |
*/
|
sl@0
|
1182 |
|
sl@0
|
1183 |
|
sl@0
|
1184 |
TInt CFloggerTest027_09::DoTestCheckWriteL()
|
sl@0
|
1185 |
{
|
sl@0
|
1186 |
User::After(KTimeToLog);
|
sl@0
|
1187 |
RFile theFile;
|
sl@0
|
1188 |
HBufC8 * hBuffer;
|
sl@0
|
1189 |
TInt listfilesize;
|
sl@0
|
1190 |
TInt returnCode;
|
sl@0
|
1191 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
1192 |
_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
|
sl@0
|
1193 |
|
sl@0
|
1194 |
TBuf8<256> testData; //To hold the test descriptor
|
sl@0
|
1195 |
|
sl@0
|
1196 |
_LIT8(KTestMessageOne,"TEST 27.09: The value of test integer variable :%d");
|
sl@0
|
1197 |
testData.Format(KTestMessageOne,100);
|
sl@0
|
1198 |
|
sl@0
|
1199 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
1200 |
|
sl@0
|
1201 |
//Open the file in the read mode
|
sl@0
|
1202 |
User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
|
sl@0
|
1203 |
|
sl@0
|
1204 |
CleanupClosePushL(theFile);
|
sl@0
|
1205 |
|
sl@0
|
1206 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
1207 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
1208 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
1209 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
1210 |
|
sl@0
|
1211 |
// Read from position 0: start of file
|
sl@0
|
1212 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
1213 |
|
sl@0
|
1214 |
returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
|
sl@0
|
1215 |
//from the file
|
sl@0
|
1216 |
|
sl@0
|
1217 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
1218 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
1219 |
if (returnCode > 0)
|
sl@0
|
1220 |
return KErrNone;
|
sl@0
|
1221 |
else
|
sl@0
|
1222 |
return KErrGeneral;
|
sl@0
|
1223 |
}
|
sl@0
|
1224 |
|
sl@0
|
1225 |
|
sl@0
|
1226 |
|
sl@0
|
1227 |
|
sl@0
|
1228 |
/**
|
sl@0
|
1229 |
* Function Name : CFloggerTest027_10
|
sl@0
|
1230 |
* Input parameters : None
|
sl@0
|
1231 |
* Output parameters : None
|
sl@0
|
1232 |
* Description : This is the constructor
|
sl@0
|
1233 |
*/
|
sl@0
|
1234 |
|
sl@0
|
1235 |
|
sl@0
|
1236 |
CFloggerTest027_10::CFloggerTest027_10()
|
sl@0
|
1237 |
{
|
sl@0
|
1238 |
// Store the name of this test case
|
sl@0
|
1239 |
SetTestStepName(_L("step_027_10"));
|
sl@0
|
1240 |
}
|
sl@0
|
1241 |
|
sl@0
|
1242 |
|
sl@0
|
1243 |
/**
|
sl@0
|
1244 |
* Function Name :~ CFloggerTest027_10
|
sl@0
|
1245 |
* Input parameters : None
|
sl@0
|
1246 |
* Output parameters : None
|
sl@0
|
1247 |
* Description : This is the Destructor
|
sl@0
|
1248 |
*/
|
sl@0
|
1249 |
|
sl@0
|
1250 |
|
sl@0
|
1251 |
CFloggerTest027_10::~CFloggerTest027_10()
|
sl@0
|
1252 |
{
|
sl@0
|
1253 |
}
|
sl@0
|
1254 |
|
sl@0
|
1255 |
|
sl@0
|
1256 |
/**
|
sl@0
|
1257 |
* Function Name : doTestStepL
|
sl@0
|
1258 |
* Input parameters : None
|
sl@0
|
1259 |
* Output parameters : TVerdict
|
sl@0
|
1260 |
* Description : This function returns whether the test case 027_10 has
|
sl@0
|
1261 |
* passed or failed
|
sl@0
|
1262 |
|
sl@0
|
1263 |
*/
|
sl@0
|
1264 |
|
sl@0
|
1265 |
|
sl@0
|
1266 |
TVerdict CFloggerTest027_10::doTestStepL( )
|
sl@0
|
1267 |
{
|
sl@0
|
1268 |
INFO_PRINTF1(_L("Step 027.10 called "));
|
sl@0
|
1269 |
if ( executeStepL() == KErrNone )
|
sl@0
|
1270 |
SetTestStepResult(EPass);
|
sl@0
|
1271 |
|
sl@0
|
1272 |
else
|
sl@0
|
1273 |
SetTestStepResult(EFail);
|
sl@0
|
1274 |
|
sl@0
|
1275 |
|
sl@0
|
1276 |
return TestStepResult();
|
sl@0
|
1277 |
}
|
sl@0
|
1278 |
|
sl@0
|
1279 |
/**
|
sl@0
|
1280 |
* Function Name : executeStepL
|
sl@0
|
1281 |
* Input parameters : None
|
sl@0
|
1282 |
* Output parameters : TInt
|
sl@0
|
1283 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
1284 |
|
sl@0
|
1285 |
*/
|
sl@0
|
1286 |
|
sl@0
|
1287 |
|
sl@0
|
1288 |
TInt CFloggerTest027_10::executeStepL(TBool)
|
sl@0
|
1289 |
{
|
sl@0
|
1290 |
return KErrGeneral;
|
sl@0
|
1291 |
}
|
sl@0
|
1292 |
/**
|
sl@0
|
1293 |
* Function Name : executeStepL
|
sl@0
|
1294 |
* Input parameters : None
|
sl@0
|
1295 |
* Output parameters : TInt
|
sl@0
|
1296 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
1297 |
|
sl@0
|
1298 |
*/
|
sl@0
|
1299 |
|
sl@0
|
1300 |
|
sl@0
|
1301 |
TInt CFloggerTest027_10::executeStepL()
|
sl@0
|
1302 |
{
|
sl@0
|
1303 |
TInt ret = KErrNone;
|
sl@0
|
1304 |
ret = DoTestWrite();
|
sl@0
|
1305 |
if ( ret == KErrNone)
|
sl@0
|
1306 |
{
|
sl@0
|
1307 |
TRAPD(r, ret = DoTestCheckWriteL());
|
sl@0
|
1308 |
if ( r != KErrNone)
|
sl@0
|
1309 |
ret = r;
|
sl@0
|
1310 |
}
|
sl@0
|
1311 |
return ret;
|
sl@0
|
1312 |
}
|
sl@0
|
1313 |
|
sl@0
|
1314 |
|
sl@0
|
1315 |
TInt CFloggerTest027_10::DoTestWrite()
|
sl@0
|
1316 |
{
|
sl@0
|
1317 |
_LIT8(ptrSubSystem,"SubSystem");
|
sl@0
|
1318 |
_LIT8(ptrComponent,"Component");
|
sl@0
|
1319 |
_LIT8(KTestMessage ,"TC no 27.10: This is test message");
|
sl@0
|
1320 |
__FLOG_STATIC(ptrSubSystem, ptrComponent, KTestMessage);
|
sl@0
|
1321 |
return KErrNone;
|
sl@0
|
1322 |
}
|
sl@0
|
1323 |
|
sl@0
|
1324 |
|
sl@0
|
1325 |
/**
|
sl@0
|
1326 |
* Function Name : DoTestCheckWriteL
|
sl@0
|
1327 |
* Input parameters : None
|
sl@0
|
1328 |
* Output parameters : TInt
|
sl@0
|
1329 |
* Description : This function checks whether test data was written
|
sl@0
|
1330 |
in to the log file or not..
|
sl@0
|
1331 |
|
sl@0
|
1332 |
*/
|
sl@0
|
1333 |
|
sl@0
|
1334 |
|
sl@0
|
1335 |
TInt CFloggerTest027_10::DoTestCheckWriteL()
|
sl@0
|
1336 |
{
|
sl@0
|
1337 |
User::After(KTimeToLog);
|
sl@0
|
1338 |
RFile theFile;
|
sl@0
|
1339 |
HBufC8 * hBuffer;
|
sl@0
|
1340 |
TInt listfilesize;
|
sl@0
|
1341 |
TInt returnCode;
|
sl@0
|
1342 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
1343 |
_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
|
sl@0
|
1344 |
_LIT8(KTestMessage ,"TC no 27.10: This is test message");
|
sl@0
|
1345 |
|
sl@0
|
1346 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
1347 |
|
sl@0
|
1348 |
//Open the file in the read mode
|
sl@0
|
1349 |
User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
|
sl@0
|
1350 |
|
sl@0
|
1351 |
CleanupClosePushL(theFile);
|
sl@0
|
1352 |
|
sl@0
|
1353 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
1354 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
1355 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
1356 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
1357 |
|
sl@0
|
1358 |
// Read from position 0: start of file
|
sl@0
|
1359 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
1360 |
|
sl@0
|
1361 |
returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
|
sl@0
|
1362 |
//from the file
|
sl@0
|
1363 |
|
sl@0
|
1364 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
1365 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
1366 |
if (returnCode > 0)
|
sl@0
|
1367 |
return KErrNone;
|
sl@0
|
1368 |
else
|
sl@0
|
1369 |
return KErrGeneral;
|
sl@0
|
1370 |
}
|
sl@0
|
1371 |
|
sl@0
|
1372 |
|
sl@0
|
1373 |
|
sl@0
|
1374 |
|
sl@0
|
1375 |
/**
|
sl@0
|
1376 |
* Function Name : CFloggerTest027_11
|
sl@0
|
1377 |
* Input parameters : None
|
sl@0
|
1378 |
* Output parameters : None
|
sl@0
|
1379 |
* Description : This is the constructor
|
sl@0
|
1380 |
*/
|
sl@0
|
1381 |
|
sl@0
|
1382 |
|
sl@0
|
1383 |
CFloggerTest027_11::CFloggerTest027_11()
|
sl@0
|
1384 |
{
|
sl@0
|
1385 |
// Store the name of this test case
|
sl@0
|
1386 |
SetTestStepName(_L("step_027_11"));
|
sl@0
|
1387 |
}
|
sl@0
|
1388 |
|
sl@0
|
1389 |
|
sl@0
|
1390 |
/**
|
sl@0
|
1391 |
* Function Name :~ CFloggerTest027_11
|
sl@0
|
1392 |
* Input parameters : None
|
sl@0
|
1393 |
* Output parameters : None
|
sl@0
|
1394 |
* Description : This is the Destructor
|
sl@0
|
1395 |
*/
|
sl@0
|
1396 |
|
sl@0
|
1397 |
|
sl@0
|
1398 |
CFloggerTest027_11::~CFloggerTest027_11()
|
sl@0
|
1399 |
{
|
sl@0
|
1400 |
}
|
sl@0
|
1401 |
|
sl@0
|
1402 |
|
sl@0
|
1403 |
/**
|
sl@0
|
1404 |
* Function Name : doTestStepL
|
sl@0
|
1405 |
* Input parameters : None
|
sl@0
|
1406 |
* Output parameters : TVerdict
|
sl@0
|
1407 |
* Description : This function returns whether the test case 027_11 has
|
sl@0
|
1408 |
* passed or failed
|
sl@0
|
1409 |
|
sl@0
|
1410 |
*/
|
sl@0
|
1411 |
|
sl@0
|
1412 |
|
sl@0
|
1413 |
TVerdict CFloggerTest027_11::doTestStepL( )
|
sl@0
|
1414 |
{
|
sl@0
|
1415 |
INFO_PRINTF1(_L("Step 027.11 called "));
|
sl@0
|
1416 |
if ( executeStepL() == KErrNone )
|
sl@0
|
1417 |
SetTestStepResult(EPass);
|
sl@0
|
1418 |
|
sl@0
|
1419 |
else
|
sl@0
|
1420 |
SetTestStepResult(EFail);
|
sl@0
|
1421 |
|
sl@0
|
1422 |
|
sl@0
|
1423 |
return TestStepResult();
|
sl@0
|
1424 |
}
|
sl@0
|
1425 |
|
sl@0
|
1426 |
/**
|
sl@0
|
1427 |
* Function Name : executeStepL
|
sl@0
|
1428 |
* Input parameters : None
|
sl@0
|
1429 |
* Output parameters : TInt
|
sl@0
|
1430 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
1431 |
|
sl@0
|
1432 |
*/
|
sl@0
|
1433 |
|
sl@0
|
1434 |
|
sl@0
|
1435 |
TInt CFloggerTest027_11::executeStepL(TBool)
|
sl@0
|
1436 |
{
|
sl@0
|
1437 |
return KErrGeneral;
|
sl@0
|
1438 |
}
|
sl@0
|
1439 |
|
sl@0
|
1440 |
/**
|
sl@0
|
1441 |
* Function Name : executeStepL
|
sl@0
|
1442 |
* Input parameters : None
|
sl@0
|
1443 |
* Output parameters : TInt
|
sl@0
|
1444 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
1445 |
|
sl@0
|
1446 |
*/
|
sl@0
|
1447 |
|
sl@0
|
1448 |
|
sl@0
|
1449 |
TInt CFloggerTest027_11::executeStepL()
|
sl@0
|
1450 |
{
|
sl@0
|
1451 |
TInt ret = KErrNone;
|
sl@0
|
1452 |
ret = DoTestWrite();
|
sl@0
|
1453 |
if ( ret == KErrNone)
|
sl@0
|
1454 |
{
|
sl@0
|
1455 |
TRAPD(r, ret = DoTestCheckWriteL());
|
sl@0
|
1456 |
if ( r != KErrNone)
|
sl@0
|
1457 |
ret = r;
|
sl@0
|
1458 |
}
|
sl@0
|
1459 |
return ret;
|
sl@0
|
1460 |
}
|
sl@0
|
1461 |
|
sl@0
|
1462 |
|
sl@0
|
1463 |
TInt CFloggerTest027_11::DoTestWrite()
|
sl@0
|
1464 |
{
|
sl@0
|
1465 |
TPtrC8 ptrSubSystem;
|
sl@0
|
1466 |
TPtrC8 ptrComponent;
|
sl@0
|
1467 |
ptrSubSystem.Set(_L8("SubSystem"));
|
sl@0
|
1468 |
ptrComponent.Set(_L8("Component"));
|
sl@0
|
1469 |
_LIT8(descTxt,"T 27_11:Test Msg"); //Test body descriptor
|
sl@0
|
1470 |
__FLOG_STATIC_HEXDUMP((ptrSubSystem, ptrComponent, descTxt));
|
sl@0
|
1471 |
return KErrNone;
|
sl@0
|
1472 |
}
|
sl@0
|
1473 |
|
sl@0
|
1474 |
|
sl@0
|
1475 |
/**
|
sl@0
|
1476 |
* Function Name : DoTestCheckWriteL
|
sl@0
|
1477 |
* Input parameters : None
|
sl@0
|
1478 |
* Output parameters : TInt
|
sl@0
|
1479 |
* Description : This function checks whether test data was written
|
sl@0
|
1480 |
in to the log file or not.
|
sl@0
|
1481 |
|
sl@0
|
1482 |
*/
|
sl@0
|
1483 |
|
sl@0
|
1484 |
|
sl@0
|
1485 |
TInt CFloggerTest027_11::DoTestCheckWriteL()
|
sl@0
|
1486 |
{
|
sl@0
|
1487 |
User::After(KTimeToLog);
|
sl@0
|
1488 |
RFile theFile;
|
sl@0
|
1489 |
HBufC8 * hBuffer;
|
sl@0
|
1490 |
TInt listfilesize;
|
sl@0
|
1491 |
TInt returnCode;
|
sl@0
|
1492 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
1493 |
_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
|
sl@0
|
1494 |
_LIT8(KTestMessage ,"T 27_11:Test Msg");
|
sl@0
|
1495 |
|
sl@0
|
1496 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
1497 |
|
sl@0
|
1498 |
//Open the file in the read mode
|
sl@0
|
1499 |
User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
|
sl@0
|
1500 |
|
sl@0
|
1501 |
CleanupClosePushL(theFile);
|
sl@0
|
1502 |
|
sl@0
|
1503 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
1504 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
1505 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
1506 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
1507 |
|
sl@0
|
1508 |
// Read from position 0: start of file
|
sl@0
|
1509 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
1510 |
|
sl@0
|
1511 |
returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
|
sl@0
|
1512 |
//from the file
|
sl@0
|
1513 |
|
sl@0
|
1514 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
1515 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
1516 |
if (returnCode > 0)
|
sl@0
|
1517 |
return KErrNone;
|
sl@0
|
1518 |
else
|
sl@0
|
1519 |
return KErrGeneral;
|
sl@0
|
1520 |
}
|
sl@0
|
1521 |
|
sl@0
|
1522 |
|
sl@0
|
1523 |
|
sl@0
|
1524 |
|
sl@0
|
1525 |
/**
|
sl@0
|
1526 |
* Function Name : CFloggerTest027_12
|
sl@0
|
1527 |
* Input parameters : None
|
sl@0
|
1528 |
* Output parameters : None
|
sl@0
|
1529 |
* Description : This is the constructor
|
sl@0
|
1530 |
*/
|
sl@0
|
1531 |
|
sl@0
|
1532 |
|
sl@0
|
1533 |
CFloggerTest027_12::CFloggerTest027_12()
|
sl@0
|
1534 |
{
|
sl@0
|
1535 |
// Store the name of this test case
|
sl@0
|
1536 |
SetTestStepName(_L("step_027_12"));
|
sl@0
|
1537 |
}
|
sl@0
|
1538 |
|
sl@0
|
1539 |
|
sl@0
|
1540 |
/**
|
sl@0
|
1541 |
* Function Name :~ CFloggerTest027_12
|
sl@0
|
1542 |
* Input parameters : None
|
sl@0
|
1543 |
* Output parameters : None
|
sl@0
|
1544 |
* Description : This is the Destructor
|
sl@0
|
1545 |
*/
|
sl@0
|
1546 |
|
sl@0
|
1547 |
|
sl@0
|
1548 |
CFloggerTest027_12::~CFloggerTest027_12()
|
sl@0
|
1549 |
{
|
sl@0
|
1550 |
}
|
sl@0
|
1551 |
|
sl@0
|
1552 |
|
sl@0
|
1553 |
/**
|
sl@0
|
1554 |
* Function Name : doTestStepL
|
sl@0
|
1555 |
* Input parameters : None
|
sl@0
|
1556 |
* Output parameters : TVerdict
|
sl@0
|
1557 |
* Description : This function returns whether the test case 027_12 has
|
sl@0
|
1558 |
* passed or failed
|
sl@0
|
1559 |
|
sl@0
|
1560 |
*/
|
sl@0
|
1561 |
|
sl@0
|
1562 |
|
sl@0
|
1563 |
TVerdict CFloggerTest027_12::doTestStepL( )
|
sl@0
|
1564 |
{
|
sl@0
|
1565 |
INFO_PRINTF1(_L("Step 027.12 called "));
|
sl@0
|
1566 |
if ( executeStepL() == KErrNone )
|
sl@0
|
1567 |
SetTestStepResult(EPass);
|
sl@0
|
1568 |
|
sl@0
|
1569 |
else
|
sl@0
|
1570 |
SetTestStepResult(EFail);
|
sl@0
|
1571 |
|
sl@0
|
1572 |
|
sl@0
|
1573 |
return TestStepResult();
|
sl@0
|
1574 |
}
|
sl@0
|
1575 |
|
sl@0
|
1576 |
/**
|
sl@0
|
1577 |
* Function Name : executeStepL
|
sl@0
|
1578 |
* Input parameters : None
|
sl@0
|
1579 |
* Output parameters : TInt
|
sl@0
|
1580 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
1581 |
*/
|
sl@0
|
1582 |
|
sl@0
|
1583 |
|
sl@0
|
1584 |
TInt CFloggerTest027_12::executeStepL(TBool)
|
sl@0
|
1585 |
{
|
sl@0
|
1586 |
return KErrGeneral;
|
sl@0
|
1587 |
}
|
sl@0
|
1588 |
|
sl@0
|
1589 |
/**
|
sl@0
|
1590 |
* Function Name : executeStepL
|
sl@0
|
1591 |
* Input parameters : None
|
sl@0
|
1592 |
* Output parameters : TInt
|
sl@0
|
1593 |
* Description : This function calls the flogger write and checks whether the log message is written in to the log file
|
sl@0
|
1594 |
*/
|
sl@0
|
1595 |
|
sl@0
|
1596 |
|
sl@0
|
1597 |
TInt CFloggerTest027_12::executeStepL()
|
sl@0
|
1598 |
{
|
sl@0
|
1599 |
TInt ret = KErrNone;
|
sl@0
|
1600 |
ret = DoTestWrite();
|
sl@0
|
1601 |
if ( ret == KErrNone)
|
sl@0
|
1602 |
{
|
sl@0
|
1603 |
TRAPD(r, ret = DoTestCheckWriteL());
|
sl@0
|
1604 |
if ( r != KErrNone)
|
sl@0
|
1605 |
ret = r;
|
sl@0
|
1606 |
}
|
sl@0
|
1607 |
return ret;
|
sl@0
|
1608 |
}
|
sl@0
|
1609 |
|
sl@0
|
1610 |
|
sl@0
|
1611 |
TInt CFloggerTest027_12::DoTestWrite()
|
sl@0
|
1612 |
{
|
sl@0
|
1613 |
TPtrC8 ptrSubSystem;
|
sl@0
|
1614 |
TPtrC8 ptrComponent;
|
sl@0
|
1615 |
ptrSubSystem.Set(_L8("SubSystem"));
|
sl@0
|
1616 |
ptrComponent.Set(_L8("Component"));
|
sl@0
|
1617 |
_LIT16(KTestMessageTwo,"TEST 27.12: The value of first test integer variable :%d The value of second test integer variable : %d");
|
sl@0
|
1618 |
__FLOG_STATIC2(ptrSubSystem, ptrComponent, KTestMessageTwo, 100, 200);
|
sl@0
|
1619 |
return KErrNone;
|
sl@0
|
1620 |
}
|
sl@0
|
1621 |
|
sl@0
|
1622 |
|
sl@0
|
1623 |
/**
|
sl@0
|
1624 |
* Function Name : DoTestCheckWriteL
|
sl@0
|
1625 |
* Input parameters : None
|
sl@0
|
1626 |
* Output parameters : TInt
|
sl@0
|
1627 |
* Description : This function checks whether test data was written
|
sl@0
|
1628 |
in to the log file or not.
|
sl@0
|
1629 |
|
sl@0
|
1630 |
*/
|
sl@0
|
1631 |
|
sl@0
|
1632 |
|
sl@0
|
1633 |
TInt CFloggerTest027_12::DoTestCheckWriteL()
|
sl@0
|
1634 |
{
|
sl@0
|
1635 |
User::After(KTimeToLog);
|
sl@0
|
1636 |
RFile theFile;
|
sl@0
|
1637 |
HBufC8 * hBuffer;
|
sl@0
|
1638 |
TInt listfilesize;
|
sl@0
|
1639 |
TInt returnCode;
|
sl@0
|
1640 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
1641 |
_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
|
sl@0
|
1642 |
|
sl@0
|
1643 |
TBuf8<256> testData; //To hold the test descriptor
|
sl@0
|
1644 |
|
sl@0
|
1645 |
_LIT8(KTestMessageTwo,"TEST 27.12: The value of first test integer variable :%d The value of second test integer variable : %d");
|
sl@0
|
1646 |
testData.Format(KTestMessageTwo,100, 200);
|
sl@0
|
1647 |
|
sl@0
|
1648 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
1649 |
|
sl@0
|
1650 |
//Open the file in the read mode
|
sl@0
|
1651 |
User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
|
sl@0
|
1652 |
|
sl@0
|
1653 |
CleanupClosePushL(theFile);
|
sl@0
|
1654 |
|
sl@0
|
1655 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
1656 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
1657 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
1658 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
1659 |
|
sl@0
|
1660 |
// Read from position 0: start of file
|
sl@0
|
1661 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
1662 |
|
sl@0
|
1663 |
returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
|
sl@0
|
1664 |
//from the file
|
sl@0
|
1665 |
|
sl@0
|
1666 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
1667 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
1668 |
if (returnCode > 0)
|
sl@0
|
1669 |
return KErrNone;
|
sl@0
|
1670 |
else
|
sl@0
|
1671 |
return KErrGeneral;
|
sl@0
|
1672 |
}
|
sl@0
|
1673 |
|
sl@0
|
1674 |
|