sl@0: // Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: #include "t_logutil2.h" sl@0: #include sl@0: sl@0: RTest TheTest(_L("t_logpurge")); sl@0: sl@0: const TInt KTestEventNum = 10; sl@0: const TInt KTestEventAge = 5; sl@0: const TInt KTestRecentNum = 10; sl@0: const TInt KTestDuplicateNum = 10; sl@0: sl@0: _LIT(KTestRemoteParty, "Test Remote Party %d"); sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0875 sl@0: @SYMTestCaseDesc Tests for maximum logging of configuration data sl@0: @SYMTestPriority High sl@0: @SYMTestActions Get the event type configuration data.Set the log size to maximum. sl@0: Change the log engine configuration data with the new one.Add events to the log sl@0: Set the filter on the view and check for KErrNone flag. sl@0: Add a new event and disable logging by setting the maximum logging size to zero sl@0: Clear all the events and test for KErrNone and the total count of events. sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestMaxLogSizeL(CLogClient& aClient) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0875 ")); sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: event->SetEventType(KLogCallEventTypeUid); sl@0: sl@0: CTestActive* active = new(ELeave)CTestActive(); sl@0: CleanupStack::PushL(active); sl@0: sl@0: CLogViewEvent* view = CLogViewEvent::NewL(aClient); sl@0: CleanupStack::PushL(view); sl@0: sl@0: CLogFilter* filter = CLogFilter::NewL(); sl@0: CleanupStack::PushL(filter); sl@0: sl@0: TLogConfig config; sl@0: sl@0: // Get log configuration sl@0: active->StartL(); sl@0: aClient.GetConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Set the maximum log size sl@0: config.iMaxLogSize = KTestEventNum; sl@0: sl@0: // Change the log engine config sl@0: active->StartL(); sl@0: aClient.ChangeConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Initialise the view - There should be no events sl@0: TEST(!view->SetFilterL(*filter, active->iStatus)); sl@0: sl@0: // Add the number of allowed events sl@0: TInt count; sl@0: for(count = 0; count < KTestEventNum; count++) sl@0: { sl@0: active->StartL(); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: } sl@0: sl@0: TEST(view->SetFilterL(*filter, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // The view should now have the correct number of events sl@0: TEST(view->CountL() == KTestEventNum); sl@0: sl@0: // Add the same number of events again - the old ones should be deleted sl@0: for(count = 0; count < KTestEventNum; count++) sl@0: { sl@0: TEST(view->SetFilterL(*filter, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Get the last (oldest) event sl@0: active->StartL(); sl@0: view->LastL(active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Remember the Id sl@0: TLogId id = view->Event().Id(); sl@0: sl@0: // Add another event - the oldest should be removed sl@0: active->StartL(); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // There should be the same number of events in view sl@0: TEST(view->CountL() == KTestEventNum); sl@0: sl@0: event->SetId(id); sl@0: sl@0: // Try and get the old event sl@0: active->StartL(); sl@0: aClient.GetEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNotFound); sl@0: } sl@0: sl@0: // Add an event sl@0: active->StartL(); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Check it's there sl@0: active->StartL(); sl@0: aClient.GetEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Set the maximum log size to zero, i.e. disable logging sl@0: config.iMaxLogSize = 0; sl@0: sl@0: // Change the log engine config sl@0: active->StartL(); sl@0: aClient.ChangeConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Check the event has gone sl@0: active->StartL(); sl@0: aClient.GetEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNotFound);; sl@0: sl@0: // Add an event sl@0: active->StartL(); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNotSupported); sl@0: sl@0: // Check that event doesn't exist sl@0: active->StartL(); sl@0: aClient.GetEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNotFound);; sl@0: sl@0: User::After(1000000); sl@0: sl@0: TTime now; sl@0: now.UniversalTime(); sl@0: now+=(TTimeIntervalDays) 1; sl@0: // Clear all the events sl@0: active->StartL(); sl@0: aClient.ClearLog(now, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(!view->SetFilterL(*filter, active->iStatus)); sl@0: TEST(view->CountL() == 0); sl@0: sl@0: CleanupStack::PopAndDestroy(4); // filter, view, active, event sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0876 sl@0: @SYMTestCaseDesc Tests for maximum logging of configuration data sl@0: @SYMTestPriority High sl@0: @SYMTestActions Get the event type configuration data.Set the log size to maximum. sl@0: Change the log engine configuration data and add the number of allowed events sl@0: Reduce the number of allowed events.The old ones should be purged sl@0: Change the log engine config and check for the event count. sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestMaxLogSizeConfigL(CLogClient& aClient) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0876 ")); sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: event->SetEventType(KLogCallEventTypeUid); sl@0: sl@0: CTestActive* active = new(ELeave)CTestActive(); sl@0: CleanupStack::PushL(active); sl@0: sl@0: CLogViewEvent* view = CLogViewEvent::NewL(aClient); sl@0: CleanupStack::PushL(view); sl@0: sl@0: CLogFilter* filter = CLogFilter::NewL(); sl@0: CleanupStack::PushL(filter); sl@0: sl@0: TLogConfig config; sl@0: sl@0: // Get log configuration sl@0: active->StartL(); sl@0: aClient.GetConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Set the maximum log size sl@0: config.iMaxLogSize = KTestEventNum; sl@0: sl@0: // Change the log engine config sl@0: active->StartL(); sl@0: aClient.ChangeConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Initialise the view - There should be no events sl@0: TEST(!view->SetFilterL(*filter, active->iStatus)); sl@0: sl@0: // Add the number of allowed events sl@0: TInt count; sl@0: for(count = 0; count < KTestEventNum; count++) sl@0: { sl@0: active->StartL(); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: } sl@0: sl@0: TEST(view->SetFilterL(*filter, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // The view should now have the correct number of events sl@0: TEST(view->CountL() == KTestEventNum); sl@0: sl@0: // Reduce the number of allowed events sl@0: // The old ones should be purged sl@0: config.iMaxLogSize = KTestEventNum / 2; sl@0: sl@0: // Change the log engine config sl@0: active->StartL(); sl@0: aClient.ChangeConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Check the event count sl@0: TEST(view->SetFilterL(*filter, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: TEST(view->CountL() == KTestEventNum / 2); sl@0: sl@0: User::After(0x1000000); sl@0: sl@0: TTime now; sl@0: now.UniversalTime(); sl@0: now+=(TTimeIntervalDays )1; sl@0: // Clear all the events sl@0: active->StartL(); sl@0: aClient.ClearLog(now, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(!view->SetFilterL(*filter, active->iStatus)); sl@0: TEST(view->CountL() == 0); sl@0: sl@0: CleanupStack::PopAndDestroy(4); // filter, view, active, event sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0877 sl@0: @SYMTestCaseDesc Tests for maximum time for which events can be retained in the log sl@0: @SYMTestPriority High sl@0: @SYMTestActions Get the event type configuration data.Set maximum log age. sl@0: Change the log engine configuration data with the new one.Add events to the log sl@0: Set the date and time of events clear the log and check for errors sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestMaxLogAgeL(CLogClient& aClient, TLogAge aMaxLogAge) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0877 ")); sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: event->SetEventType(KLogCallEventTypeUid); sl@0: sl@0: CTestActive* active = new(ELeave)CTestActive(); sl@0: CleanupStack::PushL(active); sl@0: sl@0: CLogViewEvent* view = CLogViewEvent::NewL(aClient); sl@0: CleanupStack::PushL(view); sl@0: sl@0: CLogFilter* filter = CLogFilter::NewL(); sl@0: CleanupStack::PushL(filter); sl@0: sl@0: TLogConfig config; sl@0: sl@0: // Get log configuration sl@0: active->StartL(); sl@0: aClient.GetConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Set the maximum log age sl@0: config.iMaxLogSize = KTestEventAge * 2; sl@0: config.iMaxEventAge = aMaxLogAge; sl@0: sl@0: // Change the log engine config sl@0: active->StartL(); sl@0: aClient.ChangeConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Initialise the view - There should be no events sl@0: TEST(!view->SetFilterL(*filter, active->iStatus)); sl@0: sl@0: TTime date; sl@0: date.UniversalTime(); sl@0: sl@0: // Wait a second sl@0: User::After(0x1000000); sl@0: sl@0: // Add events sl@0: TInt count; sl@0: for(count = 0; count < KTestEventAge * 2; count++) sl@0: { sl@0: active->StartL(); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Set the time and date of the event sl@0: event->SetTime(date); sl@0: date -= TTimeIntervalDays(1); sl@0: sl@0: active->StartL(); sl@0: aClient.ChangeEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: User::After(1000000); sl@0: sl@0: TEST(view->SetFilterL(*filter, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Check the old events have been removed sl@0: if ((count < KTestEventAge) || !aMaxLogAge) sl@0: TEST(view->CountL() == count + 1); sl@0: else sl@0: TEST(view->CountL() == KTestEventAge); sl@0: } sl@0: sl@0: User::After(0x1000000); sl@0: date.UniversalTime(); sl@0: sl@0: date+=(TTimeIntervalYears )1; sl@0: sl@0: // Clear all the events sl@0: active->StartL(); sl@0: aClient.ClearLog(date, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(!view->SetFilterL(*filter, active->iStatus)); sl@0: TEST(view->CountL() == 0); sl@0: sl@0: CleanupStack::PopAndDestroy(4); // filter, view, active, event sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0878 sl@0: @SYMTestCaseDesc Tests for maximum number of events that a recent event list holds sl@0: @SYMTestPriority High sl@0: @SYMTestActions Set the event configuration data of recent log size(10) to maximum and sl@0: Add events to the log.Set the filter on the view and check for NO error. sl@0: Add a new event and disable logging by setting the maximum logging size to zero sl@0: Clear all the events and test for no errors and the total count of events and the logviewrecent should be zero. sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestMaxRecentSize1L(CLogClient& aClient) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0878 ")); sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: sl@0: // Incoming sl@0: TBuf buf; sl@0: aClient.GetString(buf, R_LOG_DIR_IN); sl@0: sl@0: event->SetEventType(KLogCallEventTypeUid); sl@0: event->SetDirection(buf); sl@0: sl@0: CTestActive* active = new(ELeave)CTestActive(); sl@0: CleanupStack::PushL(active); sl@0: sl@0: CLogViewEvent* view = CLogViewEvent::NewL(aClient); sl@0: CleanupStack::PushL(view); sl@0: sl@0: CLogViewRecent* recent = CLogViewRecent::NewL(aClient); sl@0: CleanupStack::PushL(recent); sl@0: sl@0: CLogFilter* filter = CLogFilter::NewL(); sl@0: CleanupStack::PushL(filter); sl@0: sl@0: TLogConfig config; sl@0: sl@0: // Get log configuration sl@0: active->StartL(); sl@0: aClient.GetConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Set the maximum log size sl@0: config.iMaxLogSize = KTestRecentNum * 2; sl@0: config.iMaxRecentLogSize = KTestRecentNum; sl@0: sl@0: // Change the log engine config sl@0: active->StartL(); sl@0: aClient.ChangeConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Initialise the views - There should be no events sl@0: TEST(!view->SetFilterL(*filter, active->iStatus)); sl@0: TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); sl@0: sl@0: // Add a number of events sl@0: TInt count; sl@0: for(count = 0; count < KTestRecentNum; count++) sl@0: { sl@0: event->SetContact(count); sl@0: sl@0: active->StartL(); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: } sl@0: sl@0: TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(recent->CountL() == KTestRecentNum); sl@0: sl@0: // Add the same number of events again - the old ones should be removed sl@0: for(count = 0; count < KTestRecentNum; count++) sl@0: { sl@0: // Add another event - the oldest should be removed from recent list sl@0: active->StartL(); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(view->SetFilterL(*filter, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Check an event has been removed from recent view sl@0: TEST(recent->CountL() == KTestRecentNum); sl@0: TEST(view->CountL() == count + KTestRecentNum + 1); sl@0: } sl@0: sl@0: User::After(0x1000000); sl@0: sl@0: TTime now; sl@0: now.UniversalTime(); sl@0: now+=(TTimeIntervalDays )1; sl@0: sl@0: // Clear all the events sl@0: active->StartL(); sl@0: aClient.ClearLog(now, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(!view->SetFilterL(*filter, active->iStatus)); sl@0: TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); sl@0: TEST(view->CountL() == 0 && recent->CountL() == 0); sl@0: sl@0: CleanupStack::PopAndDestroy(5); // filter, recent, view, active, event sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0879 sl@0: @SYMTestCaseDesc Tests for maximum number of events that a recent event list holds sl@0: @SYMTestPriority High sl@0: @SYMTestActions Set the event configuration data of recent log size(10) to maximum and sl@0: Add events to the log.Set the filter on the view and check for NO error. sl@0: Reduce the recent log size(5) and set the new configuration. sl@0: Clear all the events and test for no errors and the total count of events and the logviewrecent should be zero. sl@0: Tests for CLogViewRecent::SetRecentListL sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestMaxRecentSizeConfigL(CLogClient& aClient) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0879 ")); sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: sl@0: // Incoming sl@0: TBuf buf; sl@0: aClient.GetString(buf, R_LOG_DIR_IN); sl@0: sl@0: event->SetEventType(KLogCallEventTypeUid); sl@0: event->SetDirection(buf); sl@0: sl@0: CTestActive* active = new(ELeave)CTestActive(); sl@0: CleanupStack::PushL(active); sl@0: sl@0: CLogViewRecent* recent = CLogViewRecent::NewL(aClient); sl@0: CleanupStack::PushL(recent); sl@0: sl@0: TLogConfig config; sl@0: sl@0: // Get log configuration sl@0: active->StartL(); sl@0: aClient.GetConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Set the maximum log size sl@0: config.iMaxLogSize = KTestRecentNum * 2; sl@0: config.iMaxRecentLogSize = KTestRecentNum; sl@0: sl@0: // Change the log engine config sl@0: active->StartL(); sl@0: aClient.ChangeConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Initialise the views - There should be no events sl@0: TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); sl@0: sl@0: // Add a number of events sl@0: TInt count; sl@0: for(count = 0; count < KTestRecentNum; count++) sl@0: { sl@0: event->SetContact(count); sl@0: sl@0: active->StartL(); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: } sl@0: sl@0: TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(recent->CountL() == KTestRecentNum); sl@0: sl@0: // Reduce the maximum allowed recent list size sl@0: // The oldest ones should be removed sl@0: config.iMaxRecentLogSize = KTestRecentNum / 2; sl@0: sl@0: active->StartL(); sl@0: aClient.ChangeConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(recent->CountL() == KTestRecentNum / 2); sl@0: User::After(0x1000000); sl@0: sl@0: TTime now; sl@0: now.UniversalTime(); sl@0: now+=(TTimeIntervalDays )1; sl@0: sl@0: // Clear all the events sl@0: active->StartL(); sl@0: aClient.ClearLog(now, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); sl@0: TEST(recent->CountL() == 0); sl@0: sl@0: CleanupStack::PopAndDestroy(3); // recent, active, event sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0880 sl@0: @SYMTestCaseDesc Tests for CLogViewRecent::SetRecentListL(),CLogViewRecent::DuplicatesL() functions sl@0: @SYMTestPriority High sl@0: @SYMTestActions Set the event configuration data of recent log size(10) to maximum and sl@0: Add events to the log.Set the filter on the view and check for NO error. sl@0: Reduce the recent log size(5) and set the new configuration. sl@0: Clear all the events and test for no errors and the total count of events and the logviewrecent should be zero. sl@0: Tests for CLogViewRecent::SetRecentListL() sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestMaxRecentSize2L(CLogClient& aClient) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0880 ")); sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: sl@0: // Incoming sl@0: TBuf buf; sl@0: aClient.GetString(buf, R_LOG_DIR_IN); sl@0: sl@0: event->SetEventType(KLogCallEventTypeUid); sl@0: event->SetDirection(buf); sl@0: sl@0: CTestActive* active = new(ELeave)CTestActive(); sl@0: CleanupStack::PushL(active); sl@0: sl@0: CLogViewRecent* recent = CLogViewRecent::NewL(aClient); sl@0: CleanupStack::PushL(recent); sl@0: sl@0: CLogViewDuplicate* dup = CLogViewDuplicate::NewL(aClient); sl@0: CleanupStack::PushL(dup); sl@0: sl@0: CLogFilter* filter = CLogFilter::NewL(); sl@0: CleanupStack::PushL(filter); sl@0: sl@0: TLogConfig config; sl@0: sl@0: // Get log configuration sl@0: active->StartL(); sl@0: aClient.GetConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Set the maximum log size sl@0: config.iMaxLogSize = (KTestRecentNum * KTestDuplicateNum) * 2; sl@0: config.iMaxRecentLogSize = KTestRecentNum; sl@0: sl@0: // Change the log engine config sl@0: active->StartL(); sl@0: aClient.ChangeConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Initialise the view - There should be no events sl@0: TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); sl@0: sl@0: // Add a number of events sl@0: TInt count; sl@0: for(count = 0; count < KTestRecentNum; count++) sl@0: { sl@0: TBuf buf; sl@0: buf.Format(KTestRemoteParty, count); sl@0: event->SetRemoteParty(buf); sl@0: sl@0: active->StartL(); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Add some duplicates sl@0: TInt duplicate; sl@0: for(duplicate = 0; duplicate < KTestDuplicateNum; duplicate++) sl@0: { sl@0: active->StartL(); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: } sl@0: sl@0: // The views should now have the correct number of events sl@0: TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(recent->CountL() == count + 1); sl@0: sl@0: TEST(recent->DuplicatesL(*dup, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(dup->CountL() == KTestDuplicateNum); sl@0: } sl@0: sl@0: event->SetRemoteParty(KNullDesC); sl@0: sl@0: // Add the more events - the old ones should be removed sl@0: for(count = 0; count < KTestRecentNum; count++) sl@0: { sl@0: // Add another event - the oldest should be removed from recent list sl@0: active->StartL(); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Check an event has been removed from recent view sl@0: TEST(recent->CountL() == KTestRecentNum); sl@0: } sl@0: sl@0: User::After(0x1000000); sl@0: sl@0: TTime now; sl@0: now.UniversalTime(); sl@0: now+=(TTimeIntervalDays )1; sl@0: sl@0: // Clear all the events sl@0: active->StartL(); sl@0: aClient.ClearLog(now, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(!recent->DuplicatesL(*dup, active->iStatus)); sl@0: sl@0: CleanupStack::PopAndDestroy(5); // filter, dup, recent, active, event sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0881 sl@0: @SYMTestCaseDesc Tests for purge sl@0: @SYMTestPriority High sl@0: @SYMTestActions Get the event type data sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestNoPurgeWithGetL(CLogClient& aClient) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0881 ")); sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: event->SetEventType(KLogCallEventTypeUid); sl@0: sl@0: CTestActive* active = new(ELeave)CTestActive(); sl@0: CleanupStack::PushL(active); sl@0: sl@0: TLogConfig config; sl@0: sl@0: // Get log configuration sl@0: active->StartL(); sl@0: aClient.GetConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Set the maximum log age sl@0: TInt oldAge = config.iMaxEventAge; sl@0: config.iMaxEventAge = 24 * 60 * 60; sl@0: sl@0: // Change the log engine config sl@0: active->StartL(); sl@0: aClient.ChangeConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: active->StartL(); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Check that the event can be retrieved sl@0: active->StartL(); sl@0: aClient.GetEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Wait for 15 seconds (just to be safe) sl@0: User::After(15000000); sl@0: sl@0: // Check that the event can still be retrieved sl@0: active->StartL(); sl@0: aClient.GetEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Perform a dummy change sl@0: event->SetTime(event->Time() - TTimeIntervalDays(2)); sl@0: active->StartL(); sl@0: aClient.ChangeEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // Check the event has been removed sl@0: active->StartL(); sl@0: aClient.GetEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNotFound);; sl@0: sl@0: // Reset the config sl@0: config.iMaxEventAge = oldAge; sl@0: sl@0: // Change the log engine config sl@0: active->StartL(); sl@0: aClient.ChangeConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: CleanupStack::PopAndDestroy(2); // active, event sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0882 sl@0: @SYMTestCaseDesc Tests for CLogClient::ClearLog() function sl@0: @SYMTestPriority High sl@0: @SYMTestActions Change locale settings and log duration to 1 day and test for number of event types in log sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestClearLog1L(CLogClient& aClient) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0882 ")); sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: event->SetEventType(KLogCallEventTypeUid); sl@0: sl@0: CTestActive* active = new(ELeave)CTestActive(); sl@0: CleanupStack::PushL(active); sl@0: sl@0: CLogViewEvent* view = CLogViewEvent::NewL(aClient); sl@0: CleanupStack::PushL(view); sl@0: sl@0: // change Locale sl@0: TLocale locale; sl@0: locale.SetCountryCode(47);//Norway sl@0: locale.SetDateFormat(EDateEuropean); sl@0: locale.SetTimeFormat(ETime12); sl@0: for (int i=0; i<4; i++) sl@0: { sl@0: locale.SetTimeSeparator(TChar('.'),i); sl@0: locale.SetDateSeparator(TChar(':'),i); sl@0: } sl@0: locale.Set(); sl@0: sl@0: // change the log duration settings to 1 day sl@0: TLogConfig config; sl@0: active->StartL(); sl@0: aClient.GetConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: config.iMaxLogSize = KTestEventAge * 2; sl@0: config.iMaxEventAge = 86400; sl@0: active->StartL(); sl@0: aClient.ChangeConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // add a call event sl@0: active->StartL(); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: User::After(1000000); sl@0: TTime now; sl@0: now.HomeTime(); sl@0: event->SetTime(now); sl@0: active->StartL(); sl@0: aClient.ChangeEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // forward two days sl@0: now+=(TTimeIntervalDays )2; sl@0: User::SetHomeTime(now); sl@0: sl@0: // dummy call ensures ClearLog() is called sl@0: active->StartL(); sl@0: aClient.ChangeConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // try to retrieve event sl@0: active->StartL(); sl@0: aClient.GetEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNotFound);; sl@0: sl@0: TEST(view->CountL() == 0); sl@0: sl@0: CleanupStack::PopAndDestroy(3); // view, active, event sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0883 sl@0: @SYMTestCaseDesc Tests for CLogClient::ClearLog() function sl@0: @SYMTestPriority High sl@0: @SYMTestActions Change locale settings,call up ClearLog and try to retrieve event,test for count of number of events in the view. sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestClearLog2L(CLogClient& aClient) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0883 ")); sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: event->SetEventType(KLogCallEventTypeUid); sl@0: sl@0: CTestActive* active = new(ELeave)CTestActive(); sl@0: CleanupStack::PushL(active); sl@0: sl@0: CLogViewEvent* view = CLogViewEvent::NewL(aClient); sl@0: CleanupStack::PushL(view); sl@0: sl@0: // change Locale sl@0: TLocale locale; sl@0: locale.SetCountryCode(47);//Norway sl@0: locale.SetDateFormat(EDateEuropean); sl@0: locale.SetTimeFormat(ETime12); sl@0: for (int i=0; i<4; i++) sl@0: { sl@0: locale.SetTimeSeparator(TChar('.'),i); sl@0: locale.SetDateSeparator(TChar(':'),i); sl@0: } sl@0: locale.Set(); sl@0: sl@0: // change the log duration settings to 1 day sl@0: TLogConfig config; sl@0: active->StartL(); sl@0: aClient.GetConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: config.iMaxLogSize = KTestEventAge * 2; sl@0: config.iMaxEventAge = 86400; sl@0: active->StartL(); sl@0: aClient.ChangeConfig(config, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // add a call event sl@0: active->StartL(); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: User::After(1000000); sl@0: TTime now; sl@0: now.HomeTime(); sl@0: event->SetTime(now); sl@0: active->StartL(); sl@0: aClient.ChangeEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // forward two days sl@0: now+=(TTimeIntervalDays )2; sl@0: User::SetHomeTime(now); sl@0: sl@0: active->StartL(); sl@0: aClient.ClearLog(now, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: // try to retrieve event sl@0: active->StartL(); sl@0: aClient.GetEvent(*event, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNotFound);; sl@0: sl@0: TEST(view->CountL() == 0); sl@0: sl@0: CleanupStack::PopAndDestroy(3); // view, active, event sl@0: } sl@0: sl@0: #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-LOGENG-UT-4036 sl@0: @SYMTestCaseDesc Clear log events with specific SimId test. sl@0: The test adds 3 events with different SimIds and then checks that sl@0: CLogEvent::ClearLog() deletes only the event with the specified id. sl@0: @SYMTestActions Clear log events with specific SimId test. sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMTestPriority High sl@0: @SYMREQ REQ12748 sl@0: */ sl@0: void ClearLogSimIdL(CLogClient& aClient) sl@0: {//This test case is compiled only when SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM macro is defined. sl@0: const TSimId KSimId1 = 4100000000U; sl@0: const TSimId KSimId2 = 100; sl@0: const TSimId KSimId3 = 1678; sl@0: sl@0: TTime now; sl@0: now.UniversalTime(); sl@0: sl@0: TDateTime dt(now.DateTime()); sl@0: dt.SetHour(dt.Hour() - 1); sl@0: TTime date(dt); sl@0: sl@0: TTime threshold(date); sl@0: threshold += TTimeIntervalSeconds(10); sl@0: sl@0: CTestActive* active = new(ELeave)CTestActive(); sl@0: CleanupStack::PushL(active); sl@0: sl@0: //////// Event1 /////////////////////////// sl@0: CLogEvent* event1 = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event1); sl@0: event1->SetEventType(KLogCallEventTypeUid); sl@0: event1->SetSimId(KSimId1); sl@0: sl@0: active->StartL(); sl@0: aClient.AddEvent(*event1, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: event1->SetTime(date); sl@0: sl@0: active->StartL(); sl@0: aClient.ChangeEvent(*event1, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: //////// Event2 /////////////////////////// sl@0: CLogEvent* event2 = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event2); sl@0: event2->SetEventType(KLogCallEventTypeUid); sl@0: event2->SetSimId(KSimId2); sl@0: sl@0: active->StartL(); sl@0: aClient.AddEvent(*event2, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: event2->SetTime(date); sl@0: sl@0: active->StartL(); sl@0: aClient.ChangeEvent(*event2, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: //////// Event3 /////////////////////////// sl@0: CLogEvent* event3 = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event3); sl@0: event3->SetEventType(KLogCallEventTypeUid); sl@0: event3->SetSimId(KSimId3); sl@0: sl@0: active->StartL(); sl@0: aClient.AddEvent(*event3, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: event3->SetTime(date); sl@0: sl@0: active->StartL(); sl@0: aClient.ChangeEvent(*event3, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: ////////////////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: //Delete event3 ///////////////////////// sl@0: aClient.ClearLog(threshold, KSimId3, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: //Event1 and event2 should be there sl@0: active->StartL(); sl@0: aClient.GetEvent(*event1, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: active->StartL(); sl@0: aClient.GetEvent(*event2, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: active->StartL(); sl@0: aClient.GetEvent(*event3, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNotFound); sl@0: sl@0: //Delete event2 ///////////////////////// sl@0: aClient.ClearLog(threshold, KSimId2, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: //Event1 should be there sl@0: active->StartL(); sl@0: aClient.GetEvent(*event1, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: active->StartL(); sl@0: aClient.GetEvent(*event2, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNotFound); sl@0: active->StartL(); sl@0: aClient.GetEvent(*event3, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNotFound); sl@0: sl@0: //Delete event1 ///////////////////////// sl@0: aClient.ClearLog(threshold, KSimId1, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: //All events deleted sl@0: active->StartL(); sl@0: aClient.GetEvent(*event1, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNotFound); sl@0: active->StartL(); sl@0: aClient.GetEvent(*event2, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNotFound); sl@0: active->StartL(); sl@0: aClient.GetEvent(*event3, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNotFound); sl@0: sl@0: CleanupStack::PopAndDestroy(4); //event3, event2, event1, active sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID PDS-LOGENG-UT-4037 sl@0: @SYMTestCaseDesc Clear log events from a recent list with specific SimId test. sl@0: The test adds 3 events to a recent list with different SimIds and then checks that sl@0: CLogEvent::ClearLog() deletes only the event with the specified id. sl@0: @SYMTestActions Clear log events from a recent list with specific SimId test. sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMTestPriority High sl@0: @SYMREQ REQ12748 sl@0: */ sl@0: void ClearLogRecentSimIdL(CLogClient& aClient) sl@0: {//This test case is compiled only when SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM macro is defined. sl@0: const TSimId KSimId1 = 4200110000U; sl@0: const TSimId KSimId2 = 38223; sl@0: const TSimId KSimId3 = 239816; sl@0: sl@0: const TUid KEvTypeUid = {KLogCallEventType}; sl@0: _LIT(KEvDirection, "Missed call"); sl@0: sl@0: CTestActive* active = new(ELeave)CTestActive(); sl@0: CleanupStack::PushL(active); sl@0: sl@0: //////// Event1 /////////////////////////// sl@0: CLogEvent* event1 = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event1); sl@0: event1->SetEventType(KEvTypeUid); sl@0: event1->SetDirection(KEvDirection); sl@0: event1->SetNumber(_L("12345678")); sl@0: event1->SetSimId(KSimId1); sl@0: active->StartL(); sl@0: aClient.AddEvent(*event1, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: //////// Event2 /////////////////////////// sl@0: CLogEvent* event2 = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event2); sl@0: event2->SetEventType(KEvTypeUid); sl@0: event2->SetDirection(KEvDirection); sl@0: event2->SetNumber(_L("87654321")); sl@0: event2->SetSimId(KSimId2); sl@0: active->StartL(); sl@0: aClient.AddEvent(*event2, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: //////// Event3 /////////////////////////// sl@0: CLogEvent* event3 = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event3); sl@0: event3->SetEventType(KEvTypeUid); sl@0: event3->SetDirection(KEvDirection); sl@0: event3->SetNumber(_L("99229922")); sl@0: event3->SetSimId(KSimId3); sl@0: active->StartL(); sl@0: aClient.AddEvent(*event3, active->iStatus); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: ////////////////////////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: //Delete event3 ///////////////////////// sl@0: aClient.ClearLog(KLogRecentMissedCalls, KSimId3, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: //Event1 and event2 should be there sl@0: CLogViewRecent* view = CLogViewRecent::NewL(aClient); sl@0: CleanupStack::PushL(view); sl@0: TBool rc = view->SetRecentListL(KLogRecentMissedCalls, active->iStatus); sl@0: TEST(rc); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TInt count = view->CountL(); sl@0: TEST2(count, 2); sl@0: rc = view->FirstL(active->iStatus); sl@0: TEST(rc); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: const CLogEvent& e1 = view->Event(); sl@0: TEST(e1.SimId() == KSimId2 || e1.SimId() == KSimId1); sl@0: rc = view->NextL(active->iStatus); sl@0: TEST(rc); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: const CLogEvent& e2 = view->Event(); sl@0: TEST(e2.SimId() == KSimId2 || e2.SimId() == KSimId1); sl@0: TEST(e1.Id() != e2.Id()); sl@0: sl@0: CleanupStack::PopAndDestroy(view); sl@0: sl@0: //Delete event1 ///////////////////////// sl@0: aClient.ClearLog(KLogRecentMissedCalls, KSimId1, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: //Only event2 should be there sl@0: view = CLogViewRecent::NewL(aClient); sl@0: CleanupStack::PushL(view); sl@0: rc = view->SetRecentListL(KLogRecentMissedCalls, active->iStatus); sl@0: TEST(rc); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: count = view->CountL(); sl@0: TEST2(count, 1); sl@0: rc = view->FirstL(active->iStatus); sl@0: TEST(rc); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: const CLogEvent& e3 = view->Event(); sl@0: TEST(e3.SimId() == KSimId2); sl@0: sl@0: CleanupStack::PopAndDestroy(5); //view, event3, event2, event1, active sl@0: } sl@0: sl@0: #endif//SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM sl@0: sl@0: void doTestsL() sl@0: { sl@0: TestUtils::Initialize(_L("t_logpurge")); sl@0: TestUtils::DeleteDatabaseL(); sl@0: sl@0: CLogClient* client = CLogClient::NewL(theFs); sl@0: CleanupStack::PushL(client); sl@0: sl@0: TheTest.Start(_L("Maximum Log Size")); sl@0: TestMaxLogSizeL(*client); sl@0: theLog.Write(_L8("Test 1 OK\n")); sl@0: sl@0: TheTest.Next(_L("Purge Log When Config Changed")); sl@0: TestMaxLogSizeConfigL(*client); sl@0: theLog.Write(_L8("Test 2 OK\n")); sl@0: sl@0: TheTest.Next(_L("Test purge by Maximum Log Age enabled/disabled")); sl@0: TestMaxLogAgeL(*client, 0); // disable purging by age sl@0: TestMaxLogAgeL(*client, KTestEventAge * 60 * 60 * 24); sl@0: theLog.Write(_L8("Test 3 OK\n")); sl@0: sl@0: TheTest.Next(_L("Maximum Recent List Size")); sl@0: TestMaxRecentSize1L(*client); sl@0: theLog.Write(_L8("Test 4 OK\n")); sl@0: sl@0: TheTest.Next(_L("Purge Recent Lists When Config Changed")); sl@0: TestMaxRecentSizeConfigL(*client); sl@0: theLog.Write(_L8("Test 5 OK\n")); sl@0: sl@0: TheTest.Next(_L("Maximum Recent List Size With Duplicates")); sl@0: TestMaxRecentSize2L(*client); sl@0: theLog.Write(_L8("Test 6 OK\n")); sl@0: sl@0: TheTest.Next(_L("Check no purge when retrieving event")); sl@0: TestNoPurgeWithGetL(*client); sl@0: theLog.Write(_L8("Test 7 OK\n")); sl@0: sl@0: TheTest.Next(_L("Check ClearLog works for different locales")); sl@0: TestClearLog1L(*client); sl@0: TestClearLog2L(*client); sl@0: theLog.Write(_L8("Test 8 OK\n")); sl@0: sl@0: #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM sl@0: TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4036 CLogClient::ClearLog() + SimId test")); sl@0: ClearLogSimIdL(*client); sl@0: theLog.Write(_L8("Test 9 OK\n")); sl@0: sl@0: TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4037 CLogClient::ClearLog()/recent + SimId test")); sl@0: ClearLogRecentSimIdL(*client); sl@0: theLog.Write(_L8("Test 10 OK\n")); sl@0: #endif sl@0: sl@0: CleanupStack::PopAndDestroy(); // client; sl@0: }