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