os/persistentdata/loggingservices/eventlogger/test/src/t_logheap.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include <s32file.h>
    17 #include <logview.h>
    18 #include "t_logutil2.h"
    19 
    20 RTest TheTest(_L("t_logheap"));
    21 
    22 const TUid KTestEventUid = {0x10005393};
    23 _LIT(KTestEventDesc1, "Event Type Description");
    24 _LIT(KTestEventDesc2, "Changed Event Description");
    25 _LIT(KTestRemoteParty1, "Remote Party");
    26 _LIT(KTestRemoteParty2, "Changed Remote Party");
    27 _LIT(KTestDirection1, "Direction");
    28 _LIT(KTestDirection2, "Changed Direction");
    29 const TLogDurationType KTestDurationType1 = 1;
    30 const TLogDurationType KTestDurationType2 = 2;
    31 const TLogDuration KTestDuration1 = 0x1234;
    32 const TLogDuration KTestDuration2 = 0x1234567;
    33 _LIT(KTestStatus1, "Status");
    34 _LIT(KTestStatus2, "Changed Status");
    35 _LIT(KTestSubject1, "Subject");
    36 _LIT(KTestSubject2, "Changed Subject");
    37 _LIT(KTestNumber1, "Number");
    38 _LIT(KTestNumber2, "Changed Number");
    39 const TLogContactItemId KTestContact1 = 0x1234;
    40 const TLogContactItemId KTestContact2 = 0x1234567;
    41 const TLogLink KTestLink1 = 0x1234;
    42 const TLogLink KTestLink2 = 0x1234567;
    43 _LIT8(KTestData1, "ABCDEFGH");
    44 _LIT8(KTestData2, "IJKLMNOPQRSTUVWXYZ");
    45 const TLogSize KTestMaxLogSize = 0xFFF;
    46 const TLogRecentSize KTestMaxRecentLogSize = 0xF;
    47 const TLogAge KTestMaxEventAge = 0xFFFFFFF;
    48 
    49 _LIT(KCreateDb, "Create Db");
    50 _LIT(KOpenDb,   "Open Db");
    51 
    52 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
    53 _LIT(KServerSide, "server side");
    54 _LIT(KClientSide, "client side");
    55 #endif
    56 
    57 /**
    58 @SYMTestCaseID          SYSLIB-LOGENG-CT-0884
    59 @SYMTestCaseDesc	    Tests for functionality of CLogEvent,CTestActive classes
    60 @SYMTestPriority 	    High
    61 @SYMTestActions  	    Tests for no memory errors.
    62 @SYMTestExpectedResults Test must not fail
    63 @SYMREQ                 REQ0000
    64 */
    65 LOCAL_C void TestStartup1L()
    66 	{
    67 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0884 "));
    68 	CLogClient* client = CLogClient::NewL(theFs);
    69 	CleanupStack::PushL(client);
    70 
    71 	CTestActive* active = new(ELeave)CTestActive();
    72 	CleanupStack::PushL(active);
    73 
    74 	CLogEvent* event = CLogEvent::NewL();
    75 	CleanupStack::PushL(event);
    76 
    77 	TTime now;
    78 	now.UniversalTime();
    79 
    80 	event->SetEventType(KLogCallEventTypeUid);
    81 
    82 	active->StartL();
    83 	client->AddEvent(*event, active->iStatus);
    84 	CActiveScheduler::Start();
    85 	TEST2(active->iStatus.Int(), KErrNone);
    86 	
    87 	TBool finished = EFalse;
    88 	TInt failCount = 0;
    89 
    90 	while(!finished)
    91 		{
    92 		__UHEAP_FAILNEXT(++failCount);
    93 		client->ChangeEvent(*event, active->iStatus);
    94 		__UHEAP_RESET;
    95 		active->StartL();
    96 		CActiveScheduler::Start();
    97 
    98 		if (active->iStatus == KErrNone)
    99 			{
   100 			finished = ETrue;
   101 			}
   102 		else
   103 			{
   104 			TEST2(active->iStatus.Int(), KErrNoMemory);
   105 			}
   106 		}
   107 
   108 	CleanupStack::PopAndDestroy(3); // client, active, event
   109     TheTest.Printf(_L("===CLogClient::ChangeEvent() client side OOM test succeeded at iteration %d\n"), failCount);
   110 	}
   111 
   112 /**
   113 @SYMTestCaseID          SYSLIB-LOGENG-CT-0885
   114 @SYMTestCaseDesc	    Tests for CLogEvent,CTestActive classes
   115 @SYMTestPriority 	    High
   116 @SYMTestActions  	    Tests for all basic functions of CLogEvent,CTestActive classes.Check for ErrNone flag.
   117 @SYMTestExpectedResults Test must not fail
   118 @SYMREQ                 REQ0000
   119 */
   120 LOCAL_C void TestBasicL(CLogClient& aClient)
   121 	{
   122 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0885 "));
   123 	
   124 	CTestActive* active = new(ELeave)CTestActive();
   125 	CleanupStack::PushL(active);
   126 
   127 	CLogEvent* event = CLogEvent::NewL();
   128 	CleanupStack::PushL(event);
   129 
   130 	TTime now;
   131 	now.UniversalTime();
   132 
   133 	event->SetEventType(KLogCallEventTypeUid);
   134 
   135 	active->StartL();
   136 	aClient.AddEvent(*event, active->iStatus);
   137 	CActiveScheduler::Start();
   138 	TEST2(active->iStatus.Int(), KErrNone);
   139 
   140 	TEST(event->EventType() == KLogCallEventTypeUid);
   141 	TEST(event->Description().Length() > 0);
   142 	TEST(event->Time() >= now);
   143 	now = event->Time();
   144 
   145 	TLogId id = event->Id();
   146 
   147 	event->SetRemoteParty(KTestRemoteParty1);
   148 	event->SetDirection(KTestDirection1);
   149 	event->SetDurationType(KTestDurationType1);
   150 	event->SetDuration(KTestDuration1);
   151 	event->SetStatus(KTestStatus1);
   152 	event->SetSubject(KTestSubject1);
   153 	event->SetNumber(KTestNumber1);
   154 	event->SetContact(KTestContact1);
   155 	event->SetLink(KTestLink1);
   156 	event->SetDataL(KTestData1);
   157 
   158 	active->StartL();
   159 	aClient.ChangeEvent(*event, active->iStatus);
   160 	CActiveScheduler::Start();
   161 	TEST2(active->iStatus.Int(), KErrNone);
   162 
   163 	TEST(event->Id() == id);
   164 	TEST(event->EventType() == KLogCallEventTypeUid);
   165 	TEST(event->Description().Length() > 0);
   166 	TEST(event->Time() == now);
   167 	TEST(event->RemoteParty() == KTestRemoteParty1);
   168 	TEST(event->Direction() == KTestDirection1);
   169 	TEST(event->DurationType() == KTestDurationType1);
   170 	TEST(event->Duration() == KTestDuration1);
   171 	TEST(event->Status() == KTestStatus1);
   172 	TEST(event->Subject() == KTestSubject1);
   173 	TEST(event->Number() == KTestNumber1);
   174 	TEST(event->Contact() == KTestContact1);
   175 	TEST(event->Link() == KTestLink1);
   176 	TEST(event->Data() == KTestData1);
   177 
   178 	CleanupStack::PopAndDestroy(); // event;
   179 
   180 	event = CLogEvent::NewL();
   181 	CleanupStack::PushL(event);
   182 
   183 	event->SetId(id);
   184 
   185 	active->StartL();
   186 	aClient.GetEvent(*event, active->iStatus);
   187 	CActiveScheduler::Start();
   188 	TEST2(active->iStatus.Int(), KErrNone);
   189 
   190 	TEST(event->Id() == id);
   191 	TEST(event->EventType() == KLogCallEventTypeUid);
   192 	TEST(event->Description().Length() > 0);
   193 	TEST(event->Time() == now);
   194 	TEST(event->RemoteParty() == KTestRemoteParty1);
   195 	TEST(event->Direction() == KTestDirection1);
   196 	TEST(event->DurationType() == KTestDurationType1);
   197 	TEST(event->Duration() == KTestDuration1);
   198 	TEST(event->Status() == KTestStatus1);
   199 	TEST(event->Subject() == KTestSubject1);
   200 	TEST(event->Number() == KTestNumber1);
   201 	TEST(event->Contact() == KTestContact1);
   202 	TEST(event->Link() == KTestLink1);
   203 	TEST(event->Data() == KTestData1);
   204 
   205 	active->StartL();
   206 	aClient.DeleteEvent(id, active->iStatus);
   207 	CActiveScheduler::Start();
   208 	TEST2(active->iStatus.Int(), KErrNone);
   209 
   210 	active->StartL();
   211 	aClient.GetEvent(*event, active->iStatus);
   212 	CActiveScheduler::Start();
   213 	TEST2(active->iStatus.Int(), KErrNotFound);
   214 
   215 	CleanupStack::PopAndDestroy(2, active); // event, active
   216 	}
   217 
   218 /**
   219 @SYMTestCaseID          SYSLIB-LOGENG-CT-0886
   220 @SYMTestCaseDesc	    Tests for new CLogClient object creation
   221 @SYMTestPriority 	    High
   222 @SYMTestActions  	    Create a CLogClient object on heap.Check for memory errors
   223 @SYMTestExpectedResults Test must not fail
   224 @SYMREQ                 REQ0000
   225 */
   226 LOCAL_C void TestConstruction1L(TBool aCreateDb)
   227 	{
   228 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0886 "));
   229 
   230 	if(aCreateDb)
   231 	    {
   232 	    TestUtils::DeleteDatabaseL();
   233 	    }
   234 		
   235 	CLogClient* client = NULL;
   236 	TInt failCount = 0;
   237 
   238 	TBool finished = EFalse;
   239 	TInt error;
   240 
   241 	while(!finished)
   242 		{
   243 		__UHEAP_FAILNEXT(++failCount);
   244 
   245 		TRAP(error, client = CLogClient::NewL(theFs));
   246 
   247 		__UHEAP_RESET;
   248 
   249 		if (error == KErrNone)
   250 			{
   251 			finished = ETrue;
   252 			TestBasicL(*client);
   253 			}
   254 		else
   255 			TEST2(error, KErrNoMemory);
   256 		}
   257 
   258 	delete client;
   259     TheTest.Printf(_L("==CLogClient::NewL()+\"%S\" client side OOM test succeeded at iteration %d\n"), aCreateDb ? &KCreateDb : &KOpenDb, failCount);
   260 	}
   261 
   262 /**s
   263 @SYMTestCaseID          SYSLIB-LOGENG-CT-0887
   264 @SYMTestCaseDesc	    Tests for creation of new CLogClient object 
   265 @SYMTestPriority 	    High
   266 @SYMTestActions  	    Check for memory errors and error in the environment 
   267 @SYMTestExpectedResults Test must not fail
   268 @SYMREQ                 REQ0000
   269 */
   270 LOCAL_C void TestConstruction3L(TBool aCreateDb)
   271 	{
   272 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0887 "));
   273 
   274     if(aCreateDb)
   275         {
   276         TestUtils::DeleteDatabaseL();
   277         }
   278 
   279 	CLogClient* client = NULL;
   280 
   281 	TInt failCount = 0;
   282 
   283 	TBool finished = EFalse;
   284 	TInt error;
   285 
   286 	while(!finished)
   287 		{
   288 		__LOGSERV_UHEAP_FAILNEXT(++failCount);
   289 
   290 		TRAP(error, client = CLogClient::NewL(theFs));
   291 
   292 		__LOGSERV_UHEAP_RESET;
   293 
   294 		if (error == KErrNone)
   295 			{
   296 			finished = ETrue;
   297 			TestBasicL(*client);
   298 			}
   299 		else
   300 			TEST2(error, KErrNoMemory);
   301 		}
   302 
   303 	delete client;
   304     TheTest.Printf(_L("==CLogClient::NewL()+\"%S\" server side OOM test succeeded at iteration %d\n"), aCreateDb ? &KCreateDb : &KOpenDb, failCount);
   305 	}
   306 
   307 /**
   308 @SYMTestCaseID          SYSLIB-LOGENG-CT-0888
   309 @SYMTestCaseDesc	    Tests for CLogClient::AddEventType() function
   310 @SYMTestPriority 	    High
   311 @SYMTestActions  	    Tests for adding events to the log
   312                         Check for memory errors and error in the environment 
   313 @SYMTestExpectedResults Test must not fail
   314 @SYMREQ                 REQ0000
   315 */
   316 LOCAL_C void TestAddEventType1L()
   317 	{
   318 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0888 "));
   319 	
   320 	CLogClient* client = CLogClient::NewL(theFs);
   321 	CleanupStack::PushL(client);
   322 	
   323 	CLogEventType* type = CLogEventType::NewL();
   324 	CleanupStack::PushL(type);
   325 
   326 	type->SetUid(KTestEventUid);
   327 	type->SetDescription(KTestEventDesc1);
   328 	type->SetLoggingEnabled(ETrue);
   329 
   330 	CTestActive* active = new(ELeave)CTestActive();
   331 	CleanupStack::PushL(active);
   332 
   333 	TInt failCount = 0;
   334 	TBool finished = EFalse;
   335 	TInt error;
   336 
   337 	while(!finished)
   338 		{
   339 		error = KErrNone;
   340 
   341 		__UHEAP_FAILNEXT(++failCount);
   342 		client->AddEventType(*type, active->iStatus);
   343 	
   344 		active->StartL();
   345 		CActiveScheduler::Start();
   346 		
   347 		if (active->iStatus == KErrNone)
   348 			finished = ETrue;
   349 		else
   350 			error = active->iStatus.Int();
   351 
   352 		__UHEAP_RESET;
   353 
   354 		if (error == KErrNoMemory)
   355 			{
   356 			active->StartL();
   357 			client->GetEventType(*type, active->iStatus);
   358 			CActiveScheduler::Start();
   359 			TEST2(active->iStatus.Int(), KErrNotFound);
   360 			}
   361 		else
   362 			TEST2(error, KErrNone);
   363 
   364 		}
   365 
   366 	active->StartL();
   367 	client->AddEventType(*type, active->iStatus);
   368 	CActiveScheduler::Start();
   369 	TEST2(active->iStatus.Int(), KErrAlreadyExists);
   370 
   371 	CleanupStack::PopAndDestroy(3, client); // active, type, client
   372    TheTest.Printf(_L("===CLogClient::AddEventType() client side OOM test succeeded at iteration %d\n"), failCount);
   373 	}
   374 
   375 /**
   376 @SYMTestCaseID          SYSLIB-LOGENG-CT-0889
   377 @SYMTestCaseDesc	    Tests for CLogClient::AddEventType() function
   378 @SYMTestPriority 	    High
   379 @SYMTestActions  	    Tests for adding events to the log
   380                         Check for memory errors and error in the environment 
   381 						Test for adding the same event and check for already exits error.
   382 @SYMTestExpectedResults Test must not fail
   383 @SYMREQ                 REQ0000
   384 */
   385 LOCAL_C void TestAddEventType3L()
   386 	{
   387 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0889 "));
   388 	
   389 	CLogClient* client = CLogClient::NewL(theFs);
   390 	CleanupStack::PushL(client);
   391 	
   392 	CLogEventType* type = CLogEventType::NewL();
   393 	CleanupStack::PushL(type);
   394 
   395 	type->SetUid(KTestEventUid);
   396 	type->SetDescription(KTestEventDesc1);
   397 	type->SetLoggingEnabled(ETrue);
   398 
   399 	CTestActive* active = new(ELeave)CTestActive();
   400 	CleanupStack::PushL(active);
   401 
   402 	TInt failCount = 0;
   403 
   404 	TBool finished = EFalse;
   405 	TInt error;
   406 
   407 	while(!finished)
   408 		{
   409 		error = KErrNone;
   410 
   411 		__LOGSERV_UHEAP_FAILNEXT(++failCount);
   412 		client->AddEventType(*type, active->iStatus);
   413 	
   414 		active->StartL();
   415 		CActiveScheduler::Start();
   416 		
   417 		if (active->iStatus == KErrNone)
   418 			finished = ETrue;
   419 		else
   420 			error = active->iStatus.Int();
   421 
   422 		__LOGSERV_UHEAP_RESET;
   423 
   424 		if (error == KErrNoMemory)
   425 			{
   426 			active->StartL();
   427 			client->GetEventType(*type, active->iStatus);
   428 			CActiveScheduler::Start();
   429 			TEST2(active->iStatus.Int(), KErrNotFound);
   430 			}
   431 		else
   432 			TEST2(error, KErrNone);
   433 
   434 		}
   435 
   436 	active->StartL();
   437 	client->AddEventType(*type, active->iStatus);
   438 	CActiveScheduler::Start();
   439 	TEST2(active->iStatus.Int(), KErrAlreadyExists);
   440 
   441 	CleanupStack::PopAndDestroy(3, client); // active, type, client
   442 	TheTest.Printf(_L("===CLogClient::AddEventType() server side OOM test succeeded at iteration %d\n"), failCount);
   443 	}
   444 
   445 /**
   446 @SYMTestCaseID          SYSLIB-LOGENG-CT-0890
   447 @SYMTestCaseDesc	    Tests for CLogClient::GetEventType() function 
   448 @SYMTestPriority 	    High
   449 @SYMTestActions  	    Tests for getting event type for the specific UID  from the log
   450                         Check for memory errors and error in the environment
   451 @SYMTestExpectedResults Test must not fail
   452 @SYMREQ                 REQ0000
   453 */
   454 LOCAL_C void TestGetEventType1L()
   455 	{
   456 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0890 "));
   457 	
   458 	CLogClient* client = CLogClient::NewL(theFs);
   459 	CleanupStack::PushL(client);
   460 	
   461 	CLogEventType* type = CLogEventType::NewL();
   462 	CleanupStack::PushL(type);
   463 
   464 	type->SetUid(KTestEventUid);
   465 
   466 	CTestActive* active = new(ELeave)CTestActive();
   467 	CleanupStack::PushL(active);
   468 
   469 	TInt failCount = 0;
   470 	TBool finished = EFalse;
   471 
   472 	while(!finished)
   473 		{
   474 		__UHEAP_FAILNEXT(++failCount);
   475 
   476 		client->GetEventType(*type, active->iStatus);
   477 
   478 		active->StartL();
   479 		CActiveScheduler::Start();
   480 		
   481 		if (active->iStatus == KErrNone)
   482 			finished = ETrue;
   483 		else
   484 			{
   485 			TEST2(active->iStatus.Int(), KErrNoMemory);
   486 			TEST(type->Description() == KNullDesC);
   487 			}
   488 
   489 		__UHEAP_RESET;
   490 		}
   491 
   492 	TEST(type->Uid() == KTestEventUid);
   493 	TEST(type->Description() == KTestEventDesc1);
   494 	TEST(type->LoggingEnabled());
   495 
   496 	CleanupStack::PopAndDestroy(3, client); // active, type, client
   497     TheTest.Printf(_L("===CLogClient::GetEventType() client side OOM test succeeded at iteration %d\n"), failCount);
   498 	}
   499 
   500 /**
   501 @SYMTestCaseID          SYSLIB-LOGENG-CT-0891
   502 @SYMTestCaseDesc	    Tests for CLogClient::GetEventType() function 
   503 @SYMTestPriority 	    High
   504 @SYMTestActions  	    Tests for getting event type for the specific UID  from the log
   505                         Check for memory errors and error in the environment
   506 @SYMTestExpectedResults Test must not fail
   507 @SYMREQ                 REQ0000
   508 */
   509 LOCAL_C void TestGetEventType3L()
   510 	{
   511 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0891 "));
   512 	
   513 	CLogClient* client = CLogClient::NewL(theFs);
   514 	CleanupStack::PushL(client);
   515 	
   516 	CLogEventType* type = CLogEventType::NewL();
   517 	CleanupStack::PushL(type);
   518 
   519 	type->SetUid(KTestEventUid);
   520 
   521 	CTestActive* active = new(ELeave)CTestActive();
   522 	CleanupStack::PushL(active);
   523 
   524 	TInt failCount = 0;
   525 	TBool finished = EFalse;
   526 
   527 	while(!finished)
   528 		{
   529 		__LOGSERV_UHEAP_FAILNEXT(++failCount);
   530 
   531 		client->GetEventType(*type, active->iStatus);
   532 
   533 		active->StartL();
   534 		CActiveScheduler::Start();
   535 		
   536 		if (active->iStatus == KErrNone)
   537 			finished = ETrue;
   538 		else
   539 			{
   540 			TEST2(active->iStatus.Int(), KErrNoMemory);
   541 			TEST(type->Description() == KNullDesC);
   542 			}
   543 
   544 		__LOGSERV_UHEAP_RESET;
   545 		}
   546 
   547 	TEST(type->Uid() == KTestEventUid);
   548 	TEST(type->Description() == KTestEventDesc1);
   549 	TEST(type->LoggingEnabled());
   550 
   551 	CleanupStack::PopAndDestroy(3, client); // active, type, client
   552     TheTest.Printf(_L("===CLogClient::GetEventType() server side OOM test succeeded at iteration %d\n"), failCount);
   553 	}
   554 
   555 /**
   556 @SYMTestCaseID          SYSLIB-LOGENG-CT-0892
   557 @SYMTestCaseDesc	    Tests for CLogClient::ChangeEventType() function 
   558 @SYMTestPriority 	    High
   559 @SYMTestActions  	    Tests for changing the event type 
   560                         Check for memory errors and error in the environment 
   561 @SYMTestExpectedResults Test must not fail
   562 @SYMREQ                 REQ0000
   563 */
   564 LOCAL_C void TestChangeEventType1L()
   565 	{
   566 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0892 "));
   567 	
   568 	CLogClient* client = CLogClient::NewL(theFs);
   569 	CleanupStack::PushL(client);
   570 	
   571 	CTestActive* active = new(ELeave)CTestActive();
   572 	CleanupStack::PushL(active);
   573 
   574 	CLogEventType* type = CLogEventType::NewL();
   575 	CleanupStack::PushL(type);
   576 
   577 	type->SetUid(KTestEventUid);
   578 
   579 	type->SetDescription(KTestEventDesc1);
   580 	type->SetDescription(KTestEventDesc2);
   581 
   582 	TInt failCount = 0;
   583 	TBool finished = EFalse;
   584 	TInt error;
   585 
   586 	while(!finished)
   587 		{
   588 		error = KErrNone;
   589 
   590 		type->SetDescription(KTestEventDesc2);
   591 		type->SetLoggingEnabled(EFalse);
   592 
   593 		__UHEAP_FAILNEXT(++failCount);
   594 		
   595 		client->ChangeEventType(*type, active->iStatus);
   596 
   597 		active->StartL();
   598 		CActiveScheduler::Start();
   599 
   600 		if (active->iStatus == KErrNone)
   601 			finished = ETrue;
   602 		else
   603 			error = active->iStatus.Int();
   604 
   605 		__UHEAP_RESET;
   606 
   607 		if (error == KErrNoMemory)
   608 			{
   609 			active->StartL();
   610 			client->GetEventType(*type, active->iStatus);
   611 			CActiveScheduler::Start();
   612 			TEST2(active->iStatus.Int(), KErrNone);
   613 
   614 			TEST(type->Description() == KTestEventDesc1);
   615 			TEST(type->LoggingEnabled());
   616 			}
   617 		else
   618 			TEST2(error, KErrNone);
   619 		}
   620 
   621 	type->SetUid(KTestEventUid);
   622 
   623 	active->StartL();
   624 	client->GetEventType(*type, active->iStatus);
   625 	CActiveScheduler::Start();
   626 	TEST2(active->iStatus.Int(), KErrNone);
   627 
   628 	TEST(type->Uid() == KTestEventUid);
   629 	TEST(type->Description() == KTestEventDesc2);
   630 	TEST(type->LoggingEnabled() == EFalse);
   631 
   632 	CleanupStack::PopAndDestroy(3, client); // type, active, client
   633     TheTest.Printf(_L("===CLogClient::ChangeEventType() client side OOM test succeeded at iteration %d\n"), failCount);
   634 	}
   635 
   636 /**
   637 @SYMTestCaseID          SYSLIB-LOGENG-CT-0893
   638 @SYMTestCaseDesc	    Tests for CLogClient::ChangeEventType() function 
   639 @SYMTestPriority 	    High
   640 @SYMTestActions  	    Tests for changing the event type. 
   641                         Check for memory errors and error in the environment 
   642 @SYMTestExpectedResults Test must not fail
   643 @SYMREQ                 REQ0000
   644 */
   645 LOCAL_C void TestChangeEventType3L()
   646 	{
   647 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0893 "));
   648 	
   649 	CLogClient* client = CLogClient::NewL(theFs);
   650 	CleanupStack::PushL(client);
   651 	
   652 	CTestActive* active = new(ELeave)CTestActive();
   653 	CleanupStack::PushL(active);
   654 
   655 	CLogEventType* type = CLogEventType::NewL();
   656 	CleanupStack::PushL(type);
   657 
   658 	type->SetUid(KTestEventUid);
   659 
   660 	type->SetDescription(KTestEventDesc1);
   661 	type->SetDescription(KTestEventDesc2);
   662 
   663 	TInt failCount = 0;
   664 	TBool finished = EFalse;
   665 	TInt error;
   666 
   667 	while(!finished)
   668 		{
   669 		error = KErrNone;
   670 
   671 		type->SetDescription(KTestEventDesc2);
   672 		type->SetLoggingEnabled(EFalse);
   673 
   674 		__LOGSERV_UHEAP_FAILNEXT(++failCount);
   675 		
   676 		client->ChangeEventType(*type, active->iStatus);
   677 
   678 		active->StartL();
   679 		CActiveScheduler::Start();
   680 
   681 		if (active->iStatus == KErrNone)
   682 			finished = ETrue;
   683 		else
   684 			error = active->iStatus.Int();
   685 
   686 		__LOGSERV_UHEAP_RESET;
   687 
   688 		if (error == KErrNoMemory)
   689 			{
   690 			active->StartL();
   691 			client->GetEventType(*type, active->iStatus);
   692 			CActiveScheduler::Start();
   693 			TEST2(active->iStatus.Int(), KErrNone);
   694 
   695 			TEST(type->Description() == KTestEventDesc1);
   696 			TEST(type->LoggingEnabled());
   697 			}
   698 		else
   699 			TEST2(error, KErrNone);
   700 		}
   701 
   702 	type->SetUid(KTestEventUid);
   703 
   704 	active->StartL();
   705 	client->GetEventType(*type, active->iStatus);
   706 	CActiveScheduler::Start();
   707 	TEST2(active->iStatus.Int(), KErrNone);
   708 
   709 	TEST(type->Uid() == KTestEventUid);
   710 	TEST(type->Description() == KTestEventDesc2);
   711 	TEST(type->LoggingEnabled() == EFalse);
   712 
   713 	CleanupStack::PopAndDestroy(3, client); // type, active, client
   714     TheTest.Printf(_L("===CLogClient::ChangeEventType() server side OOM test succeeded at iteration %d\n"), failCount);
   715 	}
   716 
   717 /**
   718 @SYMTestCaseID          SYSLIB-LOGENG-CT-0894
   719 @SYMTestCaseDesc	    Tests for CLogClient::DeleteEventType() function 
   720 @SYMTestPriority 	    High
   721 @SYMTestActions  	    Tests for deleting of event type.
   722                         After deletion check by trying to retrieve the event.
   723 						Check for ErrNotFound,error flag
   724 @SYMTestExpectedResults Test must not fail
   725 @SYMREQ                 REQ0000
   726 */
   727 LOCAL_C void TestDeleteEventType1L()
   728 	{
   729 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0894 "));
   730 
   731 	CLogClient* client = CLogClient::NewL(theFs);
   732 	CleanupStack::PushL(client);
   733 	
   734 	CTestActive* active = new(ELeave)CTestActive();
   735 	CleanupStack::PushL(active);
   736 
   737 	CLogEventType* type = CLogEventType::NewL();
   738 	CleanupStack::PushL(type);
   739 
   740 	type->SetUid(KTestEventUid);
   741 
   742 	TInt failCount = 0;
   743 	TBool finished = EFalse;
   744 	TInt error;
   745 
   746 	while(!finished)
   747 		{
   748 		error = KErrNone;
   749 
   750 		__UHEAP_FAILNEXT(++failCount);
   751 		client->DeleteEventType(KTestEventUid, active->iStatus);
   752 
   753 		active->StartL();
   754 		CActiveScheduler::Start();
   755 
   756 		if (active->iStatus == KErrNone)
   757 			finished = ETrue;
   758 		else
   759 			error = active->iStatus.Int();
   760 
   761 		__UHEAP_RESET;
   762 
   763 		if (error == KErrNoMemory)
   764 			{
   765 			active->StartL();
   766 			client->GetEventType(*type, active->iStatus);
   767 			CActiveScheduler::Start();
   768 			TEST2(active->iStatus.Int(), KErrNone);
   769 			}
   770 		else
   771 			TEST2(error, KErrNone);
   772 		}
   773 
   774 	active->StartL();
   775 	client->GetEventType(*type, active->iStatus);
   776 	CActiveScheduler::Start();
   777 	TEST2(active->iStatus.Int(), KErrNotFound);
   778 
   779 	CleanupStack::PopAndDestroy(3, client); // type, active, client
   780     TheTest.Printf(_L("===CLogClient::DeleteEventType() client side OOM test succeeded at iteration %d\n"), failCount);
   781 	}
   782 
   783 /**
   784 @SYMTestCaseID          SYSLIB-LOGENG-CT-0895
   785 @SYMTestCaseDesc	    Tests for CLogClient::DeleteEventType() function 
   786 @SYMTestPriority 	    High
   787 @SYMTestActions  	    Tests for deleting of event type.
   788                         After deletion check by trying to retrieve the event.
   789 						Check for ErrNotFound,error flag.
   790 @SYMTestExpectedResults Test must not fail
   791 @SYMREQ                 REQ0000
   792 */
   793 LOCAL_C void TestDeleteEventType3L()
   794 	{
   795 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0895 "));
   796 	
   797 	CLogClient* client = CLogClient::NewL(theFs);
   798 	CleanupStack::PushL(client);
   799 	
   800 	CTestActive* active = new(ELeave)CTestActive();
   801 	CleanupStack::PushL(active);
   802 
   803 	CLogEventType* type = CLogEventType::NewL();
   804 	CleanupStack::PushL(type);
   805 
   806 	type->SetUid(KTestEventUid);
   807 
   808 	TInt failCount = 0;
   809 
   810 	TBool finished = EFalse;
   811 	TInt error;
   812 
   813 	while(!finished)
   814 		{
   815 		error = KErrNone;
   816 
   817 		__LOGSERV_UHEAP_FAILNEXT(++failCount);
   818 		client->DeleteEventType(KTestEventUid, active->iStatus);
   819 
   820 		active->StartL();
   821 		CActiveScheduler::Start();
   822 
   823 		if (active->iStatus == KErrNone)
   824 			finished = ETrue;
   825 		else
   826 			error = active->iStatus.Int();
   827 
   828 		__LOGSERV_UHEAP_RESET;
   829 
   830 		if (error == KErrNoMemory)
   831 			{
   832 			active->StartL();
   833 			client->GetEventType(*type, active->iStatus);
   834 			CActiveScheduler::Start();
   835 			TEST2(active->iStatus.Int(), KErrNone);
   836 			}
   837 		else
   838 			TEST2(error, KErrNone);
   839 		}
   840 
   841 	active->StartL();
   842 	client->GetEventType(*type, active->iStatus);
   843 	CActiveScheduler::Start();
   844 	TEST2(active->iStatus.Int(), KErrNotFound);
   845 
   846 	CleanupStack::PopAndDestroy(3, client); // type, active, client
   847     TheTest.Printf(_L("===CLogClient::DeleteEventType() server side OOM test succeeded at iteration %d\n"), failCount);
   848 	}
   849 
   850 /**
   851 @SYMTestCaseID          SYSLIB-LOGENG-CT-0896
   852 @SYMTestCaseDesc	    Tests for adding event CLogClient::AddEvent() function  
   853 @SYMTestPriority 	    High
   854 @SYMTestActions  	    Add logeventtype and logevent to the log
   855                         Tests for memory errors and environment errors.
   856 @SYMTestExpectedResults Test must not fail 
   857 @SYMREQ                 REQ0000
   858 */
   859 LOCAL_C void TestAddEvent1L()
   860 	{
   861 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0896 "));
   862 
   863 	CLogClient* client = CLogClient::NewL(theFs);
   864 	CleanupStack::PushL(client);
   865 	
   866 	CLogEventType* type = CLogEventType::NewL();
   867 	CleanupStack::PushL(type);
   868 
   869 	type->SetUid(KTestEventUid);
   870 	type->SetDescription(KTestEventDesc1);
   871 	type->SetLoggingEnabled(ETrue);
   872 
   873 	CTestActive* active = new(ELeave)CTestActive();
   874 	CleanupStack::PushL(active);
   875 
   876 	active->StartL();
   877 	client->AddEventType(*type, active->iStatus);
   878 	CActiveScheduler::Start();
   879 	TEST2(active->iStatus.Int(), KErrNone);
   880 
   881 	CLogEvent* event = CLogEvent::NewL();
   882 	CleanupStack::PushL(event);
   883 
   884 	TTime now;
   885 	now.UniversalTime();
   886 
   887 	event->SetEventType(KTestEventUid);
   888 	event->SetRemoteParty(KTestRemoteParty1);
   889 	event->SetDirection(KTestDirection1);
   890 	event->SetDurationType(KTestDurationType1);
   891 	event->SetDuration(KTestDuration1);
   892 	event->SetStatus(KTestStatus1);
   893 	event->SetSubject(KTestSubject1);
   894 	event->SetNumber(KTestNumber1);
   895 	event->SetContact(KTestContact1);
   896 	event->SetLink(KTestLink1);
   897 	event->SetDataL(KTestData1);
   898 
   899 	TInt failCount = 0;
   900 	TBool finished = EFalse;
   901 	TInt error;
   902 
   903 	while(!finished)
   904 		{
   905 		error = KErrNone;
   906 
   907 		__UHEAP_FAILNEXT(++failCount);
   908 		client->AddEvent(*event, active->iStatus);
   909 		active->StartL();
   910 		CActiveScheduler::Start();
   911 
   912 		if (active->iStatus == KErrNone)
   913 			finished = ETrue;
   914 		else
   915 			error = active->iStatus.Int();
   916 
   917 		__UHEAP_RESET;
   918 
   919 		if(error != KErrNoMemory)
   920 			{
   921 			TEST2(error, KErrNone);
   922 			}
   923 		}
   924 
   925 	TEST(event->Time() >= now);
   926 	TEST(event->Description() == KTestEventDesc1);
   927 
   928 	active->StartL();
   929 	client->GetEvent(*event, active->iStatus);
   930 	CActiveScheduler::Start();
   931 	TEST2(active->iStatus.Int(), KErrNone);
   932 
   933 	CleanupStack::PopAndDestroy(4, client); // event, active, type, client
   934     TheTest.Printf(_L("===CLogClient::AddEvent() client side OOM test succeeded at iteration %d\n"), failCount);
   935 	}
   936 
   937 /**
   938 @SYMTestCaseID          SYSLIB-LOGENG-CT-0897
   939 @SYMTestCaseDesc	    Tests for adding event CLogClient::AddEvent() function 
   940 @SYMTestPriority 	    High
   941 @SYMTestActions  	    Add logeventtype and logevent to the log
   942                         Tests for memory errors and environment errors.
   943 @SYMTestExpectedResults Test must not fail 
   944 @SYMREQ                 REQ0000
   945 */
   946 LOCAL_C void TestAddEvent3L()
   947 	{
   948 	
   949 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0897 "));
   950 	
   951 	CLogClient* client = CLogClient::NewL(theFs);
   952 	CleanupStack::PushL(client);
   953 
   954 	CLogEventType* type = CLogEventType::NewL();
   955 	CleanupStack::PushL(type);
   956 
   957 	type->SetUid(KTestEventUid);
   958 	type->SetDescription(KTestEventDesc1);
   959 	type->SetLoggingEnabled(ETrue);
   960 
   961 	CTestActive* active = new(ELeave)CTestActive();
   962 	CleanupStack::PushL(active);
   963 
   964 	active->StartL();
   965 	client->AddEventType(*type, active->iStatus);
   966 	CActiveScheduler::Start();
   967 	TEST2(active->iStatus.Int(), KErrNone);
   968 
   969 	CLogEvent* event = CLogEvent::NewL();
   970 	CleanupStack::PushL(event);
   971 
   972 	TTime now;
   973 	now.UniversalTime();
   974 
   975 	event->SetEventType(KTestEventUid);
   976 	event->SetRemoteParty(KTestRemoteParty1);
   977 	event->SetDirection(KTestDirection1);
   978 	event->SetDurationType(KTestDurationType1);
   979 	event->SetDuration(KTestDuration1);
   980 	event->SetStatus(KTestStatus1);
   981 	event->SetSubject(KTestSubject1);
   982 	event->SetNumber(KTestNumber1);
   983 	event->SetContact(KTestContact1);
   984 	event->SetLink(KTestLink1);
   985 	event->SetDataL(KTestData1);
   986 
   987 	TInt failCount = 0;
   988 	TBool finished = EFalse;
   989 	TInt error;
   990 
   991 	while(!finished)
   992 		{
   993 		error = KErrNone;
   994 
   995 		__LOGSERV_UHEAP_FAILNEXT(++failCount);
   996 		client->AddEvent(*event, active->iStatus);
   997 		active->StartL();
   998 		CActiveScheduler::Start();
   999 
  1000 		if (active->iStatus == KErrNone)
  1001 			finished = ETrue;
  1002 		else
  1003 			error = active->iStatus.Int();
  1004 
  1005 		__LOGSERV_UHEAP_RESET;
  1006 
  1007 		if(error != KErrNoMemory)
  1008 			{
  1009 			TEST2(error, KErrNone);
  1010 			}
  1011 		}
  1012 
  1013 	TEST(event->Time() >= now);
  1014 	TEST(event->Description() == KTestEventDesc1);
  1015 
  1016 	active->StartL();
  1017 	client->GetEvent(*event, active->iStatus);
  1018 	CActiveScheduler::Start();
  1019 	TEST2(active->iStatus.Int(), KErrNone);
  1020 
  1021 	CleanupStack::PopAndDestroy(4, client); // event, active, type, client
  1022     TheTest.Printf(_L("===CLogClient::AddEvent() server side OOM test succeeded at iteration %d\n"), failCount);
  1023 	}
  1024 
  1025 /**
  1026 @SYMTestCaseID          SYSLIB-LOGENG-CT-0898
  1027 @SYMTestCaseDesc	    Tests for retrieving details of an event 
  1028                         Tests for CLogClient::GetEvent() function.
  1029 @SYMTestPriority 	    High
  1030 @SYMTestActions  	    Tests for getting event details.Check for memory errors and error in the environment
  1031                         Tests for the integrity of the information
  1032 @SYMTestExpectedResults Test must not fail
  1033 @SYMREQ                 REQ0000
  1034 */
  1035 LOCAL_C void TestGetEvent1L()
  1036 	{
  1037 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0898 "));
  1038 	
  1039 	CLogClient* client = CLogClient::NewL(theFs);
  1040 	CleanupStack::PushL(client);
  1041 	
  1042 	CTestActive* active = new(ELeave)CTestActive();
  1043 	CleanupStack::PushL(active);
  1044 
  1045 	CLogEvent* event = CLogEvent::NewL();
  1046 	CleanupStack::PushL(event);
  1047 
  1048 	event->SetId(0);
  1049 
  1050 	TInt failCount = 0;
  1051 	TBool finished = EFalse;
  1052 
  1053 	while(!finished)
  1054 		{
  1055 		__UHEAP_FAILNEXT(++failCount);
  1056 		client->GetEvent(*event, active->iStatus);
  1057 
  1058 		active->StartL();
  1059 		CActiveScheduler::Start();
  1060 
  1061 		if (active->iStatus == KErrNone)
  1062 			finished = ETrue;
  1063 		else
  1064 			TEST2(active->iStatus.Int(), KErrNoMemory);
  1065 
  1066 		__UHEAP_RESET;
  1067 		}
  1068 
  1069 	TEST(event->Id() == 0);
  1070 	TEST(event->Time() > TTime(0));
  1071 	TEST(event->Description() == KTestEventDesc1);
  1072 	TEST(event->EventType() == KTestEventUid);
  1073 	TEST(event->RemoteParty() == KTestRemoteParty1);
  1074 	TEST(event->Direction() == KTestDirection1);
  1075 	TEST(event->DurationType() == KTestDurationType1);
  1076 	TEST(event->Duration() == KTestDuration1);
  1077 	TEST(event->Status() == KTestStatus1);
  1078 	TEST(event->Subject() == KTestSubject1);
  1079 	TEST(event->Number() == KTestNumber1);
  1080 	TEST(event->Contact() == KTestContact1);
  1081 	TEST(event->Link() == KTestLink1);
  1082 	TEST(event->Data() == KTestData1);
  1083 
  1084 	CleanupStack::PopAndDestroy(3, client); // event, active, client
  1085     TheTest.Printf(_L("===CLogClient::AddEvent() client side OOM test succeeded at iteration %d\n"), failCount);
  1086 	}
  1087 
  1088 /**
  1089 @SYMTestCaseID          SYSLIB-LOGENG-CT-0899
  1090 @SYMTestCaseDesc	    Tests for retrieving details of an event.Tests for CLogClient::GetEventL() function 
  1091 @SYMTestPriority 	    High
  1092 @SYMTestActions  	    Tests for getting event details of UID 0.Check for memory errors and error in the environment
  1093                         Tests for the integrity of the information
  1094 @SYMTestExpectedResults Test must not fail
  1095 @SYMREQ                 REQ0000
  1096 */
  1097 LOCAL_C void TestGetEvent3L()
  1098 	{
  1099 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0899 "));
  1100 	
  1101 	CLogClient* client = CLogClient::NewL(theFs);
  1102 	CleanupStack::PushL(client);
  1103 	
  1104 	CTestActive* active = new(ELeave)CTestActive();
  1105 	CleanupStack::PushL(active);
  1106 
  1107 	CLogEvent* event = CLogEvent::NewL();
  1108 	CleanupStack::PushL(event);
  1109 
  1110 	event->SetId(0);
  1111 
  1112 	TInt failCount = 0;
  1113 	TBool finished = EFalse;
  1114 
  1115 	while(!finished)
  1116 		{
  1117 		__LOGSERV_UHEAP_FAILNEXT(++failCount);
  1118 		client->GetEvent(*event, active->iStatus);
  1119 
  1120 		active->StartL();
  1121 		CActiveScheduler::Start();
  1122 
  1123 		if (active->iStatus == KErrNone)
  1124 			finished = ETrue;
  1125 		else
  1126 			TEST2(active->iStatus.Int(), KErrNoMemory);
  1127 
  1128 		__LOGSERV_UHEAP_RESET;
  1129 		}
  1130 
  1131 	TEST(event->Id() == 0);
  1132 	TEST(event->Time() > TTime(0));
  1133 	TEST(event->Description() == KTestEventDesc1);
  1134 	TEST(event->EventType() == KTestEventUid);
  1135 	TEST(event->RemoteParty() == KTestRemoteParty1);
  1136 	TEST(event->Direction() == KTestDirection1);
  1137 	TEST(event->DurationType() == KTestDurationType1);
  1138 	TEST(event->Duration() == KTestDuration1);
  1139 	TEST(event->Status() == KTestStatus1);
  1140 	TEST(event->Subject() == KTestSubject1);
  1141 	TEST(event->Number() == KTestNumber1);
  1142 	TEST(event->Contact() == KTestContact1);
  1143 	TEST(event->Link() == KTestLink1);
  1144 	TEST(event->Data() == KTestData1);
  1145 
  1146 	CleanupStack::PopAndDestroy(3, client); // event, active, client
  1147     TheTest.Printf(_L("===CLogClient::GetEvent() server side OOM test succeeded at iteration %d\n"), failCount);
  1148 	}
  1149 
  1150 /**
  1151 @SYMTestCaseID          SYSLIB-LOGENG-CT-0900
  1152 @SYMTestCaseDesc	    Tests for changing the log event details.
  1153                         Tests for CLogClient::ChangeEvent() function
  1154 @SYMTestPriority 	    High
  1155 @SYMTestActions  	    Tests for changing the event details.Check for memory errors and error in the environment
  1156                         If no memory error,get the event details and check for the integrity.
  1157 @SYMTestExpectedResults Test must not fail
  1158 @SYMREQ                 REQ0000
  1159 */
  1160 LOCAL_C void TestChangeEvent3L()
  1161 	{
  1162 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0900 "));
  1163 	
  1164 	CLogClient* client = CLogClient::NewL(theFs);
  1165 	CleanupStack::PushL(client);
  1166 	
  1167 	CTestActive* active = new(ELeave)CTestActive();
  1168 	CleanupStack::PushL(active);
  1169 
  1170 	CLogEvent* event = CLogEvent::NewL();
  1171 	CleanupStack::PushL(event);
  1172 
  1173 	TTime now;
  1174 	now.UniversalTime();
  1175 
  1176 	TInt failCount = 0;
  1177 	TBool finished = EFalse;
  1178 	TInt error;
  1179 
  1180 	while(!finished)
  1181 		{
  1182 		error = KErrNone;
  1183 
  1184 		event->SetId(0);
  1185 		event->SetTime(now);
  1186 		event->SetRemoteParty(KTestRemoteParty2);
  1187 		event->SetDirection(KTestDirection2);
  1188 		event->SetDurationType(KTestDurationType2);
  1189 		event->SetDuration(KTestDuration2);
  1190 		event->SetStatus(KTestStatus2);
  1191 		event->SetSubject(KTestSubject2);
  1192 		event->SetNumber(KTestNumber2);
  1193 		event->SetContact(KTestContact2);
  1194 		event->SetLink(KTestLink2);
  1195 		event->SetDataL(KTestData2);
  1196 
  1197 		__LOGSERV_UHEAP_FAILNEXT(++failCount);
  1198 		client->ChangeEvent(*event, active->iStatus);
  1199 
  1200 		active->StartL();
  1201 		CActiveScheduler::Start();
  1202 		if (active->iStatus == KErrNone)
  1203 			finished = ETrue;
  1204 		else
  1205 			error = active->iStatus.Int();
  1206 
  1207 		__LOGSERV_UHEAP_RESET;
  1208 
  1209 		if (error == KErrNoMemory)
  1210 			{
  1211 			active->StartL();
  1212 			client->GetEvent(*event, active->iStatus);
  1213 			CActiveScheduler::Start();
  1214 			TEST2(active->iStatus.Int(), KErrNone);
  1215 
  1216 			TEST(event->Id() == 0);
  1217 			TEST(event->Time() > TTime(0));
  1218 			TEST(event->Description() == KTestEventDesc1);
  1219 			TEST(event->EventType() == KTestEventUid);
  1220 			TEST(event->RemoteParty() == KTestRemoteParty1);
  1221 			TEST(event->Direction() == KTestDirection1);
  1222 			TEST(event->DurationType() == KTestDurationType1);
  1223 			TEST(event->Duration() == KTestDuration1);
  1224 			TEST(event->Status() == KTestStatus1);
  1225 			TEST(event->Subject() == KTestSubject1);
  1226 			TEST(event->Number() == KTestNumber1);
  1227 			TEST(event->Contact() == KTestContact1);
  1228 			TEST(event->Link() == KTestLink1);
  1229 			TEST(event->Data() == KTestData1);
  1230 			}
  1231 		else
  1232 			TEST2(error, KErrNone);
  1233 		}
  1234 
  1235 	active->StartL();
  1236 	client->GetEvent(*event, active->iStatus);
  1237 	CActiveScheduler::Start();
  1238 	TEST2(active->iStatus.Int(), KErrNone);
  1239 
  1240 	TEST(event->Id() == 0);
  1241 	TEST(event->Time() == now);
  1242 	TEST(event->Description() == KTestEventDesc1);
  1243 	TEST(event->EventType() == KTestEventUid);
  1244 	TEST(event->RemoteParty() == KTestRemoteParty2);
  1245 	TEST(event->Direction() == KTestDirection2);
  1246 	TEST(event->DurationType() == KTestDurationType2);
  1247 	TEST(event->Duration() == KTestDuration2);
  1248 	TEST(event->Status() == KTestStatus2);
  1249 	TEST(event->Subject() == KTestSubject2);
  1250 	TEST(event->Number() == KTestNumber2);
  1251 	TEST(event->Contact() == KTestContact2);
  1252 	TEST(event->Link() == KTestLink2);
  1253 	TEST(event->Data() == KTestData2);
  1254 
  1255 	CleanupStack::PopAndDestroy(3, client); // event, active, client
  1256     TheTest.Printf(_L("===CLogClient::ChangeEvent() server side OOM test succeeded at iteration %d\n"), failCount);
  1257 	}
  1258 
  1259 /**
  1260 @SYMTestCaseID          SYSLIB-LOGENG-CT-0901
  1261 @SYMTestCaseDesc	    Tests for changing the log event details.Tests for CLogClient::ChangeEvent() function
  1262 @SYMTestPriority 	    High
  1263 @SYMTestActions  	    Tests for changing the event details.Check for memory errors and error in the environment
  1264                         If no memory error,get the event details and check for the integrity.
  1265 @SYMTestExpectedResults Test must not fail
  1266 @SYMREQ                 REQ0000
  1267 */
  1268 LOCAL_C void TestChangeEvent1L()
  1269 	{
  1270 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0901 "));
  1271 	
  1272 	CLogClient* client = CLogClient::NewL(theFs);
  1273 	CleanupStack::PushL(client);
  1274 	
  1275 	CTestActive* active = new(ELeave)CTestActive();
  1276 	CleanupStack::PushL(active);
  1277 
  1278 	CLogEvent* event = CLogEvent::NewL();
  1279 	CleanupStack::PushL(event);
  1280 
  1281 	TTime now;
  1282 	now.UniversalTime();
  1283 
  1284 	TInt failCount = 0;
  1285 	TBool finished = EFalse;
  1286 	TInt error;
  1287 
  1288 	while(!finished)
  1289 		{
  1290 		error = KErrNone;
  1291 
  1292 		event->SetId(0);
  1293 		event->SetTime(now);
  1294 		event->SetRemoteParty(KTestRemoteParty2);
  1295 		event->SetDirection(KTestDirection2);
  1296 		event->SetDurationType(KTestDurationType2);
  1297 		event->SetDuration(KTestDuration2);
  1298 		event->SetStatus(KTestStatus2);
  1299 		event->SetSubject(KTestSubject2);
  1300 		event->SetNumber(KTestNumber2);
  1301 		event->SetContact(KTestContact2);
  1302 		event->SetLink(KTestLink2);
  1303 		event->SetDataL(KTestData2);
  1304 
  1305 		__UHEAP_FAILNEXT(++failCount);
  1306 		client->ChangeEvent(*event, active->iStatus);
  1307 
  1308 		active->StartL();
  1309 		CActiveScheduler::Start();
  1310 		if (active->iStatus == KErrNone)
  1311 			finished = ETrue;
  1312 		else
  1313 			error = active->iStatus.Int();
  1314 
  1315 		__UHEAP_RESET;
  1316 
  1317 		if (error == KErrNoMemory)
  1318 			{
  1319 			active->StartL();
  1320 			client->GetEvent(*event, active->iStatus);
  1321 			CActiveScheduler::Start();
  1322 			TEST2(active->iStatus.Int(), KErrNone);
  1323 
  1324 			TEST(event->Id() == 0);
  1325 			TEST(event->Time() > TTime(0));
  1326 			TEST(event->Description() == KTestEventDesc1);
  1327 			TEST(event->EventType() == KTestEventUid);
  1328 			TEST(event->RemoteParty() == KTestRemoteParty1);
  1329 			TEST(event->Direction() == KTestDirection1);
  1330 			TEST(event->DurationType() == KTestDurationType1);
  1331 			TEST(event->Duration() == KTestDuration1);
  1332 			TEST(event->Status() == KTestStatus1);
  1333 			TEST(event->Subject() == KTestSubject1);
  1334 			TEST(event->Number() == KTestNumber1);
  1335 			TEST(event->Contact() == KTestContact1);
  1336 			TEST(event->Link() == KTestLink1);
  1337 			TEST(event->Data() == KTestData1);
  1338 			}
  1339 		else
  1340 			TEST2(error, KErrNone);
  1341 		}
  1342 
  1343 	active->StartL();
  1344 	client->GetEvent(*event, active->iStatus);
  1345 	CActiveScheduler::Start();
  1346 	TEST2(active->iStatus.Int(), KErrNone);
  1347 
  1348 	TEST(event->Id() == 0);
  1349 	TEST(event->Time() == now);
  1350 	TEST(event->Description() == KTestEventDesc1);
  1351 	TEST(event->EventType() == KTestEventUid);
  1352 	TEST(event->RemoteParty() == KTestRemoteParty2);
  1353 	TEST(event->Direction() == KTestDirection2);
  1354 	TEST(event->DurationType() == KTestDurationType2);
  1355 	TEST(event->Duration() == KTestDuration2);
  1356 	TEST(event->Status() == KTestStatus2);
  1357 	TEST(event->Subject() == KTestSubject2);
  1358 	TEST(event->Number() == KTestNumber2);
  1359 	TEST(event->Contact() == KTestContact2);
  1360 	TEST(event->Link() == KTestLink2);
  1361 	TEST(event->Data() == KTestData2);
  1362 
  1363 	CleanupStack::PopAndDestroy(3, client); // event, active, client
  1364     TheTest.Printf(_L("===CLogClient::ChangeEvent() client side OOM test succeeded at iteration %d\n"), failCount);
  1365 	}
  1366 
  1367 /**
  1368 @SYMTestCaseID          SYSLIB-LOGENG-CT-0902
  1369 @SYMTestCaseDesc	    Tests for deleting an event from the main event log.Tests for CLogClient::DeleteEvent() function
  1370 @SYMTestPriority 	    High
  1371 @SYMTestActions  	    Tests for deleting an event with unique ID of 0,check for any memory errors
  1372                         Try to get the deleted event and test for not found error.
  1373 @SYMTestExpectedResults Test must not fail
  1374 @SYMREQ                 REQ0000
  1375 */
  1376 LOCAL_C void TestDeleteEvent1L()
  1377 	{
  1378 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0902 "));
  1379 	
  1380 	CLogClient* client = CLogClient::NewL(theFs);
  1381 	CleanupStack::PushL(client);
  1382 	
  1383 	CTestActive* active = new(ELeave)CTestActive();
  1384 	CleanupStack::PushL(active);
  1385 
  1386 	CLogEvent* event = CLogEvent::NewL();
  1387 	CleanupStack::PushL(event);
  1388 
  1389 	event->SetId(0);
  1390 
  1391 	TInt failCount = 0;
  1392 	TBool finished = EFalse;
  1393 	TInt error;
  1394 
  1395 	while(!finished)
  1396 		{
  1397 		error = KErrNone;
  1398 
  1399 		__UHEAP_FAILNEXT(++failCount);
  1400 		client->DeleteEvent(0, active->iStatus);
  1401 
  1402 		if (error == KErrNone)
  1403 			{
  1404 			active->StartL();
  1405 			CActiveScheduler::Start();
  1406 
  1407 			if (active->iStatus == KErrNone)
  1408 				finished = ETrue;
  1409 			else
  1410 				error = active->iStatus.Int();
  1411 			}
  1412 
  1413 		__UHEAP_RESET;
  1414 
  1415 		if (error == KErrNoMemory)
  1416 			{
  1417 			active->StartL();
  1418 			client->GetEvent(*event, active->iStatus);
  1419 			CActiveScheduler::Start();
  1420 			TEST2(active->iStatus.Int(), KErrNone);
  1421 			}
  1422 		else
  1423 			TEST2(error, KErrNone);
  1424 		}
  1425 
  1426 	active->StartL();
  1427 	client->GetEvent(*event, active->iStatus);
  1428 	CActiveScheduler::Start();
  1429 	TEST2(active->iStatus.Int(), KErrNotFound);
  1430 
  1431 	CleanupStack::PopAndDestroy(3); // event, active, client
  1432     TheTest.Printf(_L("===CLogClient::DeleteEvent() client side OOM test succeeded at iteration %d\n"), failCount);
  1433 	}
  1434 
  1435 /**
  1436 @SYMTestCaseID          SYSLIB-LOGENG-CT-0903
  1437 @SYMTestCaseDesc	    Tests for deleting an event from the main event log
  1438 @SYMTestPriority 	    High
  1439 @SYMTestActions  	    Tests for deleting an event with unique ID of 0,check for any memory errors
  1440                         Try to get the deleted event and test for not found error.
  1441 @SYMTestExpectedResults Test must not fail
  1442 @SYMREQ                 REQ0000
  1443 */
  1444 LOCAL_C void TestDeleteEvent3L()
  1445 	{
  1446 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0903 "));
  1447 	
  1448 	CLogClient* client = CLogClient::NewL(theFs);
  1449 	CleanupStack::PushL(client);
  1450 	
  1451 	CTestActive* active = new(ELeave)CTestActive();
  1452 	CleanupStack::PushL(active);
  1453 
  1454 	CLogEvent* event = CLogEvent::NewL();
  1455 	CleanupStack::PushL(event);
  1456 
  1457 	event->SetId(0);
  1458 
  1459 	TInt failCount = 0;
  1460 	TBool finished = EFalse;
  1461 	TInt error;
  1462 
  1463 	while(!finished)
  1464 		{
  1465 		error = KErrNone;
  1466 
  1467 		__LOGSERV_UHEAP_FAILNEXT(++failCount);
  1468 		client->DeleteEvent(0, active->iStatus);
  1469 
  1470 		if (error == KErrNone)
  1471 			{
  1472 			active->StartL();
  1473 			CActiveScheduler::Start();
  1474 
  1475 			if (active->iStatus == KErrNone)
  1476 				finished = ETrue;
  1477 			else
  1478 				error = active->iStatus.Int();
  1479 			}
  1480 
  1481 		__LOGSERV_UHEAP_RESET;
  1482 
  1483 		if (error == KErrNoMemory)
  1484 			{
  1485 			active->StartL();
  1486 			client->GetEvent(*event, active->iStatus);
  1487 			CActiveScheduler::Start();
  1488 			TEST2(active->iStatus.Int(), KErrNone);
  1489 			}
  1490 		else
  1491 			TEST2(error, KErrNone);
  1492 		}
  1493 
  1494 	active->StartL();
  1495 	client->GetEvent(*event, active->iStatus);
  1496 	CActiveScheduler::Start();
  1497 	TEST2(active->iStatus.Int(), KErrNotFound);
  1498 
  1499 	CleanupStack::PopAndDestroy(3, client); // event, active, client
  1500     TheTest.Printf(_L("===CLogClient::DeleteEvent() server side OOM test succeeded at iteration %d\n"), failCount);
  1501 	}
  1502 
  1503 /**
  1504 @SYMTestCaseID          SYSLIB-LOGENG-CT-0904
  1505 @SYMTestCaseDesc	    Tests for CLogClient::GetConfig() function
  1506 @SYMTestPriority 	    High
  1507 @SYMTestActions  	    Set the configuration data with zero values.
  1508                         Get the log engine configuration data,check for any memory errors.
  1509 						Tests for the integrity of the data
  1510 @SYMTestExpectedResults Test must not fail
  1511 @SYMREQ                 REQ0000
  1512 */
  1513 LOCAL_C void TestGetConfig1L()
  1514 	{
  1515 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0904 "));
  1516 	
  1517 	CLogClient* client = CLogClient::NewL(theFs);
  1518 	CleanupStack::PushL(client);
  1519 	
  1520 	CTestActive* active = new(ELeave)CTestActive();
  1521 	CleanupStack::PushL(active);
  1522 
  1523 	TLogConfig config;
  1524 
  1525 	TEST(config.iMaxEventAge == 0);
  1526 	TEST(config.iMaxLogSize == 0);
  1527 	TEST(config.iMaxRecentLogSize == 0);
  1528 
  1529 	TInt failCount = 0;
  1530 	TBool finished = EFalse;
  1531 
  1532 	while(!finished)
  1533 		{
  1534 		__UHEAP_FAILNEXT(++failCount);
  1535 		client->GetConfig(config, active->iStatus);
  1536 
  1537 		active->StartL();
  1538 		CActiveScheduler::Start();
  1539 
  1540 		if (active->iStatus == KErrNone)
  1541 			finished = ETrue;
  1542 		else
  1543 			TEST2(active->iStatus.Int(), KErrNoMemory);
  1544 
  1545 		__UHEAP_RESET;
  1546 		}
  1547 
  1548 	TEST(config.iMaxEventAge > 0);
  1549 	TEST(config.iMaxLogSize > 0);
  1550 	TEST(config.iMaxRecentLogSize > 0);
  1551 
  1552 	CleanupStack::PopAndDestroy(2, client); // active, client
  1553     TheTest.Printf(_L("===CLogClient::GetConfig() client side OOM test succeeded at iteration %d\n"), failCount);
  1554 	}
  1555 
  1556 /**
  1557 @SYMTestCaseID          SYSLIB-LOGENG-CT-0905
  1558 @SYMTestCaseDesc	    Tests for CLogClient::GetConfig() function
  1559 @SYMTestPriority 	    High
  1560 @SYMTestActions  	    Set the configuration data with zero values.
  1561                         Get the log engine configuration data,check for any memory errors.
  1562 						Tests for the integrity of the data
  1563 @SYMTestExpectedResults Test must not fail
  1564 @SYMREQ                 REQ0000
  1565 */
  1566 LOCAL_C void TestGetConfig3L()
  1567 	{
  1568 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0905 "));
  1569 	
  1570 	CLogClient* client = CLogClient::NewL(theFs);
  1571 	CleanupStack::PushL(client);
  1572 	
  1573 	CTestActive* active = new(ELeave)CTestActive();
  1574 	CleanupStack::PushL(active);
  1575 
  1576 	TLogConfig config;
  1577 
  1578 	TEST(config.iMaxEventAge == 0);
  1579 	TEST(config.iMaxLogSize == 0);
  1580 	TEST(config.iMaxRecentLogSize == 0);
  1581 
  1582 	TInt failCount = 0;
  1583 	TBool finished = EFalse;
  1584 
  1585 	while(!finished)
  1586 		{
  1587 		__LOGSERV_UHEAP_FAILNEXT(++failCount);
  1588 		client->GetConfig(config, active->iStatus);
  1589 
  1590 		active->StartL();
  1591 		CActiveScheduler::Start();
  1592 
  1593 		if (active->iStatus == KErrNone)
  1594 			finished = ETrue;
  1595 		else
  1596 			TEST2(active->iStatus.Int(), KErrNoMemory);
  1597 
  1598 		__LOGSERV_UHEAP_RESET;
  1599 		}
  1600 
  1601 	TEST(config.iMaxEventAge > 0);
  1602 	TEST(config.iMaxLogSize > 0);
  1603 	TEST(config.iMaxRecentLogSize > 0);
  1604 
  1605 	CleanupStack::PopAndDestroy(2, client); // active, client
  1606     TheTest.Printf(_L("===CLogClient::GetConfig() server side OOM test succeeded at iteration %d\n"), failCount);
  1607 	}
  1608 
  1609 /**
  1610 @SYMTestCaseID          SYSLIB-LOGENG-CT-0906
  1611 @SYMTestCaseDesc	    Tests for CLogClient::ChangeConfig() function
  1612 @SYMTestPriority 	    High
  1613 @SYMTestActions  	    Get the configuration data and store in temporary object.
  1614                         Set the new configuration data and change the log engine configuration,check for no memory error
  1615                         If no memory error,get the configuration data and test for the new changes of the data with the old data.
  1616 @SYMTestExpectedResults Test must not fail
  1617 @SYMREQ                 REQ0000
  1618 */
  1619 LOCAL_C void TestChangeConfig1L()
  1620 	{
  1621 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0906 "));
  1622 	
  1623 	CLogClient* client = CLogClient::NewL(theFs);
  1624 	CleanupStack::PushL(client);
  1625 	
  1626 	CTestActive* active = new(ELeave)CTestActive();
  1627 	CleanupStack::PushL(active);
  1628 
  1629 	TLogConfig configOld;
  1630 
  1631 	active->StartL();
  1632 	client->GetConfig(configOld, active->iStatus);
  1633 	CActiveScheduler::Start();
  1634 	TEST2(active->iStatus.Int(), KErrNone);
  1635 
  1636 	TLogConfig config;
  1637 
  1638 	TInt failCount = 0;
  1639 	TBool finished = EFalse;
  1640 	TInt error;
  1641 
  1642 	while(!finished)
  1643 		{
  1644 		error = KErrNone;
  1645 
  1646 		config.iMaxLogSize = KTestMaxLogSize;
  1647 		config.iMaxRecentLogSize = KTestMaxRecentLogSize;
  1648 		config.iMaxEventAge = KTestMaxEventAge;
  1649 
  1650 		__UHEAP_FAILNEXT(++failCount);
  1651 		client->ChangeConfig(config, active->iStatus);
  1652 
  1653 		active->StartL();
  1654 		CActiveScheduler::Start();
  1655 
  1656 		if (active->iStatus == KErrNone)
  1657 			finished = ETrue;
  1658 		else
  1659 			error = active->iStatus.Int();
  1660 		
  1661 		__UHEAP_RESET;
  1662 
  1663 		if (error == KErrNoMemory)
  1664 			{
  1665 			active->StartL();
  1666 			client->GetConfig(config, active->iStatus);
  1667 			CActiveScheduler::Start();
  1668 			TEST2(active->iStatus.Int(), KErrNone);
  1669 
  1670 			TEST(config.iMaxLogSize == configOld.iMaxLogSize);
  1671 			TEST(config.iMaxRecentLogSize == configOld.iMaxRecentLogSize);
  1672 			TEST(config.iMaxEventAge == configOld.iMaxEventAge);
  1673 			}
  1674 		else
  1675 			TEST2(error, KErrNone);		
  1676 		}
  1677 
  1678 	TEST(config.iMaxLogSize == KTestMaxLogSize);
  1679 	TEST(config.iMaxRecentLogSize == KTestMaxRecentLogSize);
  1680 	TEST(config.iMaxEventAge == KTestMaxEventAge);
  1681 
  1682 	CleanupStack::PopAndDestroy(2, client); // active, client
  1683     TheTest.Printf(_L("===CLogClient::ChangeConfig() client side OOM test succeeded at iteration %d\n"), failCount);
  1684 	}
  1685 
  1686 /**
  1687 @SYMTestCaseID          SYSLIB-LOGENG-CT-0907
  1688 @SYMTestCaseDesc	    Tests for CLogClient::ChangeConfig() function
  1689 @SYMTestPriority 	    High
  1690 @SYMTestActions  	    Get the configuration data and store in temporary object.
  1691                         Set the new configuration data and change the log engine configuration,check for no memory error
  1692                         If no memory error,get the configuration data and test for the new changes of the data with the old data.
  1693 @SYMTestExpectedResults Test must not fail
  1694 @SYMREQ                 REQ0000
  1695 */
  1696 LOCAL_C void TestChangeConfig3L()
  1697 	{
  1698 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0907 "));
  1699 	
  1700 	CLogClient* client = CLogClient::NewL(theFs);
  1701 	CleanupStack::PushL(client);
  1702 	
  1703 	CTestActive* active = new(ELeave)CTestActive();
  1704 	CleanupStack::PushL(active);
  1705 
  1706 	TLogConfig configOld;
  1707 
  1708 	active->StartL();
  1709 	client->GetConfig(configOld, active->iStatus);
  1710 	CActiveScheduler::Start();
  1711 	TEST2(active->iStatus.Int(), KErrNone);
  1712 
  1713 	TLogConfig config;
  1714 
  1715 	TInt failCount = 0;
  1716 	TBool finished = EFalse;
  1717 	TInt error;
  1718 
  1719 	while(!finished)
  1720 		{
  1721 		error = KErrNone;
  1722 
  1723 		config.iMaxLogSize = KTestMaxLogSize;
  1724 		config.iMaxRecentLogSize = KTestMaxRecentLogSize;
  1725 		config.iMaxEventAge = KTestMaxEventAge;
  1726 
  1727 		__LOGSERV_UHEAP_FAILNEXT(++failCount);
  1728 		client->ChangeConfig(config, active->iStatus);
  1729 
  1730 		active->StartL();
  1731 		CActiveScheduler::Start();
  1732 
  1733 		if (active->iStatus == KErrNone)
  1734 			finished = ETrue;
  1735 		else
  1736 			error = active->iStatus.Int();
  1737 		
  1738 		__LOGSERV_UHEAP_RESET;
  1739 
  1740 		if (error == KErrNoMemory)
  1741 			{
  1742 			active->StartL();
  1743 			client->GetConfig(config, active->iStatus);
  1744 			CActiveScheduler::Start();
  1745 			TEST2(active->iStatus.Int(), KErrNone);
  1746 
  1747 			TEST(config.iMaxLogSize == configOld.iMaxLogSize);
  1748 			TEST(config.iMaxRecentLogSize == configOld.iMaxRecentLogSize);
  1749 			TEST(config.iMaxEventAge == configOld.iMaxEventAge);
  1750 			}
  1751 		else
  1752 			TEST2(error, KErrNone);		
  1753 		}
  1754 
  1755 	TEST(config.iMaxLogSize == KTestMaxLogSize);
  1756 	TEST(config.iMaxRecentLogSize == KTestMaxRecentLogSize);
  1757 	TEST(config.iMaxEventAge == KTestMaxEventAge);
  1758 
  1759 	CleanupStack::PopAndDestroy(2, client); // active, client
  1760     TheTest.Printf(_L("===CLogClient::ChangeConfig() server side OOM test succeeded at iteration %d\n"), failCount);
  1761 	}
  1762 
  1763 /**
  1764 @SYMTestCaseID          SYSLIB-LOGENG-CT-0908
  1765 @SYMTestCaseDesc	    Tests for CLogClient::GetString() function
  1766 @SYMTestPriority 	    High
  1767 @SYMTestActions  	    Get the standard string name from the resource.
  1768                         Tests for no memory error and null string.
  1769 @SYMTestExpectedResults Test must not fail
  1770 @SYMREQ                 REQ0000
  1771 */
  1772 LOCAL_C void TestGetString1L()
  1773 	{
  1774 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0908 "));
  1775 	
  1776 	CLogClient* client = CLogClient::NewL(theFs);
  1777 	CleanupStack::PushL(client);
  1778 	
  1779 	TBuf<KLogMaxSharedStringLength> str;
  1780 	
  1781 	TInt failCount = 0;
  1782 	TBool finished = EFalse;
  1783 	TInt error;
  1784 
  1785 	while(!finished)
  1786 		{
  1787 		__UHEAP_FAILNEXT(++failCount);
  1788 
  1789 		error = client->GetString(str, R_LOG_DIR_IN);
  1790 
  1791 		__UHEAP_RESET;
  1792 
  1793 		if (error == KErrNone)
  1794 			{
  1795 			finished = ETrue;
  1796 			TEST(str.Length() > 0);
  1797 			}
  1798 		else
  1799 			{
  1800 			TEST2(error, KErrNoMemory);
  1801 			TEST(str.Length() == 0);
  1802 			}
  1803 		}
  1804 	CleanupStack::PopAndDestroy(client);
  1805     TheTest.Printf(_L("===CLogClient::GetString() client side OOM test succeeded at iteration %d\n"), failCount);
  1806 	}
  1807 
  1808 /**
  1809 @SYMTestCaseID          SYSLIB-LOGENG-CT-0909
  1810 @SYMTestCaseDesc	    Tests for CLogClient::ClearLog() function
  1811 @SYMTestPriority 	    High
  1812 @SYMTestActions  	    Add 4 events to the event log,check for no errors
  1813                         Clear the log by calling ClearLog function.
  1814 						Try for getting the before added 4 events and check for not found error.
  1815 @SYMTestExpectedResults Test must not fail
  1816 @SYMREQ                 REQ0000
  1817 */
  1818 LOCAL_C void TestClearEventLog1L(TBool aMicroSeconds)
  1819 	{
  1820 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0909 "));
  1821 	
  1822 	CLogClient* client = CLogClient::NewL(theFs);
  1823 	CleanupStack::PushL(client);
  1824 	
  1825 	TTime now;
  1826 	now.UniversalTime();
  1827 	
  1828 	TDateTime dt(now.DateTime());
  1829 	if(!aMicroSeconds)
  1830 		dt.SetMicroSecond(0);
  1831 	dt.SetYear(dt.Year() - 1);
  1832 	TTime date1(dt);
  1833 
  1834 	dt.SetYear(dt.Year() - 1);
  1835 	TTime date2(dt);
  1836 
  1837 	TTime ClearThreshold(date1);
  1838 	ClearThreshold -= TTimeIntervalSeconds(1);
  1839 	/*need to use set the clear threshold (at least 1 sec) before the date of event 1,2.
  1840 	Otherwise the test will fail if now happens to occur at 0 microseconds (e.g the  
  1841 	last 6 digit of now is 0) */
  1842 	
  1843 	CTestActive* active = new(ELeave)CTestActive();
  1844 	CleanupStack::PushL(active);
  1845 
  1846 	CLogEvent* event1 = CLogEvent::NewL();
  1847 	CleanupStack::PushL(event1);
  1848 	event1->SetEventType(KTestEventUid);
  1849 
  1850 	active->StartL();
  1851 	client->AddEvent(*event1, active->iStatus);
  1852 	CActiveScheduler::Start();
  1853 	TEST2(active->iStatus.Int(), KErrNone);
  1854 
  1855 	event1->SetTime(date1);
  1856 
  1857 	active->StartL();
  1858 	client->ChangeEvent(*event1, active->iStatus);
  1859 	CActiveScheduler::Start();
  1860 	TEST2(active->iStatus.Int(), KErrNone);
  1861 
  1862 	CLogEvent* event2 = CLogEvent::NewL();
  1863 	CleanupStack::PushL(event2);
  1864 	event2->SetEventType(KTestEventUid);
  1865 
  1866 	active->StartL();
  1867 	client->AddEvent(*event2, active->iStatus);
  1868 	CActiveScheduler::Start();
  1869 	TEST2(active->iStatus.Int(), KErrNone);
  1870 
  1871 	event2->SetTime(date1);
  1872 
  1873 	active->StartL();
  1874 	client->ChangeEvent(*event2, active->iStatus);
  1875 	CActiveScheduler::Start();
  1876 	TEST2(active->iStatus.Int(), KErrNone);
  1877 
  1878 	CLogEvent* event3 = CLogEvent::NewL();
  1879 	CleanupStack::PushL(event3);
  1880 	event3->SetEventType(KTestEventUid);
  1881 
  1882 	active->StartL();
  1883 	client->AddEvent(*event3, active->iStatus);
  1884 	CActiveScheduler::Start();
  1885 	TEST2(active->iStatus.Int(), KErrNone);
  1886 
  1887 	event3->SetTime(date2);
  1888 
  1889 	active->StartL();
  1890 	client->ChangeEvent(*event3, active->iStatus);
  1891 	CActiveScheduler::Start();
  1892 	TEST2(active->iStatus.Int(), KErrNone);
  1893 
  1894 	CLogEvent* event4 = CLogEvent::NewL();
  1895 	CleanupStack::PushL(event4);
  1896 	event4->SetEventType(KTestEventUid);
  1897 
  1898 	active->StartL();
  1899 	client->AddEvent(*event4, active->iStatus);
  1900 	CActiveScheduler::Start();
  1901 	TEST2(active->iStatus.Int(), KErrNone);
  1902 
  1903 	event4->SetTime(date2);
  1904 
  1905 	active->StartL();
  1906 	client->ChangeEvent(*event4, active->iStatus);
  1907 	CActiveScheduler::Start();
  1908 	TEST2(active->iStatus.Int(), KErrNone);
  1909 
  1910 	TInt failCount = 0;
  1911 	TBool finished = EFalse;
  1912 
  1913 	while(!finished)
  1914 		{
  1915 		__UHEAP_FAILNEXT(++failCount);
  1916 
  1917 		client->ClearLog(ClearThreshold, active->iStatus);
  1918 
  1919 		__UHEAP_RESET;
  1920 
  1921 		active->StartL();	
  1922 		CActiveScheduler::Start();
  1923 
  1924 		if (active->iStatus == KErrNone)
  1925 			finished = ETrue;
  1926 		else
  1927 			TEST2(active->iStatus.Int(), KErrNoMemory);
  1928 		}
  1929 
  1930 	active->StartL();
  1931 	client->GetEvent(*event1, active->iStatus);
  1932 	CActiveScheduler::Start();
  1933 	if (active->iStatus != KErrNone) 
  1934 	    TheTest.Printf(_L("error code:%d failcoount:%d\n"),active->iStatus.Int(),failCount);
  1935 	TEST2(active->iStatus.Int(), KErrNone);
  1936 
  1937 	active->StartL();
  1938 	client->GetEvent(*event2, active->iStatus);
  1939 	CActiveScheduler::Start();
  1940 	TEST2(active->iStatus.Int(), KErrNone);
  1941 
  1942 	active->StartL();
  1943 	client->GetEvent(*event3, active->iStatus);
  1944 	CActiveScheduler::Start();
  1945 	TEST2(active->iStatus.Int(), KErrNotFound);
  1946 
  1947 	active->StartL();
  1948 	client->GetEvent(*event4, active->iStatus);
  1949 	CActiveScheduler::Start();
  1950 	TEST2(active->iStatus.Int(), KErrNotFound);
  1951 
  1952 	active->StartL();
  1953 	client->ClearLog(now, active->iStatus);
  1954 	CActiveScheduler::Start();
  1955 	TEST2(active->iStatus.Int(), KErrNone);
  1956 
  1957 	active->StartL();
  1958 	client->GetEvent(*event1, active->iStatus);
  1959 	CActiveScheduler::Start();
  1960 	TEST2(active->iStatus.Int(), KErrNotFound);
  1961 
  1962 	active->StartL();
  1963 	client->GetEvent(*event2, active->iStatus);
  1964 	CActiveScheduler::Start();
  1965 	TEST2(active->iStatus.Int(), KErrNotFound);
  1966 
  1967 	CleanupStack::PopAndDestroy(6, client); // event4, event3, event2, event1, active, client
  1968     TheTest.Printf(_L("===CLogClient::ClearLog() client side OOM test succeeded at iteration %d\n"), failCount);
  1969 	}
  1970 
  1971 /**
  1972 @SYMTestCaseID          SYSLIB-LOGENG-CT-0910
  1973 @SYMTestCaseDesc	    Tests for CLogClient::ClearLog() function
  1974 @SYMTestPriority 	    High
  1975 @SYMTestActions  	    Add 4 events to the event log,check for no errors
  1976                         Clear the log by calling ClearLog function.
  1977 						Try for getting the before added 4 events and check for not found error.
  1978 @SYMTestExpectedResults Test must not fail
  1979 @SYMREQ                 REQ0000
  1980 */
  1981 LOCAL_C void TestClearEventLog3L(TBool aMicroSeconds)
  1982 	{
  1983 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0910 "));
  1984 	
  1985 	CLogClient* client = CLogClient::NewL(theFs);
  1986 	CleanupStack::PushL(client);
  1987 	
  1988 	TTime now;
  1989 	now.UniversalTime();
  1990 	
  1991 	TDateTime dt(now.DateTime());
  1992 	if(!aMicroSeconds)
  1993 		dt.SetMicroSecond(0);
  1994 	dt.SetYear(dt.Year() - 1);
  1995 	TTime date1(dt);
  1996 
  1997 	dt.SetYear(dt.Year() - 1);
  1998 	TTime date2(dt);
  1999 	
  2000 	TTime ClearThreshold(date1);
  2001 	ClearThreshold -= TTimeIntervalSeconds(1);
  2002 	/*need to use set the clear threshold (at least 1 sec) before the date of event 1,2.
  2003 	Otherwise the test will fail if now happens to occur at 0 microseconds (e.g the  
  2004 	last 6 digit of now is 0) */
  2005 	
  2006 	
  2007 	CTestActive* active = new(ELeave)CTestActive();
  2008 	CleanupStack::PushL(active);
  2009 
  2010 	CLogEvent* event1 = CLogEvent::NewL();
  2011 	CleanupStack::PushL(event1);
  2012 	event1->SetEventType(KTestEventUid);
  2013 
  2014 	active->StartL();
  2015 	client->AddEvent(*event1, active->iStatus);
  2016 	CActiveScheduler::Start();
  2017 	TEST2(active->iStatus.Int(), KErrNone);
  2018 
  2019 	event1->SetTime(date1);
  2020 
  2021 	active->StartL();
  2022 	client->ChangeEvent(*event1, active->iStatus);
  2023 	CActiveScheduler::Start();
  2024 	TEST2(active->iStatus.Int(), KErrNone);
  2025 
  2026 	CLogEvent* event2 = CLogEvent::NewL();
  2027 	CleanupStack::PushL(event2);
  2028 	event2->SetEventType(KTestEventUid);
  2029 
  2030 	active->StartL();
  2031 	client->AddEvent(*event2, active->iStatus);
  2032 	CActiveScheduler::Start();
  2033 	TEST2(active->iStatus.Int(), KErrNone);
  2034 
  2035 	event2->SetTime(date1);
  2036 
  2037 	active->StartL();
  2038 	client->ChangeEvent(*event2, active->iStatus);
  2039 	CActiveScheduler::Start();
  2040 	TEST2(active->iStatus.Int(), KErrNone);
  2041 
  2042 	CLogEvent* event3 = CLogEvent::NewL();
  2043 	CleanupStack::PushL(event3);
  2044 	event3->SetEventType(KTestEventUid);
  2045 
  2046 	active->StartL();
  2047 	client->AddEvent(*event3, active->iStatus);
  2048 	CActiveScheduler::Start();
  2049 	TEST2(active->iStatus.Int(), KErrNone);
  2050 
  2051 	event3->SetTime(date2);
  2052 
  2053 	active->StartL();
  2054 	client->ChangeEvent(*event3, active->iStatus);
  2055 	CActiveScheduler::Start();
  2056 	TEST2(active->iStatus.Int(), KErrNone);
  2057 
  2058 	CLogEvent* event4 = CLogEvent::NewL();
  2059 	CleanupStack::PushL(event4);
  2060 	event4->SetEventType(KTestEventUid);
  2061 
  2062 	active->StartL();
  2063 	client->AddEvent(*event4, active->iStatus);
  2064 	CActiveScheduler::Start();
  2065 	TEST2(active->iStatus.Int(), KErrNone);
  2066 
  2067 	event4->SetTime(date2);
  2068 
  2069 	active->StartL();
  2070 	client->ChangeEvent(*event4, active->iStatus);
  2071 	CActiveScheduler::Start();
  2072 	TEST2(active->iStatus.Int(), KErrNone);
  2073 
  2074 	TInt failCount = 0;
  2075 	TBool finished = EFalse;
  2076 
  2077 	while(!finished)
  2078 		{
  2079 		__LOGSERV_UHEAP_FAILNEXT(++failCount);
  2080 
  2081 		client->ClearLog(ClearThreshold, active->iStatus);
  2082 
  2083 		__LOGSERV_UHEAP_RESET;
  2084 
  2085 		active->StartL();	
  2086 		CActiveScheduler::Start();
  2087 
  2088 		if (active->iStatus == KErrNone)
  2089 			finished = ETrue;
  2090 		else
  2091 			TEST2(active->iStatus.Int(), KErrNoMemory);
  2092 		}
  2093 
  2094 	active->StartL();
  2095 	client->GetEvent(*event1, active->iStatus);
  2096 	CActiveScheduler::Start();
  2097 	TEST2(active->iStatus.Int(), KErrNone);
  2098 
  2099 	active->StartL();
  2100 	client->GetEvent(*event2, active->iStatus);
  2101 	CActiveScheduler::Start();
  2102 	TEST2(active->iStatus.Int(), KErrNone);
  2103 
  2104 	active->StartL();
  2105 	client->GetEvent(*event3, active->iStatus);
  2106 	CActiveScheduler::Start();
  2107 	TEST2(active->iStatus.Int(), KErrNotFound);
  2108 
  2109 	active->StartL();
  2110 	client->GetEvent(*event4, active->iStatus);
  2111 	CActiveScheduler::Start();
  2112 	TEST2(active->iStatus.Int(), KErrNotFound);
  2113 
  2114 	active->StartL();
  2115 	client->ClearLog(now, active->iStatus);
  2116 	CActiveScheduler::Start();
  2117 	TEST2(active->iStatus.Int(), KErrNone);
  2118 
  2119 	active->StartL();
  2120 	client->GetEvent(*event1, active->iStatus);
  2121 	CActiveScheduler::Start();
  2122 	TEST2(active->iStatus.Int(), KErrNotFound);
  2123 
  2124 	active->StartL();
  2125 	client->GetEvent(*event2, active->iStatus);
  2126 	CActiveScheduler::Start();
  2127 	TEST2(active->iStatus.Int(), KErrNotFound);
  2128 
  2129 	CleanupStack::PopAndDestroy(6, client); // event4, event3, event2, event1, active, client
  2130     TheTest.Printf(_L("===CLogClient::ClearLog() server side OOM test succeeded at iteration %d\n"), failCount);
  2131 	}
  2132 	
  2133 	/**
  2134 @SYMTestCaseID          SYSLIB-LOGENG-CT-1910
  2135 @SYMTestCaseDesc	    Tests for CLogClient::ClearLog() under boundary conditions
  2136 @SYMTestPriority 	    High
  2137 @SYMTestActions  	    Add 4 events to the event log,check for no errors
  2138                         Clear the log by calling ClearLog function. 
  2139                         However using the date for 2 events the same as the clear date threshold.
  2140 						Try for getting the before added 4 events and check for not found error.
  2141 @SYMTestExpectedResults Test must not fail
  2142 @SYMDEF                 DEF093601
  2143 */
  2144 LOCAL_C void TestDEF093601L(TBool aClientTest)
  2145 	{
  2146 	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1910 "));
  2147 	if(aClientTest)
  2148 		TestClearEventLog3L(EFalse);
  2149 	else
  2150 		TestClearEventLog1L(EFalse);
  2151 	}
  2152 
  2153 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
  2154 
  2155 /**
  2156 @SYMTestCaseID			PDS-LOGENG-UT-4038
  2157 @SYMTestCaseDesc		Clear log events with specific SimId - client/server side OOM test.
  2158 						The test adds 2 events, one of them with a SimId. Then the test
  2159 						executes CLogClient::ClearLog() in an OOM loop.
  2160 @SYMTestActions			Clear log events with specific SimId - client/server side OOM test.
  2161 @SYMTestExpectedResults Test must not fail
  2162 @SYMTestPriority		Medium
  2163 @SYMREQ					REQ12748
  2164 */
  2165 void ClearLogSimIdOomTestL(TBool aServerSideOomTest)
  2166 	{//This test case is compiled only when SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM macro is defined
  2167 	CLogClient* client = CLogClient::NewL(theFs);
  2168 	CleanupStack::PushL(client);
  2169 	
  2170 	const TSimId KSimId = 4100000000U;
  2171 	TTime now;
  2172 	now.UniversalTime();
  2173 	
  2174 	TDateTime dt(now.DateTime());
  2175 	dt.SetYear(dt.Year() - 1);
  2176 	TTime date(dt);
  2177 	
  2178 	TTime threshold(date);
  2179 	threshold += TTimeIntervalSeconds(10);
  2180 	
  2181 	CTestActive* active = new(ELeave)CTestActive();
  2182 	CleanupStack::PushL(active);
  2183 	
  2184 	//////// Event1 ///////////////////////////
  2185 	CLogEvent* event1 = CLogEvent::NewL();
  2186 	CleanupStack::PushL(event1);
  2187 	event1->SetEventType(KTestEventUid);
  2188 
  2189 	active->StartL();
  2190 	client->AddEvent(*event1, active->iStatus);
  2191 	CActiveScheduler::Start();
  2192 	TEST2(active->iStatus.Int(), KErrNone);
  2193 
  2194 	event1->SetTime(date);
  2195 
  2196 	active->StartL();
  2197 	client->ChangeEvent(*event1, active->iStatus);
  2198 	CActiveScheduler::Start();
  2199 	TEST2(active->iStatus.Int(), KErrNone);
  2200 
  2201 	//////// Event2 ///////////////////////////
  2202 	CLogEvent* event2 = CLogEvent::NewL();
  2203 	CleanupStack::PushL(event2);
  2204 	event2->SetEventType(KTestEventUid);
  2205 
  2206 	active->StartL();
  2207 	client->AddEvent(*event2, active->iStatus);
  2208 	CActiveScheduler::Start();
  2209 	TEST2(active->iStatus.Int(), KErrNone);
  2210 
  2211 	event2->SetTime(date);
  2212 	event2->SetSimId(KSimId);
  2213 
  2214 	active->StartL();
  2215 	client->ChangeEvent(*event2, active->iStatus);
  2216 	CActiveScheduler::Start();
  2217 	TEST2(active->iStatus.Int(), KErrNone);
  2218 	////////////////////////////////////////////
  2219 	
  2220 	TInt failCount = 0;
  2221 	TBool finished = EFalse;
  2222 
  2223 	while(!finished)
  2224 		{
  2225 		if(aServerSideOomTest)
  2226 			{
  2227 			__LOGSERV_UHEAP_FAILNEXT(++failCount);
  2228 			}
  2229 		else
  2230 			{
  2231 			__UHEAP_FAILNEXT(++failCount);
  2232 			}
  2233 
  2234 		client->ClearLog(threshold, KSimId, active->iStatus);
  2235 
  2236 		if(aServerSideOomTest)
  2237 			{
  2238 			__LOGSERV_UHEAP_RESET;
  2239 			}
  2240 		else
  2241 			{
  2242 			__UHEAP_RESET;
  2243 			}
  2244 
  2245 		active->StartL();	
  2246 		CActiveScheduler::Start();
  2247 
  2248 		if (active->iStatus == KErrNone)
  2249 			finished = ETrue;
  2250 		else
  2251 			TEST2(active->iStatus.Int(), KErrNoMemory);
  2252 		}
  2253 
  2254 	//Check: event1 is without SimId and must not be deleted. event2 is with SimId and should be deleted. 
  2255 	active->StartL();
  2256 	client->GetEvent(*event1, active->iStatus);
  2257 	CActiveScheduler::Start();
  2258 	TEST2(active->iStatus.Int(), KErrNone);
  2259 
  2260 	active->StartL();
  2261 	client->GetEvent(*event2, active->iStatus);
  2262 	CActiveScheduler::Start();
  2263 	TEST2(active->iStatus.Int(), KErrNotFound);
  2264 
  2265 	//Delete all events
  2266 	active->StartL();
  2267 	client->ClearLog(now, active->iStatus);
  2268 	CActiveScheduler::Start();
  2269 	TEST2(active->iStatus.Int(), KErrNone);
  2270 	
  2271 	active->StartL();
  2272 	client->GetEvent(*event1, active->iStatus);
  2273 	CActiveScheduler::Start();
  2274 	TEST2(active->iStatus.Int(), KErrNotFound);
  2275 
  2276 	active->StartL();
  2277 	client->GetEvent(*event2, active->iStatus);
  2278 	CActiveScheduler::Start();
  2279 	TEST2(active->iStatus.Int(), KErrNotFound);	
  2280 	
  2281 	CleanupStack::PopAndDestroy(4, client); //event2, event1, active, client
  2282     TheTest.Printf(_L("===CLogClient::ClearLog() + SimId %S OOM test succeeded at iteration %d\n"), aServerSideOomTest ? &KServerSide : &KClientSide, failCount);
  2283 	}
  2284 
  2285 /**
  2286 @SYMTestCaseID			PDS-LOGENG-UT-4039
  2287 @SYMTestCaseDesc		Clear log events with specific SimId and recent list- client/server side OOM test.
  2288 						The test adds 2 events to a recent list, one of them with a SimId. Then the test
  2289 						executes CLogClient::ClearLog() in an OOM loop.
  2290 @SYMTestActions			Clear log events with specific SimId and recent list- client/server side OOM test.
  2291 @SYMTestExpectedResults Test must not fail
  2292 @SYMTestPriority		Medium
  2293 @SYMREQ					REQ12748
  2294 */
  2295 void ClearLogRecentSimIdOomTestL(TBool aServerSideOomTest)
  2296 	{//This test case is compiled only when SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM macro is defined
  2297 	CLogClient* client = CLogClient::NewL(theFs);
  2298 	CleanupStack::PushL(client);
  2299 	
  2300 	const TSimId KSimId = 4200000000U;
  2301 	const TUid KEvTypeUid = {KLogCallEventType};
  2302 	_LIT(KEvDirection, "Missed call");
  2303 	
  2304 	CTestActive* active = new(ELeave)CTestActive();
  2305 	CleanupStack::PushL(active);
  2306 	
  2307 	//////// Event1 ///////////////////////////
  2308 	CLogEvent* event1 = CLogEvent::NewL();
  2309 	CleanupStack::PushL(event1);
  2310 	event1->SetEventType(KEvTypeUid);
  2311 	event1->SetDirection(KEvDirection);
  2312 	event1->SetNumber(_L("12345678"));
  2313 
  2314 	active->StartL();
  2315 	client->AddEvent(*event1, active->iStatus);
  2316 	CActiveScheduler::Start();
  2317 	TEST2(active->iStatus.Int(), KErrNone);
  2318 	//////// Event2 ///////////////////////////
  2319 	CLogEvent* event2 = CLogEvent::NewL();
  2320 	CleanupStack::PushL(event2);
  2321 	event2->SetEventType(KEvTypeUid);
  2322 	event2->SetDirection(KEvDirection);
  2323 	event2->SetNumber(_L("87654321"));
  2324 	event2->SetSimId(KSimId);
  2325 
  2326 	active->StartL();
  2327 	client->AddEvent(*event2, active->iStatus);
  2328 	CActiveScheduler::Start();
  2329 	TEST2(active->iStatus.Int(), KErrNone);
  2330 	////////////////////////////////////////////
  2331 	
  2332 	TInt failCount = 0;
  2333 	TBool finished = EFalse;
  2334 
  2335 	while(!finished)
  2336 		{
  2337 		if(aServerSideOomTest)
  2338 			{
  2339 			__LOGSERV_UHEAP_FAILNEXT(++failCount);
  2340 			}
  2341 		else
  2342 			{
  2343 			__UHEAP_FAILNEXT(++failCount);
  2344 			}
  2345 
  2346 		client->ClearLog(KLogRecentMissedCalls, KSimId, active->iStatus);
  2347 
  2348 		if(aServerSideOomTest)
  2349 			{
  2350 			__LOGSERV_UHEAP_RESET;
  2351 			}
  2352 		else
  2353 			{
  2354 			__UHEAP_RESET;
  2355 			}
  2356 
  2357 		active->StartL();	
  2358 		CActiveScheduler::Start();
  2359 
  2360 		if (active->iStatus == KErrNone)
  2361 			finished = ETrue;
  2362 		else
  2363 			TEST2(active->iStatus.Int(), KErrNoMemory);
  2364 		}
  2365 
  2366 	//Check: event1 is without SimId and must be presented in the view. Event2 is with SimId and should not be in the view.
  2367 	CLogViewRecent* view = CLogViewRecent::NewL(*client);
  2368 	CleanupStack::PushL(view);
  2369 	TBool rc = view->SetRecentListL(KLogRecentMissedCalls, active->iStatus);
  2370 	TEST(rc);
  2371 	active->StartL();
  2372 	CActiveScheduler::Start();
  2373 	TEST2(active->iStatus.Int(), KErrNone);
  2374 	
  2375 	TInt count = view->CountL();
  2376 	TEST2(count, 1);
  2377 	rc = view->FirstL(active->iStatus);
  2378 	TEST(rc);
  2379 	active->StartL();
  2380 	CActiveScheduler::Start();
  2381 	TEST2(active->iStatus.Int(), KErrNone);
  2382 	const CLogEvent& e = view->Event();
  2383 	TEST2(e.SimId(), KLogNullSimId);
  2384 	
  2385 	CleanupStack::PopAndDestroy(view);
  2386 
  2387 	//Delete all events
  2388 	active->StartL();
  2389 	client->ClearLog(KLogRecentMissedCalls, active->iStatus);
  2390 	CActiveScheduler::Start();
  2391 	TEST2(active->iStatus.Int(), KErrNone);
  2392 	
  2393 	//Check: no events in the recent view list 
  2394 	view = CLogViewRecent::NewL(*client);
  2395 	CleanupStack::PushL(view);
  2396 	rc = view->SetRecentListL(KLogRecentMissedCalls, active->iStatus);
  2397 	TEST(!rc);
  2398 	
  2399 	CleanupStack::PopAndDestroy(5, client); //view, event2, event1, active, client
  2400     TheTest.Printf(_L("===CLogClient::ClearLog()/Recent + SimId %S OOM test succeeded at iteration %d\n"), aServerSideOomTest ? &KServerSide : &KClientSide, failCount);
  2401 	}
  2402 
  2403 #endif//SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
  2404 
  2405 LOCAL_C void doClientFailureL()
  2406 	{
  2407 	TheTest.Next(_L("Server startup"));
  2408 	TestStartup1L();
  2409 	User::After(100000);
  2410 
  2411 	TheTest.Next(_L("Construction + create logeng database"));
  2412 	TestConstruction1L(ETrue); // Creates database
  2413     TheTest.Next(_L("Construction + open logeng database"));
  2414 	TestConstruction1L(EFalse); // Opens existing database
  2415 	TestUtils::DeleteDatabaseL();
  2416 	theLog.Write(_L8("Test 1.1 OK\n"));
  2417 
  2418 	TheTest.Next(_L("Add Event Type"));
  2419 	TestAddEventType1L();
  2420 	theLog.Write(_L8("Test 1.2 OK\n"));
  2421 
  2422 	TheTest.Next(_L("Get Event Type"));
  2423 	TestGetEventType1L();
  2424 	theLog.Write(_L8("Test 1.3 OK\n"));
  2425 
  2426 	TheTest.Next(_L("Change Event Type"));
  2427 	TestChangeEventType1L();
  2428 	theLog.Write(_L8("Test 1.4 OK\n"));
  2429 
  2430 	TheTest.Next(_L("Delete Event Type"));
  2431 	TestDeleteEventType1L();
  2432 	theLog.Write(_L8("Test 1.5 OK\n"));
  2433 
  2434 	TheTest.Next(_L("Add Event"));
  2435 	TestAddEvent1L();
  2436 	theLog.Write(_L8("Test 1.6 OK\n"));
  2437 
  2438 	TheTest.Next(_L("Get Event"));
  2439 	TestGetEvent1L();
  2440 	theLog.Write(_L8("Test 1.7 OK\n"));
  2441 
  2442 	TheTest.Next(_L("Change Event"));
  2443 	TestChangeEvent1L();
  2444 	theLog.Write(_L8("Test 1.8 OK\n"));
  2445 
  2446 	TheTest.Next(_L("Delete Event"));
  2447 	TestDeleteEvent1L();
  2448 	theLog.Write(_L8("Test 1.9 OK\n"));
  2449 
  2450 	TheTest.Next(_L("Get Config"));
  2451 	TestGetConfig1L();
  2452 	theLog.Write(_L8("Test 1.10 OK\n"));
  2453 
  2454 	TheTest.Next(_L("Change Config"));
  2455 	TestChangeConfig1L();
  2456 	theLog.Write(_L8("Test 1.11 OK\n"));
  2457 
  2458 	TheTest.Next(_L("Get String"));
  2459 	TestGetString1L();
  2460 	theLog.Write(_L8("Test 1.12 OK\n"));
  2461 	
  2462 	TheTest.Next(_L("Clear Event Log"));
  2463 	TestClearEventLog1L(ETrue);
  2464 	theLog.Write(_L8("Test 1.13 OK\n"));
  2465 	
  2466 	TheTest.Next(_L("DEF093601"));
  2467 	TestDEF093601L(EFalse);
  2468 	theLog.Write(_L8("Test 1.14 OK\n"));
  2469 
  2470 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
  2471 	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4038 Clear Event Log + SimId"));
  2472 	ClearLogSimIdOomTestL(EFalse);
  2473 	theLog.Write(_L8("Test 1.15 OK\n"));
  2474 	
  2475 	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4039 Clear Event Log/Recent + SimId"));
  2476 	ClearLogRecentSimIdOomTestL(EFalse);
  2477 	theLog.Write(_L8("Test 1.16 OK\n"));
  2478 #endif	
  2479 	}
  2480 
  2481 LOCAL_C void doLogServFailureL()
  2482 	{
  2483 	TheTest.Next(_L("Construction + create logeng database"));
  2484 	TestConstruction3L(ETrue); // Creates database
  2485     TheTest.Next(_L("Construction + open logeng database"));
  2486 	TestConstruction3L(EFalse); // Opens existing database
  2487 	TestUtils::DeleteDatabaseL();
  2488 	theLog.Write(_L8("Test 2.1 OK\n"));
  2489 
  2490 	TheTest.Next(_L("Add Event Type"));
  2491 	TestAddEventType3L();
  2492 	theLog.Write(_L8("Test 2.2 OK\n"));
  2493 
  2494 	TheTest.Next(_L("Get Event Type"));
  2495 	TestGetEventType3L();
  2496 	theLog.Write(_L8("Test 2.3 OK\n"));
  2497 
  2498 	TheTest.Next(_L("Change Event Type"));
  2499 	TestChangeEventType3L();
  2500 	theLog.Write(_L8("Test 2.4 OK\n"));
  2501 
  2502 	TheTest.Next(_L("Delete Event Type"));
  2503 	TestDeleteEventType3L();
  2504 	theLog.Write(_L8("Test 2.5 OK\n"));
  2505 
  2506 	TheTest.Next(_L("Add Event"));
  2507 	TestAddEvent3L();
  2508 	theLog.Write(_L8("Test 2.6 OK\n"));
  2509 
  2510 	TheTest.Next(_L("Get Event"));
  2511 	TestGetEvent3L(); 
  2512 	theLog.Write(_L8("Test 2.7 OK\n"));
  2513 
  2514 	TheTest.Next(_L("Change Event"));
  2515 	TestChangeEvent3L();
  2516 	theLog.Write(_L8("Test 2.8 OK\n"));
  2517 
  2518 	TheTest.Next(_L("Delete Event"));
  2519 	TestDeleteEvent3L();
  2520 	theLog.Write(_L8("Test 2.9 OK\n"));
  2521 
  2522 	TheTest.Next(_L("Get Config"));
  2523 	TestGetConfig3L();
  2524 	theLog.Write(_L8("Test 2.10 OK\n"));
  2525 
  2526 	TheTest.Next(_L("Change Config"));
  2527 	TestChangeConfig3L();
  2528 	theLog.Write(_L8("Test 2.11 OK\n"));
  2529 
  2530 	TheTest.Next(_L("Clear Event Log"));
  2531 	TestClearEventLog3L(ETrue);
  2532 	theLog.Write(_L8("Test 2.12 OK\n"));
  2533 	
  2534 	TheTest.Next(_L("DEF093601"));
  2535 	TestDEF093601L(ETrue);
  2536 	theLog.Write(_L8("Test 2.13 OK\n"));
  2537 	
  2538 #ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
  2539 	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4038 Clear Event Log + SimId"));
  2540 	ClearLogSimIdOomTestL(ETrue);
  2541 	theLog.Write(_L8("Test 2.14 OK\n"));
  2542 
  2543 	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4039 Clear Event Log/Recent + SimId"));
  2544 	ClearLogRecentSimIdOomTestL(ETrue);
  2545 	theLog.Write(_L8("Test 2.15 OK\n"));
  2546 #endif	
  2547 	}
  2548 
  2549 void doTestsL()
  2550 	{
  2551 	TestUtils::Initialize(_L("t_logheap"));
  2552 
  2553 	TheTest.Start(_L("Log Client"));
  2554 	doClientFailureL();
  2555 
  2556 	TheTest.Next(_L("Log Server"));
  2557 	doLogServFailureL();
  2558 	}