os/persistentdata/loggingservices/eventlogger/test/src/t_logplatformsecurity.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
sl@0
     2
// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
// All rights reserved.
sl@0
     4
// This component and the accompanying materials are made available
sl@0
     5
// under the terms of "Eclipse Public License v1.0"
sl@0
     6
// which accompanies this distribution, and is available
sl@0
     7
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
//
sl@0
     9
// Initial Contributors:
sl@0
    10
// Nokia Corporation - initial contribution.
sl@0
    11
//
sl@0
    12
// Contributors:
sl@0
    13
//
sl@0
    14
// Description:
sl@0
    15
//
sl@0
    16
sl@0
    17
sl@0
    18
#include <s32file.h>
sl@0
    19
#include <logcntdef.h>
sl@0
    20
#include "t_logutil2.h"
sl@0
    21
#include <logview.h>
sl@0
    22
sl@0
    23
//LOWCAP defined in t_loglowcapability.mmp file.
sl@0
    24
#ifdef LOWCAP
sl@0
    25
    TBool TheHiCapability = EFalse;
sl@0
    26
    RTest TheTest(_L("t_loglowcapability"));
sl@0
    27
    _LIT(KTestTitle, "t_loglowcapability");
sl@0
    28
#else
sl@0
    29
    TBool TheHiCapability = ETrue;
sl@0
    30
    RTest TheTest(_L("t_loghicapability"));
sl@0
    31
    _LIT(KTestTitle, "t_loghicapability");
sl@0
    32
#endif
sl@0
    33
sl@0
    34
const TUid KTestEventUid = {0x10005393};
sl@0
    35
_LIT(KTestEventDesc1, "Event Type Description");
sl@0
    36
_LIT(KTestEventDesc2, "Changed Event Description");
sl@0
    37
_LIT(KTestRemoteParty1, "Remote Party");
sl@0
    38
_LIT(KTestDirection1, "Direction");
sl@0
    39
const TLogDurationType KTestDurationType1 = 1;
sl@0
    40
const TLogDuration KTestDuration1 = 0x1234;
sl@0
    41
_LIT(KTestStatus1, "Status");
sl@0
    42
_LIT(KTestSubject1, "Subject");
sl@0
    43
_LIT(KTestNumber1, "Number");
sl@0
    44
const TLogContactItemId KTestContact1 = 0x1234;
sl@0
    45
const TLogContactItemId KTestContact2 = 0x1234567;
sl@0
    46
const TLogLink KTestLink1 = 0x1234;
sl@0
    47
_LIT8(KTestData1, "ABCDEFGH");
sl@0
    48
const TLogSize KTestMaxLogSize = 0xFFF;
sl@0
    49
const TLogRecentSize KTestMaxRecentLogSize = 0xF;
sl@0
    50
const TLogAge KTestMaxEventAge = 0xFFFFFFF;
sl@0
    51
sl@0
    52
sl@0
    53
/**
sl@0
    54
@SYMTestCaseID SYSLIB-LOGENG-CT-0118
sl@0
    55
@SYMTestCaseDesc The test aims to ensure that the log server starts in reponse 
sl@0
    56
to a client request.
sl@0
    57
@SYMTestPriority High
sl@0
    58
@SYMTestActions The test asks the server for details of a built in event type.
sl@0
    59
A successful server start-up is essential for the completion of subsequent tests.
sl@0
    60
@SYMTestExpectedResults Success. (active->iStatus == 0) Regardless of the capability 
sl@0
    61
of the process running this test, it should always succeed because the GetEventType 
sl@0
    62
is not policed by platform security.
sl@0
    63
@SYMREQ REQ3431
sl@0
    64
*/
sl@0
    65
LOCAL_C void TestStartupL()
sl@0
    66
	{
sl@0
    67
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0118 "));
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
	CLogEventType *type = CLogEventType::NewL();
sl@0
    75
	CleanupStack::PushL(type);
sl@0
    76
sl@0
    77
	type->SetUid(KLogCallEventTypeUid);
sl@0
    78
	active->StartL();
sl@0
    79
	client->GetEventType(*type, active->iStatus);
sl@0
    80
	CActiveScheduler::Start();
sl@0
    81
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
    82
		
sl@0
    83
	CleanupStack::PopAndDestroy(3); // client, active, type
sl@0
    84
	}
sl@0
    85
sl@0
    86
sl@0
    87
sl@0
    88
sl@0
    89
/**
sl@0
    90
@SYMTestCaseID SYSLIB-LOGENG-CT-0119
sl@0
    91
@SYMTestCaseDesc Tests AddEvent, GetEvent, ChangeEvent and DeleteEvent.
sl@0
    92
@SYMTestPriority High
sl@0
    93
@SYMTestActions See the description and expected results.
sl@0
    94
@SYMTestExpectedResults 
sl@0
    95
sl@0
    96
1. a client with sufficient capability succeed in all cases would expect the following...
sl@0
    97
AddEvent - KErrNone
sl@0
    98
GetEvent - KErrNone
sl@0
    99
ChangeEvent - KErrNone
sl@0
   100
DeleteEvent - KErrNone
sl@0
   101
sl@0
   102
2. a client with insufficient capability would expect the following results...
sl@0
   103
AddEvent - KErrPermissionDenied
sl@0
   104
GetEvent - KErrNone
sl@0
   105
ChangeEvent - KErrPermissionDenied
sl@0
   106
DeleteEvent - KErrPermissionDenied
sl@0
   107
sl@0
   108
@SYMREQ REQ3431
sl@0
   109
*/
sl@0
   110
LOCAL_C void TestBasicL(CLogClient& aClient)
sl@0
   111
	{
sl@0
   112
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0119 "));
sl@0
   113
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   114
	CleanupStack::PushL(active);
sl@0
   115
sl@0
   116
	CLogEvent* event = CLogEvent::NewL();
sl@0
   117
	CleanupStack::PushL(event);
sl@0
   118
	
sl@0
   119
	TTime now;
sl@0
   120
	now.UniversalTime();
sl@0
   121
sl@0
   122
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   123
sl@0
   124
	active->StartL();
sl@0
   125
	aClient.AddEvent(*event, active->iStatus);
sl@0
   126
	CActiveScheduler::Start();
sl@0
   127
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied);
sl@0
   128
sl@0
   129
	if(!TheHiCapability)
sl@0
   130
		{
sl@0
   131
		TInt eventId = TestUtils::AddEventL();
sl@0
   132
		TEST(eventId >= 0);
sl@0
   133
		event->SetId(eventId);
sl@0
   134
		}
sl@0
   135
sl@0
   136
sl@0
   137
	TEST(event->EventType() == KLogCallEventTypeUid);
sl@0
   138
sl@0
   139
	now = event->Time();
sl@0
   140
sl@0
   141
	TLogId id = event->Id();
sl@0
   142
sl@0
   143
	event->SetRemoteParty(KTestRemoteParty1);
sl@0
   144
	event->SetDirection(KTestDirection1);
sl@0
   145
	event->SetDurationType(KTestDurationType1);
sl@0
   146
	event->SetDuration(KTestDuration1);
sl@0
   147
	event->SetStatus(KTestStatus1);
sl@0
   148
	event->SetSubject(KTestSubject1);
sl@0
   149
	event->SetNumber(KTestNumber1);
sl@0
   150
	event->SetContact(KTestContact1);
sl@0
   151
	event->SetLink(KTestLink1);
sl@0
   152
	event->SetDataL(KTestData1);
sl@0
   153
sl@0
   154
	active->StartL();
sl@0
   155
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
   156
	CActiveScheduler::Start();
sl@0
   157
    TheTest.Printf(_L("TestBasicL(), TheHiCapability=%d, event id=%d\r\n"), TheHiCapability, id);
sl@0
   158
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied);
sl@0
   159
sl@0
   160
	TEST(event->Id() == id );
sl@0
   161
	TEST(event->EventType() == KLogCallEventTypeUid);
sl@0
   162
sl@0
   163
	if(TheHiCapability)
sl@0
   164
		{
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
		
sl@0
   179
	CleanupStack::PopAndDestroy(); // event;
sl@0
   180
sl@0
   181
	event = CLogEvent::NewL();
sl@0
   182
	CleanupStack::PushL(event);
sl@0
   183
sl@0
   184
	event->SetId(id);
sl@0
   185
sl@0
   186
	active->StartL();
sl@0
   187
	aClient.GetEvent(*event, active->iStatus);
sl@0
   188
	CActiveScheduler::Start();
sl@0
   189
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied);
sl@0
   190
sl@0
   191
	if(TheHiCapability)
sl@0
   192
		{
sl@0
   193
		TEST(event->Id() == id);
sl@0
   194
		TEST(event->EventType() == KLogCallEventTypeUid);
sl@0
   195
		TEST(event->Description().Length() > 0);
sl@0
   196
		TEST(event->Time() == now);
sl@0
   197
		TEST(event->RemoteParty() == KTestRemoteParty1);
sl@0
   198
		TEST(event->Direction() == KTestDirection1);
sl@0
   199
		TEST(event->DurationType() == KTestDurationType1);
sl@0
   200
		TEST(event->Duration() == KTestDuration1);
sl@0
   201
		TEST(event->Status() == KTestStatus1);
sl@0
   202
		TEST(event->Subject() == KTestSubject1);
sl@0
   203
		TEST(event->Number() == KTestNumber1);
sl@0
   204
		TEST(event->Contact() == KTestContact1);
sl@0
   205
		TEST(event->Link() == KTestLink1);
sl@0
   206
		TEST(event->Data() == KTestData1);
sl@0
   207
		}
sl@0
   208
			
sl@0
   209
	active->StartL();
sl@0
   210
	aClient.DeleteEvent(id, active->iStatus);
sl@0
   211
	CActiveScheduler::Start();
sl@0
   212
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied);
sl@0
   213
sl@0
   214
	active->StartL();
sl@0
   215
	aClient.GetEvent(*event, active->iStatus);
sl@0
   216
	CActiveScheduler::Start();
sl@0
   217
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNotFound : KErrPermissionDenied);
sl@0
   218
	
sl@0
   219
	// try to delete a non-existent event...
sl@0
   220
	active->StartL();
sl@0
   221
	aClient.DeleteEvent(123, active->iStatus);
sl@0
   222
	CActiveScheduler::Start();
sl@0
   223
	TEST2(active->iStatus.Int(), KErrNotFound);
sl@0
   224
sl@0
   225
	CleanupStack::PopAndDestroy(2); // event, active
sl@0
   226
	}
sl@0
   227
sl@0
   228
sl@0
   229
sl@0
   230
/**
sl@0
   231
@SYMTestCaseID SYSLIB-LOGENG-CT-0120
sl@0
   232
@SYMTestCaseDesc Test AddEventType for high and low capability clients
sl@0
   233
@SYMTestPriority High
sl@0
   234
@SYMTestActions 
sl@0
   235
1.  For a clients of all capabilities...
sl@0
   236
	a. Add a new event type
sl@0
   237
	b. Fill a CLogEventType object with details of the new type
sl@0
   238
	c. Try to add the new event type for a second time 
sl@0
   239
sl@0
   240
@SYMTestExpectedResults 
sl@0
   241
1.  For a client with sufficient capability...
sl@0
   242
	Test a. - KErrNone - the new event type was added OK
sl@0
   243
	Test b. - KErrNone - the new event type is fully visible
sl@0
   244
	Test c. - KErrAlreadyExists - it was already added by test a. !
sl@0
   245
sl@0
   246
2.  For a client with insufficient capability...
sl@0
   247
	Test a. - KErrPermissionDenied - not allowed !
sl@0
   248
	Test b. - KErrNotFound - allowed, but it isn't there because test a. failed.
sl@0
   249
	Test c. - KErrPermissionDenied - exactly the same as test a.
sl@0
   250
	
sl@0
   251
@SYMREQ REQ3431
sl@0
   252
*/
sl@0
   253
LOCAL_C void TestAddEventTypeL(CLogClient& aClient)
sl@0
   254
	{
sl@0
   255
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0120 "));
sl@0
   256
	CLogEventType* type = CLogEventType::NewL();
sl@0
   257
	CleanupStack::PushL(type);
sl@0
   258
sl@0
   259
	type->SetUid(KTestEventUid);
sl@0
   260
	type->SetDescription(KTestEventDesc1);
sl@0
   261
	type->SetLoggingEnabled(ETrue);
sl@0
   262
sl@0
   263
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   264
	CleanupStack::PushL(active);
sl@0
   265
sl@0
   266
	aClient.AddEventType(*type, active->iStatus);
sl@0
   267
	active->StartL();
sl@0
   268
	CActiveScheduler::Start();
sl@0
   269
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied);
sl@0
   270
		
sl@0
   271
	active->StartL();
sl@0
   272
	aClient.GetEventType(*type, active->iStatus);
sl@0
   273
	CActiveScheduler::Start();
sl@0
   274
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrNotFound);
sl@0
   275
			
sl@0
   276
	active->StartL();
sl@0
   277
	aClient.AddEventType(*type, active->iStatus);
sl@0
   278
	CActiveScheduler::Start();
sl@0
   279
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrAlreadyExists : KErrPermissionDenied);
sl@0
   280
sl@0
   281
	CleanupStack::PopAndDestroy(2); // active, type
sl@0
   282
	}
sl@0
   283
sl@0
   284
sl@0
   285
sl@0
   286
/**
sl@0
   287
@SYMTestCaseID SYSLIB-LOGENG-CT-0121
sl@0
   288
@SYMTestCaseDesc Try to populate an CLogEventType object with details of a 
sl@0
   289
non built-in event type.
sl@0
   290
@SYMTestPriority High
sl@0
   291
@SYMTestActions Calls GetEventType(...)
sl@0
   292
@SYMTestExpectedResults Always succeeds - all clients should be able to do this as
sl@0
   293
the GetEventType operation is not policed by platform security.
sl@0
   294
@SYMREQ REQ3431
sl@0
   295
*/
sl@0
   296
LOCAL_C void TestGetEventTypeL(CLogClient& aClient)
sl@0
   297
	//
sl@0
   298
	// This test should succeed, regardless of capability
sl@0
   299
	// GetEventType is not policed.
sl@0
   300
	//
sl@0
   301
	{
sl@0
   302
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0121 "));
sl@0
   303
	CLogEventType* type = CLogEventType::NewL();
sl@0
   304
	CleanupStack::PushL(type);
sl@0
   305
sl@0
   306
	type->SetUid(KTestEventUid);
sl@0
   307
sl@0
   308
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   309
	CleanupStack::PushL(active);
sl@0
   310
sl@0
   311
	aClient.GetEventType(*type, active->iStatus);
sl@0
   312
	active->StartL();
sl@0
   313
	CActiveScheduler::Start();
sl@0
   314
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   315
sl@0
   316
	TEST(type->Uid() == KTestEventUid);
sl@0
   317
	TEST(type->Description() == KTestEventDesc1);
sl@0
   318
	TEST(type->LoggingEnabled());
sl@0
   319
sl@0
   320
	CleanupStack::PopAndDestroy(2); // active, type
sl@0
   321
	}
sl@0
   322
sl@0
   323
sl@0
   324
sl@0
   325
sl@0
   326
/**
sl@0
   327
@SYMTestCaseID SYSLIB-LOGENG-CT-0122
sl@0
   328
@SYMTestCaseDesc Tries to change existing event types.
sl@0
   329
@SYMTestActions See the description and expected results.
sl@0
   330
@SYMTestPriority High
sl@0
   331
@SYMTestExpectedResults Should always succeed
sl@0
   332
@SYMREQ REQ3431
sl@0
   333
*/
sl@0
   334
LOCAL_C void TestChangeEventTypeL(CLogClient& aClient)
sl@0
   335
	{
sl@0
   336
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0122 "));
sl@0
   337
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   338
	CleanupStack::PushL(active);
sl@0
   339
sl@0
   340
	CLogEventType* type = CLogEventType::NewL();
sl@0
   341
	CleanupStack::PushL(type);
sl@0
   342
sl@0
   343
	type->SetUid(KTestEventUid);
sl@0
   344
sl@0
   345
	type->SetDescription(KTestEventDesc1);
sl@0
   346
	type->SetDescription(KTestEventDesc2);
sl@0
   347
sl@0
   348
#ifdef _DEBUG
sl@0
   349
	TInt failCount = 0;
sl@0
   350
#endif
sl@0
   351
sl@0
   352
	TBool finished = EFalse;
sl@0
   353
	TInt error;
sl@0
   354
sl@0
   355
	while(!finished)
sl@0
   356
		{
sl@0
   357
		error = KErrNone;
sl@0
   358
sl@0
   359
		type->SetDescription(KTestEventDesc2);
sl@0
   360
		type->SetLoggingEnabled(EFalse);
sl@0
   361
sl@0
   362
		__UHEAP_FAILNEXT(failCount++);
sl@0
   363
		
sl@0
   364
		aClient.ChangeEventType(*type, active->iStatus);
sl@0
   365
sl@0
   366
		active->StartL();
sl@0
   367
		CActiveScheduler::Start();
sl@0
   368
sl@0
   369
		if (active->iStatus == KErrNone)
sl@0
   370
			finished = ETrue;
sl@0
   371
		else
sl@0
   372
			error = active->iStatus.Int();
sl@0
   373
sl@0
   374
		__UHEAP_RESET;
sl@0
   375
sl@0
   376
		if (error == KErrNoMemory)
sl@0
   377
			{
sl@0
   378
			active->StartL();
sl@0
   379
			aClient.GetEventType(*type, active->iStatus);
sl@0
   380
			CActiveScheduler::Start();
sl@0
   381
			TEST2(active->iStatus.Int(), KErrNone);
sl@0
   382
sl@0
   383
			TEST(type->Description() == KTestEventDesc1);
sl@0
   384
			TEST(type->LoggingEnabled());
sl@0
   385
			}
sl@0
   386
		else
sl@0
   387
			{
sl@0
   388
			TEST2(error, TheHiCapability ? KErrNone : KErrPermissionDenied);
sl@0
   389
			
sl@0
   390
			if(!TheHiCapability)
sl@0
   391
				finished = TRUE;
sl@0
   392
			}
sl@0
   393
		}
sl@0
   394
sl@0
   395
	type->SetUid(KTestEventUid);
sl@0
   396
sl@0
   397
	active->StartL();
sl@0
   398
	aClient.GetEventType(*type, active->iStatus);
sl@0
   399
	CActiveScheduler::Start();
sl@0
   400
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   401
sl@0
   402
	if(TheHiCapability)
sl@0
   403
		{
sl@0
   404
		TEST(type->Uid() == KTestEventUid);
sl@0
   405
		TEST(type->Description() == KTestEventDesc2);
sl@0
   406
		TEST(type->LoggingEnabled() == EFalse);
sl@0
   407
		}
sl@0
   408
	else
sl@0
   409
		{
sl@0
   410
		TEST(type->Uid() == KTestEventUid);
sl@0
   411
		TEST(type->Description() == KTestEventDesc1);
sl@0
   412
		TEST(type->LoggingEnabled());
sl@0
   413
		}
sl@0
   414
sl@0
   415
	CleanupStack::PopAndDestroy(2); // type, active
sl@0
   416
	}
sl@0
   417
sl@0
   418
sl@0
   419
sl@0
   420
sl@0
   421
/**
sl@0
   422
@SYMTestCaseID SYSLIB-LOGENG-CT-0123
sl@0
   423
@SYMTestCaseDesc Delete event types
sl@0
   424
@SYMTestActions See the description and expected results.
sl@0
   425
@SYMTestPriority High
sl@0
   426
@SYMTestExpectedResults Should always succeed
sl@0
   427
@SYMREQ REQ3431
sl@0
   428
*/
sl@0
   429
LOCAL_C void TestDeleteEventTypeL(CLogClient& aClient)
sl@0
   430
	{
sl@0
   431
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0123 "));
sl@0
   432
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   433
	CleanupStack::PushL(active);
sl@0
   434
sl@0
   435
	CLogEventType* type = CLogEventType::NewL();
sl@0
   436
	CleanupStack::PushL(type);
sl@0
   437
sl@0
   438
	type->SetUid(KTestEventUid);
sl@0
   439
sl@0
   440
#ifdef _DEBUG
sl@0
   441
	TInt failCount = 0;
sl@0
   442
#endif
sl@0
   443
sl@0
   444
	TBool finished = EFalse;
sl@0
   445
	TInt error;
sl@0
   446
sl@0
   447
	while(!finished)
sl@0
   448
		{
sl@0
   449
		error = KErrNone;
sl@0
   450
sl@0
   451
		__UHEAP_FAILNEXT(failCount++);
sl@0
   452
		aClient.DeleteEventType(KTestEventUid, active->iStatus);
sl@0
   453
sl@0
   454
		active->StartL();
sl@0
   455
		CActiveScheduler::Start();
sl@0
   456
sl@0
   457
		if (active->iStatus == KErrNone)
sl@0
   458
			finished = ETrue;
sl@0
   459
		else
sl@0
   460
			error = active->iStatus.Int();
sl@0
   461
sl@0
   462
		__UHEAP_RESET;
sl@0
   463
sl@0
   464
		if (error == KErrNoMemory)
sl@0
   465
			{
sl@0
   466
			active->StartL();
sl@0
   467
			aClient.GetEventType(*type, active->iStatus);
sl@0
   468
			CActiveScheduler::Start();
sl@0
   469
			TEST2(active->iStatus.Int(), KErrNone);
sl@0
   470
			}
sl@0
   471
		else
sl@0
   472
			{
sl@0
   473
			TEST2(error, TheHiCapability ? KErrNone : KErrPermissionDenied);
sl@0
   474
			
sl@0
   475
			if(!TheHiCapability)
sl@0
   476
				finished = TRUE;
sl@0
   477
			}
sl@0
   478
		}
sl@0
   479
sl@0
   480
	active->StartL();
sl@0
   481
	aClient.GetEventType(*type, active->iStatus);
sl@0
   482
	CActiveScheduler::Start();
sl@0
   483
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNotFound : KErrNone);
sl@0
   484
sl@0
   485
	CleanupStack::PopAndDestroy(2); // type, active
sl@0
   486
	}
sl@0
   487
sl@0
   488
sl@0
   489
sl@0
   490
sl@0
   491
/**
sl@0
   492
@SYMTestCaseID SYSLIB-LOGENG-CT-0124
sl@0
   493
@SYMTestCaseDesc Try to delete built in event types
sl@0
   494
@SYMTestPriority High
sl@0
   495
@SYMTestActions No one is allowed to delete built in event types !
sl@0
   496
@SYMTestExpectedResults Should always succeed
sl@0
   497
@SYMREQ REQ3431
sl@0
   498
*/
sl@0
   499
LOCAL_C void TestDeleteBuiltInEventTypeL(CLogClient& aClient)
sl@0
   500
	{
sl@0
   501
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0124 "));
sl@0
   502
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   503
	CleanupStack::PushL(active);
sl@0
   504
sl@0
   505
	CLogEventType* type = CLogEventType::NewL();
sl@0
   506
	CleanupStack::PushL(type);
sl@0
   507
	
sl@0
   508
	TUid someBuiltInTypes [] = 
sl@0
   509
		{
sl@0
   510
		KLogCallEventTypeUid, 
sl@0
   511
		KLogDataEventTypeUid, 
sl@0
   512
		KLogFaxEventTypeUid
sl@0
   513
		};
sl@0
   514
	
sl@0
   515
	for (TInt i=0; i < 3; i++)
sl@0
   516
		{
sl@0
   517
		aClient.DeleteEventType(someBuiltInTypes [i], active->iStatus);
sl@0
   518
		active->StartL();
sl@0
   519
		CActiveScheduler::Start();
sl@0
   520
		TEST2(active->iStatus.Int(), KErrPermissionDenied);
sl@0
   521
sl@0
   522
		type->SetUid(someBuiltInTypes [i]);
sl@0
   523
		active->StartL();
sl@0
   524
		aClient.GetEventType(*type, active->iStatus);
sl@0
   525
		CActiveScheduler::Start();
sl@0
   526
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
   527
		TEST(type->Uid() == someBuiltInTypes [i]);
sl@0
   528
		}
sl@0
   529
sl@0
   530
	CleanupStack::PopAndDestroy(2); // type, active
sl@0
   531
	}
sl@0
   532
sl@0
   533
sl@0
   534
sl@0
   535
sl@0
   536
sl@0
   537
/**
sl@0
   538
@SYMTestCaseID SYSLIB-LOGENG-CT-0125
sl@0
   539
@SYMTestCaseDesc Get database configuration
sl@0
   540
@SYMTestPriority High
sl@0
   541
@SYMTestActions All clients are allowed to do this
sl@0
   542
@SYMTestExpectedResults Should always succeed
sl@0
   543
@SYMREQ REQ3431
sl@0
   544
*/
sl@0
   545
LOCAL_C void TestGetConfigL(CLogClient& aClient)
sl@0
   546
	{
sl@0
   547
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0125 "));
sl@0
   548
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   549
	CleanupStack::PushL(active);
sl@0
   550
sl@0
   551
	TLogConfig config;
sl@0
   552
sl@0
   553
	TEST(config.iMaxEventAge == 0);
sl@0
   554
	TEST(config.iMaxLogSize == 0);
sl@0
   555
	TEST(config.iMaxRecentLogSize == 0);
sl@0
   556
sl@0
   557
#ifdef _DEBUG
sl@0
   558
	TInt failCount = 0;
sl@0
   559
#endif
sl@0
   560
sl@0
   561
	TBool finished = EFalse;
sl@0
   562
sl@0
   563
	while(!finished)
sl@0
   564
		{
sl@0
   565
		__UHEAP_FAILNEXT(failCount++);
sl@0
   566
		aClient.GetConfig(config, active->iStatus);
sl@0
   567
sl@0
   568
		active->StartL();
sl@0
   569
		CActiveScheduler::Start();
sl@0
   570
sl@0
   571
		if (active->iStatus == KErrNone)
sl@0
   572
			finished = ETrue;
sl@0
   573
		else
sl@0
   574
			TEST2(active->iStatus.Int(), KErrNoMemory);
sl@0
   575
sl@0
   576
		__UHEAP_RESET;
sl@0
   577
		}
sl@0
   578
sl@0
   579
	TEST(config.iMaxEventAge > 0);
sl@0
   580
	TEST(config.iMaxLogSize > 0);
sl@0
   581
	TEST(config.iMaxRecentLogSize > 0);
sl@0
   582
sl@0
   583
	CleanupStack::PopAndDestroy(); // active
sl@0
   584
	}
sl@0
   585
sl@0
   586
sl@0
   587
sl@0
   588
sl@0
   589
/**
sl@0
   590
@SYMTestCaseID SYSLIB-LOGENG-CT-0126
sl@0
   591
@SYMTestCaseDesc Change the database configuration
sl@0
   592
@SYMTestPriority High
sl@0
   593
@SYMTestActions Low capability clients can't do this
sl@0
   594
@SYMTestExpectedResults Should always succeed
sl@0
   595
@SYMREQ REQ3431
sl@0
   596
*/
sl@0
   597
LOCAL_C void TestChangeConfigL(CLogClient& aClient)
sl@0
   598
	{
sl@0
   599
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0126 "));
sl@0
   600
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   601
	CleanupStack::PushL(active);
sl@0
   602
sl@0
   603
	TLogConfig configOld;
sl@0
   604
sl@0
   605
	active->StartL();
sl@0
   606
	aClient.GetConfig(configOld, active->iStatus);
sl@0
   607
	CActiveScheduler::Start();
sl@0
   608
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   609
sl@0
   610
	TLogConfig config;
sl@0
   611
sl@0
   612
#ifdef _DEBUG
sl@0
   613
	TInt failCount = 0;
sl@0
   614
#endif
sl@0
   615
sl@0
   616
	TBool finished = EFalse;
sl@0
   617
	TInt error;
sl@0
   618
sl@0
   619
	while(!finished)
sl@0
   620
		{
sl@0
   621
		error = KErrNone;
sl@0
   622
sl@0
   623
		config.iMaxLogSize = KTestMaxLogSize;
sl@0
   624
		config.iMaxRecentLogSize = KTestMaxRecentLogSize;
sl@0
   625
		config.iMaxEventAge = KTestMaxEventAge;
sl@0
   626
sl@0
   627
		__UHEAP_FAILNEXT(failCount++);
sl@0
   628
		aClient.ChangeConfig(config, active->iStatus);
sl@0
   629
sl@0
   630
		active->StartL();
sl@0
   631
		CActiveScheduler::Start();
sl@0
   632
sl@0
   633
		if (active->iStatus == KErrNone)
sl@0
   634
			finished = ETrue;
sl@0
   635
		else
sl@0
   636
			error = active->iStatus.Int();
sl@0
   637
		
sl@0
   638
		__UHEAP_RESET;
sl@0
   639
sl@0
   640
		if ((error == KErrNoMemory) || (error == KErrPermissionDenied))
sl@0
   641
			{
sl@0
   642
			active->StartL();
sl@0
   643
			aClient.GetConfig(config, active->iStatus);
sl@0
   644
			CActiveScheduler::Start();
sl@0
   645
			TEST2(active->iStatus.Int(), KErrNone);
sl@0
   646
sl@0
   647
			TEST(config.iMaxLogSize == configOld.iMaxLogSize);
sl@0
   648
			TEST(config.iMaxRecentLogSize == configOld.iMaxRecentLogSize);
sl@0
   649
			TEST(config.iMaxEventAge == configOld.iMaxEventAge);
sl@0
   650
			}
sl@0
   651
		else
sl@0
   652
			{
sl@0
   653
			TEST2(error, KErrNone);		
sl@0
   654
			}
sl@0
   655
			
sl@0
   656
		if(! TheHiCapability)
sl@0
   657
			finished = TRUE;
sl@0
   658
						
sl@0
   659
		}
sl@0
   660
sl@0
   661
	if(TheHiCapability)
sl@0
   662
		{
sl@0
   663
		TEST(config.iMaxLogSize == KTestMaxLogSize);
sl@0
   664
		TEST(config.iMaxRecentLogSize == KTestMaxRecentLogSize);
sl@0
   665
		TEST(config.iMaxEventAge == KTestMaxEventAge);
sl@0
   666
		}
sl@0
   667
	else
sl@0
   668
		{
sl@0
   669
		TEST(config.iMaxLogSize == configOld.iMaxLogSize);
sl@0
   670
		TEST(config.iMaxRecentLogSize == configOld.iMaxRecentLogSize);
sl@0
   671
		TEST(config.iMaxEventAge == configOld.iMaxEventAge);
sl@0
   672
		}
sl@0
   673
		
sl@0
   674
	CleanupStack::PopAndDestroy(); // active
sl@0
   675
	}
sl@0
   676
sl@0
   677
sl@0
   678
sl@0
   679
sl@0
   680
/**
sl@0
   681
@SYMTestCaseID SYSLIB-LOGENG-CT-0127
sl@0
   682
@SYMTestCaseDesc Clear the log
sl@0
   683
@SYMTestPriority High
sl@0
   684
@SYMTestActions Low capability clients can't do this
sl@0
   685
@SYMTestExpectedResults Should always pass
sl@0
   686
@SYMREQ REQ3431
sl@0
   687
*/
sl@0
   688
void ClearLogL(CLogClient& aClient)
sl@0
   689
	{
sl@0
   690
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0127 "));
sl@0
   691
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   692
	CleanupStack::PushL(active);
sl@0
   693
sl@0
   694
	TTime now;
sl@0
   695
	now.UniversalTime();
sl@0
   696
	
sl@0
   697
	active->StartL();
sl@0
   698
	aClient.ClearLog(now, active->iStatus);
sl@0
   699
		
sl@0
   700
	CActiveScheduler::Start();
sl@0
   701
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied);
sl@0
   702
	
sl@0
   703
	CleanupStack::PopAndDestroy(); // active
sl@0
   704
	}	
sl@0
   705
sl@0
   706
/**
sl@0
   707
@SYMTestCaseID SYSLIB-LOGENG-CT-0128
sl@0
   708
@SYMTestCaseDesc Try to clear the recent event list
sl@0
   709
@SYMTestPriority High
sl@0
   710
@SYMTestActions Low capability clients will fail
sl@0
   711
@SYMTestExpectedResults Should always succeed
sl@0
   712
@SYMREQ REQ3431
sl@0
   713
*/
sl@0
   714
void ClearRecentListL(CLogClient& aClient)
sl@0
   715
	{
sl@0
   716
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0128 "));
sl@0
   717
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   718
	CleanupStack::PushL(active);
sl@0
   719
sl@0
   720
	TTime now;
sl@0
   721
	now.UniversalTime();
sl@0
   722
	
sl@0
   723
	active->StartL();
sl@0
   724
	aClient.ClearLog(KLogRecentIncomingCalls, active->iStatus);
sl@0
   725
	
sl@0
   726
	CActiveScheduler::Start();
sl@0
   727
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied);
sl@0
   728
	
sl@0
   729
	CleanupStack::PopAndDestroy(); // active
sl@0
   730
	}	
sl@0
   731
sl@0
   732
#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
sl@0
   733
sl@0
   734
/**
sl@0
   735
@SYMTestCaseID			PDS-LOGENG-UT-4040
sl@0
   736
@SYMTestCaseDesc		Clear log events with specific SimId - platform security test.
sl@0
   737
						This test is called from two test applications: t_logHicapability 
sl@0
   738
						and t_loglowcapabilty. As the names state, t_loghicapability has platsec capabilities to 
sl@0
   739
						call CLogClient::CLearLog(), t_loglowcapabilty - hasn't.
sl@0
   740
						When t_loghicapability calls ClearLogL(), "TheHiCapability" flag is true and it is expected
sl@0
   741
						the CLogClient::ClearLog() call to complete successfully. 
sl@0
   742
						When t_loglowcapability calls ClearLogL(), "TheHiCapability" flag is false and it is expected
sl@0
   743
						the CLogClient::ClearLog() call to fail with KErrPermissionDenied. 
sl@0
   744
@SYMTestActions			Clear log events with specific SimId - platform security test.
sl@0
   745
@SYMTestExpectedResults Test must not fail
sl@0
   746
@SYMTestPriority		High
sl@0
   747
@SYMREQ					REQ12748
sl@0
   748
*/
sl@0
   749
void ClearLogL(CLogClient& aClient, TSimId aSimId)
sl@0
   750
	{//This test case is compiled only when SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM macro is defined.
sl@0
   751
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   752
	CleanupStack::PushL(active);
sl@0
   753
sl@0
   754
	TTime now;
sl@0
   755
	now.UniversalTime();
sl@0
   756
	
sl@0
   757
	active->StartL();
sl@0
   758
	aClient.ClearLog(now, aSimId, active->iStatus);
sl@0
   759
		
sl@0
   760
	CActiveScheduler::Start();
sl@0
   761
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied);
sl@0
   762
	
sl@0
   763
	CleanupStack::PopAndDestroy(); // active
sl@0
   764
	}	
sl@0
   765
sl@0
   766
/**
sl@0
   767
@SYMTestCaseID			PDS-LOGENG-UT-4041
sl@0
   768
@SYMTestCaseDesc		Clear log events from the specified recent list with specific SimId - platform security test.
sl@0
   769
						This test is called from two test applications: t_logHicapability 
sl@0
   770
						and t_loglowcapabilty. As the names state, t_loghicapability has platsec capabilities to 
sl@0
   771
						call CLogClient::CLearLog(), t_loglowcapabilty - hasn't.
sl@0
   772
						When t_loghicapability calls ClearLogL(), "TheHiCapability" flag is true and it is expected
sl@0
   773
						the CLogClient::ClearLog() call to complete successfully. 
sl@0
   774
						When t_loglowcapability calls ClearLogL(), "TheHiCapability" flag is false and it is expected
sl@0
   775
						the CLogClient::ClearLog() call to fail with KErrPermissionDenied. 
sl@0
   776
@SYMTestActions			Clear log events from the specified recent list with specific SimId - platform security test.
sl@0
   777
@SYMTestExpectedResults Test must not fail
sl@0
   778
@SYMTestPriority		High
sl@0
   779
@SYMREQ					REQ12748
sl@0
   780
*/
sl@0
   781
void ClearRecentListL(CLogClient& aClient, TSimId aSimId)
sl@0
   782
	{//This test case is compiled only when SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM macro is defined.
sl@0
   783
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   784
	CleanupStack::PushL(active);
sl@0
   785
sl@0
   786
	TTime now;
sl@0
   787
	now.UniversalTime();
sl@0
   788
	
sl@0
   789
	active->StartL();
sl@0
   790
	aClient.ClearLog(KLogRecentIncomingCalls, aSimId, active->iStatus);
sl@0
   791
	
sl@0
   792
	CActiveScheduler::Start();
sl@0
   793
	TEST2(active->iStatus.Int(), TheHiCapability ? KErrNone : KErrPermissionDenied);
sl@0
   794
	
sl@0
   795
	CleanupStack::PopAndDestroy(); // active
sl@0
   796
	}	
sl@0
   797
sl@0
   798
#endif//SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
sl@0
   799
sl@0
   800
/**
sl@0
   801
@SYMTestCaseID SYSLIB-LOGENG-CT-0129
sl@0
   802
@SYMTestCaseDesc Test that a view only contains events that are suitable for a clients cabability
sl@0
   803
@SYMTestPriority High
sl@0
   804
@SYMTestActions See comments in the trest code below for further info.
sl@0
   805
@SYMTestExpectedResults Should always succeed
sl@0
   806
@SYMREQ REQ3431
sl@0
   807
*/
sl@0
   808
LOCAL_C void TestEventViewWithFilterL(CLogClient& aClient)
sl@0
   809
	{
sl@0
   810
	// TestUtils::AddTestEventsL() --> should be called before this function.
sl@0
   811
	// It deletes the database, then...
sl@0
   812
	// adds 8 events - 2 are visible to clients with no capabilities
sl@0
   813
	// and 6 are of type KLogCallEventTypeUid, which is protected.
sl@0
   814
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0129 "));
sl@0
   815
	CTestActive* active = new(ELeave)CTestActive;
sl@0
   816
	CleanupStack::PushL(active);
sl@0
   817
sl@0
   818
	CLogFilterList* list = new(ELeave)CLogFilterList;
sl@0
   819
	CleanupStack::PushL(list);
sl@0
   820
sl@0
   821
	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
sl@0
   822
	CleanupStack::PushL(view);
sl@0
   823
sl@0
   824
	CLogFilter* filter = CLogFilter::NewL();
sl@0
   825
	CleanupStack::PushL(filter);
sl@0
   826
	
sl@0
   827
	TLogString direction;
sl@0
   828
	aClient.GetString(direction, R_LOG_DIR_IN);
sl@0
   829
	
sl@0
   830
	// Test 1.
sl@0
   831
	// Of the 8 new events, 2 have KTestContact1 as the contact field
sl@0
   832
	// One of them is a secure type and the other isn't.
sl@0
   833
	// So, if running at hi capability, expect 2 events, else 1
sl@0
   834
	TInt expectedEventCount = (TheHiCapability) ? 2 : 1;
sl@0
   835
	filter->SetContact(KTestContact1);
sl@0
   836
	list->AppendL(filter);
sl@0
   837
	active->StartL();
sl@0
   838
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   839
	CActiveScheduler::Start();
sl@0
   840
	TEST(view->CountL() == expectedEventCount);
sl@0
   841
	
sl@0
   842
	// Test 2.
sl@0
   843
	// Of the 8 new events, 6 have KTestContact2 as the contact field
sl@0
   844
	// One of them is a secure type and the other isn't.
sl@0
   845
	// The filters will be combined in the query, so expect
sl@0
   846
	// 8 events if running at hi capability, else 2
sl@0
   847
	expectedEventCount = (TheHiCapability) ? 8 : 2;
sl@0
   848
	CleanupStack::Pop(); // filter
sl@0
   849
	filter = CLogFilter::NewL();
sl@0
   850
	CleanupStack::PushL(filter);
sl@0
   851
	filter->SetContact(KTestContact2);
sl@0
   852
	list->AppendL(filter);
sl@0
   853
	active->StartL();
sl@0
   854
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   855
	CActiveScheduler::Start();
sl@0
   856
	TEST(view->CountL() == expectedEventCount);
sl@0
   857
		
sl@0
   858
	// Test 3.
sl@0
   859
	// Of the 8 new events, 7 have R_LOG_DIR_IN as the direction field.
sl@0
   860
	// Two of these are only visible for hi capability clients, the other one
sl@0
   861
	// can be viewed by all clients.
sl@0
   862
	expectedEventCount = (TheHiCapability) ? 7 : 1;
sl@0
   863
	CleanupStack::Pop(); // filter
sl@0
   864
	filter = CLogFilter::NewL();
sl@0
   865
	CleanupStack::PushL(filter);
sl@0
   866
	filter->SetDirection(direction);
sl@0
   867
	list->AppendL(filter);
sl@0
   868
	active->StartL();
sl@0
   869
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   870
	CActiveScheduler::Start();
sl@0
   871
	TEST(view->CountL() == expectedEventCount);
sl@0
   872
	
sl@0
   873
	// clear up...
sl@0
   874
	list->ResetAndDestroy();
sl@0
   875
	CleanupStack::Pop(); // filter
sl@0
   876
	CleanupStack::PopAndDestroy(3);  // view, list, active
sl@0
   877
	}
sl@0
   878
sl@0
   879
sl@0
   880
sl@0
   881
sl@0
   882
/**
sl@0
   883
@SYMTestCaseID SYSLIB-LOGENG-CT-0130
sl@0
   884
@SYMTestCaseDesc Test the clients ability to view recent events
sl@0
   885
@SYMTestActions See the description and expected results.
sl@0
   886
@SYMTestPriority High
sl@0
   887
@SYMTestExpectedResults Should always succeed
sl@0
   888
@SYMREQ REQ3431
sl@0
   889
*/
sl@0
   890
LOCAL_C void TestRecentViewL(CLogClient& aClient)
sl@0
   891
	{
sl@0
   892
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0130 "));
sl@0
   893
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   894
	CleanupStack::PushL(active);
sl@0
   895
sl@0
   896
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
   897
	CleanupStack::PushL(view);
sl@0
   898
sl@0
   899
	active->StartL();
sl@0
   900
	
sl@0
   901
	// will return FALSE if the view is empty, which should  be the case
sl@0
   902
	// with low/no capability clients.
sl@0
   903
	if (view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus))
sl@0
   904
		{
sl@0
   905
		__ASSERT_ALWAYS(TheHiCapability, _L("TestRecentViewL"));
sl@0
   906
		CActiveScheduler::Start();
sl@0
   907
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
   908
		TEST(view->CountL() == 2);
sl@0
   909
		TInt count = view->CountL();
sl@0
   910
		}
sl@0
   911
	else	// low capability client won't be able to see recent incoming calls
sl@0
   912
		{
sl@0
   913
		__ASSERT_ALWAYS(!TheHiCapability, _L("TestRecentViewL"));
sl@0
   914
		active->Cancel();
sl@0
   915
		}
sl@0
   916
sl@0
   917
	CleanupStack::PopAndDestroy(2);	// view, active
sl@0
   918
	}
sl@0
   919
sl@0
   920
//.............................................................................
sl@0
   921
sl@0
   922
void doTestsL()
sl@0
   923
	{
sl@0
   924
    TestUtils::Initialize(KTestTitle);
sl@0
   925
					
sl@0
   926
	TheTest.Start(_L("Starting tests..."));
sl@0
   927
		
sl@0
   928
	CLogClient* client = CLogClient::NewL(theFs);
sl@0
   929
	CleanupStack::PushL(client);
sl@0
   930
	
sl@0
   931
	TestUtils::DeleteDatabaseL();
sl@0
   932
	
sl@0
   933
	TheTest.Next(_L("Server startup"));
sl@0
   934
	TestStartupL();
sl@0
   935
	User::After(100000);
sl@0
   936
sl@0
   937
	TheTest.Next(_L("Test Add, Get, Change & Delete event"));
sl@0
   938
	TestUtils::DeleteDatabaseL();
sl@0
   939
	TestBasicL(*client);
sl@0
   940
	theLog.Write(_L8("Basic tests OK\n"));
sl@0
   941
sl@0
   942
	TheTest.Next(_L("Add Event Type"));
sl@0
   943
	TestAddEventTypeL(*client);
sl@0
   944
	theLog.Write(_L8("Add Event Type test OK\n"));
sl@0
   945
	
sl@0
   946
	if(!TheHiCapability)
sl@0
   947
		{	
sl@0
   948
		// TestAddEventTypeL() will have failed to add an event type, so
sl@0
   949
		// this will ensure one is present for the next tests.
sl@0
   950
		TestUtils::AddEventTypeL();
sl@0
   951
		}
sl@0
   952
	
sl@0
   953
	TheTest.Next(_L("Get Event Type"));
sl@0
   954
	TestGetEventTypeL(*client);
sl@0
   955
	theLog.Write(_L8("Get Event Type test OK\n"));
sl@0
   956
	
sl@0
   957
	TheTest.Next(_L("Change Event Type"));
sl@0
   958
	TestChangeEventTypeL(*client);
sl@0
   959
	theLog.Write(_L8("Change Event Type test OK\n"));
sl@0
   960
	
sl@0
   961
	TheTest.Next(_L("Delete Event Type"));
sl@0
   962
	TestDeleteEventTypeL(*client);
sl@0
   963
	theLog.Write(_L8("Delete Event Type test OK\n"));
sl@0
   964
	
sl@0
   965
	TheTest.Next(_L("Delete Built-in Event Type"));
sl@0
   966
	TestDeleteBuiltInEventTypeL(*client);
sl@0
   967
	theLog.Write(_L8("Delete Built-in Event Type test OK\n"));
sl@0
   968
	
sl@0
   969
	TheTest.Next(_L("Get Server Configuration"));
sl@0
   970
	TestGetConfigL(*client);
sl@0
   971
	theLog.Write(_L8("Get Server Configuration test OK\n"));
sl@0
   972
	
sl@0
   973
	TheTest.Next(_L("Change Server Configuration"));
sl@0
   974
	TestChangeConfigL(*client);
sl@0
   975
	theLog.Write(_L8("Change Server Configuration test OK\n"));
sl@0
   976
	
sl@0
   977
	TheTest.Next(_L("Clear the Log test"));
sl@0
   978
	ClearLogL(*client);
sl@0
   979
	theLog.Write(_L8("Clear the Log test OK\n"));
sl@0
   980
		
sl@0
   981
	TheTest.Next(_L("Clear Recent List test"));
sl@0
   982
	ClearRecentListL(*client);
sl@0
   983
	theLog.Write(_L8("Clear Recent List test OK\n"));
sl@0
   984
	
sl@0
   985
#ifdef SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM	
sl@0
   986
	const TSimId KSimId = 4000000000U;
sl@0
   987
sl@0
   988
	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4040 Clear the \"Log + SimId\" test"));
sl@0
   989
	ClearLogL(*client, KSimId);
sl@0
   990
	theLog.Write(_L8("Clear the \"Log + SimId\" test OK\n"));
sl@0
   991
sl@0
   992
	TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-UT-4041 Clear \"Recent List + SimId\" test"));
sl@0
   993
	ClearRecentListL(*client, KSimId);
sl@0
   994
	theLog.Write(_L8("Clear \"Recent List + SimId\" test OK\n"));
sl@0
   995
#endif
sl@0
   996
	
sl@0
   997
	//
sl@0
   998
	// View API tests below this
sl@0
   999
	//
sl@0
  1000
	TestUtils::DeleteDatabaseL();
sl@0
  1001
	
sl@0
  1002
	// TestUtils::AddTestEventsL() -->  adds 8 events.
sl@0
  1003
	// 2 are visible to clients with no capabilities
sl@0
  1004
	// and 6 are of type KLogCallEventTypeUid, which is protected.
sl@0
  1005
	TestUtils::AddViewTestEventsL();
sl@0
  1006
	
sl@0
  1007
	TheTest.Next(_L("Event View with Filter list"));
sl@0
  1008
	TestEventViewWithFilterL(*client);	
sl@0
  1009
	theLog.Write(_L8("Event View with Filter list test OK\n"));
sl@0
  1010
	
sl@0
  1011
	TheTest.Next(_L("Recent View"));
sl@0
  1012
	TestRecentViewL(*client);
sl@0
  1013
	theLog.Write(_L8("Recent View test OK\n"));
sl@0
  1014
sl@0
  1015
	TestUtils::DeleteDatabaseL();	// ready for next test
sl@0
  1016
sl@0
  1017
	CleanupStack::PopAndDestroy(); // client
sl@0
  1018
	}