1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/loggingservices/eventlogger/test/src/t_logviewfail2.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1145 @@
1.4 +// Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include <s32file.h>
1.20 +#include "t_logutil2.h"
1.21 +#include <logview.h>
1.22 +
1.23 +RTest TheTest(_L("t_logviewfail2"));
1.24 +
1.25 +const TLogContactItemId KTestContact = 0x123;
1.26 +_LIT(KTestStatus, "Test Status Text");
1.27 +
1.28 +/**
1.29 +@SYMTestCaseID SYSLIB-LOGENG-CT-0971
1.30 +@SYMTestCaseDesc Tests for CLogViewEvent::SetFilterL() function
1.31 +@SYMTestPriority High
1.32 +@SYMTestActions Create a log filter and set the filter on logview.Check for equality of events on the view and events
1.33 + added.Check for file failure error
1.34 +@SYMTestExpectedResults Test must not fail
1.35 +@SYMREQ REQ0000
1.36 +*/
1.37 +LOCAL_C void TestEventViewSetupWithFileFailL(CLogClient& aClient)
1.38 + {
1.39 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0971 "));
1.40 + CTestActive* active = new(ELeave)CTestActive;
1.41 + CleanupStack::PushL(active);
1.42 +
1.43 + CLogEvent* event = CLogEvent::NewL();
1.44 + CleanupStack::PushL(event);
1.45 + event->SetEventType(KLogCallEventTypeUid);
1.46 + event->SetStatus(KTestStatus);
1.47 +
1.48 + // Add an event
1.49 + aClient.AddEvent(*event, active->iStatus);
1.50 + active->StartL();
1.51 + CActiveScheduler::Start();
1.52 + TEST2(active->iStatus.Int(), KErrNone);
1.53 +
1.54 + CLogViewEvent* view = CLogViewEvent::NewL(aClient);
1.55 + CleanupStack::PushL(view);
1.56 +
1.57 + CLogFilterList* list = new(ELeave)CLogFilterList;
1.58 + CleanupStack::PushL(list);
1.59 +
1.60 + CLogFilter* filter = CLogFilter::NewL();
1.61 + CleanupStack::PushL(filter);
1.62 + filter->SetStatus(KTestStatus);
1.63 +
1.64 + TInt failCount = 0;
1.65 +
1.66 + TBool finished = EFalse;
1.67 + TInt error;
1.68 +
1.69 + while(!finished)
1.70 + {
1.71 + TheTest.Printf(_L("%d \r"), failCount);
1.72 + __FILE_FAILNEXT(KErrNoMemory, failCount++);
1.73 +
1.74 + TBool result = EFalse;
1.75 + TRAP(error, result = view->SetFilterL(*filter, active->iStatus));
1.76 +
1.77 + if (error == KErrNone)
1.78 + {
1.79 + TEST(result);
1.80 +
1.81 + active->StartL();
1.82 + CActiveScheduler::Start();
1.83 +
1.84 + if (active->iStatus.Int() == KErrNone)
1.85 + {
1.86 + finished = ETrue;
1.87 +
1.88 + TEST(view->CountL() >= 1);
1.89 + TEST(TestUtils::EventsEqual(*event, view->Event()));
1.90 + }
1.91 + else
1.92 + {
1.93 + if(active->iStatus.Int() != KErrNoMemory)
1.94 + {
1.95 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
1.96 + }
1.97 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.98 + }
1.99 + }
1.100 + else
1.101 + {
1.102 + if(error != KErrNoMemory)
1.103 + {
1.104 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1.105 + }
1.106 + TEST2(error, KErrNoMemory);
1.107 + }
1.108 +
1.109 + __FILE_RESET;
1.110 + }
1.111 + TheTest.Printf(_L("\r\nTest-1 has succeeded at iteration %d\n"), failCount);
1.112 +
1.113 + list->AppendL(filter);
1.114 + CleanupStack::Pop(); // filter
1.115 +
1.116 + filter = CLogFilter::NewL();
1.117 + CleanupStack::PushL(filter);
1.118 + filter->SetEventType(KLogCallEventTypeUid);
1.119 + list->AppendL(filter);
1.120 + CleanupStack::Pop(); // filter
1.121 +
1.122 + failCount = 0;
1.123 + finished = EFalse;
1.124 +
1.125 + while(!finished)
1.126 + {
1.127 + TheTest.Printf(_L("%d \r"), failCount);
1.128 + __FILE_FAILNEXT(KErrNoMemory, failCount++);
1.129 +
1.130 + TBool result = EFalse;
1.131 + TRAP(error, result = view->SetFilterL(*list, active->iStatus));
1.132 +
1.133 + if (error == KErrNone)
1.134 + {
1.135 + TEST(result);
1.136 +
1.137 + active->StartL();
1.138 + CActiveScheduler::Start();
1.139 +
1.140 + if (active->iStatus.Int() == KErrNone)
1.141 + {
1.142 + finished = ETrue;
1.143 +
1.144 + TEST(view->CountL() >= 1);
1.145 + TEST(TestUtils::EventsEqual(*event, view->Event()));
1.146 + }
1.147 + else
1.148 + {
1.149 + if(active->iStatus.Int() != KErrNoMemory)
1.150 + {
1.151 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
1.152 + }
1.153 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.154 + }
1.155 + }
1.156 + else
1.157 + {
1.158 + if(error != KErrNoMemory)
1.159 + {
1.160 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1.161 + }
1.162 + TEST2(error, KErrNoMemory);
1.163 + }
1.164 +
1.165 + __FILE_RESET;
1.166 + }
1.167 +
1.168 + list->ResetAndDestroy();
1.169 + CleanupStack::PopAndDestroy(4); // list, view, event, active
1.170 +
1.171 + TheTest.Printf(_L("\r\nTest-2 has succeeded at iteration %d\n"), failCount);
1.172 + }
1.173 +
1.174 +/**
1.175 +@SYMTestCaseID SYSLIB-LOGENG-CT-0972
1.176 +@SYMTestCaseDesc Tests CLogViewRecent::SetRecentListL() function
1.177 +@SYMTestPriority High
1.178 +@SYMTestActions Set recent view list first without a filter and later with log filter,check for file failure error
1.179 +@SYMTestExpectedResults Test must not fail
1.180 +@SYMREQ REQ0000
1.181 +*/
1.182 +LOCAL_C void TestRecentViewSetupWithFileFailL(CLogClient& aClient)
1.183 + {
1.184 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0972 "));
1.185 + CTestActive* active = new(ELeave)CTestActive;
1.186 + CleanupStack::PushL(active);
1.187 +
1.188 + CLogEvent* event = CLogEvent::NewL();
1.189 + CleanupStack::PushL(event);
1.190 +
1.191 + // Incoming
1.192 + TLogString buf;
1.193 + aClient.GetString(buf, R_LOG_DIR_IN);
1.194 +
1.195 + event->SetEventType(KLogCallEventTypeUid);
1.196 + event->SetDirection(buf);
1.197 + event->SetStatus(KTestStatus);
1.198 +
1.199 + // Add an event
1.200 + aClient.AddEvent(*event, active->iStatus);
1.201 + active->StartL();
1.202 + CActiveScheduler::Start();
1.203 + TEST2(active->iStatus.Int(), KErrNone);
1.204 +
1.205 + CLogViewRecent* view = CLogViewRecent::NewL(aClient);
1.206 + CleanupStack::PushL(view);
1.207 +
1.208 + TInt failCount = 0;
1.209 + TBool finished = EFalse;
1.210 + TInt error;
1.211 +
1.212 + while(!finished)
1.213 + {
1.214 + TheTest.Printf(_L("%d \r"), failCount);
1.215 + __FILE_FAILNEXT(KErrNoMemory, failCount++);
1.216 +
1.217 + TBool result = EFalse;
1.218 + TRAP(error, result = view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
1.219 +
1.220 + if (error == KErrNone)
1.221 + {
1.222 + TEST(result);
1.223 +
1.224 + active->StartL();
1.225 + CActiveScheduler::Start();
1.226 +
1.227 + if (active->iStatus.Int() == KErrNone)
1.228 + {
1.229 + finished = ETrue;
1.230 + TEST(view->CountL() >= 1);
1.231 + }
1.232 + else
1.233 + {
1.234 + if(active->iStatus.Int() != KErrNoMemory)
1.235 + {
1.236 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
1.237 + }
1.238 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.239 + }
1.240 + }
1.241 + else
1.242 + {
1.243 + if(error != KErrNoMemory)
1.244 + {
1.245 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1.246 + }
1.247 + TEST2(error, KErrNoMemory);
1.248 + }
1.249 +
1.250 + __FILE_RESET;
1.251 + }
1.252 + TheTest.Printf(_L("\r\nTest-1 has succeeded at iteration %d\n"), failCount);
1.253 +
1.254 + CLogFilterList* list = new(ELeave)CLogFilterList;
1.255 + CleanupStack::PushL(list);
1.256 +
1.257 + CLogFilter* filter = CLogFilter::NewL();
1.258 + CleanupStack::PushL(filter);
1.259 + filter->SetStatus(KTestStatus);
1.260 +
1.261 + failCount = 0;
1.262 + finished = EFalse;
1.263 +
1.264 + while(!finished)
1.265 + {
1.266 + TheTest.Printf(_L("%d \r"), failCount);
1.267 + __FILE_FAILNEXT(KErrNoMemory, failCount++);
1.268 +
1.269 + TBool result = EFalse;
1.270 + TRAP(error, result = view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
1.271 +
1.272 + if (error == KErrNone)
1.273 + {
1.274 + TEST(result);
1.275 +
1.276 + active->StartL();
1.277 + CActiveScheduler::Start();
1.278 +
1.279 + if (active->iStatus.Int() == KErrNone)
1.280 + {
1.281 + finished = ETrue;
1.282 + TEST(view->CountL() >= 1);
1.283 + }
1.284 + else
1.285 + {
1.286 + if(active->iStatus.Int() != KErrNoMemory)
1.287 + {
1.288 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
1.289 + }
1.290 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.291 + }
1.292 + }
1.293 + else
1.294 + {
1.295 + if(error != KErrNoMemory)
1.296 + {
1.297 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1.298 + }
1.299 + TEST2(error, KErrNoMemory);
1.300 + }
1.301 +
1.302 + __FILE_RESET;
1.303 + }
1.304 + TheTest.Printf(_L("\r\nTest-2 has succeeded at iteration %d\n"), failCount);
1.305 +
1.306 + list->AppendL(filter);
1.307 + CleanupStack::Pop(); // filter
1.308 +
1.309 + filter = CLogFilter::NewL();
1.310 + CleanupStack::PushL(filter);
1.311 + filter->SetEventType(KLogCallEventTypeUid);
1.312 + list->AppendL(filter);
1.313 + CleanupStack::Pop(); // filter
1.314 +
1.315 + failCount = 0;
1.316 + finished = EFalse;
1.317 +
1.318 + while(!finished)
1.319 + {
1.320 + TheTest.Printf(_L("%d \r"), failCount);
1.321 + __FILE_FAILNEXT(KErrNoMemory, failCount++);
1.322 +
1.323 + TBool result = EFalse;
1.324 + TRAP(error, result = view->SetRecentListL(KLogRecentIncomingCalls, *list, active->iStatus));
1.325 +
1.326 + if (error == KErrNone)
1.327 + {
1.328 + TEST(result);
1.329 +
1.330 + active->StartL();
1.331 + CActiveScheduler::Start();
1.332 +
1.333 + if (active->iStatus.Int() == KErrNone)
1.334 + {
1.335 + finished = ETrue;
1.336 + TEST(view->CountL() >= 1);
1.337 + }
1.338 + else
1.339 + {
1.340 + if(active->iStatus.Int() != KErrNoMemory)
1.341 + {
1.342 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
1.343 + }
1.344 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.345 + }
1.346 + }
1.347 + else
1.348 + {
1.349 + if(error != KErrNoMemory)
1.350 + {
1.351 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1.352 + }
1.353 + TEST2(error, KErrNoMemory);
1.354 + }
1.355 +
1.356 + __FILE_RESET;
1.357 + }
1.358 +
1.359 + list->ResetAndDestroy();
1.360 + CleanupStack::PopAndDestroy(4); // list, view, event, active
1.361 +
1.362 + TheTest.Printf(_L("\r\nTest-3 has succeeded at iteration %d\n"), failCount);
1.363 + }
1.364 +
1.365 +/**
1.366 +@SYMTestCaseID SYSLIB-LOGENG-CT-0973
1.367 +@SYMTestCaseDesc Tests for CLogViewRecent::DuplicatesL() function
1.368 +@SYMTestPriority High
1.369 +@SYMTestActions Set the specified duplicate event view with logview duplicates.
1.370 + Check for file failure errors
1.371 +@SYMTestExpectedResults Test must not fail
1.372 +@SYMREQ REQ0000
1.373 +*/
1.374 +LOCAL_C void TestDuplicateViewSetupWithFileFailL(CLogClient& aClient)
1.375 + {
1.376 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0973 "));
1.377 + CTestActive* active = new(ELeave)CTestActive;
1.378 + CleanupStack::PushL(active);
1.379 +
1.380 + CLogEvent* event = CLogEvent::NewL();
1.381 + CleanupStack::PushL(event);
1.382 +
1.383 + // Incoming
1.384 + TLogString buf;
1.385 + aClient.GetString(buf, R_LOG_DIR_IN);
1.386 +
1.387 + event->SetEventType(KLogCallEventTypeUid);
1.388 + event->SetDirection(buf);
1.389 + event->SetContact(KTestContact);
1.390 + event->SetStatus(KTestStatus);
1.391 +
1.392 + // Add events
1.393 + aClient.AddEvent(*event, active->iStatus);
1.394 + active->StartL();
1.395 + CActiveScheduler::Start();
1.396 + TEST2(active->iStatus.Int(), KErrNone);
1.397 +
1.398 + aClient.AddEvent(*event, active->iStatus);
1.399 + active->StartL();
1.400 + CActiveScheduler::Start();
1.401 + TEST2(active->iStatus.Int(), KErrNone);
1.402 +
1.403 + CLogViewRecent* view = CLogViewRecent::NewL(aClient);
1.404 + CleanupStack::PushL(view);
1.405 +
1.406 + TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
1.407 + active->StartL();
1.408 + CActiveScheduler::Start();
1.409 + TEST2(active->iStatus.Int(), KErrNone);
1.410 +
1.411 + CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
1.412 + CleanupStack::PushL(duplicate);
1.413 +
1.414 + TInt failCount = 0;
1.415 + TBool finished = EFalse;
1.416 + TInt error;
1.417 +
1.418 + while(!finished)
1.419 + {
1.420 + TheTest.Printf(_L("%d \r"), failCount);
1.421 + __FILE_FAILNEXT(KErrNoMemory, failCount++);
1.422 +
1.423 + TBool result = EFalse;
1.424 + TRAP(error, result = view->DuplicatesL(*duplicate, active->iStatus));
1.425 +
1.426 + if (error == KErrNone)
1.427 + {
1.428 + TEST(result);
1.429 +
1.430 + active->StartL();
1.431 + CActiveScheduler::Start();
1.432 +
1.433 + if (active->iStatus.Int() == KErrNone)
1.434 + {
1.435 + finished = ETrue;
1.436 + TEST(duplicate->CountL() >= 1);
1.437 + }
1.438 + else
1.439 + {
1.440 + if(active->iStatus.Int() != KErrNoMemory)
1.441 + {
1.442 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
1.443 + }
1.444 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.445 + }
1.446 + }
1.447 + else
1.448 + {
1.449 + if(error != KErrNoMemory)
1.450 + {
1.451 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1.452 + }
1.453 + TEST2(error, KErrNoMemory);
1.454 + }
1.455 +
1.456 + __FILE_RESET;
1.457 + }
1.458 + TheTest.Printf(_L("\r\nTest-1 has succeeded at iteration %d\n"), failCount);
1.459 +
1.460 + CLogFilterList* list = new(ELeave)CLogFilterList;
1.461 + CleanupStack::PushL(list);
1.462 +
1.463 + CLogFilter* filter = CLogFilter::NewL();
1.464 + CleanupStack::PushL(filter);
1.465 + filter->SetStatus(KTestStatus);
1.466 +
1.467 + failCount = 0;
1.468 + finished = EFalse;
1.469 +
1.470 + while(!finished)
1.471 + {
1.472 + TheTest.Printf(_L("%d \r"), failCount);
1.473 + __FILE_FAILNEXT(KErrNoMemory, failCount++);
1.474 +
1.475 + TBool result = EFalse;
1.476 + TRAP(error, result = view->DuplicatesL(*duplicate, *filter, active->iStatus));
1.477 +
1.478 + if (error == KErrNone)
1.479 + {
1.480 + TEST(result);
1.481 +
1.482 + active->StartL();
1.483 + CActiveScheduler::Start();
1.484 +
1.485 + if (active->iStatus.Int() == KErrNone)
1.486 + {
1.487 + finished = ETrue;
1.488 + TEST(duplicate->CountL() >= 1);
1.489 + }
1.490 + else
1.491 + {
1.492 + if(active->iStatus.Int() != KErrNoMemory)
1.493 + {
1.494 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
1.495 + }
1.496 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.497 + }
1.498 + }
1.499 + else
1.500 + {
1.501 + if(error != KErrNoMemory)
1.502 + {
1.503 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1.504 + }
1.505 + TEST2(error, KErrNoMemory);
1.506 + }
1.507 +
1.508 + __FILE_RESET;
1.509 + }
1.510 + TheTest.Printf(_L("\r\nTest-2 has succeeded at iteration %d\n"), failCount);
1.511 +
1.512 + list->AppendL(filter);
1.513 + CleanupStack::Pop(); // filter
1.514 +
1.515 + filter = CLogFilter::NewL();
1.516 + CleanupStack::PushL(filter);
1.517 + filter->SetEventType(KLogCallEventTypeUid);
1.518 + list->AppendL(filter);
1.519 + CleanupStack::Pop(); // filter
1.520 +
1.521 + failCount = 0;
1.522 + finished = EFalse;
1.523 +
1.524 + while(!finished)
1.525 + {
1.526 + TheTest.Printf(_L("%d \r"), failCount);
1.527 + __FILE_FAILNEXT(KErrNoMemory, failCount++);
1.528 +
1.529 + TBool result = EFalse;
1.530 + TRAP(error, result = view->DuplicatesL(*duplicate, *list, active->iStatus));
1.531 +
1.532 + if (error == KErrNone)
1.533 + {
1.534 + TEST(result);
1.535 +
1.536 + active->StartL();
1.537 + CActiveScheduler::Start();
1.538 +
1.539 + if (active->iStatus.Int() == KErrNone)
1.540 + {
1.541 + finished = ETrue;
1.542 + TEST(duplicate->CountL() >= 1);
1.543 + }
1.544 + else
1.545 + {
1.546 + if(active->iStatus.Int() != KErrNoMemory)
1.547 + {
1.548 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
1.549 + }
1.550 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.551 + }
1.552 + }
1.553 + else
1.554 + {
1.555 + if(error != KErrNoMemory)
1.556 + {
1.557 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1.558 + }
1.559 + TEST2(error, KErrNoMemory);
1.560 + }
1.561 +
1.562 + __FILE_RESET;
1.563 + }
1.564 +
1.565 + list->ResetAndDestroy();
1.566 + CleanupStack::PopAndDestroy(5); // list, duplicate, view, event, active
1.567 +
1.568 + TheTest.Printf(_L("\r\nTest-3 has succeeded at iteration %d\n"), failCount);
1.569 + }
1.570 +
1.571 +/**
1.572 +@SYMTestCaseID SYSLIB-LOGENG-CT-0974
1.573 +@SYMTestCaseDesc Tests for CLogViewEvent::NextL(),CLogViewEvent::LastL(),CLogViewEvent::PreviousL(),
1.574 + CLogViewEvent::FirstL() functions
1.575 +@SYMTestPriority High
1.576 +@SYMTestActions Tests for all the navigation functions in the view.Check for file failure error
1.577 +@SYMTestExpectedResults Test must not fail
1.578 +@SYMREQ REQ0000
1.579 +*/
1.580 +LOCAL_C void TestNavigationWithFileFailL(CLogClient& aClient)
1.581 + {
1.582 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0974 "));
1.583 + CTestActive* active = new(ELeave)CTestActive;
1.584 + CleanupStack::PushL(active);
1.585 +
1.586 + CLogEvent* event = CLogEvent::NewL();
1.587 + CleanupStack::PushL(event);
1.588 + event->SetEventType(KLogCallEventTypeUid);
1.589 +
1.590 + // Add an event
1.591 + aClient.AddEvent(*event, active->iStatus);
1.592 + active->StartL();
1.593 + CActiveScheduler::Start();
1.594 + TEST2(active->iStatus.Int(), KErrNone);
1.595 +
1.596 + CLogViewEvent* view = CLogViewEvent::NewL(aClient);
1.597 + CleanupStack::PushL(view);
1.598 +
1.599 + CLogFilter* filter = CLogFilter::NewL();
1.600 + CleanupStack::PushL(filter);
1.601 +
1.602 + TInt failCount = 0;
1.603 + TBool finished = EFalse;
1.604 + TInt error;
1.605 +
1.606 + while(!finished)
1.607 + {
1.608 + TEST(view->SetFilterL(*filter, active->iStatus));
1.609 + active->StartL();
1.610 + CActiveScheduler::Start();
1.611 + TEST2(active->iStatus.Int(), KErrNone);
1.612 + TEST(view->CountL() > 1);
1.613 + event->CopyL(view->Event());
1.614 +
1.615 + TheTest.Printf(_L("%d \r"), failCount);
1.616 + __FILE_FAILNEXT(KErrNoMemory, failCount++);
1.617 +
1.618 + TBool result = EFalse;
1.619 + TRAP(error, result = view->NextL(active->iStatus));
1.620 +
1.621 + if (error == KErrNone)
1.622 + {
1.623 + TEST(result);
1.624 +
1.625 + active->StartL();
1.626 + CActiveScheduler::Start();
1.627 +
1.628 + if (active->iStatus.Int() == KErrNone)
1.629 + {
1.630 + finished = ETrue;
1.631 + TEST(!TestUtils::EventsEqual(*event, view->Event()));
1.632 + }
1.633 + else
1.634 + {
1.635 + if(active->iStatus.Int() != KErrNoMemory)
1.636 + {
1.637 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
1.638 + }
1.639 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.640 + }
1.641 + }
1.642 + else
1.643 + {
1.644 + if(error != KErrNoMemory)
1.645 + {
1.646 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1.647 + }
1.648 + TEST2(error, KErrNoMemory);
1.649 + }
1.650 +
1.651 + __FILE_RESET;
1.652 + }
1.653 + TheTest.Printf(_L("\r\nTest-1 (\"View Next\") has succeeded at iteration %d\n"), failCount);
1.654 +
1.655 + failCount = 0;
1.656 + finished = EFalse;
1.657 +
1.658 + while(!finished)
1.659 + {
1.660 + TEST(view->SetFilterL(*filter, active->iStatus));
1.661 + active->StartL();
1.662 + CActiveScheduler::Start();
1.663 + TEST2(active->iStatus.Int(), KErrNone);
1.664 + TEST(view->CountL() > 1);
1.665 +
1.666 + TEST(view->LastL(active->iStatus));
1.667 + active->StartL();
1.668 + CActiveScheduler::Start();
1.669 + TEST2(active->iStatus.Int(), KErrNone);
1.670 +
1.671 + event->CopyL(view->Event());
1.672 +
1.673 + TheTest.Printf(_L("%d \r"), failCount);
1.674 + __FILE_FAILNEXT(KErrNoMemory, failCount++);
1.675 +
1.676 + TBool result = EFalse;
1.677 + TRAP(error, result = view->PreviousL(active->iStatus));
1.678 +
1.679 + if (error == KErrNone)
1.680 + {
1.681 + TEST(result);
1.682 +
1.683 + active->StartL();
1.684 + CActiveScheduler::Start();
1.685 +
1.686 + if (active->iStatus.Int() == KErrNone)
1.687 + {
1.688 + finished = ETrue;
1.689 + TEST(!TestUtils::EventsEqual(*event, view->Event()));
1.690 + }
1.691 + else
1.692 + {
1.693 + if(active->iStatus.Int() != KErrNoMemory)
1.694 + {
1.695 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
1.696 + }
1.697 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.698 + }
1.699 + }
1.700 + else
1.701 + {
1.702 + if(error != KErrNoMemory)
1.703 + {
1.704 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1.705 + }
1.706 + TEST2(error, KErrNoMemory);
1.707 + }
1.708 +
1.709 + __FILE_RESET;
1.710 + }
1.711 + TheTest.Printf(_L("\r\nTest-2 (\"View Previous\") has succeeded at iteration %d\n"), failCount);
1.712 +
1.713 + failCount = 0;
1.714 + finished = EFalse;
1.715 +
1.716 + while(!finished)
1.717 + {
1.718 + TEST(view->SetFilterL(*filter, active->iStatus));
1.719 + active->StartL();
1.720 + CActiveScheduler::Start();
1.721 + TEST2(active->iStatus.Int(), KErrNone);
1.722 + TEST(view->CountL() > 1);
1.723 +
1.724 + TEST(view->LastL(active->iStatus));
1.725 + active->StartL();
1.726 + CActiveScheduler::Start();
1.727 + TEST2(active->iStatus.Int(), KErrNone);
1.728 +
1.729 + event->CopyL(view->Event());
1.730 +
1.731 + TheTest.Printf(_L("%d \r"), failCount);
1.732 + __FILE_FAILNEXT(KErrNoMemory, failCount++);
1.733 +
1.734 + TBool result = EFalse;
1.735 + TRAP(error, result = view->FirstL(active->iStatus));
1.736 +
1.737 + if (error == KErrNone)
1.738 + {
1.739 + TEST(result);
1.740 +
1.741 + active->StartL();
1.742 + CActiveScheduler::Start();
1.743 +
1.744 + if (active->iStatus.Int() == KErrNone)
1.745 + {
1.746 + finished = ETrue;
1.747 + TEST(!TestUtils::EventsEqual(*event, view->Event()));
1.748 + }
1.749 + else
1.750 + {
1.751 + if(active->iStatus.Int() != KErrNoMemory)
1.752 + {
1.753 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
1.754 + }
1.755 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.756 + }
1.757 + }
1.758 + else
1.759 + {
1.760 + if(error != KErrNoMemory)
1.761 + {
1.762 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1.763 + }
1.764 + TEST2(error, KErrNoMemory);
1.765 + }
1.766 +
1.767 + __FILE_RESET;
1.768 + }
1.769 + TheTest.Printf(_L("\r\nTest-3 (\"View First\") has succeeded at iteration %d\n"), failCount);
1.770 +
1.771 + failCount = 0;
1.772 + finished = EFalse;
1.773 +
1.774 + while(!finished)
1.775 + {
1.776 + TEST(view->SetFilterL(*filter, active->iStatus));
1.777 + active->StartL();
1.778 + CActiveScheduler::Start();
1.779 + TEST2(active->iStatus.Int(), KErrNone);
1.780 + TEST(view->CountL() > 1);
1.781 +
1.782 + TEST(view->FirstL(active->iStatus));
1.783 + active->StartL();
1.784 + CActiveScheduler::Start();
1.785 + TEST2(active->iStatus.Int(), KErrNone);
1.786 +
1.787 + event->CopyL(view->Event());
1.788 +
1.789 + TheTest.Printf(_L("%d \r"), failCount);
1.790 + __FILE_FAILNEXT(KErrNoMemory, failCount++);
1.791 +
1.792 + TBool result = EFalse;
1.793 + TRAP(error, result = view->LastL(active->iStatus));
1.794 +
1.795 + if (error == KErrNone)
1.796 + {
1.797 + TEST(result);
1.798 +
1.799 + active->StartL();
1.800 + CActiveScheduler::Start();
1.801 +
1.802 + if (active->iStatus.Int() == KErrNone)
1.803 + {
1.804 + finished = ETrue;
1.805 + TEST(!TestUtils::EventsEqual(*event, view->Event()));
1.806 + }
1.807 + else
1.808 + {
1.809 + if(active->iStatus.Int() != KErrNoMemory)
1.810 + {
1.811 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
1.812 + }
1.813 + TEST2(active->iStatus.Int(), KErrNoMemory);
1.814 + }
1.815 + }
1.816 + else
1.817 + {
1.818 + if(error != KErrNoMemory)
1.819 + {
1.820 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1.821 + }
1.822 + TEST2(error, KErrNoMemory);
1.823 + }
1.824 +
1.825 + __FILE_RESET;
1.826 + }
1.827 +
1.828 + CleanupStack::PopAndDestroy(4); // filter, view, event, active
1.829 +
1.830 + TheTest.Printf(_L("\r\nTest-4 (\"View Last\") has succeeded at iteration %d\n"), failCount);
1.831 + }
1.832 +
1.833 +/**
1.834 +@SYMTestCaseID SYSLIB-LOGENG-CT-0975
1.835 +@SYMTestCaseDesc Tests for CLogViewEvent::CountL() functions
1.836 +@SYMTestPriority High
1.837 +@SYMTestActions Test for getting the number of events in the view.Check for file failure error
1.838 +@SYMTestExpectedResults Test must not fail
1.839 +@SYMREQ REQ0000
1.840 +*/
1.841 +LOCAL_C void TestViewCountWithFileFailL(CLogClient& aClient)
1.842 + {
1.843 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0975 "));
1.844 + CTestActive* active = new(ELeave)CTestActive;
1.845 + CleanupStack::PushL(active);
1.846 +
1.847 + CLogEvent* event = CLogEvent::NewL();
1.848 + CleanupStack::PushL(event);
1.849 + event->SetEventType(KLogCallEventTypeUid);
1.850 +
1.851 + // Add an event
1.852 + aClient.AddEvent(*event, active->iStatus);
1.853 + active->StartL();
1.854 + CActiveScheduler::Start();
1.855 + TEST2(active->iStatus.Int(), KErrNone);
1.856 +
1.857 + CLogViewEvent* view = CLogViewEvent::NewL(aClient);
1.858 + CleanupStack::PushL(view);
1.859 +
1.860 + CLogFilter* filter = CLogFilter::NewL();
1.861 + CleanupStack::PushL(filter);
1.862 +
1.863 + TEST(view->SetFilterL(*filter, active->iStatus));
1.864 + active->StartL();
1.865 + CActiveScheduler::Start();
1.866 + TEST2(active->iStatus.Int(), KErrNone);
1.867 +
1.868 + TInt failCount = 0;
1.869 + TBool finished = EFalse;
1.870 + TInt error;
1.871 +
1.872 + while(!finished)
1.873 + {
1.874 + TheTest.Printf(_L("%d \r"), failCount);
1.875 + __FILE_FAILNEXT(KErrNoMemory, failCount++);
1.876 +
1.877 + TInt result = 0;
1.878 + TRAP(error, result = view->CountL());
1.879 +
1.880 + if (error == KErrNone)
1.881 + {
1.882 + finished = ETrue;
1.883 + TEST(result > 0);
1.884 + }
1.885 + else
1.886 + {
1.887 + if(error != KErrNoMemory)
1.888 + {
1.889 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1.890 + }
1.891 + TEST2(error, KErrNoMemory);
1.892 + }
1.893 +
1.894 + __FILE_RESET;
1.895 + }
1.896 +
1.897 + CleanupStack::PopAndDestroy(4); // filter, view, event, active
1.898 +
1.899 + TheTest.Printf(_L("\r\nThe test (\"View Count\") has succeeded at iteration %d\n"), failCount);
1.900 + }
1.901 +
1.902 +/**
1.903 +@SYMTestCaseID SYSLIB-LOGENG-CT-0976
1.904 +@SYMTestCaseDesc Tests for CLogViewRecent::RemoveL() function
1.905 +@SYMTestPriority High
1.906 +@SYMTestActions Test for removing the event with the specified unique event ID from the view.Check for file failure error
1.907 +@SYMTestExpectedResults Test must not fail
1.908 +@SYMREQ REQ0000
1.909 +*/
1.910 +LOCAL_C void TestRecentViewRemoveWithFileFailL(CLogClient& aClient)
1.911 + {
1.912 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0976 "));
1.913 + CTestActive* active = new(ELeave)CTestActive;
1.914 + CleanupStack::PushL(active);
1.915 +
1.916 + CLogEvent* event = CLogEvent::NewL();
1.917 + CleanupStack::PushL(event);
1.918 +
1.919 + // Incoming
1.920 + TLogString buf;
1.921 + aClient.GetString(buf, R_LOG_DIR_IN);
1.922 +
1.923 + event->SetEventType(KLogCallEventTypeUid);
1.924 + event->SetDirection(buf);
1.925 +
1.926 + // Add events
1.927 + event->SetContact(1);
1.928 + aClient.AddEvent(*event, active->iStatus);
1.929 + active->StartL();
1.930 + CActiveScheduler::Start();
1.931 + TEST2(active->iStatus.Int(), KErrNone);
1.932 +
1.933 + event->SetContact(2);
1.934 + aClient.AddEvent(*event, active->iStatus);
1.935 + active->StartL();
1.936 + CActiveScheduler::Start();
1.937 + TEST2(active->iStatus.Int(), KErrNone);
1.938 +
1.939 + event->SetContact(3);
1.940 + aClient.AddEvent(*event, active->iStatus);
1.941 + active->StartL();
1.942 + CActiveScheduler::Start();
1.943 + TEST2(active->iStatus.Int(), KErrNone);
1.944 +
1.945 + CLogViewRecent* view = CLogViewRecent::NewL(aClient);
1.946 + CleanupStack::PushL(view);
1.947 +
1.948 + TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
1.949 + active->StartL();
1.950 + CActiveScheduler::Start();
1.951 + TEST2(active->iStatus.Int(), KErrNone);
1.952 +
1.953 + TInt count = view->CountL();
1.954 + TEST(count > 1);
1.955 +
1.956 + TInt failCount = 0;
1.957 + TBool finished = EFalse;
1.958 + TInt error;
1.959 +
1.960 + while(!finished)
1.961 + {
1.962 + TheTest.Printf(_L("%d \r"), failCount);
1.963 + __FILE_FAILNEXT(KErrNoMemory, failCount++);
1.964 +
1.965 + TRAP(error, view->RemoveL(view->Event().Id()));
1.966 +
1.967 + __FILE_RESET;
1.968 +
1.969 + if (error == KErrNone)
1.970 + {
1.971 + finished = ETrue;
1.972 +
1.973 + TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
1.974 + active->StartL();
1.975 + CActiveScheduler::Start();
1.976 + if(active->iStatus.Int() != KErrNone)
1.977 + {
1.978 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
1.979 + }
1.980 + TEST2(active->iStatus.Int(), KErrNone);
1.981 +
1.982 + TEST(count == view->CountL() + 1);
1.983 + }
1.984 + else
1.985 + {
1.986 + if(error != KErrNoMemory)
1.987 + {
1.988 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1.989 + }
1.990 + TEST2(error, KErrNoMemory);
1.991 + }
1.992 + // This failCount value causes DBMS to return KErrCorrupt. Apparently this
1.993 + // can't actually occur in real life, so we skip this value.
1.994 + if (failCount > 9)
1.995 + {
1.996 + finished = ETrue;
1.997 + TRAP(error, view->RemoveL(view->Event().Id()));
1.998 + TEST2(error, KErrNone);
1.999 + }
1.1000 + }
1.1001 + CleanupStack::PopAndDestroy(3); // view, event, active
1.1002 +
1.1003 + TheTest.Printf(_L("\r\nThe test (\"View Remove\") has succeeded at iteration %d\n"), failCount);
1.1004 + }
1.1005 +
1.1006 +/**
1.1007 +@SYMTestCaseID SYSLIB-LOGENG-CT-0977
1.1008 +@SYMTestCaseDesc Tests for CLogViewDuplicate::RemoveL() function
1.1009 +@SYMTestPriority High
1.1010 +@SYMTestActions Test for removing the event with the specified unique event ID from the view.Check for file failure error
1.1011 +@SYMTestExpectedResults Test must not fail
1.1012 +@SYMREQ REQ0000
1.1013 +*/
1.1014 +LOCAL_C void TestDuplicateViewRemoveWithFileFailL(CLogClient& aClient)
1.1015 + {
1.1016 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0977 "));
1.1017 + CTestActive* active = new(ELeave)CTestActive;
1.1018 + CleanupStack::PushL(active);
1.1019 +
1.1020 + CLogEvent* event = CLogEvent::NewL();
1.1021 + CleanupStack::PushL(event);
1.1022 +
1.1023 + // Incoming
1.1024 + TLogString buf;
1.1025 + aClient.GetString(buf, R_LOG_DIR_IN);
1.1026 +
1.1027 + event->SetEventType(KLogCallEventTypeUid);
1.1028 + event->SetDirection(buf);
1.1029 + event->SetContact(KTestContact);
1.1030 +
1.1031 + // Add events
1.1032 + aClient.AddEvent(*event, active->iStatus);
1.1033 + active->StartL();
1.1034 + CActiveScheduler::Start();
1.1035 + TEST2(active->iStatus.Int(), KErrNone);
1.1036 +
1.1037 + aClient.AddEvent(*event, active->iStatus);
1.1038 + active->StartL();
1.1039 + CActiveScheduler::Start();
1.1040 + TEST2(active->iStatus.Int(), KErrNone);
1.1041 +
1.1042 + aClient.AddEvent(*event, active->iStatus);
1.1043 + active->StartL();
1.1044 + CActiveScheduler::Start();
1.1045 + TEST2(active->iStatus.Int(), KErrNone);
1.1046 +
1.1047 + aClient.AddEvent(*event, active->iStatus);
1.1048 + active->StartL();
1.1049 + CActiveScheduler::Start();
1.1050 + TEST2(active->iStatus.Int(), KErrNone);
1.1051 +
1.1052 + CLogViewRecent* view = CLogViewRecent::NewL(aClient);
1.1053 + CleanupStack::PushL(view);
1.1054 +
1.1055 + TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
1.1056 + active->StartL();
1.1057 + CActiveScheduler::Start();
1.1058 + TEST2(active->iStatus.Int(), KErrNone);
1.1059 +
1.1060 + CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
1.1061 + CleanupStack::PushL(duplicate);
1.1062 +
1.1063 + TEST(view->DuplicatesL(*duplicate, active->iStatus));
1.1064 + active->StartL();
1.1065 + CActiveScheduler::Start();
1.1066 + TEST2(active->iStatus.Int(), KErrNone);
1.1067 +
1.1068 + TInt count = duplicate->CountL();
1.1069 + TEST(count > 0);
1.1070 +
1.1071 + TInt failCount = 0;
1.1072 + TBool finished = EFalse;
1.1073 + TInt error;
1.1074 +
1.1075 + while(!finished)
1.1076 + {
1.1077 + TheTest.Printf(_L("%d \r"), failCount);
1.1078 + __FILE_FAILNEXT(KErrNoMemory, failCount++);
1.1079 +
1.1080 + if(failCount == 17)
1.1081 + {
1.1082 + __FILE_RESET;
1.1083 + break;
1.1084 + }
1.1085 +
1.1086 + TRAP(error, duplicate->RemoveL(duplicate->Event().Id()));
1.1087 +
1.1088 + __FILE_RESET;
1.1089 +
1.1090 + if (error == KErrNone)
1.1091 + {
1.1092 + finished = ETrue;
1.1093 +
1.1094 + TEST(view->DuplicatesL(*duplicate, active->iStatus));
1.1095 + active->StartL();
1.1096 + CActiveScheduler::Start();
1.1097 + if(active->iStatus.Int() != KErrNone)
1.1098 + {
1.1099 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, active->iStatus.Int());
1.1100 + }
1.1101 + TEST2(active->iStatus.Int(), KErrNone);
1.1102 +
1.1103 + TEST(count == duplicate->CountL() + 1);
1.1104 + }
1.1105 + else
1.1106 + {
1.1107 + if(error != KErrNoMemory)
1.1108 + {
1.1109 + TheTest.Printf(_L("\r\nIter.step: %d, error %d\n"), failCount, error);
1.1110 + }
1.1111 + TEST2(error, KErrNoMemory);
1.1112 + }
1.1113 + }
1.1114 + CleanupStack::PopAndDestroy(4); // duplicate, view, event, active
1.1115 +
1.1116 + TheTest.Printf(_L("\r\nThe test (\"View Remove Duplicates\") has succeeded at iteration %d\n"), failCount);
1.1117 + }
1.1118 +
1.1119 +void doTestsL()
1.1120 + {
1.1121 + TestUtils::Initialize(_L("t_logviewfail2"));
1.1122 + TestUtils::DeleteDatabaseL();
1.1123 +
1.1124 + CLogClient* client = CLogClient::NewL(theFs);
1.1125 + CleanupStack::PushL(client);
1.1126 +
1.1127 + TheTest.Start(_L("Event View Setup"));
1.1128 + TestEventViewSetupWithFileFailL(*client);
1.1129 + TheTest.Next(_L("Recent View Setup"));
1.1130 + TestRecentViewSetupWithFileFailL(*client);
1.1131 + TheTest.Next(_L("Duplicated View Setup"));
1.1132 + TestDuplicateViewSetupWithFileFailL(*client);
1.1133 + theLog.Write(_L8("Test 1 OK\n"));
1.1134 +
1.1135 + TheTest.Next(_L("View Navigation"));
1.1136 + TestNavigationWithFileFailL(*client);
1.1137 + theLog.Write(_L8("Test 2 OK\n"));
1.1138 +
1.1139 + TheTest.Next(_L("View Count"));
1.1140 + TestViewCountWithFileFailL(*client);
1.1141 + TheTest.Next(_L("View Remove"));
1.1142 + TestRecentViewRemoveWithFileFailL(*client);
1.1143 + TheTest.Next(_L("View Remove Duplicates"));
1.1144 + TestDuplicateViewRemoveWithFileFailL(*client);
1.1145 + theLog.Write(_L8("Test 3 OK\n"));
1.1146 +
1.1147 + CleanupStack::PopAndDestroy(); // client;
1.1148 + }