equal
deleted
inserted
replaced
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
13 // Description: |
13 // Description: |
14 // |
14 // |
15 |
15 |
16 #include <s32file.h> |
16 #include <s32file.h> |
17 #include <bautils.h> |
17 #include <bautils.h> |
18 #include "TEST.H" |
18 #include "t_logutil2.h" |
19 |
19 |
20 #undef test //there is a "test" macro which hides "RTest test" declaration. |
20 RTest TheTest(_L("t_logwrap")); |
21 |
|
22 RTest test(_L("Log Wrapper Test Harness")); |
|
23 |
21 |
24 _LIT(KTestRemoteParty, "Remote Party"); |
22 _LIT(KTestRemoteParty, "Remote Party"); |
25 _LIT(KTestDirection, "Direction"); |
23 _LIT(KTestDirection, "Direction"); |
26 const TLogDurationType KTestDurationType = 1; |
24 const TLogDurationType KTestDurationType = 1; |
27 const TLogDuration KTestDuration = 0x1234; |
25 const TLogDuration KTestDuration = 0x1234; |
41 @SYMTestExpectedResults Test must not fail |
39 @SYMTestExpectedResults Test must not fail |
42 @SYMREQ REQ0000 |
40 @SYMREQ REQ0000 |
43 */ |
41 */ |
44 LOCAL_C void TestBasicL(CLogBase& aClient, TBool aClientAvailable) |
42 LOCAL_C void TestBasicL(CLogBase& aClient, TBool aClientAvailable) |
45 { |
43 { |
46 test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1011 ")); |
44 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1011 ")); |
47 CTestActive* active = new(ELeave)CTestActive(); |
45 CTestActive* active = new(ELeave)CTestActive(); |
48 CleanupStack::PushL(active); |
46 CleanupStack::PushL(active); |
49 |
47 |
50 CLogEvent* event = CLogEvent::NewL(); |
48 CLogEvent* event = CLogEvent::NewL(); |
51 CleanupStack::PushL(event); |
49 CleanupStack::PushL(event); |
190 @SYMTestExpectedResults Test must not fail |
188 @SYMTestExpectedResults Test must not fail |
191 @SYMREQ REQ0000 |
189 @SYMREQ REQ0000 |
192 */ |
190 */ |
193 LOCAL_C void TestWrapperL() |
191 LOCAL_C void TestWrapperL() |
194 { |
192 { |
195 test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1012 ")); |
193 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1012 ")); |
196 CTestActive* active = new(ELeave)CTestActive(); |
194 CTestActive* active = new(ELeave)CTestActive(); |
197 CleanupStack::PushL(active); |
195 CleanupStack::PushL(active); |
198 |
196 |
199 CLogWrapper* wrapper = CLogWrapper::NewL(theFs); |
197 CLogWrapper* wrapper = CLogWrapper::NewL(theFs); |
200 CleanupStack::PushL(wrapper); |
198 CleanupStack::PushL(wrapper); |
227 @SYMTestExpectedResults Test must not fail |
225 @SYMTestExpectedResults Test must not fail |
228 @SYMREQ REQ0000 |
226 @SYMREQ REQ0000 |
229 */ |
227 */ |
230 LOCAL_C void TestHeapFailL() |
228 LOCAL_C void TestHeapFailL() |
231 { |
229 { |
232 test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1013 ")); |
230 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1013 ")); |
233 CLogWrapper* wrapper = NULL; |
231 CLogWrapper* wrapper = NULL; |
234 |
232 |
235 #ifdef _DEBUG |
233 #ifdef _DEBUG |
236 TInt failCount = 0; |
234 TInt failCount = 0; |
237 #endif |
235 #endif |
268 @SYMTestExpectedResults Test must not fail |
266 @SYMTestExpectedResults Test must not fail |
269 @SYMREQ REQ0000 |
267 @SYMREQ REQ0000 |
270 */ |
268 */ |
271 LOCAL_C void TestFileFailL() |
269 LOCAL_C void TestFileFailL() |
272 { |
270 { |
273 test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1014 ")); |
271 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1014 ")); |
274 CLogWrapper* wrapper = NULL; |
272 CLogWrapper* wrapper = NULL; |
275 |
273 |
276 TInt failCount = 0; |
274 TInt failCount = 0; |
277 TBool finished = EFalse; |
275 TBool finished = EFalse; |
278 TInt error; |
276 TInt error; |
306 @SYMTestExpectedResults Test must not fail |
304 @SYMTestExpectedResults Test must not fail |
307 @SYMREQ REQ0000 |
305 @SYMREQ REQ0000 |
308 */ |
306 */ |
309 LOCAL_C void Test4INC047632L() |
307 LOCAL_C void Test4INC047632L() |
310 { |
308 { |
311 test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1015 ")); |
309 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1015 ")); |
312 #ifdef _DEBUG |
310 #ifdef _DEBUG |
313 TestUtils::CopyCorruptDbL(); |
311 TestUtils::CopyCorruptDbL(); |
314 |
312 |
315 // run basic test |
313 // run basic test |
316 CLogWrapper* wrapper = NULL; |
314 CLogWrapper* wrapper = NULL; |
339 @SYMTestExpectedResults Test must not fail |
337 @SYMTestExpectedResults Test must not fail |
340 @SYMDEF INC114909 |
338 @SYMDEF INC114909 |
341 */ |
339 */ |
342 LOCAL_C void Test5INC114909L() |
340 LOCAL_C void Test5INC114909L() |
343 { |
341 { |
344 test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-4001 ")); |
342 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-4001 ")); |
345 #ifdef _DEBUG |
343 #ifdef _DEBUG |
346 // Copy over the damaged database to be used. |
344 // Copy over the damaged database to be used. |
347 TestUtils::CopyCorruptDamagedDbL(); |
345 TestUtils::CopyCorruptDamagedDbL(); |
348 |
346 |
349 // run basic test |
347 // run basic test |
370 #endif//_DEBUG |
368 #endif//_DEBUG |
371 } |
369 } |
372 |
370 |
373 void doTestsL() |
371 void doTestsL() |
374 { |
372 { |
375 TestUtils::Initialize(_L("T_LOGWRAP")); |
373 TestUtils::Initialize(_L("t_logwrap")); |
376 |
374 |
377 test.Start(_L("Wrapper")); |
375 TheTest.Start(_L("Wrapper")); |
378 TestWrapperL(); |
376 TestWrapperL(); |
379 theLog.Write(_L8("Test 1 OK\n")); |
377 theLog.Write(_L8("Test 1 OK\n")); |
380 |
378 |
381 test.Next(_L("Heap Failure")); |
379 TheTest.Next(_L("Heap Failure")); |
382 TestHeapFailL(); |
380 TestHeapFailL(); |
383 theLog.Write(_L8("Test 2 OK\n")); |
381 theLog.Write(_L8("Test 2 OK\n")); |
384 |
382 |
385 test.Next(_L("File Failure")); |
383 TheTest.Next(_L("File Failure")); |
386 TestFileFailL(); |
384 TestFileFailL(); |
387 theLog.Write(_L8("Test 3 OK\n")); |
385 theLog.Write(_L8("Test 3 OK\n")); |
388 |
386 |
389 test.Next(_L("Test4 for INC047632 - corrupt Logdbu.dat returns KErrEoF")); |
387 TheTest.Next(_L("Test4 for INC047632 - corrupt Logdbu.dat returns KErrEoF")); |
390 Test4INC047632L(); |
388 Test4INC047632L(); |
391 theLog.Write(_L8("Test 4 for INC047632 OK\n")); |
389 theLog.Write(_L8("Test 4 for INC047632 OK\n")); |
392 |
390 |
393 test.Next(_L("Test5 for INC114909 - test damaged Logdbu.dat is dealt with correctly ")); |
391 TheTest.Next(_L("Test5 for INC114909 - test damaged Logdbu.dat is dealt with correctly ")); |
394 Test5INC114909L(); |
392 Test5INC114909L(); |
395 theLog.Write(_L8("Test 5 for INC114909 OK\n")); |
393 theLog.Write(_L8("Test 5 for INC114909 OK\n")); |
396 } |
394 } |