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 |
// This contains Unit Test Case 025.01
|
sl@0
|
15 |
|
sl@0
|
16 |
// EPOC includes
|
sl@0
|
17 |
#include <e32base.h>
|
sl@0
|
18 |
|
sl@0
|
19 |
// Test system includes
|
sl@0
|
20 |
#include "teststepcomsdbg.h"
|
sl@0
|
21 |
#include "TestMessage.h"
|
sl@0
|
22 |
#include "step_025_xx.h"
|
sl@0
|
23 |
#include "tlog1.h"
|
sl@0
|
24 |
#include "tlog2.h"
|
sl@0
|
25 |
#include "tlog3.h"
|
sl@0
|
26 |
#include "tlog4.h"
|
sl@0
|
27 |
|
sl@0
|
28 |
|
sl@0
|
29 |
#include <comms-infras/commsdebugutility.h>
|
sl@0
|
30 |
|
sl@0
|
31 |
|
sl@0
|
32 |
/**
|
sl@0
|
33 |
* 025_BuildTestUdeb1: Test that flogger builds clients correctly
|
sl@0
|
34 |
*/
|
sl@0
|
35 |
|
sl@0
|
36 |
CFloggerTest025_BuildTestUdeb1::CFloggerTest025_BuildTestUdeb1()
|
sl@0
|
37 |
{
|
sl@0
|
38 |
// Store the name of this test case
|
sl@0
|
39 |
SetTestStepName(_L("step_025_BuildTestUdeb1"));
|
sl@0
|
40 |
}
|
sl@0
|
41 |
|
sl@0
|
42 |
|
sl@0
|
43 |
|
sl@0
|
44 |
|
sl@0
|
45 |
CFloggerTest025_BuildTestUdeb1::~CFloggerTest025_BuildTestUdeb1()
|
sl@0
|
46 |
{
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
|
sl@0
|
50 |
|
sl@0
|
51 |
|
sl@0
|
52 |
TVerdict CFloggerTest025_BuildTestUdeb1::doTestStepL( )
|
sl@0
|
53 |
{
|
sl@0
|
54 |
if ( executeStepL() == KErrNone )
|
sl@0
|
55 |
SetTestStepResult(EPass);
|
sl@0
|
56 |
|
sl@0
|
57 |
else
|
sl@0
|
58 |
SetTestStepResult(EFail);
|
sl@0
|
59 |
|
sl@0
|
60 |
|
sl@0
|
61 |
|
sl@0
|
62 |
return TestStepResult();
|
sl@0
|
63 |
}
|
sl@0
|
64 |
|
sl@0
|
65 |
|
sl@0
|
66 |
TInt CFloggerTest025_BuildTestUdeb1::executeStepL(TBool)
|
sl@0
|
67 |
{
|
sl@0
|
68 |
return KErrGeneral;
|
sl@0
|
69 |
}
|
sl@0
|
70 |
|
sl@0
|
71 |
TInt CFloggerTest025_BuildTestUdeb1::executeStepL()
|
sl@0
|
72 |
{
|
sl@0
|
73 |
|
sl@0
|
74 |
TInt ret;
|
sl@0
|
75 |
RFileLogger theFlogger;
|
sl@0
|
76 |
|
sl@0
|
77 |
ret = theFlogger.Connect();
|
sl@0
|
78 |
|
sl@0
|
79 |
if ( ret == KErrNone)
|
sl@0
|
80 |
{
|
sl@0
|
81 |
theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
|
sl@0
|
82 |
theFlogger.ClearLog();
|
sl@0
|
83 |
theFlogger.Close();
|
sl@0
|
84 |
|
sl@0
|
85 |
TestLog1::Test();
|
sl@0
|
86 |
ret = DoTestCheckWriteL();
|
sl@0
|
87 |
}
|
sl@0
|
88 |
|
sl@0
|
89 |
return ret;
|
sl@0
|
90 |
|
sl@0
|
91 |
}
|
sl@0
|
92 |
|
sl@0
|
93 |
|
sl@0
|
94 |
|
sl@0
|
95 |
TInt CFloggerTest025_BuildTestUdeb1::DoTestCheckWriteL()
|
sl@0
|
96 |
{
|
sl@0
|
97 |
RFile theFile;
|
sl@0
|
98 |
HBufC8 * hBuffer;
|
sl@0
|
99 |
TInt listfilesize;
|
sl@0
|
100 |
TInt returnCode;
|
sl@0
|
101 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
102 |
|
sl@0
|
103 |
User::After(KTimeToLog);
|
sl@0
|
104 |
|
sl@0
|
105 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
106 |
|
sl@0
|
107 |
//Open the file in the read mode
|
sl@0
|
108 |
User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
|
sl@0
|
109 |
|
sl@0
|
110 |
CleanupClosePushL(theFile);
|
sl@0
|
111 |
|
sl@0
|
112 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
113 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
114 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
115 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
116 |
|
sl@0
|
117 |
// Read from position 0: start of file
|
sl@0
|
118 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
119 |
if (returnCode == KErrNone)
|
sl@0
|
120 |
returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read
|
sl@0
|
121 |
//from the file
|
sl@0
|
122 |
|
sl@0
|
123 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
124 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
125 |
if (returnCode > 0)
|
sl@0
|
126 |
return KErrNone;
|
sl@0
|
127 |
else
|
sl@0
|
128 |
return KErrGeneral;
|
sl@0
|
129 |
}
|
sl@0
|
130 |
|
sl@0
|
131 |
|
sl@0
|
132 |
|
sl@0
|
133 |
/**
|
sl@0
|
134 |
* 025_BuildTestUdeb2: Test that flogger builds clients correctly
|
sl@0
|
135 |
*/
|
sl@0
|
136 |
|
sl@0
|
137 |
// We've had to disable this test case since the building of the class TestLog2 library tlog2.lib causes a linkage
|
sl@0
|
138 |
// warning on WINS due to flogger.lib not being used in the debug build, but needed for the release build.
|
sl@0
|
139 |
|
sl@0
|
140 |
/*
|
sl@0
|
141 |
CFloggerTest025_BuildTestUdeb2::CFloggerTest025_BuildTestUdeb2()
|
sl@0
|
142 |
{
|
sl@0
|
143 |
// Store the name of this test case
|
sl@0
|
144 |
SetTestStepName(_L("step_025_BuildTestUdeb2"));
|
sl@0
|
145 |
}
|
sl@0
|
146 |
|
sl@0
|
147 |
|
sl@0
|
148 |
|
sl@0
|
149 |
|
sl@0
|
150 |
CFloggerTest025_BuildTestUdeb2::~CFloggerTest025_BuildTestUdeb2()
|
sl@0
|
151 |
{
|
sl@0
|
152 |
}
|
sl@0
|
153 |
|
sl@0
|
154 |
|
sl@0
|
155 |
|
sl@0
|
156 |
|
sl@0
|
157 |
TVerdict CFloggerTest025_BuildTestUdeb2::doTestStepL( )
|
sl@0
|
158 |
{
|
sl@0
|
159 |
if ( executeStepL() == KErrNone )
|
sl@0
|
160 |
SetTestStepResult(EPass);
|
sl@0
|
161 |
|
sl@0
|
162 |
else
|
sl@0
|
163 |
SetTestStepResult(EFail);
|
sl@0
|
164 |
|
sl@0
|
165 |
|
sl@0
|
166 |
|
sl@0
|
167 |
return TestStepResult();
|
sl@0
|
168 |
}
|
sl@0
|
169 |
|
sl@0
|
170 |
|
sl@0
|
171 |
|
sl@0
|
172 |
|
sl@0
|
173 |
TInt CFloggerTest025_BuildTestUdeb2::executeStepL()
|
sl@0
|
174 |
{
|
sl@0
|
175 |
|
sl@0
|
176 |
TInt ret;
|
sl@0
|
177 |
RFileLogger theFlogger;
|
sl@0
|
178 |
|
sl@0
|
179 |
ret = theFlogger.Connect();
|
sl@0
|
180 |
|
sl@0
|
181 |
if ( ret == KErrNone)
|
sl@0
|
182 |
{
|
sl@0
|
183 |
theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
|
sl@0
|
184 |
theFlogger.ClearLog();
|
sl@0
|
185 |
theFlogger.Close();
|
sl@0
|
186 |
|
sl@0
|
187 |
TestLog2::Test();
|
sl@0
|
188 |
ret = DoTestCheckWriteL();
|
sl@0
|
189 |
}
|
sl@0
|
190 |
|
sl@0
|
191 |
return ret;
|
sl@0
|
192 |
|
sl@0
|
193 |
}
|
sl@0
|
194 |
|
sl@0
|
195 |
|
sl@0
|
196 |
|
sl@0
|
197 |
TInt CFloggerTest025_BuildTestUdeb2::DoTestCheckWriteL()
|
sl@0
|
198 |
{
|
sl@0
|
199 |
RFile theFile;
|
sl@0
|
200 |
HBufC8 * hBuffer;
|
sl@0
|
201 |
TInt listfilesize;
|
sl@0
|
202 |
TInt returnCode;
|
sl@0
|
203 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
204 |
TInt numSuccessful = 0;
|
sl@0
|
205 |
|
sl@0
|
206 |
User::After(KTimeToLog);
|
sl@0
|
207 |
|
sl@0
|
208 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
209 |
|
sl@0
|
210 |
//Open the file in the read mode
|
sl@0
|
211 |
User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
|
sl@0
|
212 |
|
sl@0
|
213 |
CleanupClosePushL(theFile);
|
sl@0
|
214 |
|
sl@0
|
215 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
216 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
217 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
218 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
219 |
|
sl@0
|
220 |
// Read from position 0: start of file
|
sl@0
|
221 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
222 |
|
sl@0
|
223 |
// we should not find any log string
|
sl@0
|
224 |
if (returnCode == KErrNone)
|
sl@0
|
225 |
{
|
sl@0
|
226 |
returnCode = ptrString.Find(KTestMessage8);
|
sl@0
|
227 |
if (returnCode == KErrNotFound)
|
sl@0
|
228 |
{
|
sl@0
|
229 |
numSuccessful++;
|
sl@0
|
230 |
}
|
sl@0
|
231 |
}
|
sl@0
|
232 |
|
sl@0
|
233 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
234 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
235 |
if (numSuccessful > 0)
|
sl@0
|
236 |
return KErrNone;
|
sl@0
|
237 |
else
|
sl@0
|
238 |
return KErrGeneral;
|
sl@0
|
239 |
}
|
sl@0
|
240 |
|
sl@0
|
241 |
*/
|
sl@0
|
242 |
|
sl@0
|
243 |
/**
|
sl@0
|
244 |
* 025_BuildTestUdeb3: Test that flogger builds clients correctly
|
sl@0
|
245 |
*/
|
sl@0
|
246 |
|
sl@0
|
247 |
CFloggerTest025_BuildTestUdeb3::CFloggerTest025_BuildTestUdeb3()
|
sl@0
|
248 |
{
|
sl@0
|
249 |
// Store the name of this test case
|
sl@0
|
250 |
SetTestStepName(_L("step_025_BuildTestUdeb3"));
|
sl@0
|
251 |
}
|
sl@0
|
252 |
|
sl@0
|
253 |
|
sl@0
|
254 |
|
sl@0
|
255 |
|
sl@0
|
256 |
CFloggerTest025_BuildTestUdeb3::~CFloggerTest025_BuildTestUdeb3()
|
sl@0
|
257 |
{
|
sl@0
|
258 |
}
|
sl@0
|
259 |
|
sl@0
|
260 |
|
sl@0
|
261 |
|
sl@0
|
262 |
|
sl@0
|
263 |
TVerdict CFloggerTest025_BuildTestUdeb3::doTestStepL( )
|
sl@0
|
264 |
{
|
sl@0
|
265 |
if ( executeStepL() == KErrNone )
|
sl@0
|
266 |
SetTestStepResult(EPass);
|
sl@0
|
267 |
|
sl@0
|
268 |
else
|
sl@0
|
269 |
SetTestStepResult(EFail);
|
sl@0
|
270 |
|
sl@0
|
271 |
|
sl@0
|
272 |
|
sl@0
|
273 |
return TestStepResult();
|
sl@0
|
274 |
}
|
sl@0
|
275 |
|
sl@0
|
276 |
|
sl@0
|
277 |
TInt CFloggerTest025_BuildTestUdeb3::executeStepL(TBool)
|
sl@0
|
278 |
{
|
sl@0
|
279 |
return KErrGeneral;
|
sl@0
|
280 |
}
|
sl@0
|
281 |
|
sl@0
|
282 |
TInt CFloggerTest025_BuildTestUdeb3::executeStepL()
|
sl@0
|
283 |
{
|
sl@0
|
284 |
|
sl@0
|
285 |
TInt ret;
|
sl@0
|
286 |
RFileLogger theFlogger;
|
sl@0
|
287 |
|
sl@0
|
288 |
ret = theFlogger.Connect();
|
sl@0
|
289 |
|
sl@0
|
290 |
if ( ret == KErrNone)
|
sl@0
|
291 |
{
|
sl@0
|
292 |
theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
|
sl@0
|
293 |
theFlogger.ClearLog();
|
sl@0
|
294 |
theFlogger.Close();
|
sl@0
|
295 |
|
sl@0
|
296 |
TestLog3::Test();
|
sl@0
|
297 |
ret = DoTestCheckWriteL();
|
sl@0
|
298 |
}
|
sl@0
|
299 |
|
sl@0
|
300 |
return ret;
|
sl@0
|
301 |
|
sl@0
|
302 |
}
|
sl@0
|
303 |
|
sl@0
|
304 |
|
sl@0
|
305 |
|
sl@0
|
306 |
TInt CFloggerTest025_BuildTestUdeb3::DoTestCheckWriteL()
|
sl@0
|
307 |
{
|
sl@0
|
308 |
RFile theFile;
|
sl@0
|
309 |
HBufC8 * hBuffer;
|
sl@0
|
310 |
TInt listfilesize;
|
sl@0
|
311 |
TInt returnCode;
|
sl@0
|
312 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
313 |
TInt numSuccessful = 0;
|
sl@0
|
314 |
|
sl@0
|
315 |
User::After(KTimeToLog);
|
sl@0
|
316 |
|
sl@0
|
317 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
318 |
|
sl@0
|
319 |
//Open the file in the read mode
|
sl@0
|
320 |
User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
|
sl@0
|
321 |
|
sl@0
|
322 |
CleanupClosePushL(theFile);
|
sl@0
|
323 |
|
sl@0
|
324 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
325 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
326 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
327 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
328 |
|
sl@0
|
329 |
// Read from position 0: start of file
|
sl@0
|
330 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
331 |
|
sl@0
|
332 |
// we should not find any log string
|
sl@0
|
333 |
if (returnCode == KErrNone)
|
sl@0
|
334 |
{
|
sl@0
|
335 |
returnCode = ptrString.Find(KTestMessage8);
|
sl@0
|
336 |
if (returnCode == KErrNotFound)
|
sl@0
|
337 |
{
|
sl@0
|
338 |
numSuccessful++;
|
sl@0
|
339 |
}
|
sl@0
|
340 |
}
|
sl@0
|
341 |
|
sl@0
|
342 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
343 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
344 |
if (numSuccessful > 0)
|
sl@0
|
345 |
return KErrNone;
|
sl@0
|
346 |
else
|
sl@0
|
347 |
return KErrGeneral;
|
sl@0
|
348 |
}
|
sl@0
|
349 |
|
sl@0
|
350 |
|
sl@0
|
351 |
|
sl@0
|
352 |
|
sl@0
|
353 |
|
sl@0
|
354 |
|
sl@0
|
355 |
/**
|
sl@0
|
356 |
* 025_BuildTestUdeb4: Test that flogger builds clients correctly
|
sl@0
|
357 |
*/
|
sl@0
|
358 |
|
sl@0
|
359 |
CFloggerTest025_BuildTestUdeb4::CFloggerTest025_BuildTestUdeb4()
|
sl@0
|
360 |
{
|
sl@0
|
361 |
// Store the name of this test case
|
sl@0
|
362 |
SetTestStepName(_L("step_025_BuildTestUdeb4"));
|
sl@0
|
363 |
}
|
sl@0
|
364 |
|
sl@0
|
365 |
|
sl@0
|
366 |
|
sl@0
|
367 |
|
sl@0
|
368 |
CFloggerTest025_BuildTestUdeb4::~CFloggerTest025_BuildTestUdeb4()
|
sl@0
|
369 |
{
|
sl@0
|
370 |
}
|
sl@0
|
371 |
|
sl@0
|
372 |
|
sl@0
|
373 |
|
sl@0
|
374 |
|
sl@0
|
375 |
TVerdict CFloggerTest025_BuildTestUdeb4::doTestStepL( )
|
sl@0
|
376 |
{
|
sl@0
|
377 |
if ( executeStepL() == KErrNone )
|
sl@0
|
378 |
SetTestStepResult(EPass);
|
sl@0
|
379 |
|
sl@0
|
380 |
else
|
sl@0
|
381 |
SetTestStepResult(EFail);
|
sl@0
|
382 |
|
sl@0
|
383 |
|
sl@0
|
384 |
|
sl@0
|
385 |
return TestStepResult();
|
sl@0
|
386 |
}
|
sl@0
|
387 |
|
sl@0
|
388 |
|
sl@0
|
389 |
TInt CFloggerTest025_BuildTestUdeb4::executeStepL(TBool)
|
sl@0
|
390 |
{
|
sl@0
|
391 |
return KErrGeneral;
|
sl@0
|
392 |
}
|
sl@0
|
393 |
|
sl@0
|
394 |
TInt CFloggerTest025_BuildTestUdeb4::executeStepL()
|
sl@0
|
395 |
{
|
sl@0
|
396 |
|
sl@0
|
397 |
TInt ret;
|
sl@0
|
398 |
RFileLogger theFlogger;
|
sl@0
|
399 |
|
sl@0
|
400 |
ret = theFlogger.Connect();
|
sl@0
|
401 |
|
sl@0
|
402 |
if ( ret == KErrNone)
|
sl@0
|
403 |
{
|
sl@0
|
404 |
theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
|
sl@0
|
405 |
theFlogger.ClearLog();
|
sl@0
|
406 |
theFlogger.Close();
|
sl@0
|
407 |
|
sl@0
|
408 |
TestLog4::Test();
|
sl@0
|
409 |
ret = DoTestCheckWriteL();
|
sl@0
|
410 |
}
|
sl@0
|
411 |
|
sl@0
|
412 |
return ret;
|
sl@0
|
413 |
|
sl@0
|
414 |
}
|
sl@0
|
415 |
|
sl@0
|
416 |
|
sl@0
|
417 |
|
sl@0
|
418 |
TInt CFloggerTest025_BuildTestUdeb4::DoTestCheckWriteL()
|
sl@0
|
419 |
{
|
sl@0
|
420 |
RFile theFile;
|
sl@0
|
421 |
HBufC8 * hBuffer;
|
sl@0
|
422 |
TInt listfilesize;
|
sl@0
|
423 |
TInt returnCode;
|
sl@0
|
424 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
425 |
|
sl@0
|
426 |
User::After(KTimeToLog);
|
sl@0
|
427 |
|
sl@0
|
428 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
429 |
|
sl@0
|
430 |
//Open the file in the read mode
|
sl@0
|
431 |
User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
|
sl@0
|
432 |
|
sl@0
|
433 |
CleanupClosePushL(theFile);
|
sl@0
|
434 |
|
sl@0
|
435 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
436 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
437 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
438 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
439 |
|
sl@0
|
440 |
// Read from position 0: start of file
|
sl@0
|
441 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
442 |
if (returnCode == KErrNone)
|
sl@0
|
443 |
returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read
|
sl@0
|
444 |
//from the file
|
sl@0
|
445 |
|
sl@0
|
446 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
447 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
448 |
if (returnCode > 0)
|
sl@0
|
449 |
return KErrNone;
|
sl@0
|
450 |
else
|
sl@0
|
451 |
return KErrGeneral;
|
sl@0
|
452 |
}
|
sl@0
|
453 |
|
sl@0
|
454 |
|
sl@0
|
455 |
|
sl@0
|
456 |
|
sl@0
|
457 |
/**
|
sl@0
|
458 |
* 025_BuildTestUrel1: Test that flogger builds clients correctly
|
sl@0
|
459 |
*/
|
sl@0
|
460 |
|
sl@0
|
461 |
CFloggerTest025_BuildTestUrel1::CFloggerTest025_BuildTestUrel1()
|
sl@0
|
462 |
{
|
sl@0
|
463 |
// Store the name of this test case
|
sl@0
|
464 |
SetTestStepName(_L("step_025_BuildTestUrel1"));
|
sl@0
|
465 |
}
|
sl@0
|
466 |
|
sl@0
|
467 |
|
sl@0
|
468 |
|
sl@0
|
469 |
|
sl@0
|
470 |
CFloggerTest025_BuildTestUrel1::~CFloggerTest025_BuildTestUrel1()
|
sl@0
|
471 |
{
|
sl@0
|
472 |
}
|
sl@0
|
473 |
|
sl@0
|
474 |
|
sl@0
|
475 |
|
sl@0
|
476 |
|
sl@0
|
477 |
TVerdict CFloggerTest025_BuildTestUrel1::doTestStepL( )
|
sl@0
|
478 |
{
|
sl@0
|
479 |
if ( executeStepL() == KErrNone )
|
sl@0
|
480 |
SetTestStepResult(EPass);
|
sl@0
|
481 |
|
sl@0
|
482 |
else
|
sl@0
|
483 |
SetTestStepResult(EFail);
|
sl@0
|
484 |
|
sl@0
|
485 |
|
sl@0
|
486 |
|
sl@0
|
487 |
return TestStepResult();
|
sl@0
|
488 |
}
|
sl@0
|
489 |
|
sl@0
|
490 |
|
sl@0
|
491 |
TInt CFloggerTest025_BuildTestUrel1::executeStepL(TBool)
|
sl@0
|
492 |
{
|
sl@0
|
493 |
return KErrGeneral;
|
sl@0
|
494 |
}
|
sl@0
|
495 |
|
sl@0
|
496 |
TInt CFloggerTest025_BuildTestUrel1::executeStepL()
|
sl@0
|
497 |
{
|
sl@0
|
498 |
|
sl@0
|
499 |
TInt ret;
|
sl@0
|
500 |
RFileLogger theFlogger;
|
sl@0
|
501 |
|
sl@0
|
502 |
ret = theFlogger.Connect();
|
sl@0
|
503 |
|
sl@0
|
504 |
if ( ret == KErrNone)
|
sl@0
|
505 |
{
|
sl@0
|
506 |
theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
|
sl@0
|
507 |
theFlogger.ClearLog();
|
sl@0
|
508 |
theFlogger.Close();
|
sl@0
|
509 |
|
sl@0
|
510 |
TestLog1::Test();
|
sl@0
|
511 |
ret = DoTestCheckWriteL();
|
sl@0
|
512 |
}
|
sl@0
|
513 |
|
sl@0
|
514 |
return ret;
|
sl@0
|
515 |
|
sl@0
|
516 |
}
|
sl@0
|
517 |
|
sl@0
|
518 |
|
sl@0
|
519 |
|
sl@0
|
520 |
TInt CFloggerTest025_BuildTestUrel1::DoTestCheckWriteL()
|
sl@0
|
521 |
{
|
sl@0
|
522 |
RFile theFile;
|
sl@0
|
523 |
HBufC8 * hBuffer;
|
sl@0
|
524 |
TInt listfilesize;
|
sl@0
|
525 |
TInt returnCode;
|
sl@0
|
526 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
527 |
TInt numSuccessful = 0;
|
sl@0
|
528 |
|
sl@0
|
529 |
User::After(KTimeToLog);
|
sl@0
|
530 |
|
sl@0
|
531 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
532 |
|
sl@0
|
533 |
//Open the file in the read mode
|
sl@0
|
534 |
User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
|
sl@0
|
535 |
|
sl@0
|
536 |
CleanupClosePushL(theFile);
|
sl@0
|
537 |
|
sl@0
|
538 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
539 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
540 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
541 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
542 |
|
sl@0
|
543 |
// Read from position 0: start of file
|
sl@0
|
544 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
545 |
|
sl@0
|
546 |
// we should not find any log string
|
sl@0
|
547 |
if (returnCode == KErrNone)
|
sl@0
|
548 |
{
|
sl@0
|
549 |
returnCode = ptrString.Find(KTestMessage8);
|
sl@0
|
550 |
if (returnCode == KErrNotFound)
|
sl@0
|
551 |
{
|
sl@0
|
552 |
numSuccessful++;
|
sl@0
|
553 |
}
|
sl@0
|
554 |
}
|
sl@0
|
555 |
|
sl@0
|
556 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
557 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
558 |
if (numSuccessful > 0)
|
sl@0
|
559 |
return KErrNone;
|
sl@0
|
560 |
else
|
sl@0
|
561 |
return KErrGeneral;
|
sl@0
|
562 |
}
|
sl@0
|
563 |
|
sl@0
|
564 |
|
sl@0
|
565 |
/**
|
sl@0
|
566 |
* 025_BuildTestUrel2: Test that flogger builds clients correctly
|
sl@0
|
567 |
*/
|
sl@0
|
568 |
|
sl@0
|
569 |
// We've had to disable this test case since the building of the class TestLog2 library tlog2.lib causes a linkage
|
sl@0
|
570 |
// warning on WINS due to flogger.lib not being used in the debug build, but needed for the release build.
|
sl@0
|
571 |
|
sl@0
|
572 |
/*
|
sl@0
|
573 |
CFloggerTest025_BuildTestUrel2::CFloggerTest025_BuildTestUrel2()
|
sl@0
|
574 |
{
|
sl@0
|
575 |
// Store the name of this test case
|
sl@0
|
576 |
SetTestStepName(_L("step_025_BuildTestUrel2"));
|
sl@0
|
577 |
}
|
sl@0
|
578 |
|
sl@0
|
579 |
|
sl@0
|
580 |
|
sl@0
|
581 |
|
sl@0
|
582 |
CFloggerTest025_BuildTestUrel2::~CFloggerTest025_BuildTestUrel2()
|
sl@0
|
583 |
{
|
sl@0
|
584 |
}
|
sl@0
|
585 |
|
sl@0
|
586 |
|
sl@0
|
587 |
|
sl@0
|
588 |
|
sl@0
|
589 |
TVerdict CFloggerTest025_BuildTestUrel2::doTestStepL( )
|
sl@0
|
590 |
{
|
sl@0
|
591 |
if ( executeStepL() == KErrNone )
|
sl@0
|
592 |
SetTestStepResult(EPass);
|
sl@0
|
593 |
|
sl@0
|
594 |
else
|
sl@0
|
595 |
SetTestStepResult(EFail);
|
sl@0
|
596 |
|
sl@0
|
597 |
|
sl@0
|
598 |
|
sl@0
|
599 |
return TestStepResult();
|
sl@0
|
600 |
}
|
sl@0
|
601 |
|
sl@0
|
602 |
|
sl@0
|
603 |
|
sl@0
|
604 |
|
sl@0
|
605 |
TInt CFloggerTest025_BuildTestUrel2::executeStepL()
|
sl@0
|
606 |
{
|
sl@0
|
607 |
|
sl@0
|
608 |
TInt ret;
|
sl@0
|
609 |
RFileLogger theFlogger;
|
sl@0
|
610 |
|
sl@0
|
611 |
ret = theFlogger.Connect();
|
sl@0
|
612 |
|
sl@0
|
613 |
if ( ret == KErrNone)
|
sl@0
|
614 |
{
|
sl@0
|
615 |
theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
|
sl@0
|
616 |
theFlogger.ClearLog();
|
sl@0
|
617 |
theFlogger.Close();
|
sl@0
|
618 |
|
sl@0
|
619 |
TestLog2::Test();
|
sl@0
|
620 |
ret = DoTestCheckWriteL();
|
sl@0
|
621 |
}
|
sl@0
|
622 |
|
sl@0
|
623 |
return ret;
|
sl@0
|
624 |
|
sl@0
|
625 |
}
|
sl@0
|
626 |
|
sl@0
|
627 |
|
sl@0
|
628 |
|
sl@0
|
629 |
TInt CFloggerTest025_BuildTestUrel2::DoTestCheckWriteL()
|
sl@0
|
630 |
{
|
sl@0
|
631 |
RFile theFile;
|
sl@0
|
632 |
HBufC8 * hBuffer;
|
sl@0
|
633 |
TInt listfilesize;
|
sl@0
|
634 |
TInt returnCode;
|
sl@0
|
635 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
636 |
|
sl@0
|
637 |
User::After(KTimeToLog);
|
sl@0
|
638 |
|
sl@0
|
639 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
640 |
|
sl@0
|
641 |
//Open the file in the read mode
|
sl@0
|
642 |
User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
|
sl@0
|
643 |
|
sl@0
|
644 |
CleanupClosePushL(theFile);
|
sl@0
|
645 |
|
sl@0
|
646 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
647 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
648 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
649 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
650 |
|
sl@0
|
651 |
// Read from position 0: start of file
|
sl@0
|
652 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
653 |
if (returnCode == KErrNone)
|
sl@0
|
654 |
returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read
|
sl@0
|
655 |
//from the file
|
sl@0
|
656 |
|
sl@0
|
657 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
658 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
659 |
if (returnCode > 0)
|
sl@0
|
660 |
return KErrNone;
|
sl@0
|
661 |
else
|
sl@0
|
662 |
return KErrGeneral;
|
sl@0
|
663 |
}
|
sl@0
|
664 |
|
sl@0
|
665 |
*/
|
sl@0
|
666 |
|
sl@0
|
667 |
/**
|
sl@0
|
668 |
* 025_BuildTestUrel3: Test that flogger builds clients correctly
|
sl@0
|
669 |
*/
|
sl@0
|
670 |
|
sl@0
|
671 |
CFloggerTest025_BuildTestUrel3::CFloggerTest025_BuildTestUrel3()
|
sl@0
|
672 |
{
|
sl@0
|
673 |
// Store the name of this test case
|
sl@0
|
674 |
SetTestStepName(_L("step_025_BuildTestUrel3"));
|
sl@0
|
675 |
}
|
sl@0
|
676 |
|
sl@0
|
677 |
|
sl@0
|
678 |
|
sl@0
|
679 |
|
sl@0
|
680 |
CFloggerTest025_BuildTestUrel3::~CFloggerTest025_BuildTestUrel3()
|
sl@0
|
681 |
{
|
sl@0
|
682 |
}
|
sl@0
|
683 |
|
sl@0
|
684 |
|
sl@0
|
685 |
|
sl@0
|
686 |
|
sl@0
|
687 |
TVerdict CFloggerTest025_BuildTestUrel3::doTestStepL( )
|
sl@0
|
688 |
{
|
sl@0
|
689 |
if ( executeStepL() == KErrNone )
|
sl@0
|
690 |
SetTestStepResult(EPass);
|
sl@0
|
691 |
|
sl@0
|
692 |
else
|
sl@0
|
693 |
SetTestStepResult(EFail);
|
sl@0
|
694 |
|
sl@0
|
695 |
|
sl@0
|
696 |
|
sl@0
|
697 |
return TestStepResult();
|
sl@0
|
698 |
}
|
sl@0
|
699 |
|
sl@0
|
700 |
|
sl@0
|
701 |
TInt CFloggerTest025_BuildTestUrel3::executeStepL(TBool)
|
sl@0
|
702 |
{
|
sl@0
|
703 |
return KErrGeneral;
|
sl@0
|
704 |
}
|
sl@0
|
705 |
|
sl@0
|
706 |
TInt CFloggerTest025_BuildTestUrel3::executeStepL()
|
sl@0
|
707 |
{
|
sl@0
|
708 |
|
sl@0
|
709 |
TInt ret;
|
sl@0
|
710 |
RFileLogger theFlogger;
|
sl@0
|
711 |
|
sl@0
|
712 |
ret = theFlogger.Connect();
|
sl@0
|
713 |
|
sl@0
|
714 |
if ( ret == KErrNone)
|
sl@0
|
715 |
{
|
sl@0
|
716 |
theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
|
sl@0
|
717 |
theFlogger.ClearLog();
|
sl@0
|
718 |
theFlogger.Close();
|
sl@0
|
719 |
|
sl@0
|
720 |
TestLog3::Test();
|
sl@0
|
721 |
ret = DoTestCheckWriteL();
|
sl@0
|
722 |
}
|
sl@0
|
723 |
|
sl@0
|
724 |
return ret;
|
sl@0
|
725 |
|
sl@0
|
726 |
}
|
sl@0
|
727 |
|
sl@0
|
728 |
|
sl@0
|
729 |
|
sl@0
|
730 |
TInt CFloggerTest025_BuildTestUrel3::DoTestCheckWriteL()
|
sl@0
|
731 |
{
|
sl@0
|
732 |
RFile theFile;
|
sl@0
|
733 |
HBufC8 * hBuffer;
|
sl@0
|
734 |
TInt listfilesize;
|
sl@0
|
735 |
TInt returnCode;
|
sl@0
|
736 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
737 |
TInt numSuccessful = 0;
|
sl@0
|
738 |
|
sl@0
|
739 |
User::After(KTimeToLog);
|
sl@0
|
740 |
|
sl@0
|
741 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
742 |
|
sl@0
|
743 |
//Open the file in the read mode
|
sl@0
|
744 |
User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
|
sl@0
|
745 |
|
sl@0
|
746 |
CleanupClosePushL(theFile);
|
sl@0
|
747 |
|
sl@0
|
748 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
749 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
750 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
751 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
752 |
|
sl@0
|
753 |
// Read from position 0: start of file
|
sl@0
|
754 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
755 |
|
sl@0
|
756 |
// we should not find any log string
|
sl@0
|
757 |
if (returnCode == KErrNone)
|
sl@0
|
758 |
{
|
sl@0
|
759 |
returnCode = ptrString.Find(KTestMessage8);
|
sl@0
|
760 |
if (returnCode == KErrNotFound)
|
sl@0
|
761 |
{
|
sl@0
|
762 |
numSuccessful++;
|
sl@0
|
763 |
}
|
sl@0
|
764 |
}
|
sl@0
|
765 |
|
sl@0
|
766 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
767 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
768 |
if (numSuccessful > 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 |
|
sl@0
|
778 |
|
sl@0
|
779 |
/**
|
sl@0
|
780 |
* 025_BuildTestUrel4: Test that flogger builds clients correctly
|
sl@0
|
781 |
*/
|
sl@0
|
782 |
|
sl@0
|
783 |
CFloggerTest025_BuildTestUrel4::CFloggerTest025_BuildTestUrel4()
|
sl@0
|
784 |
{
|
sl@0
|
785 |
// Store the name of this test case
|
sl@0
|
786 |
SetTestStepName(_L("step_025_BuildTestUrel4"));
|
sl@0
|
787 |
}
|
sl@0
|
788 |
|
sl@0
|
789 |
|
sl@0
|
790 |
|
sl@0
|
791 |
|
sl@0
|
792 |
CFloggerTest025_BuildTestUrel4::~CFloggerTest025_BuildTestUrel4()
|
sl@0
|
793 |
{
|
sl@0
|
794 |
}
|
sl@0
|
795 |
|
sl@0
|
796 |
|
sl@0
|
797 |
|
sl@0
|
798 |
|
sl@0
|
799 |
TVerdict CFloggerTest025_BuildTestUrel4::doTestStepL( )
|
sl@0
|
800 |
{
|
sl@0
|
801 |
if ( executeStepL() == KErrNone )
|
sl@0
|
802 |
SetTestStepResult(EPass);
|
sl@0
|
803 |
|
sl@0
|
804 |
else
|
sl@0
|
805 |
SetTestStepResult(EFail);
|
sl@0
|
806 |
|
sl@0
|
807 |
|
sl@0
|
808 |
|
sl@0
|
809 |
return TestStepResult();
|
sl@0
|
810 |
}
|
sl@0
|
811 |
|
sl@0
|
812 |
|
sl@0
|
813 |
TInt CFloggerTest025_BuildTestUrel4::executeStepL(TBool)
|
sl@0
|
814 |
{
|
sl@0
|
815 |
return KErrGeneral;
|
sl@0
|
816 |
}
|
sl@0
|
817 |
|
sl@0
|
818 |
TInt CFloggerTest025_BuildTestUrel4::executeStepL()
|
sl@0
|
819 |
{
|
sl@0
|
820 |
|
sl@0
|
821 |
TInt ret;
|
sl@0
|
822 |
RFileLogger theFlogger;
|
sl@0
|
823 |
|
sl@0
|
824 |
ret = theFlogger.Connect();
|
sl@0
|
825 |
|
sl@0
|
826 |
if ( ret == KErrNone)
|
sl@0
|
827 |
{
|
sl@0
|
828 |
theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
|
sl@0
|
829 |
theFlogger.ClearLog();
|
sl@0
|
830 |
theFlogger.Close();
|
sl@0
|
831 |
|
sl@0
|
832 |
TestLog4::Test();
|
sl@0
|
833 |
ret = DoTestCheckWriteL();
|
sl@0
|
834 |
}
|
sl@0
|
835 |
|
sl@0
|
836 |
return ret;
|
sl@0
|
837 |
|
sl@0
|
838 |
}
|
sl@0
|
839 |
|
sl@0
|
840 |
|
sl@0
|
841 |
|
sl@0
|
842 |
TInt CFloggerTest025_BuildTestUrel4::DoTestCheckWriteL()
|
sl@0
|
843 |
{
|
sl@0
|
844 |
RFile theFile;
|
sl@0
|
845 |
HBufC8 * hBuffer;
|
sl@0
|
846 |
TInt listfilesize;
|
sl@0
|
847 |
TInt returnCode;
|
sl@0
|
848 |
RFs fileSystem; //For file operation create a file system
|
sl@0
|
849 |
|
sl@0
|
850 |
User::After(KTimeToLog);
|
sl@0
|
851 |
|
sl@0
|
852 |
User::LeaveIfError(fileSystem.Connect());
|
sl@0
|
853 |
|
sl@0
|
854 |
//Open the file in the read mode
|
sl@0
|
855 |
User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
|
sl@0
|
856 |
|
sl@0
|
857 |
CleanupClosePushL(theFile);
|
sl@0
|
858 |
|
sl@0
|
859 |
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
|
sl@0
|
860 |
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
|
sl@0
|
861 |
CleanupStack::PushL(hBuffer);
|
sl@0
|
862 |
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
|
sl@0
|
863 |
|
sl@0
|
864 |
// Read from position 0: start of file
|
sl@0
|
865 |
returnCode = theFile.Read(ptrString);
|
sl@0
|
866 |
if (returnCode == KErrNone)
|
sl@0
|
867 |
returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read
|
sl@0
|
868 |
//from the file
|
sl@0
|
869 |
|
sl@0
|
870 |
CleanupStack::PopAndDestroy(hBuffer);
|
sl@0
|
871 |
CleanupStack::PopAndDestroy(); // For theFile object
|
sl@0
|
872 |
if (returnCode > 0)
|
sl@0
|
873 |
return KErrNone;
|
sl@0
|
874 |
else
|
sl@0
|
875 |
return KErrGeneral;
|
sl@0
|
876 |
}
|
sl@0
|
877 |
|