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". |
11 // Contributors: |
11 // Contributors: |
12 // |
12 // |
13 // Description: |
13 // Description: |
14 // |
14 // |
15 |
15 |
16 #include "TEST.H" |
16 #include "t_logutil2.h" |
17 #include <logview.h> |
17 #include <logview.h> |
18 |
18 |
19 #undef test //there is a "test" macro which hides "RTest test" declaration. |
19 RTest TheTest(_L("t_lognotify")); |
20 |
|
21 RTest test(_L("Log Change Notification Test Harness")); |
|
22 |
20 |
23 _LIT(KTestRemoteParty1, "Remote Party"); |
21 _LIT(KTestRemoteParty1, "Remote Party"); |
24 _LIT(KTestDirection1, "Direction"); |
22 _LIT(KTestDirection1, "Direction"); |
25 const TLogDurationType KTestDurationType1 = 1; |
23 const TLogDurationType KTestDurationType1 = 1; |
26 const TLogDuration KTestDuration1 = 0x1234; |
24 const TLogDuration KTestDuration1 = 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 TestNotificationL() |
42 LOCAL_C void TestNotificationL() |
45 { |
43 { |
46 test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0926 ")); |
44 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0926 ")); |
47 CLogClient* client = CLogClient::NewL(theFs); |
45 CLogClient* client = CLogClient::NewL(theFs); |
48 CleanupStack::PushL(client); |
46 CleanupStack::PushL(client); |
49 |
47 |
50 CTestActive* active1 = new(ELeave)CTestActive; |
48 CTestActive* active1 = new(ELeave)CTestActive; |
51 CleanupStack::PushL(active1); |
49 CleanupStack::PushL(active1); |
198 @SYMTestExpectedResults Test must not fail |
196 @SYMTestExpectedResults Test must not fail |
199 @SYMREQ REQ0000 |
197 @SYMREQ REQ0000 |
200 */ |
198 */ |
201 LOCAL_C void TestCancelNotificationL() |
199 LOCAL_C void TestCancelNotificationL() |
202 { |
200 { |
203 test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0927 ")); |
201 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0927 ")); |
204 CLogClient* client = CLogClient::NewL(theFs); |
202 CLogClient* client = CLogClient::NewL(theFs); |
205 CleanupStack::PushL(client); |
203 CleanupStack::PushL(client); |
206 |
204 |
207 CTestActive* active1 = new(ELeave)CTestActive; |
205 CTestActive* active1 = new(ELeave)CTestActive; |
208 CleanupStack::PushL(active1); |
206 CleanupStack::PushL(active1); |
319 @SYMTestExpectedResults Test must not fail |
317 @SYMTestExpectedResults Test must not fail |
320 @SYMREQ REQ0000 |
318 @SYMREQ REQ0000 |
321 */ |
319 */ |
322 LOCAL_C void TestViewPurgeNotifyL() |
320 LOCAL_C void TestViewPurgeNotifyL() |
323 { |
321 { |
324 test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0928 ")); |
322 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0928 ")); |
325 CTestTimer* timer = CTestTimer::NewL(); |
323 CTestTimer* timer = CTestTimer::NewL(); |
326 CleanupStack::PushL(timer); |
324 CleanupStack::PushL(timer); |
327 |
325 |
328 CTestActive* active = new(ELeave)CTestActive(); |
326 CTestActive* active = new(ELeave)CTestActive(); |
329 CleanupStack::PushL(active); |
327 CleanupStack::PushL(active); |
386 @SYMTestExpectedResults Test must not fail |
384 @SYMTestExpectedResults Test must not fail |
387 @SYMREQ REQ0000 |
385 @SYMREQ REQ0000 |
388 */ |
386 */ |
389 LOCAL_C void INC045485L() |
387 LOCAL_C void INC045485L() |
390 { |
388 { |
391 test.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0929 ")); |
389 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0929 ")); |
392 const TInt KEventCnt = 5;//test events count |
390 const TInt KEventCnt = 5;//test events count |
393 const TInt KSizeOfEventData = 400;//should be bigger than KLogSizeOfEventGuess constant |
391 const TInt KSizeOfEventData = 400;//should be bigger than KLogSizeOfEventGuess constant |
394 //Create client, active, event |
392 //Create client, active, event |
395 CLogClient* client = CLogClient::NewL(theFs); |
393 CLogClient* client = CLogClient::NewL(theFs); |
396 CleanupStack::PushL(client); |
394 CleanupStack::PushL(client); |
435 { |
433 { |
436 active->StartL(); |
434 active->StartL(); |
437 CActiveScheduler::Start(); |
435 CActiveScheduler::Start(); |
438 TEST2(active->iStatus.Int(), KErrNone);//If the defect is not fixed this check fails with "KErrOverflow" |
436 TEST2(active->iStatus.Int(), KErrNone);//If the defect is not fixed this check fails with "KErrOverflow" |
439 const CLogEvent& e = view->Event(); |
437 const CLogEvent& e = view->Event(); |
440 RDebug::Print(_L("View Entry[%d]: Id:%d, Type:%x\n"), j, e.Id(), e.EventType().iUid); |
438 TheTest.Printf(_L("View Entry[%d]: Id:%d, Type:%x\n"), j, e.Id(), e.EventType().iUid); |
441 const TDesC8& data = e.Data(); |
439 const TDesC8& data = e.Data(); |
442 TEST(data.Length() == KSizeOfEventData); |
440 TEST(data.Length() == KSizeOfEventData); |
443 //Touch the data. |
441 //Touch the data. |
444 for(TInt k=0;k<KSizeOfEventData;++k) |
442 for(TInt k=0;k<KSizeOfEventData;++k) |
445 { |
443 { |
518 { |
516 { |
519 active->StartL(); |
517 active->StartL(); |
520 CActiveScheduler::Start(); |
518 CActiveScheduler::Start(); |
521 TEST2(active->iStatus.Int(), KErrNone); |
519 TEST2(active->iStatus.Int(), KErrNone); |
522 const CLogEvent& e = view->Event(); |
520 const CLogEvent& e = view->Event(); |
523 RDebug::Print(_L("View Entry[%d]: Id:%d, Type:%x\n"), j, e.Id(), e.EventType().iUid); |
521 TheTest.Printf(_L("View Entry[%d]: Id:%d, Type:%x\n"), j, e.Id(), e.EventType().iUid); |
524 const TDesC8& data = e.Data(); |
522 const TDesC8& data = e.Data(); |
525 TEST(data.Length() == KSizeOfEventData); |
523 TEST(data.Length() == KSizeOfEventData); |
526 //Touch the data. |
524 //Touch the data. |
527 for(TInt k=0;k<KSizeOfEventData;++k) |
525 for(TInt k=0;k<KSizeOfEventData;++k) |
528 { |
526 { |
541 CleanupStack::PopAndDestroy(client1); |
539 CleanupStack::PopAndDestroy(client1); |
542 } |
540 } |
543 |
541 |
544 void doTestsL() |
542 void doTestsL() |
545 { |
543 { |
546 TestUtils::Initialize(_L("T_LOGNOTIFY")); |
544 TestUtils::Initialize(_L("t_lognotify")); |
547 TestUtils::DeleteDatabaseL(); |
545 TestUtils::DeleteDatabaseL(); |
548 |
546 |
549 test.Start(_L("Notifications")); |
547 TheTest.Start(_L("Notifications")); |
550 TestNotificationL(); |
548 TestNotificationL(); |
551 theLog.Write(_L8("Test 1 OK\n")); |
549 theLog.Write(_L8("Test 1 OK\n")); |
552 |
550 |
553 test.Next(_L("INC045485")); |
551 TheTest.Next(_L("INC045485")); |
554 ::INC045485L(); |
552 ::INC045485L(); |
555 |
553 |
556 test.Next(_L("Cancelling Notifications")); |
554 TheTest.Next(_L("Cancelling Notifications")); |
557 TestCancelNotificationL(); |
555 TestCancelNotificationL(); |
558 theLog.Write(_L8("Test 2 OK\n")); |
556 theLog.Write(_L8("Test 2 OK\n")); |
559 |
557 |
560 test.Next(_L("Notify with View Purge")); |
558 TheTest.Next(_L("Notify with View Purge")); |
561 TestViewPurgeNotifyL(); |
559 TestViewPurgeNotifyL(); |
562 theLog.Write(_L8("Test 3 OK\n")); |
560 theLog.Write(_L8("Test 3 OK\n")); |
563 |
561 |
564 test.Next(_L("DEF060381")); |
562 TheTest.Next(_L("DEF060381")); |
565 ::DEF060381L(); |
563 ::DEF060381L(); |
566 } |
564 } |