os/persistentdata/loggingservices/eventlogger/test/src/t_logviewfail3.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include <s32file.h>
sl@0
    17
#include "t_logutil2.h"
sl@0
    18
#include <logview.h>
sl@0
    19
sl@0
    20
RTest TheTest(_L("t_logviewfail3"));
sl@0
    21
sl@0
    22
const TLogContactItemId KTestContact = 0x123;
sl@0
    23
_LIT(KTestStatus, "Test Status Text");
sl@0
    24
sl@0
    25
/**
sl@0
    26
@SYMTestCaseID          SYSLIB-LOGENG-CT-0978
sl@0
    27
@SYMTestCaseDesc	    Tests for CLogViewEvent::NewL() function
sl@0
    28
@SYMTestPriority 	    High
sl@0
    29
@SYMTestActions  	    Add an event to the client,Create a new CLogViewEvent on heap,if no error check if the view works
sl@0
    30
                        Check for log server failure error
sl@0
    31
@SYMTestExpectedResults Test must not fail
sl@0
    32
@SYMREQ                 REQ0000
sl@0
    33
*/
sl@0
    34
LOCAL_C void TestEventViewConstructWithLogServFailL(CLogClient& aClient)
sl@0
    35
	{
sl@0
    36
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0978 "));
sl@0
    37
	CTestActive* active = new(ELeave)CTestActive;
sl@0
    38
	CleanupStack::PushL(active);
sl@0
    39
sl@0
    40
	CLogEvent* event = CLogEvent::NewL();
sl@0
    41
	CleanupStack::PushL(event);
sl@0
    42
	event->SetEventType(KLogCallEventTypeUid);
sl@0
    43
sl@0
    44
	// Add an event
sl@0
    45
	aClient.AddEvent(*event, active->iStatus);
sl@0
    46
	active->StartL();
sl@0
    47
	CActiveScheduler::Start();
sl@0
    48
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
    49
sl@0
    50
	CLogViewEvent* view = NULL;
sl@0
    51
sl@0
    52
	TInt failCount = 0;
sl@0
    53
	TBool finished = EFalse;
sl@0
    54
	TInt error;
sl@0
    55
sl@0
    56
	while(!finished)
sl@0
    57
		{
sl@0
    58
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
    59
sl@0
    60
		TRAP(error, view = CLogViewEvent::NewL(aClient));
sl@0
    61
sl@0
    62
		__LOGSERV_UHEAP_RESET;
sl@0
    63
		
sl@0
    64
		if (!error)
sl@0
    65
			{
sl@0
    66
			finished = ETrue;
sl@0
    67
			CleanupStack::PushL(view);
sl@0
    68
		
sl@0
    69
			// Check the view works
sl@0
    70
			CLogFilter* filter = CLogFilter::NewL();
sl@0
    71
			CleanupStack::PushL(filter);
sl@0
    72
			
sl@0
    73
			TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
    74
			active->StartL();
sl@0
    75
			CActiveScheduler::Start();
sl@0
    76
			TEST2(active->iStatus.Int(), KErrNone);
sl@0
    77
			TEST(view->CountL() >= 1);
sl@0
    78
			TEST(TestUtils::EventsEqual(*event, view->Event()));
sl@0
    79
sl@0
    80
			CleanupStack::PopAndDestroy(2); // filter, view
sl@0
    81
			}
sl@0
    82
		else
sl@0
    83
			{
sl@0
    84
			TEST2(error, KErrNoMemory);
sl@0
    85
			}
sl@0
    86
		}
sl@0
    87
sl@0
    88
	CleanupStack::PopAndDestroy(2); // event, active
sl@0
    89
	}
sl@0
    90
sl@0
    91
/**
sl@0
    92
@SYMTestCaseID          SYSLIB-LOGENG-CT-0979
sl@0
    93
@SYMTestCaseDesc	    Tests for CLogViewRecent::NewL(),SetRecentListL() functions
sl@0
    94
@SYMTestPriority 	    High
sl@0
    95
@SYMTestActions  	    Create a new view object,if no errors and test of initialising of the view for the specified recent event list. 
sl@0
    96
                        Check for log server failure error
sl@0
    97
@SYMTestExpectedResults Test must not fail
sl@0
    98
@SYMREQ                 REQ0000
sl@0
    99
*/
sl@0
   100
LOCAL_C void TestRecentViewConstructWithLogServFailL(CLogClient& aClient)
sl@0
   101
	{
sl@0
   102
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0979 "));
sl@0
   103
	CTestActive* active = new(ELeave)CTestActive;
sl@0
   104
	CleanupStack::PushL(active);
sl@0
   105
sl@0
   106
	CLogEvent* event = CLogEvent::NewL();
sl@0
   107
	CleanupStack::PushL(event);
sl@0
   108
sl@0
   109
	// Incoming
sl@0
   110
	TLogString buf;
sl@0
   111
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
   112
sl@0
   113
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   114
	event->SetDirection(buf);
sl@0
   115
sl@0
   116
	// Add an event
sl@0
   117
	aClient.AddEvent(*event, active->iStatus);
sl@0
   118
	active->StartL();
sl@0
   119
	CActiveScheduler::Start();
sl@0
   120
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   121
sl@0
   122
	CLogViewRecent* view = NULL;
sl@0
   123
sl@0
   124
	TInt failCount = 0;
sl@0
   125
	TBool finished = EFalse;
sl@0
   126
	TInt error;
sl@0
   127
sl@0
   128
	while(!finished)
sl@0
   129
		{
sl@0
   130
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
   131
sl@0
   132
		TRAP(error, view = CLogViewRecent::NewL(aClient));
sl@0
   133
sl@0
   134
		__LOGSERV_UHEAP_RESET;
sl@0
   135
		
sl@0
   136
		if (!error)
sl@0
   137
			{
sl@0
   138
			finished = ETrue;
sl@0
   139
			CleanupStack::PushL(view);
sl@0
   140
					
sl@0
   141
			TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
   142
			active->StartL();
sl@0
   143
			CActiveScheduler::Start();
sl@0
   144
			TEST2(active->iStatus.Int(), KErrNone);
sl@0
   145
			TEST(view->CountL() >= 1);
sl@0
   146
			TEST(TestUtils::EventsEqual(*event, view->Event()));
sl@0
   147
sl@0
   148
			CleanupStack::PopAndDestroy(); // view
sl@0
   149
			}
sl@0
   150
		else
sl@0
   151
			{
sl@0
   152
			TEST2(error, KErrNoMemory);
sl@0
   153
			}
sl@0
   154
		}
sl@0
   155
sl@0
   156
	CleanupStack::PopAndDestroy(2); // event, active
sl@0
   157
	}
sl@0
   158
sl@0
   159
/**
sl@0
   160
@SYMTestCaseID          SYSLIB-LOGENG-CT-0980
sl@0
   161
@SYMTestCaseDesc	    Tests for CLogViewDuplicate::NewL() functions
sl@0
   162
@SYMTestPriority 	    High
sl@0
   163
@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
sl@0
   164
                        Check for log server failure error
sl@0
   165
@SYMTestExpectedResults Test must not fail
sl@0
   166
@SYMREQ                 REQ0000
sl@0
   167
*/
sl@0
   168
LOCAL_C void TestDuplicateViewConstructWithLogServFailL(CLogClient& aClient)
sl@0
   169
	{
sl@0
   170
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0980 "));
sl@0
   171
	CTestActive* active = new(ELeave)CTestActive;
sl@0
   172
	CleanupStack::PushL(active);
sl@0
   173
sl@0
   174
	CLogEvent* event = CLogEvent::NewL();
sl@0
   175
	CleanupStack::PushL(event);
sl@0
   176
sl@0
   177
	// Incoming
sl@0
   178
	TLogString buf;
sl@0
   179
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
   180
sl@0
   181
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   182
	event->SetDirection(buf);
sl@0
   183
	event->SetContact(KTestContact);
sl@0
   184
sl@0
   185
	// Add events
sl@0
   186
	aClient.AddEvent(*event, active->iStatus);
sl@0
   187
	active->StartL();
sl@0
   188
	CActiveScheduler::Start();
sl@0
   189
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   190
sl@0
   191
	aClient.AddEvent(*event, active->iStatus);
sl@0
   192
	active->StartL();
sl@0
   193
	CActiveScheduler::Start();
sl@0
   194
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   195
sl@0
   196
	CLogViewDuplicate* view = NULL;
sl@0
   197
sl@0
   198
	TInt failCount = 0;
sl@0
   199
	TBool finished = EFalse;
sl@0
   200
	TInt error;
sl@0
   201
sl@0
   202
	while(!finished)
sl@0
   203
		{
sl@0
   204
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
   205
sl@0
   206
		TRAP(error, view = CLogViewDuplicate::NewL(aClient));
sl@0
   207
sl@0
   208
		__LOGSERV_UHEAP_RESET;
sl@0
   209
		
sl@0
   210
		if (!error)
sl@0
   211
			{
sl@0
   212
			finished = ETrue;
sl@0
   213
			CleanupStack::PushL(view);
sl@0
   214
			
sl@0
   215
			CLogViewRecent* recent = CLogViewRecent::NewL(aClient);
sl@0
   216
			CleanupStack::PushL(recent);
sl@0
   217
			TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
   218
			active->StartL();
sl@0
   219
			CActiveScheduler::Start();
sl@0
   220
			TEST2(active->iStatus.Int(), KErrNone);
sl@0
   221
			TEST(recent->CountL() >= 1);
sl@0
   222
sl@0
   223
			TEST(recent->DuplicatesL(*view, active->iStatus));
sl@0
   224
			active->StartL();
sl@0
   225
			CActiveScheduler::Start();
sl@0
   226
			TEST2(active->iStatus.Int(), KErrNone);
sl@0
   227
			TEST(view->CountL() >= 1);
sl@0
   228
sl@0
   229
			CleanupStack::PopAndDestroy(2); // recent, view
sl@0
   230
			}
sl@0
   231
		else
sl@0
   232
			{
sl@0
   233
			TEST2(error, KErrNoMemory);
sl@0
   234
			}
sl@0
   235
		}
sl@0
   236
sl@0
   237
	CleanupStack::PopAndDestroy(2); // event, active
sl@0
   238
	}
sl@0
   239
sl@0
   240
/**
sl@0
   241
@SYMTestCaseID          SYSLIB-LOGENG-CT-0981
sl@0
   242
@SYMTestCaseDesc	    Tests for CLogViewEvent::SetFilterL() function 
sl@0
   243
@SYMTestPriority 	    High
sl@0
   244
@SYMTestActions  	    Create a log filter and set the filter on logview.Check for equality of events on the view and events
sl@0
   245
						added.Check for log server failure error
sl@0
   246
@SYMTestExpectedResults Test must not fail
sl@0
   247
@SYMREQ                 REQ0000
sl@0
   248
*/
sl@0
   249
LOCAL_C void TestEventViewSetupWithLogServFailL(CLogClient& aClient)
sl@0
   250
	{
sl@0
   251
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0981 "));
sl@0
   252
	CTestActive* active = new(ELeave)CTestActive;
sl@0
   253
	CleanupStack::PushL(active);
sl@0
   254
sl@0
   255
	CLogEvent* event = CLogEvent::NewL();
sl@0
   256
	CleanupStack::PushL(event);
sl@0
   257
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   258
	event->SetStatus(KTestStatus);
sl@0
   259
sl@0
   260
	// Add an event
sl@0
   261
	aClient.AddEvent(*event, active->iStatus);
sl@0
   262
	active->StartL();
sl@0
   263
	CActiveScheduler::Start();
sl@0
   264
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   265
sl@0
   266
	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
sl@0
   267
	CleanupStack::PushL(view);
sl@0
   268
sl@0
   269
	CLogFilterList* list = new(ELeave)CLogFilterList;
sl@0
   270
	CleanupStack::PushL(list);
sl@0
   271
sl@0
   272
	CLogFilter* filter = CLogFilter::NewL();
sl@0
   273
	CleanupStack::PushL(filter);
sl@0
   274
	filter->SetStatus(KTestStatus);
sl@0
   275
sl@0
   276
	TInt failCount = 0;
sl@0
   277
	TBool finished = EFalse;
sl@0
   278
	TInt error;
sl@0
   279
sl@0
   280
	while(!finished)
sl@0
   281
		{
sl@0
   282
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
   283
sl@0
   284
		TBool result = EFalse;
sl@0
   285
		TRAP(error, result = view->SetFilterL(*filter, active->iStatus));
sl@0
   286
		
sl@0
   287
		if (!error)
sl@0
   288
			{
sl@0
   289
			TEST(result);
sl@0
   290
sl@0
   291
			active->StartL();
sl@0
   292
			CActiveScheduler::Start();
sl@0
   293
sl@0
   294
			if (active->iStatus.Int() == KErrNone)
sl@0
   295
				{
sl@0
   296
				finished = ETrue;		
sl@0
   297
				
sl@0
   298
				TEST(view->CountL() >= 1);
sl@0
   299
				TEST(TestUtils::EventsEqual(*event, view->Event()));
sl@0
   300
				}
sl@0
   301
			else
sl@0
   302
				{
sl@0
   303
				TEST2(active->iStatus.Int(), KErrNoMemory);
sl@0
   304
				}
sl@0
   305
			}
sl@0
   306
		else
sl@0
   307
			{
sl@0
   308
			TEST2(error, KErrNoMemory);
sl@0
   309
			}
sl@0
   310
sl@0
   311
		__LOGSERV_UHEAP_RESET;
sl@0
   312
		}
sl@0
   313
sl@0
   314
	list->AppendL(filter);
sl@0
   315
	CleanupStack::Pop(); // filter
sl@0
   316
	
sl@0
   317
	filter = CLogFilter::NewL();
sl@0
   318
	CleanupStack::PushL(filter);
sl@0
   319
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
   320
	list->AppendL(filter);
sl@0
   321
	CleanupStack::Pop(); // filter
sl@0
   322
sl@0
   323
	failCount = 0;
sl@0
   324
	finished = EFalse;
sl@0
   325
sl@0
   326
	while(!finished)
sl@0
   327
		{
sl@0
   328
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
   329
sl@0
   330
		TBool result = EFalse;
sl@0
   331
		TRAP(error, result = view->SetFilterL(*list, active->iStatus));
sl@0
   332
		
sl@0
   333
		if (!error)
sl@0
   334
			{
sl@0
   335
			TEST(result);
sl@0
   336
sl@0
   337
			active->StartL();
sl@0
   338
			CActiveScheduler::Start();
sl@0
   339
sl@0
   340
			if (active->iStatus.Int() == KErrNone)
sl@0
   341
				{
sl@0
   342
				finished = ETrue;		
sl@0
   343
				
sl@0
   344
				TEST(view->CountL() >= 1);
sl@0
   345
				TEST(TestUtils::EventsEqual(*event, view->Event()));
sl@0
   346
				}
sl@0
   347
			else
sl@0
   348
				{
sl@0
   349
				TEST2(active->iStatus.Int(), KErrNoMemory);
sl@0
   350
				}
sl@0
   351
			}
sl@0
   352
		else
sl@0
   353
			{
sl@0
   354
			TEST2(error, KErrNoMemory);
sl@0
   355
			}
sl@0
   356
sl@0
   357
		__LOGSERV_UHEAP_RESET;
sl@0
   358
		}
sl@0
   359
sl@0
   360
	list->ResetAndDestroy();
sl@0
   361
	CleanupStack::PopAndDestroy(4); // list, view, event, active
sl@0
   362
	}
sl@0
   363
sl@0
   364
/**
sl@0
   365
@SYMTestCaseID          SYSLIB-LOGENG-CT-0982
sl@0
   366
@SYMTestCaseDesc	    Tests for CLogViewRecent::SetRecentListL() function 
sl@0
   367
@SYMTestPriority 	    High
sl@0
   368
@SYMTestActions  	    Set recent view list first without a filter and later with log filter,Check for log server failure error
sl@0
   369
@SYMTestExpectedResults Test must not fail
sl@0
   370
@SYMREQ                 REQ0000
sl@0
   371
*/
sl@0
   372
LOCAL_C void TestRecentViewSetupWithLogServFailL(CLogClient& aClient)
sl@0
   373
	{
sl@0
   374
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0982 "));
sl@0
   375
	CTestActive* active = new(ELeave)CTestActive;
sl@0
   376
	CleanupStack::PushL(active);
sl@0
   377
sl@0
   378
	CLogEvent* event = CLogEvent::NewL();
sl@0
   379
	CleanupStack::PushL(event);
sl@0
   380
sl@0
   381
	// Incoming
sl@0
   382
	TLogString buf;
sl@0
   383
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
   384
sl@0
   385
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   386
	event->SetDirection(buf);
sl@0
   387
	event->SetStatus(KTestStatus);
sl@0
   388
sl@0
   389
	// Add an event
sl@0
   390
	aClient.AddEvent(*event, active->iStatus);
sl@0
   391
	active->StartL();
sl@0
   392
	CActiveScheduler::Start();
sl@0
   393
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   394
sl@0
   395
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
   396
	CleanupStack::PushL(view);
sl@0
   397
sl@0
   398
	TInt failCount = 0;
sl@0
   399
	TBool finished = EFalse;
sl@0
   400
	TInt error;
sl@0
   401
sl@0
   402
	while(!finished)
sl@0
   403
		{
sl@0
   404
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
   405
sl@0
   406
		TBool result = EFalse;
sl@0
   407
		TRAP(error, result = view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
   408
		
sl@0
   409
		if (!error)
sl@0
   410
			{
sl@0
   411
			TEST(result);
sl@0
   412
sl@0
   413
			active->StartL();
sl@0
   414
			CActiveScheduler::Start();
sl@0
   415
sl@0
   416
			if (active->iStatus.Int() == KErrNone)
sl@0
   417
				{
sl@0
   418
				finished = ETrue;		
sl@0
   419
				TEST(view->CountL() >= 1);
sl@0
   420
				}
sl@0
   421
			else
sl@0
   422
				{
sl@0
   423
				TEST2(active->iStatus.Int(), KErrNoMemory);
sl@0
   424
				}
sl@0
   425
			}
sl@0
   426
		else
sl@0
   427
			{
sl@0
   428
			TEST2(error, KErrNoMemory);
sl@0
   429
			}
sl@0
   430
sl@0
   431
		__LOGSERV_UHEAP_RESET;
sl@0
   432
		}
sl@0
   433
sl@0
   434
	CLogFilterList* list = new(ELeave)CLogFilterList;
sl@0
   435
	CleanupStack::PushL(list);
sl@0
   436
sl@0
   437
	CLogFilter* filter = CLogFilter::NewL();
sl@0
   438
	CleanupStack::PushL(filter);
sl@0
   439
	filter->SetStatus(KTestStatus);
sl@0
   440
sl@0
   441
	failCount = 0;
sl@0
   442
	finished = EFalse;
sl@0
   443
sl@0
   444
	while(!finished)
sl@0
   445
		{
sl@0
   446
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
   447
sl@0
   448
		TBool result = EFalse;
sl@0
   449
		TRAP(error, result = view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
sl@0
   450
		
sl@0
   451
		if (!error)
sl@0
   452
			{
sl@0
   453
			TEST(result);
sl@0
   454
sl@0
   455
			active->StartL();
sl@0
   456
			CActiveScheduler::Start();
sl@0
   457
sl@0
   458
			if (active->iStatus.Int() == KErrNone)
sl@0
   459
				{
sl@0
   460
				finished = ETrue;		
sl@0
   461
				TEST(view->CountL() >= 1);
sl@0
   462
				}
sl@0
   463
			else
sl@0
   464
				TEST2(active->iStatus.Int(), KErrNoMemory);
sl@0
   465
			}
sl@0
   466
		else
sl@0
   467
			TEST2(error, KErrNoMemory);
sl@0
   468
sl@0
   469
		__LOGSERV_UHEAP_RESET;
sl@0
   470
		}
sl@0
   471
sl@0
   472
	list->AppendL(filter);
sl@0
   473
	CleanupStack::Pop(); // filter
sl@0
   474
sl@0
   475
	filter = CLogFilter::NewL();
sl@0
   476
	CleanupStack::PushL(filter);
sl@0
   477
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
   478
	list->AppendL(filter);
sl@0
   479
	CleanupStack::Pop(); // filter
sl@0
   480
sl@0
   481
	failCount = 0;
sl@0
   482
	finished = EFalse;
sl@0
   483
sl@0
   484
	while(!finished)
sl@0
   485
		{
sl@0
   486
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
   487
sl@0
   488
		TBool result = EFalse;
sl@0
   489
		TRAP(error, result = view->SetRecentListL(KLogRecentIncomingCalls, *list, active->iStatus));
sl@0
   490
		
sl@0
   491
		if (!error)
sl@0
   492
			{
sl@0
   493
			TEST(result);
sl@0
   494
sl@0
   495
			active->StartL();
sl@0
   496
			CActiveScheduler::Start();
sl@0
   497
sl@0
   498
			if (active->iStatus.Int() == KErrNone)
sl@0
   499
				{
sl@0
   500
				finished = ETrue;		
sl@0
   501
				TEST(view->CountL() >= 1);
sl@0
   502
				}
sl@0
   503
			else
sl@0
   504
				TEST2(active->iStatus.Int(), KErrNoMemory);
sl@0
   505
			}
sl@0
   506
		else
sl@0
   507
			TEST2(error, KErrNoMemory);
sl@0
   508
sl@0
   509
		__LOGSERV_UHEAP_RESET;
sl@0
   510
		}
sl@0
   511
sl@0
   512
	list->ResetAndDestroy();
sl@0
   513
	CleanupStack::PopAndDestroy(4); // list, view, event, active
sl@0
   514
	}
sl@0
   515
sl@0
   516
/**
sl@0
   517
@SYMTestCaseID          SYSLIB-LOGENG-CT-0983
sl@0
   518
@SYMTestCaseDesc	    Tests for CLogViewRecent::DuplicatesL() function
sl@0
   519
@SYMTestPriority 	    High
sl@0
   520
@SYMTestActions  	    Set the specified duplicate event view with logview duplicates.
sl@0
   521
                        Check for log server failure error
sl@0
   522
@SYMTestExpectedResults Test must not fail
sl@0
   523
@SYMREQ                 REQ0000
sl@0
   524
*/
sl@0
   525
LOCAL_C void TestDuplicateViewSetupWithLogServFailL(CLogClient& aClient)
sl@0
   526
	{
sl@0
   527
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0983 "));
sl@0
   528
	CTestActive* active = new(ELeave)CTestActive;
sl@0
   529
	CleanupStack::PushL(active);
sl@0
   530
sl@0
   531
	CLogEvent* event = CLogEvent::NewL();
sl@0
   532
	CleanupStack::PushL(event);
sl@0
   533
sl@0
   534
	// Incoming
sl@0
   535
	TLogString buf;
sl@0
   536
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
   537
sl@0
   538
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   539
	event->SetDirection(buf);
sl@0
   540
	event->SetContact(KTestContact);
sl@0
   541
	event->SetStatus(KTestStatus);
sl@0
   542
sl@0
   543
	// Add events
sl@0
   544
	aClient.AddEvent(*event, active->iStatus);
sl@0
   545
	active->StartL();
sl@0
   546
	CActiveScheduler::Start();
sl@0
   547
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   548
sl@0
   549
	aClient.AddEvent(*event, active->iStatus);
sl@0
   550
	active->StartL();
sl@0
   551
	CActiveScheduler::Start();
sl@0
   552
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   553
sl@0
   554
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
   555
	CleanupStack::PushL(view);
sl@0
   556
sl@0
   557
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
   558
	active->StartL();
sl@0
   559
	CActiveScheduler::Start();
sl@0
   560
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   561
	
sl@0
   562
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
   563
	CleanupStack::PushL(duplicate);
sl@0
   564
sl@0
   565
	TInt failCount = 0;
sl@0
   566
	TBool finished = EFalse;
sl@0
   567
	TInt error;
sl@0
   568
sl@0
   569
	while(!finished)
sl@0
   570
		{
sl@0
   571
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
   572
sl@0
   573
		TBool result = EFalse;
sl@0
   574
		TRAP(error, result = view->DuplicatesL(*duplicate, active->iStatus));
sl@0
   575
		
sl@0
   576
		if (!error)
sl@0
   577
			{
sl@0
   578
			TEST(result);
sl@0
   579
sl@0
   580
			active->StartL();
sl@0
   581
			CActiveScheduler::Start();
sl@0
   582
sl@0
   583
			if (active->iStatus.Int() == KErrNone)
sl@0
   584
				{
sl@0
   585
				finished = ETrue;		
sl@0
   586
				TEST(duplicate->CountL() >= 1);
sl@0
   587
				}
sl@0
   588
			else
sl@0
   589
				TEST2(active->iStatus.Int(), KErrNoMemory);
sl@0
   590
			}
sl@0
   591
		else
sl@0
   592
			TEST2(error, KErrNoMemory);
sl@0
   593
sl@0
   594
		__LOGSERV_UHEAP_RESET;
sl@0
   595
		}
sl@0
   596
sl@0
   597
	CLogFilterList* list = new(ELeave)CLogFilterList;
sl@0
   598
	CleanupStack::PushL(list);
sl@0
   599
sl@0
   600
	CLogFilter* filter = CLogFilter::NewL();
sl@0
   601
	CleanupStack::PushL(filter);
sl@0
   602
	filter->SetStatus(KTestStatus);
sl@0
   603
sl@0
   604
	failCount = 0;
sl@0
   605
	finished = EFalse;
sl@0
   606
sl@0
   607
	while(!finished)
sl@0
   608
		{
sl@0
   609
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
   610
sl@0
   611
		TBool result = EFalse;
sl@0
   612
		TRAP(error, result = view->DuplicatesL(*duplicate, *filter, active->iStatus));
sl@0
   613
		
sl@0
   614
		if (!error)
sl@0
   615
			{
sl@0
   616
			TEST(result);
sl@0
   617
sl@0
   618
			active->StartL();
sl@0
   619
			CActiveScheduler::Start();
sl@0
   620
sl@0
   621
			if (active->iStatus.Int() == KErrNone)
sl@0
   622
				{
sl@0
   623
				finished = ETrue;		
sl@0
   624
				TEST(duplicate->CountL() >= 1);
sl@0
   625
				}
sl@0
   626
			else
sl@0
   627
				TEST2(active->iStatus.Int(), KErrNoMemory);
sl@0
   628
			}
sl@0
   629
		else
sl@0
   630
			TEST2(error, KErrNoMemory);
sl@0
   631
sl@0
   632
		__LOGSERV_UHEAP_RESET;
sl@0
   633
		}
sl@0
   634
sl@0
   635
	list->AppendL(filter);
sl@0
   636
	CleanupStack::Pop(); // filter
sl@0
   637
sl@0
   638
	filter = CLogFilter::NewL();
sl@0
   639
	CleanupStack::PushL(filter);
sl@0
   640
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
   641
	list->AppendL(filter);
sl@0
   642
	CleanupStack::Pop(); // filter
sl@0
   643
sl@0
   644
	failCount = 0;
sl@0
   645
	finished = EFalse;
sl@0
   646
sl@0
   647
	while(!finished)
sl@0
   648
		{
sl@0
   649
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
   650
sl@0
   651
		TBool result = EFalse;
sl@0
   652
		TRAP(error, result = view->DuplicatesL(*duplicate, *list, active->iStatus));
sl@0
   653
		
sl@0
   654
		if (!error)
sl@0
   655
			{
sl@0
   656
			TEST(result);
sl@0
   657
sl@0
   658
			active->StartL();
sl@0
   659
			CActiveScheduler::Start();
sl@0
   660
sl@0
   661
			if (active->iStatus.Int() == KErrNone)
sl@0
   662
				{
sl@0
   663
				finished = ETrue;		
sl@0
   664
				TEST(duplicate->CountL() >= 1);
sl@0
   665
				}
sl@0
   666
			else
sl@0
   667
				TEST2(active->iStatus.Int(), KErrNoMemory);
sl@0
   668
			}
sl@0
   669
		else
sl@0
   670
			TEST2(error, KErrNoMemory);
sl@0
   671
sl@0
   672
		__LOGSERV_UHEAP_RESET;
sl@0
   673
		}
sl@0
   674
sl@0
   675
	list->ResetAndDestroy();
sl@0
   676
	CleanupStack::PopAndDestroy(5); // list, duplicate, view, event, active
sl@0
   677
	}
sl@0
   678
sl@0
   679
/**
sl@0
   680
@SYMTestCaseID          SYSLIB-LOGENG-CT-0984
sl@0
   681
@SYMTestCaseDesc	    Tests for CLogViewEvent::NextL(),LastL(),PreviousL(),FirstL() functions
sl@0
   682
@SYMTestPriority 	    High
sl@0
   683
@SYMTestActions  	    Tests for all the navigation functions in the view.Check for log server failure error 
sl@0
   684
@SYMTestExpectedResults Test must not fail
sl@0
   685
@SYMREQ                 REQ0000
sl@0
   686
*/
sl@0
   687
LOCAL_C void TestNavigationWithLogServFailL(CLogClient& aClient)
sl@0
   688
	{
sl@0
   689
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0984 "));
sl@0
   690
	CTestActive* active = new(ELeave)CTestActive;
sl@0
   691
	CleanupStack::PushL(active);
sl@0
   692
sl@0
   693
	CLogEvent* event = CLogEvent::NewL();
sl@0
   694
	CleanupStack::PushL(event);
sl@0
   695
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   696
sl@0
   697
	// Add an event
sl@0
   698
	aClient.AddEvent(*event, active->iStatus);
sl@0
   699
	active->StartL();
sl@0
   700
	CActiveScheduler::Start();
sl@0
   701
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   702
sl@0
   703
	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
sl@0
   704
	CleanupStack::PushL(view);
sl@0
   705
sl@0
   706
	CLogFilter* filter = CLogFilter::NewL();
sl@0
   707
	CleanupStack::PushL(filter);
sl@0
   708
sl@0
   709
	TInt failCount = 0;
sl@0
   710
	TBool finished = EFalse;
sl@0
   711
	TInt error;
sl@0
   712
sl@0
   713
	while(!finished)
sl@0
   714
		{
sl@0
   715
		TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
   716
		active->StartL();
sl@0
   717
		CActiveScheduler::Start();
sl@0
   718
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
   719
		TEST(view->CountL() > 1);
sl@0
   720
		event->CopyL(view->Event());
sl@0
   721
sl@0
   722
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
   723
sl@0
   724
		TBool result = EFalse;
sl@0
   725
		TRAP(error, result = view->NextL(active->iStatus));
sl@0
   726
		
sl@0
   727
		if (!error)
sl@0
   728
			{
sl@0
   729
			TEST(result);
sl@0
   730
sl@0
   731
			active->StartL();
sl@0
   732
			CActiveScheduler::Start();
sl@0
   733
sl@0
   734
			if (active->iStatus.Int() == KErrNone)
sl@0
   735
				{
sl@0
   736
				finished = ETrue;
sl@0
   737
				TEST(!TestUtils::EventsEqual(*event, view->Event()));
sl@0
   738
				}
sl@0
   739
			else
sl@0
   740
				TEST2(active->iStatus.Int(), KErrNoMemory);
sl@0
   741
			}
sl@0
   742
		else
sl@0
   743
			TEST2(error, KErrNoMemory);
sl@0
   744
sl@0
   745
		__LOGSERV_UHEAP_RESET;
sl@0
   746
		}
sl@0
   747
sl@0
   748
	failCount = 0;
sl@0
   749
	finished = EFalse;
sl@0
   750
sl@0
   751
	while(!finished)
sl@0
   752
		{
sl@0
   753
		TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
   754
		active->StartL();
sl@0
   755
		CActiveScheduler::Start();
sl@0
   756
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
   757
		TEST(view->CountL() > 1);
sl@0
   758
sl@0
   759
		TEST(view->LastL(active->iStatus));
sl@0
   760
		active->StartL();
sl@0
   761
		CActiveScheduler::Start();
sl@0
   762
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
   763
sl@0
   764
		event->CopyL(view->Event());
sl@0
   765
sl@0
   766
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
   767
sl@0
   768
		TBool result = EFalse;
sl@0
   769
		TRAP(error, result = view->PreviousL(active->iStatus));
sl@0
   770
		
sl@0
   771
		if (!error)
sl@0
   772
			{
sl@0
   773
			TEST(result);
sl@0
   774
sl@0
   775
			active->StartL();
sl@0
   776
			CActiveScheduler::Start();
sl@0
   777
sl@0
   778
			if (active->iStatus.Int() == KErrNone)
sl@0
   779
				{
sl@0
   780
				finished = ETrue;
sl@0
   781
				TEST(!TestUtils::EventsEqual(*event, view->Event()));
sl@0
   782
				}
sl@0
   783
			else
sl@0
   784
				TEST2(active->iStatus.Int(), KErrNoMemory);
sl@0
   785
			}
sl@0
   786
		else
sl@0
   787
			TEST2(error, KErrNoMemory);
sl@0
   788
sl@0
   789
		__LOGSERV_UHEAP_RESET;
sl@0
   790
		}
sl@0
   791
sl@0
   792
	failCount = 0;
sl@0
   793
	finished = EFalse;
sl@0
   794
sl@0
   795
	while(!finished)
sl@0
   796
		{
sl@0
   797
		TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
   798
		active->StartL();
sl@0
   799
		CActiveScheduler::Start();
sl@0
   800
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
   801
		TEST(view->CountL() > 1);
sl@0
   802
sl@0
   803
		TEST(view->LastL(active->iStatus));
sl@0
   804
		active->StartL();
sl@0
   805
		CActiveScheduler::Start();
sl@0
   806
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
   807
sl@0
   808
		event->CopyL(view->Event());
sl@0
   809
sl@0
   810
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
   811
sl@0
   812
		TBool result = EFalse;
sl@0
   813
		TRAP(error, result = view->FirstL(active->iStatus));
sl@0
   814
		
sl@0
   815
		if (!error)
sl@0
   816
			{
sl@0
   817
			TEST(result);
sl@0
   818
sl@0
   819
			active->StartL();
sl@0
   820
			CActiveScheduler::Start();
sl@0
   821
sl@0
   822
			if (active->iStatus.Int() == KErrNone)
sl@0
   823
				{
sl@0
   824
				finished = ETrue;
sl@0
   825
				TEST(!TestUtils::EventsEqual(*event, view->Event()));
sl@0
   826
				}
sl@0
   827
			else
sl@0
   828
				TEST2(active->iStatus.Int(), KErrNoMemory);
sl@0
   829
			}
sl@0
   830
		else
sl@0
   831
			TEST2(error, KErrNoMemory);
sl@0
   832
sl@0
   833
		__LOGSERV_UHEAP_RESET;
sl@0
   834
		}
sl@0
   835
sl@0
   836
	failCount = 0;
sl@0
   837
	finished = EFalse;
sl@0
   838
sl@0
   839
	while(!finished)
sl@0
   840
		{
sl@0
   841
		TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
   842
		active->StartL();
sl@0
   843
		CActiveScheduler::Start();
sl@0
   844
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
   845
		TEST(view->CountL() > 1);
sl@0
   846
sl@0
   847
		TEST(view->FirstL(active->iStatus));
sl@0
   848
		active->StartL();
sl@0
   849
		CActiveScheduler::Start();
sl@0
   850
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
   851
sl@0
   852
		event->CopyL(view->Event());
sl@0
   853
sl@0
   854
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
   855
sl@0
   856
		TBool result = EFalse;
sl@0
   857
		TRAP(error, result = view->LastL(active->iStatus));
sl@0
   858
		
sl@0
   859
		if (!error)
sl@0
   860
			{
sl@0
   861
			TEST(result);
sl@0
   862
sl@0
   863
			active->StartL();
sl@0
   864
			CActiveScheduler::Start();
sl@0
   865
sl@0
   866
			if (active->iStatus.Int() == KErrNone)
sl@0
   867
				{
sl@0
   868
				finished = ETrue;
sl@0
   869
				TEST(!TestUtils::EventsEqual(*event, view->Event()));
sl@0
   870
				}
sl@0
   871
			else
sl@0
   872
				TEST2(active->iStatus.Int(), KErrNoMemory);
sl@0
   873
			}
sl@0
   874
		else
sl@0
   875
			TEST2(error, KErrNoMemory);
sl@0
   876
sl@0
   877
		__LOGSERV_UHEAP_RESET;
sl@0
   878
		}
sl@0
   879
sl@0
   880
	CleanupStack::PopAndDestroy(4); // filter, view, event, active
sl@0
   881
	}
sl@0
   882
sl@0
   883
/**
sl@0
   884
@SYMTestCaseID          SYSLIB-LOGENG-CT-0985
sl@0
   885
@SYMTestCaseDesc	    Tests for CLogViewEvent::CountL() functions
sl@0
   886
@SYMTestPriority 	    High
sl@0
   887
@SYMTestActions  	    Test for getting the number of events in the view.Check for log server failure error 
sl@0
   888
@SYMTestExpectedResults Test must not fail
sl@0
   889
@SYMREQ                 REQ0000
sl@0
   890
*/
sl@0
   891
LOCAL_C void TestViewCountWithLogServFailL(CLogClient& aClient)
sl@0
   892
	{
sl@0
   893
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0985 "));
sl@0
   894
	CTestActive* active = new(ELeave)CTestActive;
sl@0
   895
	CleanupStack::PushL(active);
sl@0
   896
sl@0
   897
	CLogEvent* event = CLogEvent::NewL();
sl@0
   898
	CleanupStack::PushL(event);
sl@0
   899
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   900
sl@0
   901
	// Add an event
sl@0
   902
	aClient.AddEvent(*event, active->iStatus);
sl@0
   903
	active->StartL();
sl@0
   904
	CActiveScheduler::Start();
sl@0
   905
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   906
sl@0
   907
	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
sl@0
   908
	CleanupStack::PushL(view);
sl@0
   909
sl@0
   910
	CLogFilter* filter = CLogFilter::NewL();
sl@0
   911
	CleanupStack::PushL(filter);
sl@0
   912
sl@0
   913
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
   914
	active->StartL();
sl@0
   915
	CActiveScheduler::Start();
sl@0
   916
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   917
sl@0
   918
	TInt failCount = 0;
sl@0
   919
	TBool finished = EFalse;
sl@0
   920
	TInt error;
sl@0
   921
sl@0
   922
	while(!finished)
sl@0
   923
		{
sl@0
   924
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
   925
sl@0
   926
		TInt result = 0;
sl@0
   927
		TRAP(error, result = view->CountL());
sl@0
   928
		
sl@0
   929
		if (!error)
sl@0
   930
			{
sl@0
   931
			finished = ETrue;
sl@0
   932
			TEST(result > 0);
sl@0
   933
			}
sl@0
   934
		else
sl@0
   935
			TEST2(error, KErrNoMemory);
sl@0
   936
sl@0
   937
		__LOGSERV_UHEAP_RESET;
sl@0
   938
		}
sl@0
   939
sl@0
   940
	CleanupStack::PopAndDestroy(4); // filter, view, event, active
sl@0
   941
	}
sl@0
   942
sl@0
   943
/**
sl@0
   944
@SYMTestCaseID          SYSLIB-LOGENG-CT-0986
sl@0
   945
@SYMTestCaseDesc	    Tests for CLogViewRecent::RemoveL() function
sl@0
   946
@SYMTestPriority 	    High
sl@0
   947
@SYMTestActions  	    Test for removing the event with the specified unique event ID from the view
sl@0
   948
						Check for log server failure error
sl@0
   949
@SYMTestExpectedResults Test must not fail
sl@0
   950
@SYMREQ                 REQ0000
sl@0
   951
*/
sl@0
   952
LOCAL_C void TestRecentViewRemoveWithLogServFailL(CLogClient& aClient)
sl@0
   953
	{
sl@0
   954
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0986 "));
sl@0
   955
	CTestActive* active = new(ELeave)CTestActive;
sl@0
   956
	CleanupStack::PushL(active);
sl@0
   957
sl@0
   958
	CLogEvent* event = CLogEvent::NewL();
sl@0
   959
	CleanupStack::PushL(event);
sl@0
   960
sl@0
   961
	// Incoming
sl@0
   962
	TLogString buf;
sl@0
   963
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
   964
sl@0
   965
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   966
	event->SetDirection(buf);
sl@0
   967
	event->SetContact(1);
sl@0
   968
sl@0
   969
	// Add events
sl@0
   970
	aClient.AddEvent(*event, active->iStatus);
sl@0
   971
	active->StartL();
sl@0
   972
	CActiveScheduler::Start();
sl@0
   973
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   974
sl@0
   975
	event->SetContact(2);
sl@0
   976
sl@0
   977
	aClient.AddEvent(*event, active->iStatus);
sl@0
   978
	active->StartL();
sl@0
   979
	CActiveScheduler::Start();
sl@0
   980
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   981
sl@0
   982
	event->SetContact(3);
sl@0
   983
sl@0
   984
	aClient.AddEvent(*event, active->iStatus);
sl@0
   985
	active->StartL();
sl@0
   986
	CActiveScheduler::Start();
sl@0
   987
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   988
sl@0
   989
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
   990
	CleanupStack::PushL(view);
sl@0
   991
sl@0
   992
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
   993
	active->StartL();
sl@0
   994
	CActiveScheduler::Start();
sl@0
   995
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   996
sl@0
   997
	TInt count = view->CountL();
sl@0
   998
	TEST(count > 1);
sl@0
   999
sl@0
  1000
	TInt failCount = 0;
sl@0
  1001
	TBool finished = EFalse;
sl@0
  1002
	TInt error;
sl@0
  1003
sl@0
  1004
	while(!finished)
sl@0
  1005
		{
sl@0
  1006
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
  1007
sl@0
  1008
		TRAP(error, view->RemoveL(view->Event().Id()));
sl@0
  1009
sl@0
  1010
		__LOGSERV_UHEAP_RESET;
sl@0
  1011
sl@0
  1012
		if (!error)
sl@0
  1013
			{
sl@0
  1014
			finished = ETrue;
sl@0
  1015
sl@0
  1016
			TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  1017
			active->StartL();
sl@0
  1018
			CActiveScheduler::Start();
sl@0
  1019
			TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1020
sl@0
  1021
			TEST(count == view->CountL() + 1);
sl@0
  1022
			}
sl@0
  1023
		else
sl@0
  1024
			TEST2(error, KErrNoMemory);
sl@0
  1025
		}
sl@0
  1026
sl@0
  1027
	failCount = 0;
sl@0
  1028
	finished = EFalse;
sl@0
  1029
sl@0
  1030
	while(!finished)
sl@0
  1031
		{
sl@0
  1032
		TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  1033
		active->StartL();
sl@0
  1034
		CActiveScheduler::Start();
sl@0
  1035
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1036
sl@0
  1037
		count = view->CountL();
sl@0
  1038
		TEST(count > 1);
sl@0
  1039
sl@0
  1040
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
  1041
sl@0
  1042
		TBool ret = EFalse;
sl@0
  1043
		TRAP(error, ret = view->RemoveL(active->iStatus));
sl@0
  1044
sl@0
  1045
		__LOGSERV_UHEAP_RESET;
sl@0
  1046
sl@0
  1047
		if (!error)
sl@0
  1048
			{
sl@0
  1049
			TEST(ret);
sl@0
  1050
sl@0
  1051
			active->StartL();
sl@0
  1052
			CActiveScheduler::Start();
sl@0
  1053
sl@0
  1054
			if (active->iStatus == KErrNone)
sl@0
  1055
				{
sl@0
  1056
				TEST(count == view->CountL() + 1);
sl@0
  1057
				finished = ETrue;
sl@0
  1058
				}
sl@0
  1059
			else
sl@0
  1060
				TEST2(active->iStatus.Int(), KErrNoMemory);
sl@0
  1061
			}
sl@0
  1062
		else
sl@0
  1063
			TEST2(error, KErrNoMemory);
sl@0
  1064
		}
sl@0
  1065
sl@0
  1066
	CleanupStack::PopAndDestroy(3); // view, event, active
sl@0
  1067
	}
sl@0
  1068
sl@0
  1069
/**
sl@0
  1070
@SYMTestCaseID          SYSLIB-LOGENG-CT-0987
sl@0
  1071
@SYMTestCaseDesc	    Tests for CLogViewDuplicate::RemoveL() function
sl@0
  1072
@SYMTestPriority 	    High
sl@0
  1073
@SYMTestActions  	    Test for removing the event with the specified unique event ID from the view.Check for memory error
sl@0
  1074
@SYMTestExpectedResults Test must not fail
sl@0
  1075
@SYMREQ                 REQ0000
sl@0
  1076
*/
sl@0
  1077
LOCAL_C void TestDuplicateViewRemoveWithLogServFailL(CLogClient& aClient)
sl@0
  1078
	{
sl@0
  1079
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0987 "));
sl@0
  1080
	CTestActive* active = new(ELeave)CTestActive;
sl@0
  1081
	CleanupStack::PushL(active);
sl@0
  1082
sl@0
  1083
	CLogEvent* event = CLogEvent::NewL();
sl@0
  1084
	CleanupStack::PushL(event);
sl@0
  1085
sl@0
  1086
	// Incoming
sl@0
  1087
	TLogString buf;
sl@0
  1088
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  1089
sl@0
  1090
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  1091
	event->SetDirection(buf);
sl@0
  1092
	event->SetContact(KTestContact);
sl@0
  1093
sl@0
  1094
	// Add events
sl@0
  1095
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1096
	active->StartL();
sl@0
  1097
	CActiveScheduler::Start();
sl@0
  1098
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1099
sl@0
  1100
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1101
	active->StartL();
sl@0
  1102
	CActiveScheduler::Start();
sl@0
  1103
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1104
sl@0
  1105
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1106
	active->StartL();
sl@0
  1107
	CActiveScheduler::Start();
sl@0
  1108
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1109
sl@0
  1110
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1111
	active->StartL();
sl@0
  1112
	CActiveScheduler::Start();
sl@0
  1113
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1114
sl@0
  1115
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
  1116
	CleanupStack::PushL(view);
sl@0
  1117
sl@0
  1118
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  1119
	active->StartL();
sl@0
  1120
	CActiveScheduler::Start();
sl@0
  1121
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1122
sl@0
  1123
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  1124
	CleanupStack::PushL(duplicate);
sl@0
  1125
sl@0
  1126
	TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  1127
	active->StartL();
sl@0
  1128
	CActiveScheduler::Start();
sl@0
  1129
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1130
	
sl@0
  1131
	TInt count = duplicate->CountL();
sl@0
  1132
	TEST(count > 0);
sl@0
  1133
sl@0
  1134
	TInt failCount = 0;
sl@0
  1135
	TBool finished = EFalse;
sl@0
  1136
	TInt error;
sl@0
  1137
sl@0
  1138
	while(!finished)
sl@0
  1139
		{
sl@0
  1140
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
  1141
sl@0
  1142
		TRAP(error, duplicate->RemoveL(duplicate->Event().Id()));
sl@0
  1143
sl@0
  1144
		__LOGSERV_UHEAP_RESET;
sl@0
  1145
sl@0
  1146
		if (!error)
sl@0
  1147
			{
sl@0
  1148
			finished = ETrue;
sl@0
  1149
sl@0
  1150
			TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  1151
			active->StartL();
sl@0
  1152
			CActiveScheduler::Start();
sl@0
  1153
			TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1154
sl@0
  1155
			TEST(count == duplicate->CountL() + 1);
sl@0
  1156
			}
sl@0
  1157
		else
sl@0
  1158
			TEST2(error, KErrNoMemory);
sl@0
  1159
		}
sl@0
  1160
sl@0
  1161
	failCount = 0;
sl@0
  1162
	finished = EFalse;
sl@0
  1163
sl@0
  1164
	while(!finished)
sl@0
  1165
		{
sl@0
  1166
		TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  1167
		active->StartL();
sl@0
  1168
		CActiveScheduler::Start();
sl@0
  1169
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1170
sl@0
  1171
		count = duplicate->CountL();
sl@0
  1172
sl@0
  1173
		__LOGSERV_UHEAP_FAILNEXT(failCount++);
sl@0
  1174
sl@0
  1175
		TBool ret = EFalse;
sl@0
  1176
		TRAP(error, ret = duplicate->RemoveL(active->iStatus));
sl@0
  1177
sl@0
  1178
		__LOGSERV_UHEAP_RESET;
sl@0
  1179
sl@0
  1180
		if (!error)
sl@0
  1181
			{
sl@0
  1182
			if (ret)
sl@0
  1183
				{
sl@0
  1184
				active->StartL();
sl@0
  1185
				CActiveScheduler::Start();
sl@0
  1186
				}
sl@0
  1187
sl@0
  1188
			if (!ret || active->iStatus == KErrNone)
sl@0
  1189
				{
sl@0
  1190
				finished = ETrue;
sl@0
  1191
				TEST(count == duplicate->CountL() + 1);
sl@0
  1192
				}
sl@0
  1193
			else
sl@0
  1194
				TEST2(active->iStatus.Int(), KErrNoMemory);
sl@0
  1195
			}
sl@0
  1196
		else
sl@0
  1197
			TEST2(error, KErrNoMemory);
sl@0
  1198
		}
sl@0
  1199
sl@0
  1200
	CleanupStack::PopAndDestroy(4); // duplicate, view, event, active
sl@0
  1201
	}
sl@0
  1202
sl@0
  1203
void doTestsL()
sl@0
  1204
	{
sl@0
  1205
	TestUtils::Initialize(_L("t_logviewfail3"));
sl@0
  1206
	TestUtils::DeleteDatabaseL();
sl@0
  1207
sl@0
  1208
	CLogClient* client = CLogClient::NewL(theFs);
sl@0
  1209
	CleanupStack::PushL(client);
sl@0
  1210
sl@0
  1211
	TheTest.Start(_L("Heap Failure in Log Server"));
sl@0
  1212
sl@0
  1213
	TheTest.Next(_L("View Construction"));
sl@0
  1214
	TestEventViewConstructWithLogServFailL(*client);
sl@0
  1215
	TestRecentViewConstructWithLogServFailL(*client);
sl@0
  1216
	TestDuplicateViewConstructWithLogServFailL(*client);
sl@0
  1217
	theLog.Write(_L8("Test 1 OK\n"));
sl@0
  1218
sl@0
  1219
	TheTest.Next(_L("View Setup"));
sl@0
  1220
	TestEventViewSetupWithLogServFailL(*client);
sl@0
  1221
	TestRecentViewSetupWithLogServFailL(*client);
sl@0
  1222
	TestDuplicateViewSetupWithLogServFailL(*client);
sl@0
  1223
	theLog.Write(_L8("Test 2 OK\n"));
sl@0
  1224
sl@0
  1225
	TheTest.Next(_L("View Navigation"));
sl@0
  1226
	TestNavigationWithLogServFailL(*client);
sl@0
  1227
	theLog.Write(_L8("Test 3 OK\n"));
sl@0
  1228
sl@0
  1229
	TheTest.Next(_L("Other"));
sl@0
  1230
	TestViewCountWithLogServFailL(*client);
sl@0
  1231
	TestRecentViewRemoveWithLogServFailL(*client);
sl@0
  1232
	TestDuplicateViewRemoveWithLogServFailL(*client);
sl@0
  1233
	theLog.Write(_L8("Test 4 OK\n"));
sl@0
  1234
sl@0
  1235
	CleanupStack::PopAndDestroy(); // client;
sl@0
  1236
	}