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