sl@0: // Copyright (c) 2002-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_logviewfail2")); sl@0: sl@0: const TLogContactItemId KTestContact = 0x123; sl@0: _LIT(KTestStatus, "Test Status Text"); sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0971 sl@0: @SYMTestCaseDesc Tests for CLogViewEvent::SetFilterL() function sl@0: @SYMTestPriority High sl@0: @SYMTestActions Create a log filter and set the filter on logview.Check for equality of events on the view and events sl@0: added.Check for file failure error sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestEventViewSetupWithFileFailL(CLogClient& aClient) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0971 ")); sl@0: CTestActive* active = new(ELeave)CTestActive; sl@0: CleanupStack::PushL(active); sl@0: sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: event->SetEventType(KLogCallEventTypeUid); sl@0: event->SetStatus(KTestStatus); sl@0: sl@0: // Add an event sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: CLogViewEvent* view = CLogViewEvent::NewL(aClient); sl@0: CleanupStack::PushL(view); sl@0: sl@0: CLogFilterList* list = new(ELeave)CLogFilterList; sl@0: CleanupStack::PushL(list); sl@0: sl@0: CLogFilter* filter = CLogFilter::NewL(); sl@0: CleanupStack::PushL(filter); sl@0: filter->SetStatus(KTestStatus); sl@0: sl@0: TInt failCount = 0; sl@0: sl@0: TBool finished = EFalse; sl@0: TInt error; sl@0: sl@0: while(!finished) sl@0: { sl@0: TheTest.Printf(_L("%d \r"), failCount); sl@0: __FILE_FAILNEXT(KErrNoMemory, failCount++); sl@0: sl@0: TBool result = EFalse; sl@0: TRAP(error, result = view->SetFilterL(*filter, active->iStatus)); sl@0: sl@0: if (error == KErrNone) sl@0: { sl@0: TEST(result); sl@0: sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: sl@0: if (active->iStatus.Int() == KErrNone) sl@0: { sl@0: finished = ETrue; sl@0: sl@0: TEST(view->CountL() >= 1); sl@0: TEST(TestUtils::EventsEqual(*event, view->Event())); sl@0: } sl@0: else sl@0: { sl@0: if(active->iStatus.Int() != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int()); sl@0: } sl@0: TEST2(active->iStatus.Int(), KErrNoMemory); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if(error != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error); sl@0: } sl@0: TEST2(error, KErrNoMemory); sl@0: } sl@0: sl@0: __FILE_RESET; sl@0: } sl@0: TheTest.Printf(_L("\r\nTest-1 has succeeded at iteration %d\n"), failCount); sl@0: sl@0: list->AppendL(filter); sl@0: CleanupStack::Pop(); // filter sl@0: sl@0: filter = CLogFilter::NewL(); sl@0: CleanupStack::PushL(filter); sl@0: filter->SetEventType(KLogCallEventTypeUid); sl@0: list->AppendL(filter); sl@0: CleanupStack::Pop(); // filter sl@0: sl@0: failCount = 0; sl@0: finished = EFalse; sl@0: sl@0: while(!finished) sl@0: { sl@0: TheTest.Printf(_L("%d \r"), failCount); sl@0: __FILE_FAILNEXT(KErrNoMemory, failCount++); sl@0: sl@0: TBool result = EFalse; sl@0: TRAP(error, result = view->SetFilterL(*list, active->iStatus)); sl@0: sl@0: if (error == KErrNone) sl@0: { sl@0: TEST(result); sl@0: sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: sl@0: if (active->iStatus.Int() == KErrNone) sl@0: { sl@0: finished = ETrue; sl@0: sl@0: TEST(view->CountL() >= 1); sl@0: TEST(TestUtils::EventsEqual(*event, view->Event())); sl@0: } sl@0: else sl@0: { sl@0: if(active->iStatus.Int() != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int()); sl@0: } sl@0: TEST2(active->iStatus.Int(), KErrNoMemory); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if(error != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error); sl@0: } sl@0: TEST2(error, KErrNoMemory); sl@0: } sl@0: sl@0: __FILE_RESET; sl@0: } sl@0: sl@0: list->ResetAndDestroy(); sl@0: CleanupStack::PopAndDestroy(4); // list, view, event, active sl@0: sl@0: TheTest.Printf(_L("\r\nTest-2 has succeeded at iteration %d\n"), failCount); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0972 sl@0: @SYMTestCaseDesc Tests CLogViewRecent::SetRecentListL() function sl@0: @SYMTestPriority High sl@0: @SYMTestActions Set recent view list first without a filter and later with log filter,check for file failure error sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestRecentViewSetupWithFileFailL(CLogClient& aClient) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0972 ")); sl@0: CTestActive* active = new(ELeave)CTestActive; sl@0: CleanupStack::PushL(active); sl@0: sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: sl@0: // Incoming sl@0: TLogString buf; sl@0: aClient.GetString(buf, R_LOG_DIR_IN); sl@0: sl@0: event->SetEventType(KLogCallEventTypeUid); sl@0: event->SetDirection(buf); sl@0: event->SetStatus(KTestStatus); sl@0: sl@0: // Add an event sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: CLogViewRecent* view = CLogViewRecent::NewL(aClient); sl@0: CleanupStack::PushL(view); sl@0: sl@0: TInt failCount = 0; sl@0: TBool finished = EFalse; sl@0: TInt error; sl@0: sl@0: while(!finished) sl@0: { sl@0: TheTest.Printf(_L("%d \r"), failCount); sl@0: __FILE_FAILNEXT(KErrNoMemory, failCount++); sl@0: sl@0: TBool result = EFalse; sl@0: TRAP(error, result = view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); sl@0: sl@0: if (error == KErrNone) sl@0: { sl@0: TEST(result); sl@0: sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: sl@0: if (active->iStatus.Int() == KErrNone) sl@0: { sl@0: finished = ETrue; sl@0: TEST(view->CountL() >= 1); sl@0: } sl@0: else sl@0: { sl@0: if(active->iStatus.Int() != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int()); sl@0: } sl@0: TEST2(active->iStatus.Int(), KErrNoMemory); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if(error != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error); sl@0: } sl@0: TEST2(error, KErrNoMemory); sl@0: } sl@0: sl@0: __FILE_RESET; sl@0: } sl@0: TheTest.Printf(_L("\r\nTest-1 has succeeded at iteration %d\n"), failCount); sl@0: sl@0: CLogFilterList* list = new(ELeave)CLogFilterList; sl@0: CleanupStack::PushL(list); sl@0: sl@0: CLogFilter* filter = CLogFilter::NewL(); sl@0: CleanupStack::PushL(filter); sl@0: filter->SetStatus(KTestStatus); sl@0: sl@0: failCount = 0; sl@0: finished = EFalse; sl@0: sl@0: while(!finished) sl@0: { sl@0: TheTest.Printf(_L("%d \r"), failCount); sl@0: __FILE_FAILNEXT(KErrNoMemory, failCount++); sl@0: sl@0: TBool result = EFalse; sl@0: TRAP(error, result = view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus)); sl@0: sl@0: if (error == KErrNone) sl@0: { sl@0: TEST(result); sl@0: sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: sl@0: if (active->iStatus.Int() == KErrNone) sl@0: { sl@0: finished = ETrue; sl@0: TEST(view->CountL() >= 1); sl@0: } sl@0: else sl@0: { sl@0: if(active->iStatus.Int() != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int()); sl@0: } sl@0: TEST2(active->iStatus.Int(), KErrNoMemory); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if(error != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error); sl@0: } sl@0: TEST2(error, KErrNoMemory); sl@0: } sl@0: sl@0: __FILE_RESET; sl@0: } sl@0: TheTest.Printf(_L("\r\nTest-2 has succeeded at iteration %d\n"), failCount); sl@0: sl@0: list->AppendL(filter); sl@0: CleanupStack::Pop(); // filter sl@0: sl@0: filter = CLogFilter::NewL(); sl@0: CleanupStack::PushL(filter); sl@0: filter->SetEventType(KLogCallEventTypeUid); sl@0: list->AppendL(filter); sl@0: CleanupStack::Pop(); // filter sl@0: sl@0: failCount = 0; sl@0: finished = EFalse; sl@0: sl@0: while(!finished) sl@0: { sl@0: TheTest.Printf(_L("%d \r"), failCount); sl@0: __FILE_FAILNEXT(KErrNoMemory, failCount++); sl@0: sl@0: TBool result = EFalse; sl@0: TRAP(error, result = view->SetRecentListL(KLogRecentIncomingCalls, *list, active->iStatus)); sl@0: sl@0: if (error == KErrNone) sl@0: { sl@0: TEST(result); sl@0: sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: sl@0: if (active->iStatus.Int() == KErrNone) sl@0: { sl@0: finished = ETrue; sl@0: TEST(view->CountL() >= 1); sl@0: } sl@0: else sl@0: { sl@0: if(active->iStatus.Int() != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int()); sl@0: } sl@0: TEST2(active->iStatus.Int(), KErrNoMemory); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if(error != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error); sl@0: } sl@0: TEST2(error, KErrNoMemory); sl@0: } sl@0: sl@0: __FILE_RESET; sl@0: } sl@0: sl@0: list->ResetAndDestroy(); sl@0: CleanupStack::PopAndDestroy(4); // list, view, event, active sl@0: sl@0: TheTest.Printf(_L("\r\nTest-3 has succeeded at iteration %d\n"), failCount); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0973 sl@0: @SYMTestCaseDesc Tests for CLogViewRecent::DuplicatesL() function sl@0: @SYMTestPriority High sl@0: @SYMTestActions Set the specified duplicate event view with logview duplicates. sl@0: Check for file failure errors sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestDuplicateViewSetupWithFileFailL(CLogClient& aClient) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0973 ")); sl@0: CTestActive* active = new(ELeave)CTestActive; sl@0: CleanupStack::PushL(active); sl@0: sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: sl@0: // Incoming sl@0: TLogString buf; sl@0: aClient.GetString(buf, R_LOG_DIR_IN); sl@0: sl@0: event->SetEventType(KLogCallEventTypeUid); sl@0: event->SetDirection(buf); sl@0: event->SetContact(KTestContact); sl@0: event->SetStatus(KTestStatus); sl@0: sl@0: // Add events sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: CLogViewRecent* view = CLogViewRecent::NewL(aClient); sl@0: CleanupStack::PushL(view); sl@0: sl@0: TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient); sl@0: CleanupStack::PushL(duplicate); sl@0: sl@0: TInt failCount = 0; sl@0: TBool finished = EFalse; sl@0: TInt error; sl@0: sl@0: while(!finished) sl@0: { sl@0: TheTest.Printf(_L("%d \r"), failCount); sl@0: __FILE_FAILNEXT(KErrNoMemory, failCount++); sl@0: sl@0: TBool result = EFalse; sl@0: TRAP(error, result = view->DuplicatesL(*duplicate, active->iStatus)); sl@0: sl@0: if (error == KErrNone) sl@0: { sl@0: TEST(result); sl@0: sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: sl@0: if (active->iStatus.Int() == KErrNone) sl@0: { sl@0: finished = ETrue; sl@0: TEST(duplicate->CountL() >= 1); sl@0: } sl@0: else sl@0: { sl@0: if(active->iStatus.Int() != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int()); sl@0: } sl@0: TEST2(active->iStatus.Int(), KErrNoMemory); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if(error != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error); sl@0: } sl@0: TEST2(error, KErrNoMemory); sl@0: } sl@0: sl@0: __FILE_RESET; sl@0: } sl@0: TheTest.Printf(_L("\r\nTest-1 has succeeded at iteration %d\n"), failCount); sl@0: sl@0: CLogFilterList* list = new(ELeave)CLogFilterList; sl@0: CleanupStack::PushL(list); sl@0: sl@0: CLogFilter* filter = CLogFilter::NewL(); sl@0: CleanupStack::PushL(filter); sl@0: filter->SetStatus(KTestStatus); sl@0: sl@0: failCount = 0; sl@0: finished = EFalse; sl@0: sl@0: while(!finished) sl@0: { sl@0: TheTest.Printf(_L("%d \r"), failCount); sl@0: __FILE_FAILNEXT(KErrNoMemory, failCount++); sl@0: sl@0: TBool result = EFalse; sl@0: TRAP(error, result = view->DuplicatesL(*duplicate, *filter, active->iStatus)); sl@0: sl@0: if (error == KErrNone) sl@0: { sl@0: TEST(result); sl@0: sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: sl@0: if (active->iStatus.Int() == KErrNone) sl@0: { sl@0: finished = ETrue; sl@0: TEST(duplicate->CountL() >= 1); sl@0: } sl@0: else sl@0: { sl@0: if(active->iStatus.Int() != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int()); sl@0: } sl@0: TEST2(active->iStatus.Int(), KErrNoMemory); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if(error != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error); sl@0: } sl@0: TEST2(error, KErrNoMemory); sl@0: } sl@0: sl@0: __FILE_RESET; sl@0: } sl@0: TheTest.Printf(_L("\r\nTest-2 has succeeded at iteration %d\n"), failCount); sl@0: sl@0: list->AppendL(filter); sl@0: CleanupStack::Pop(); // filter sl@0: sl@0: filter = CLogFilter::NewL(); sl@0: CleanupStack::PushL(filter); sl@0: filter->SetEventType(KLogCallEventTypeUid); sl@0: list->AppendL(filter); sl@0: CleanupStack::Pop(); // filter sl@0: sl@0: failCount = 0; sl@0: finished = EFalse; sl@0: sl@0: while(!finished) sl@0: { sl@0: TheTest.Printf(_L("%d \r"), failCount); sl@0: __FILE_FAILNEXT(KErrNoMemory, failCount++); sl@0: sl@0: TBool result = EFalse; sl@0: TRAP(error, result = view->DuplicatesL(*duplicate, *list, active->iStatus)); sl@0: sl@0: if (error == KErrNone) sl@0: { sl@0: TEST(result); sl@0: sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: sl@0: if (active->iStatus.Int() == KErrNone) sl@0: { sl@0: finished = ETrue; sl@0: TEST(duplicate->CountL() >= 1); sl@0: } sl@0: else sl@0: { sl@0: if(active->iStatus.Int() != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int()); sl@0: } sl@0: TEST2(active->iStatus.Int(), KErrNoMemory); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if(error != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error); sl@0: } sl@0: TEST2(error, KErrNoMemory); sl@0: } sl@0: sl@0: __FILE_RESET; sl@0: } sl@0: sl@0: list->ResetAndDestroy(); sl@0: CleanupStack::PopAndDestroy(5); // list, duplicate, view, event, active sl@0: sl@0: TheTest.Printf(_L("\r\nTest-3 has succeeded at iteration %d\n"), failCount); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0974 sl@0: @SYMTestCaseDesc Tests for CLogViewEvent::NextL(),CLogViewEvent::LastL(),CLogViewEvent::PreviousL(), sl@0: CLogViewEvent::FirstL() functions sl@0: @SYMTestPriority High sl@0: @SYMTestActions Tests for all the navigation functions in the view.Check for file failure error sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestNavigationWithFileFailL(CLogClient& aClient) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0974 ")); sl@0: CTestActive* active = new(ELeave)CTestActive; sl@0: CleanupStack::PushL(active); sl@0: sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: event->SetEventType(KLogCallEventTypeUid); sl@0: sl@0: // Add an event sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); 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: TInt failCount = 0; sl@0: TBool finished = EFalse; sl@0: TInt error; sl@0: sl@0: while(!finished) 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: TEST(view->CountL() > 1); sl@0: event->CopyL(view->Event()); sl@0: sl@0: TheTest.Printf(_L("%d \r"), failCount); sl@0: __FILE_FAILNEXT(KErrNoMemory, failCount++); sl@0: sl@0: TBool result = EFalse; sl@0: TRAP(error, result = view->NextL(active->iStatus)); sl@0: sl@0: if (error == KErrNone) sl@0: { sl@0: TEST(result); sl@0: sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: sl@0: if (active->iStatus.Int() == KErrNone) sl@0: { sl@0: finished = ETrue; sl@0: TEST(!TestUtils::EventsEqual(*event, view->Event())); sl@0: } sl@0: else sl@0: { sl@0: if(active->iStatus.Int() != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int()); sl@0: } sl@0: TEST2(active->iStatus.Int(), KErrNoMemory); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if(error != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error); sl@0: } sl@0: TEST2(error, KErrNoMemory); sl@0: } sl@0: sl@0: __FILE_RESET; sl@0: } sl@0: TheTest.Printf(_L("\r\nTest-1 (\"View Next\") has succeeded at iteration %d\n"), failCount); sl@0: sl@0: failCount = 0; sl@0: finished = EFalse; sl@0: sl@0: while(!finished) 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: TEST(view->CountL() > 1); sl@0: sl@0: TEST(view->LastL(active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: event->CopyL(view->Event()); sl@0: sl@0: TheTest.Printf(_L("%d \r"), failCount); sl@0: __FILE_FAILNEXT(KErrNoMemory, failCount++); sl@0: sl@0: TBool result = EFalse; sl@0: TRAP(error, result = view->PreviousL(active->iStatus)); sl@0: sl@0: if (error == KErrNone) sl@0: { sl@0: TEST(result); sl@0: sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: sl@0: if (active->iStatus.Int() == KErrNone) sl@0: { sl@0: finished = ETrue; sl@0: TEST(!TestUtils::EventsEqual(*event, view->Event())); sl@0: } sl@0: else sl@0: { sl@0: if(active->iStatus.Int() != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int()); sl@0: } sl@0: TEST2(active->iStatus.Int(), KErrNoMemory); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if(error != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error); sl@0: } sl@0: TEST2(error, KErrNoMemory); sl@0: } sl@0: sl@0: __FILE_RESET; sl@0: } sl@0: TheTest.Printf(_L("\r\nTest-2 (\"View Previous\") has succeeded at iteration %d\n"), failCount); sl@0: sl@0: failCount = 0; sl@0: finished = EFalse; sl@0: sl@0: while(!finished) 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: TEST(view->CountL() > 1); sl@0: sl@0: TEST(view->LastL(active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: event->CopyL(view->Event()); sl@0: sl@0: TheTest.Printf(_L("%d \r"), failCount); sl@0: __FILE_FAILNEXT(KErrNoMemory, failCount++); sl@0: sl@0: TBool result = EFalse; sl@0: TRAP(error, result = view->FirstL(active->iStatus)); sl@0: sl@0: if (error == KErrNone) sl@0: { sl@0: TEST(result); sl@0: sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: sl@0: if (active->iStatus.Int() == KErrNone) sl@0: { sl@0: finished = ETrue; sl@0: TEST(!TestUtils::EventsEqual(*event, view->Event())); sl@0: } sl@0: else sl@0: { sl@0: if(active->iStatus.Int() != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int()); sl@0: } sl@0: TEST2(active->iStatus.Int(), KErrNoMemory); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if(error != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error); sl@0: } sl@0: TEST2(error, KErrNoMemory); sl@0: } sl@0: sl@0: __FILE_RESET; sl@0: } sl@0: TheTest.Printf(_L("\r\nTest-3 (\"View First\") has succeeded at iteration %d\n"), failCount); sl@0: sl@0: failCount = 0; sl@0: finished = EFalse; sl@0: sl@0: while(!finished) 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: TEST(view->CountL() > 1); sl@0: sl@0: TEST(view->FirstL(active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: event->CopyL(view->Event()); sl@0: sl@0: TheTest.Printf(_L("%d \r"), failCount); sl@0: __FILE_FAILNEXT(KErrNoMemory, failCount++); sl@0: sl@0: TBool result = EFalse; sl@0: TRAP(error, result = view->LastL(active->iStatus)); sl@0: sl@0: if (error == KErrNone) sl@0: { sl@0: TEST(result); sl@0: sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: sl@0: if (active->iStatus.Int() == KErrNone) sl@0: { sl@0: finished = ETrue; sl@0: TEST(!TestUtils::EventsEqual(*event, view->Event())); sl@0: } sl@0: else sl@0: { sl@0: if(active->iStatus.Int() != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int()); sl@0: } sl@0: TEST2(active->iStatus.Int(), KErrNoMemory); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if(error != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error); sl@0: } sl@0: TEST2(error, KErrNoMemory); sl@0: } sl@0: sl@0: __FILE_RESET; sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(4); // filter, view, event, active sl@0: sl@0: TheTest.Printf(_L("\r\nTest-4 (\"View Last\") has succeeded at iteration %d\n"), failCount); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0975 sl@0: @SYMTestCaseDesc Tests for CLogViewEvent::CountL() functions sl@0: @SYMTestPriority High sl@0: @SYMTestActions Test for getting the number of events in the view.Check for file failure error sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestViewCountWithFileFailL(CLogClient& aClient) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0975 ")); sl@0: CTestActive* active = new(ELeave)CTestActive; sl@0: CleanupStack::PushL(active); sl@0: sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: event->SetEventType(KLogCallEventTypeUid); sl@0: sl@0: // Add an event sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); 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: 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: TInt failCount = 0; sl@0: TBool finished = EFalse; sl@0: TInt error; sl@0: sl@0: while(!finished) sl@0: { sl@0: TheTest.Printf(_L("%d \r"), failCount); sl@0: __FILE_FAILNEXT(KErrNoMemory, failCount++); sl@0: sl@0: TInt result = 0; sl@0: TRAP(error, result = view->CountL()); sl@0: sl@0: if (error == KErrNone) sl@0: { sl@0: finished = ETrue; sl@0: TEST(result > 0); sl@0: } sl@0: else sl@0: { sl@0: if(error != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error); sl@0: } sl@0: TEST2(error, KErrNoMemory); sl@0: } sl@0: sl@0: __FILE_RESET; sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(4); // filter, view, event, active sl@0: sl@0: TheTest.Printf(_L("\r\nThe test (\"View Count\") has succeeded at iteration %d\n"), failCount); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0976 sl@0: @SYMTestCaseDesc Tests for CLogViewRecent::RemoveL() function sl@0: @SYMTestPriority High sl@0: @SYMTestActions Test for removing the event with the specified unique event ID from the view.Check for file failure error sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestRecentViewRemoveWithFileFailL(CLogClient& aClient) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0976 ")); sl@0: CTestActive* active = new(ELeave)CTestActive; sl@0: CleanupStack::PushL(active); sl@0: sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: sl@0: // Incoming sl@0: TLogString 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: // Add events sl@0: event->SetContact(1); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: event->SetContact(2); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: event->SetContact(3); sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: CLogViewRecent* view = CLogViewRecent::NewL(aClient); sl@0: CleanupStack::PushL(view); sl@0: sl@0: TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); 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: TEST(count > 1); sl@0: sl@0: TInt failCount = 0; sl@0: TBool finished = EFalse; sl@0: TInt error; sl@0: sl@0: while(!finished) sl@0: { sl@0: TheTest.Printf(_L("%d \r"), failCount); sl@0: __FILE_FAILNEXT(KErrNoMemory, failCount++); sl@0: sl@0: TRAP(error, view->RemoveL(view->Event().Id())); sl@0: sl@0: __FILE_RESET; sl@0: sl@0: if (error == KErrNone) sl@0: { sl@0: finished = ETrue; sl@0: sl@0: TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: if(active->iStatus.Int() != KErrNone) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int()); sl@0: } sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(count == view->CountL() + 1); sl@0: } sl@0: else sl@0: { sl@0: if(error != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error); sl@0: } sl@0: TEST2(error, KErrNoMemory); sl@0: } sl@0: // This failCount value causes DBMS to return KErrCorrupt. Apparently this sl@0: // can't actually occur in real life, so we skip this value. sl@0: if (failCount > 9) sl@0: { sl@0: finished = ETrue; sl@0: TRAP(error, view->RemoveL(view->Event().Id())); sl@0: TEST2(error, KErrNone); sl@0: } sl@0: } sl@0: CleanupStack::PopAndDestroy(3); // view, event, active sl@0: sl@0: TheTest.Printf(_L("\r\nThe test (\"View Remove\") has succeeded at iteration %d\n"), failCount); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-LOGENG-CT-0977 sl@0: @SYMTestCaseDesc Tests for CLogViewDuplicate::RemoveL() function sl@0: @SYMTestPriority High sl@0: @SYMTestActions Test for removing the event with the specified unique event ID from the view.Check for file failure error sl@0: @SYMTestExpectedResults Test must not fail sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: LOCAL_C void TestDuplicateViewRemoveWithFileFailL(CLogClient& aClient) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0977 ")); sl@0: CTestActive* active = new(ELeave)CTestActive; sl@0: CleanupStack::PushL(active); sl@0: sl@0: CLogEvent* event = CLogEvent::NewL(); sl@0: CleanupStack::PushL(event); sl@0: sl@0: // Incoming sl@0: TLogString buf; sl@0: aClient.GetString(buf, R_LOG_DIR_IN); sl@0: sl@0: event->SetEventType(KLogCallEventTypeUid); sl@0: event->SetDirection(buf); sl@0: event->SetContact(KTestContact); sl@0: sl@0: // Add events sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: aClient.AddEvent(*event, active->iStatus); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: CLogViewRecent* view = CLogViewRecent::NewL(aClient); sl@0: CleanupStack::PushL(view); sl@0: sl@0: TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient); sl@0: CleanupStack::PushL(duplicate); sl@0: sl@0: TEST(view->DuplicatesL(*duplicate, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TInt count = duplicate->CountL(); sl@0: TEST(count > 0); sl@0: sl@0: TInt failCount = 0; sl@0: TBool finished = EFalse; sl@0: TInt error; sl@0: sl@0: while(!finished) sl@0: { sl@0: TheTest.Printf(_L("%d \r"), failCount); sl@0: __FILE_FAILNEXT(KErrNoMemory, failCount++); sl@0: sl@0: if(failCount == 17) sl@0: { sl@0: __FILE_RESET; sl@0: break; sl@0: } sl@0: sl@0: TRAP(error, duplicate->RemoveL(duplicate->Event().Id())); sl@0: sl@0: __FILE_RESET; sl@0: sl@0: if (error == KErrNone) sl@0: { sl@0: finished = ETrue; sl@0: sl@0: TEST(view->DuplicatesL(*duplicate, active->iStatus)); sl@0: active->StartL(); sl@0: CActiveScheduler::Start(); sl@0: if(active->iStatus.Int() != KErrNone) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int()); sl@0: } sl@0: TEST2(active->iStatus.Int(), KErrNone); sl@0: sl@0: TEST(count == duplicate->CountL() + 1); sl@0: } sl@0: else sl@0: { sl@0: if(error != KErrNoMemory) sl@0: { sl@0: TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error); sl@0: } sl@0: TEST2(error, KErrNoMemory); sl@0: } sl@0: } sl@0: CleanupStack::PopAndDestroy(4); // duplicate, view, event, active sl@0: sl@0: TheTest.Printf(_L("\r\nThe test (\"View Remove Duplicates\") has succeeded at iteration %d\n"), failCount); sl@0: } sl@0: sl@0: void doTestsL() sl@0: { sl@0: TestUtils::Initialize(_L("t_logviewfail2")); 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("Event View Setup")); sl@0: TestEventViewSetupWithFileFailL(*client); sl@0: TheTest.Next(_L("Recent View Setup")); sl@0: TestRecentViewSetupWithFileFailL(*client); sl@0: TheTest.Next(_L("Duplicated View Setup")); sl@0: TestDuplicateViewSetupWithFileFailL(*client); sl@0: theLog.Write(_L8("Test 1 OK\n")); sl@0: sl@0: TheTest.Next(_L("View Navigation")); sl@0: TestNavigationWithFileFailL(*client); sl@0: theLog.Write(_L8("Test 2 OK\n")); sl@0: sl@0: TheTest.Next(_L("View Count")); sl@0: TestViewCountWithFileFailL(*client); sl@0: TheTest.Next(_L("View Remove")); sl@0: TestRecentViewRemoveWithFileFailL(*client); sl@0: TheTest.Next(_L("View Remove Duplicates")); sl@0: TestDuplicateViewRemoveWithFileFailL(*client); sl@0: theLog.Write(_L8("Test 3 OK\n")); sl@0: sl@0: CleanupStack::PopAndDestroy(); // client; sl@0: }