Update contrib.
1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
18 #include "t_logutil2.h"
21 RTest TheTest(_L("t_logbackup"));
23 CBaBackupSessionWrapper* theBackup = NULL;
25 /////////////////////////////////////////////////////////////////////////////////////
26 /////////////////////////////////////////////////////////////////////////////////////
27 /////////////////////////////////////////////////////////////////////////////////////
30 _LIT(KTestEventDesc, "Event Type Description");
31 _LIT(KTestRemoteParty, "Remote Party");
32 _LIT(KTestDirection, "Direction");
33 const TLogDurationType KTestDurationType = 1;
34 const TLogDuration KTestDuration = 0x1234;
35 _LIT(KTestStatus, "Status");
36 _LIT(KTestSubject, "Subject");
37 _LIT(KTestNumber, "Number");
38 const TLogContactItemId KTestContact = 0x1234;
39 const TLogLink KTestLink = 0x1234;
40 _LIT8(KTestData, "ABCDEFGH");
41 _LIT(KTestNumber1, "TheNumber");
42 _LIT(KTestNumber2, "Changed Number");
44 class TClientObserverTestReceiver : public MLogClientChangeObserver
47 TClientObserverTestReceiver(TBool& aFlag) : iCallCount(0), iFlag(aFlag) { }
50 void HandleLogClientChangeEventL(TUid aChangeType, TInt /*aChangeParam1*/, TInt /*aChangeParam2*/, TInt /*aChangeParam3*/)
53 iFlag = (aChangeType == KLogClientChangeEventRefreshView);
55 inline TInt CallCount() const { return iCallCount; }
56 inline void Reset() { iCallCount = 0; iFlag = EFalse; }
63 LOCAL_C TBool IsLogOpenL()
65 return TestUtils::IsDatabaseOpenL();
69 @SYMTestCaseID SYSLIB-LOGENG-CT-0993
70 @SYMTestCaseDesc Tests for a file open
72 @SYMTestActions Check for errors while testing for file open
73 @SYMTestExpectedResults Test must not fail
76 LOCAL_C void TestLogOpenL()
78 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0993 "));
83 @SYMTestCaseID SYSLIB-LOGENG-CT-0994
84 @SYMTestCaseDesc Tests for file close
86 @SYMTestActions Check for errors while testing for file close
87 @SYMTestExpectedResults Test must not fail
90 LOCAL_C void TestLogClosedL()
92 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0994 "));
96 LOCAL_C void StartBackupL()
98 User::InfoPrint(_L("Backup"));
100 TDriveUnit driveUnit(EDriveC);
101 TDriveName name = driveUnit.Name();
104 LEAVE_IF_ERROR(parse.Set(KLogDatabaseName, &name, NULL));
108 theBackup = CBaBackupSessionWrapper::NewL();
110 theBackup->CloseFileL(parse.FullName(), MBackupObserver::EReleaseLockNoAccess);
111 User::After(1000000);
114 LOCAL_C void DeleteLogDatabaseL()
116 User::InfoPrint(_L("delete"));
117 TestUtils::DeleteDatabaseL(EFalse);
120 LOCAL_C void EndBackupL()
124 User::After(1000000);
127 LOCAL_C void DelayL(TInt aDelay)
129 CTestTimer* timer = CTestTimer::NewL();
130 timer->After(aDelay);
131 CActiveScheduler::Start();
136 const TUid KTestEventUid = {0x10005393};
137 _LIT(KTestEventDesc1, "Event Type Description");
138 _LIT(KTestEventDesc2, "Changed Event Description");
140 LOCAL_C void ForceClientImplInstL(CLogClient& aClient)
142 CLogEventType* type = CLogEventType::NewL();
143 CleanupStack::PushL(type);
144 type->SetUid(KTestEventUid);
145 type->SetDescription(KTestEventDesc1);
146 type->SetLoggingEnabled(ETrue);
148 CTestActive* active = new(ELeave)CTestActive;
149 CleanupStack::PushL(active);
150 aClient.AddEventType(*type, active->iStatus);
152 CActiveScheduler::Start();
153 CleanupStack::PopAndDestroy(2);//type, active
158 @SYMTestCaseID SYSLIB-LOGENG-CT-0995
159 @SYMTestCaseDesc Tests for starting and ending the backup session
160 @SYMTestPriority High
161 @SYMTestActions Test for file open and close,start and end of the backup session
162 @SYMTestExpectedResults Test must not fail
165 LOCAL_C void TestLockingL()
167 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0995 "));
168 CLogClient* client = CLogClient::NewL(theFs);
169 CleanupStack::PushL(client);
171 ForceClientImplInstL(*client);
184 CleanupStack::PopAndDestroy(); // client
188 @SYMTestCaseID SYSLIB-LOGENG-CT-0996
189 @SYMTestCaseDesc Tests for deleting the file when its locked
190 @SYMTestPriority High
191 @SYMTestActions Attempt for deleting the file when its locked
192 @SYMTestExpectedResults Test must not fail
195 LOCAL_C void TestDeleteWhileLockedL()
197 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0996 "));
198 CLogClient* client = CLogClient::NewL(theFs);
199 CleanupStack::PushL(client);
200 ForceClientImplInstL(*client);
207 CleanupStack::PopAndDestroy(); // client
210 client = CLogClient::NewL(theFs);
211 CleanupStack::PushL(client);
212 ForceClientImplInstL(*client);
222 CleanupStack::PopAndDestroy(); // client
226 @SYMTestCaseID SYSLIB-LOGENG-CT-0997
227 @SYMTestCaseDesc Tests for deleting the view while its locked
228 @SYMTestPriority High
229 @SYMTestActions Delete the view when its locked
230 @SYMTestExpectedResults Test must not fail
233 LOCAL_C void TestDeleteViewWhileLockedL()
235 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0997 "));
236 CLogClient* client = CLogClient::NewL(theFs);
237 CleanupStack::PushL(client);
238 ForceClientImplInstL(*client);
240 CLogFilter* filter = CLogFilter::NewL();
241 CleanupStack::PushL(filter);
243 CLogViewEvent* view = CLogViewEvent::NewL(*client);
244 CleanupStack::PushL(view);
251 CleanupStack::PopAndDestroy(3); // view, filter, client
254 client = CLogClient::NewL(theFs);
255 CleanupStack::PushL(client);
256 ForceClientImplInstL(*client);
258 filter = CLogFilter::NewL();
259 CleanupStack::PushL(filter);
261 view = CLogViewEvent::NewL(*client);
262 CleanupStack::PushL(view);
272 CleanupStack::PopAndDestroy(3); // view, filter, client
276 @SYMTestCaseID SYSLIB-LOGENG-CT-0998
277 @SYMTestCaseDesc Multiple client logging test
278 @SYMTestPriority High
279 @SYMTestActions Open multiple clients and test for starting and ending the backup
280 @SYMTestExpectedResults Test must not fail
283 LOCAL_C void TestMultipleClientLockingL()
285 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0998 "));
286 CLogClient* client1 = CLogClient::NewL(theFs);
287 CleanupStack::PushL(client1);
288 ForceClientImplInstL(*client1);
292 CLogClient* client2 = CLogClient::NewL(theFs);
293 CleanupStack::PushL(client2);
294 ForceClientImplInstL(*client2);
308 CleanupStack::PopAndDestroy(2); // client1, client2
312 @SYMTestCaseID SYSLIB-LOGENG-CT-0999
313 @SYMTestCaseDesc Multiple view locking test
314 @SYMTestPriority High
315 @SYMTestActions Open multiple views and test for starting and ending of backup
316 @SYMTestExpectedResults Test must not fail
319 LOCAL_C void TestMultipleViewLockingL()
321 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0999 "));
322 CLogClient* client = CLogClient::NewL(theFs);
323 CleanupStack::PushL(client);
324 ForceClientImplInstL(*client);
326 CLogFilter* filter = CLogFilter::NewL();
327 CleanupStack::PushL(filter);
329 CLogViewEvent* view1 = CLogViewEvent::NewL(*client);
330 CleanupStack::PushL(view1);
332 CLogViewEvent* view2 = CLogViewEvent::NewL(*client);
333 CleanupStack::PushL(view2);
341 CleanupStack::PopAndDestroy(4); // view2, view1, filter, client
344 LOCAL_C void DoTestLogL(CLogBase& aClient, TInt aError)
346 CTestActive* active = new(ELeave)CTestActive();
347 CleanupStack::PushL(active);
349 CLogEvent* event = CLogEvent::NewL();
350 CleanupStack::PushL(event);
355 event->SetEventType(KLogCallEventTypeUid);
358 aClient.AddEvent(*event, active->iStatus);
359 CActiveScheduler::Start();
360 TEST2(active->iStatus.Int(), aError);
362 if (aError == KErrNone)
364 TEST(event->EventType() == KLogCallEventTypeUid);
365 TEST(event->Description().Length() > 0);
366 TEST(event->Time() >= now);
371 // User a dummy id to prevent assertion
375 TLogId id = event->Id();
377 event->SetRemoteParty(KTestRemoteParty);
378 event->SetDirection(KTestDirection);
379 event->SetDurationType(KTestDurationType);
380 event->SetDuration(KTestDuration);
381 event->SetStatus(KTestStatus);
382 event->SetSubject(KTestSubject);
383 event->SetNumber(KTestNumber);
384 event->SetContact(KTestContact);
385 event->SetLink(KTestLink);
386 event->SetDataL(KTestData);
389 aClient.ChangeEvent(*event, active->iStatus);
390 CActiveScheduler::Start();
391 TEST2(active->iStatus.Int(), aError);
393 if (aError == KErrNone)
395 TEST(event->Id() == id);
396 TEST(event->EventType() == KLogCallEventTypeUid);
397 TEST(event->Description().Length() > 0);
398 TEST(event->Time() == now);
399 TEST(event->RemoteParty() == KTestRemoteParty);
400 TEST(event->Direction() == KTestDirection);
401 TEST(event->DurationType() == KTestDurationType);
402 TEST(event->Duration() == KTestDuration);
403 TEST(event->Status() == KTestStatus);
404 TEST(event->Subject() == KTestSubject);
405 TEST(event->Number() == KTestNumber);
406 TEST(event->Contact() == KTestContact);
407 TEST(event->Link() == KTestLink);
408 TEST(event->Data() == KTestData);
411 CleanupStack::PopAndDestroy(); // event;
413 event = CLogEvent::NewL();
414 CleanupStack::PushL(event);
419 aClient.GetEvent(*event, active->iStatus);
420 CActiveScheduler::Start();
421 TEST2(active->iStatus.Int(), aError);
423 if (aError == KErrNone)
425 TEST(event->Id() == id);
426 TEST(event->EventType() == KLogCallEventTypeUid);
427 TEST(event->Description().Length() > 0);
428 TEST(event->Time() == now);
429 TEST(event->RemoteParty() == KTestRemoteParty);
430 TEST(event->Direction() == KTestDirection);
431 TEST(event->DurationType() == KTestDurationType);
432 TEST(event->Duration() == KTestDuration);
433 TEST(event->Status() == KTestStatus);
434 TEST(event->Subject() == KTestSubject);
435 TEST(event->Number() == KTestNumber);
436 TEST(event->Contact() == KTestContact);
437 TEST(event->Link() == KTestLink);
438 TEST(event->Data() == KTestData);
442 aClient.DeleteEvent(id, active->iStatus);
443 CActiveScheduler::Start();
444 TEST2(active->iStatus.Int(), aError);
447 aClient.GetEvent(*event, active->iStatus);
448 CActiveScheduler::Start();
449 TheTest.Printf(_L("*** active->iStatus.Int()=%d\n"), active->iStatus.Int());
450 TEST(active->iStatus.Int() == aError || active->iStatus.Int() == KErrNotFound);
452 CleanupStack::PopAndDestroy(2); // event, active
456 @SYMTestCaseID SYSLIB-LOGENG-CT-1000
457 @SYMTestCaseDesc Client requests test
458 @SYMTestPriority High
459 @SYMTestActions Tests for client requests when the file is opened and check for no errors
460 Tests for client requests when the file is closed and check for access denied errors
461 Re-test for client requests when file is opened and check for no errors
462 @SYMTestExpectedResults Test must not fail
465 LOCAL_C void TestClientRequestsL()
467 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1000 "));
468 CLogClient* client1 = CLogClient::NewL(theFs);
469 CleanupStack::PushL(client1);
470 ForceClientImplInstL(*client1);
474 CLogClient* client2 = CLogClient::NewL(theFs);
475 CleanupStack::PushL(client2);
476 ForceClientImplInstL(*client2);
480 DoTestLogL(*client1, KErrNone);
481 DoTestLogL(*client2, KErrNone);
487 DoTestLogL(*client1, KErrAccessDenied);
488 DoTestLogL(*client2, KErrAccessDenied);
493 DoTestLogL(*client1, KErrNone);
494 DoTestLogL(*client2, KErrNone);
496 CleanupStack::PopAndDestroy(2); // client1, client2
500 @SYMTestCaseID SYSLIB-LOGENG-CT-1001
501 @SYMTestCaseDesc Tests for notification changes
502 @SYMTestPriority High
503 @SYMTestActions Set up for client log notification changes.
504 Change the log and unlock the log.Try and change the log again and check for access denied error.
505 @SYMTestExpectedResults Test must not fail
508 LOCAL_C void TestNotificationsL()
510 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1001 "));
511 CTestActive* notify = new(ELeave)CTestActive;
512 CleanupStack::PushL(notify);
514 CTestTimer* timer = CTestTimer::NewL();
515 CleanupStack::PushL(timer);
517 CLogClient* client = CLogClient::NewL(theFs);
518 CleanupStack::PushL(client);
519 ForceClientImplInstL(*client);
522 // Setup change notification
524 client->NotifyChange(10000000, notify->iStatus);
527 timer->After(1000000);
528 CActiveScheduler::Start();
531 DoTestLogL(*client, KErrNone);
539 // Try and change the log again
540 DoTestLogL(*client, KErrAccessDenied);
542 // Make sure the notifier doesn't complete
543 timer->After(15000000);
544 CActiveScheduler::Start();
545 TEST(notify->IsActive());
551 // Wait for notification
552 CActiveScheduler::Start();
553 TEST(!notify->IsActive());
555 // Setup change notification
557 client->NotifyChange(10000000, notify->iStatus);
560 timer->After(1000000);
561 CActiveScheduler::Start();
569 // Check notification is completed when client destroyed
570 TEST(notify->IsActive());
571 CleanupStack::PopAndDestroy(client);
573 // Wait for notification
574 CActiveScheduler::Start();
575 TEST(!notify->IsActive());
576 TEST2(notify->iStatus.Int(), KErrCancel);
579 client = CLogClient::NewL(theFs);
580 CleanupStack::PushL(client);
582 // Setup change notification
584 client->NotifyChange(10000000, notify->iStatus);
587 timer->After(1000000);
588 CActiveScheduler::Start();
590 // Check notification is completed when cancelled
591 TEST(notify->IsActive());
592 client->NotifyChangeCancel();
594 // Wait for notification
595 CActiveScheduler::Start();
596 TEST(!notify->IsActive());
597 TEST2(notify->iStatus.Int(), KErrCancel);
599 // Setup change notification
601 client->NotifyChange(10000000, notify->iStatus);
604 timer->After(1000000);
605 CActiveScheduler::Start();
611 // Wait for notification
612 TEST(notify->IsActive());
613 CActiveScheduler::Start();
614 TEST(!notify->IsActive());
615 TEST(notify->iStatus >= 0);
618 client->NotifyChange(10000000, notify->iStatus);
621 timer->After(1000000);
622 CActiveScheduler::Start();
625 DoTestLogL(*client, KErrNone);
627 // Wait for notification
628 TEST(notify->IsActive());
629 CActiveScheduler::Start();
630 TEST(!notify->IsActive());
631 TEST(notify->iStatus >= 0);
633 CleanupStack::PopAndDestroy(3); // client, timer, notify
637 @SYMTestCaseID SYSLIB-LOGENG-CT-1002
638 @SYMTestCaseDesc Tests for request in progress
639 @SYMTestPriority High
640 @SYMTestActions Add an event when backup is started and check for access denied error
641 @SYMTestExpectedResults Test must not fail
644 LOCAL_C void TestRequestInProgressL()
646 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1002 "));
647 CLogClient* client = CLogClient::NewL(theFs);
648 CleanupStack::PushL(client);
649 ForceClientImplInstL(*client);
652 CTestActive* active = new(ELeave)CTestActive();
653 CleanupStack::PushL(active);
655 CLogEvent* event = CLogEvent::NewL();
656 CleanupStack::PushL(event);
658 event->SetEventType(KLogCallEventTypeUid);
661 client->AddEvent(*event, active->iStatus);
663 CActiveScheduler::Start();
664 TEST2(active->iStatus.Int(), KErrAccessDenied);
667 // User a dummy id to prevent assertion
672 client->ChangeEvent(*event, active->iStatus);
675 CActiveScheduler::Start();
676 TEST2(active->iStatus.Int(), KErrAccessDenied);
681 client->GetEvent(*event, active->iStatus);
684 CActiveScheduler::Start();
685 TEST2(active->iStatus.Int(), KErrAccessDenied);
690 client->DeleteEvent(event->Id(), active->iStatus);
693 CActiveScheduler::Start();
694 TEST2(active->iStatus.Int(), KErrAccessDenied);
699 client->GetEvent(*event, active->iStatus);
702 CActiveScheduler::Start();
703 TEST2(active->iStatus.Int(), KErrAccessDenied);
706 // Check the log is useable
708 DoTestLogL(*client, KErrNone);
710 CleanupStack::PopAndDestroy(3); // client, event, active
714 @SYMTestCaseID SYSLIB-LOGENG-CT-1003
715 @SYMTestCaseDesc Tests for log view when request is in progress
716 @SYMTestPriority High
717 @SYMTestActions Add events to the log,set a filter on log view and start the backup session
718 and check for the request status for access denied.
719 @SYMTestExpectedResults Test must not fail
722 LOCAL_C void TestViewRequestInProgressL()
724 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1003 "));
725 CLogClient* client = CLogClient::NewL(theFs);
726 CleanupStack::PushL(client);
727 ForceClientImplInstL(*client);
730 CTestActive* active = new(ELeave)CTestActive();
731 CleanupStack::PushL(active);
733 CLogFilter* filter = CLogFilter::NewL();
734 CleanupStack::PushL(filter);
736 CLogViewEvent* view = CLogViewEvent::NewL(*client);
737 CleanupStack::PushL(view);
739 CLogEvent* event = CLogEvent::NewL();
740 CleanupStack::PushL(event);
741 event->SetEventType(KLogCallEventTypeUid);
744 client->AddEvent(*event, active->iStatus);
745 CActiveScheduler::Start();
746 TEST2(active->iStatus.Int(), KErrNone);
749 client->AddEvent(*event, active->iStatus);
750 CActiveScheduler::Start();
751 TEST2(active->iStatus.Int(), KErrNone);
754 TEST(view->SetFilterL(*filter, active->iStatus));
758 CActiveScheduler::Start();
759 TEST2(active->iStatus.Int(), KErrAccessDenied);
766 TEST(view->SetFilterL(*filter, active->iStatus));
768 CActiveScheduler::Start();
769 TEST2(active->iStatus.Int(), KErrNone);
771 TEST(view->NextL(active->iStatus));
775 CActiveScheduler::Start();
776 TEST2(active->iStatus.Int(), KErrAccessDenied);
783 TEST(view->SetFilterL(*filter, active->iStatus));
785 CActiveScheduler::Start();
786 TEST2(active->iStatus.Int(), KErrNone);
788 TEST(view->NextL(active->iStatus));
790 CActiveScheduler::Start();
791 TEST2(active->iStatus.Int(), KErrNone);
793 // Now check a view is no longer valid after a backup
794 TEST(view->SetFilterL(*filter, active->iStatus));
796 CActiveScheduler::Start();
797 TEST2(active->iStatus.Int(), KErrNone);
798 TEST(view->CountL() > 1);
805 // Check the view can be setup again
806 TEST(view->SetFilterL(*filter, active->iStatus));
808 CActiveScheduler::Start();
809 TEST2(active->iStatus.Int(), KErrNone);
810 TEST(view->CountL() > 1);
812 TEST(view->NextL(active->iStatus));
814 CActiveScheduler::Start();
815 TEST2(active->iStatus.Int(), KErrNone);
817 CleanupStack::PopAndDestroy(5); // event, view, filter, active, client
821 @SYMTestCaseID SYSLIB-LOGENG-CT-1004
822 @SYMTestCaseDesc Tests for view event log
823 @SYMTestPriority High
824 @SYMTestActions Create an event type and add the event to the log.
825 Close the log and try setting the filter on view.Check for access denied error.
826 Repeat the operation after opening the log and check for no error
827 @SYMTestExpectedResults Test must not fail
830 LOCAL_C void TestViewSetup1L()
832 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1004 "));
833 CLogClient* client = CLogClient::NewL(theFs);
834 CleanupStack::PushL(client);
835 ForceClientImplInstL(*client);
838 CTestActive* active = new(ELeave)CTestActive();
839 CleanupStack::PushL(active);
841 CLogFilter* filter = CLogFilter::NewL();
842 CleanupStack::PushL(filter);
844 CLogViewEvent* view = CLogViewEvent::NewL(*client);
845 CleanupStack::PushL(view);
847 CLogEvent* event = CLogEvent::NewL();
848 CleanupStack::PushL(event);
849 event->SetEventType(KLogCallEventTypeUid);
852 client->AddEvent(*event, active->iStatus);
853 CActiveScheduler::Start();
854 TEST2(active->iStatus.Int(), KErrNone);
861 TRAPD(error, view->SetFilterL(*filter, active->iStatus));
862 TEST2(error, KErrAccessDenied);
868 TEST(view->SetFilterL(*filter, active->iStatus));
870 CActiveScheduler::Start();
871 TEST2(active->iStatus.Int(), KErrNone);
877 CleanupStack::PopAndDestroy(5); // event, view, filter, active, client
881 @SYMTestCaseID SYSLIB-LOGENG-CT-1005
882 @SYMTestCaseDesc Tests for view event log
883 @SYMTestPriority High
884 @SYMTestActions Create an event type and add the event to the log.
885 Close the log and try setting the filter on view twice with an interval of one second.Check for access denied errors.
886 Repeat the operation after opening the log and check for no error
887 @SYMTestExpectedResults Test must not fail
890 LOCAL_C void TestViewSetup2L()
892 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1005 "));
893 CLogClient* client = CLogClient::NewL(theFs);
894 CleanupStack::PushL(client);
895 ForceClientImplInstL(*client);
898 CTestActive* active = new(ELeave)CTestActive();
899 CleanupStack::PushL(active);
901 CLogFilter* filter = CLogFilter::NewL();
902 CleanupStack::PushL(filter);
904 CLogViewEvent* view = CLogViewEvent::NewL(*client);
905 CleanupStack::PushL(view);
907 CLogEvent* event = CLogEvent::NewL();
908 CleanupStack::PushL(event);
909 event->SetEventType(KLogCallEventTypeUid);
912 client->AddEvent(*event, active->iStatus);
913 CActiveScheduler::Start();
914 TEST2(active->iStatus.Int(), KErrNone);
917 TEST(view->SetFilterL(*filter, active->iStatus));
919 CActiveScheduler::Start();
920 TEST2(active->iStatus.Int(), KErrNone);
926 TRAPD(error, view->SetFilterL(*filter, active->iStatus));
927 TEST2(error, KErrAccessDenied);
931 TRAP(error, view->SetFilterL(*filter, active->iStatus));
932 TEST2(error, KErrAccessDenied);
938 TEST(view->SetFilterL(*filter, active->iStatus));
940 CActiveScheduler::Start();
941 TEST2(active->iStatus.Int(), KErrNone);
947 CleanupStack::PopAndDestroy(5); // event, view, filter, active, client
951 Check that a KLogClientChangeEventRefreshView message is sent if the database is changed
952 during a backup. This could occur if the database is restored.
954 This was added to test the fix for DEF051602 - Problems with MLogViewChangeObserver when a backup occurs
956 @SYMTestCaseID SYSLIB-LOGENG-CT-1006
957 @SYMTestCaseDesc Check for any problems with MLogViewChangeObserver when a backup occurs
958 @SYMTestPriority High
959 @SYMTestActions Check that a KLogClientChangeEventRefreshView message is sent if the database is changed
960 during a backup. This could occur if the database is restored.
961 @SYMTestExpectedResults Test must not fail
964 LOCAL_C void TestRefreshViewL()
966 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1006 "));
967 CLogClient* client = CLogClient::NewL(theFs);
968 CleanupStack::PushL(client);
970 // Create a test observer MLogClientChangeObserver
971 TBool logRefreshViewFlag = EFalse;
972 TClientObserverTestReceiver testReceiver(logRefreshViewFlag);
973 client->SetGlobalChangeObserverL(&testReceiver);
981 // delete the database so a new empty db will be created
982 // This will cause a KLogClientChangeEventRefreshViewRefresh
983 // message to be sent
984 DeleteLogDatabaseL();
991 // check the obsever hs recieved a message
992 TEST(logRefreshViewFlag);
995 CleanupStack::PopAndDestroy(client);
1000 /////////////////////////////////////////////////////////////////////////////////////
1001 /////////////////////////////////////////////////////////////////////////////////////
1002 /////////////////////////////////////////////////////////////////////////////////////
1006 TestUtils::Initialize(_L("t_logbackup"));
1007 TestUtils::DeleteDatabaseL();
1009 TheTest.Start(_L("t_logbackup"));
1012 TheTest.Printf(_L("This test harness will only work on WINS\n"));
1013 User::After(5000000);
1015 CLogChangeNotifier* notifier = CLogChangeNotifier::NewL();
1016 CleanupStack::PushL(notifier);
1018 TheTest.Next(_L("Locking"));
1020 theLog.Write(_L8("Test 1 OK\n"));
1022 TheTest.Next(_L("Delete client while locked"));
1023 TestDeleteWhileLockedL();
1024 theLog.Write(_L8("Test 2 OK\n"));
1026 TheTest.Next(_L("Delete view while locked"));
1027 TestDeleteViewWhileLockedL();
1028 theLog.Write(_L8("Test 3 OK\n"));
1030 TheTest.Next(_L("Multiple clients"));
1031 TestMultipleClientLockingL();
1032 theLog.Write(_L8("Test 4 OK\n"));
1034 TheTest.Next(_L("Multiple views"));
1035 TestMultipleViewLockingL();
1036 theLog.Write(_L8("Test 5 OK\n"));
1038 TheTest.Next(_L("Client Requests"));
1039 TestClientRequestsL();
1040 theLog.Write(_L8("Test 6 OK\n"));
1042 TheTest.Next(_L("View setup"));
1045 theLog.Write(_L8("Test 7 OK\n"));
1047 TheTest.Next(_L("Notifications"));
1048 TestNotificationsL();
1049 theLog.Write(_L8("Test 8 OK\n"));
1051 TheTest.Next(_L("Request in progress"));
1052 TestRequestInProgressL();
1053 theLog.Write(_L8("Test 9 OK\n"));
1055 TheTest.Next(_L("View request in progress"));
1056 TestViewRequestInProgressL();
1057 theLog.Write(_L8("Test 10 OK\n"));
1059 TheTest.Next(_L("Refresh view"));
1061 theLog.Write(_L8("Test 11 OK\n"));
1063 CleanupStack::PopAndDestroy(notifier);