os/persistentdata/loggingservices/eventlogger/test/src/t_logbackup.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include <s32file.h>
sl@0
    17
#include <babackup.h>
sl@0
    18
#include "t_logutil2.h"
sl@0
    19
#include <logview.h>
sl@0
    20
sl@0
    21
RTest TheTest(_L("t_logbackup"));
sl@0
    22
sl@0
    23
CBaBackupSessionWrapper* theBackup = NULL;
sl@0
    24
sl@0
    25
/////////////////////////////////////////////////////////////////////////////////////
sl@0
    26
/////////////////////////////////////////////////////////////////////////////////////
sl@0
    27
/////////////////////////////////////////////////////////////////////////////////////
sl@0
    28
#ifdef __WINS__
sl@0
    29
sl@0
    30
_LIT(KTestEventDesc, "Event Type Description");
sl@0
    31
_LIT(KTestRemoteParty, "Remote Party");
sl@0
    32
_LIT(KTestDirection, "Direction");
sl@0
    33
const TLogDurationType KTestDurationType = 1;
sl@0
    34
const TLogDuration KTestDuration = 0x1234;
sl@0
    35
_LIT(KTestStatus, "Status");
sl@0
    36
_LIT(KTestSubject, "Subject");
sl@0
    37
_LIT(KTestNumber, "Number");
sl@0
    38
const TLogContactItemId KTestContact = 0x1234;
sl@0
    39
const TLogLink KTestLink = 0x1234;
sl@0
    40
_LIT8(KTestData, "ABCDEFGH");
sl@0
    41
_LIT(KTestNumber1, "TheNumber");
sl@0
    42
_LIT(KTestNumber2, "Changed Number");
sl@0
    43
sl@0
    44
class TClientObserverTestReceiver : public MLogClientChangeObserver
sl@0
    45
	{
sl@0
    46
public:
sl@0
    47
	TClientObserverTestReceiver(TBool& aFlag) : iCallCount(0), iFlag(aFlag) { }
sl@0
    48
sl@0
    49
public:
sl@0
    50
	void HandleLogClientChangeEventL(TUid aChangeType, TInt /*aChangeParam1*/, TInt /*aChangeParam2*/, TInt /*aChangeParam3*/)
sl@0
    51
		{
sl@0
    52
		++iCallCount;
sl@0
    53
		iFlag = (aChangeType == KLogClientChangeEventRefreshView);
sl@0
    54
		}
sl@0
    55
	inline TInt CallCount() const { return iCallCount; }
sl@0
    56
	inline void Reset() { iCallCount = 0; iFlag = EFalse; }
sl@0
    57
sl@0
    58
private:
sl@0
    59
	TInt iCallCount;
sl@0
    60
	TBool& iFlag;
sl@0
    61
	};
sl@0
    62
	
sl@0
    63
LOCAL_C TBool IsLogOpenL()
sl@0
    64
	{
sl@0
    65
	return TestUtils::IsDatabaseOpenL();
sl@0
    66
	}
sl@0
    67
sl@0
    68
/**
sl@0
    69
@SYMTestCaseID          SYSLIB-LOGENG-CT-0993
sl@0
    70
@SYMTestCaseDesc	    Tests for a file open
sl@0
    71
@SYMTestPriority 	    High
sl@0
    72
@SYMTestActions  	    Check for errors while testing for file open 
sl@0
    73
@SYMTestExpectedResults Test must not fail
sl@0
    74
@SYMREQ                 REQ0000
sl@0
    75
*/
sl@0
    76
LOCAL_C void TestLogOpenL()
sl@0
    77
	{
sl@0
    78
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0993 "));
sl@0
    79
	TEST(IsLogOpenL());
sl@0
    80
	}
sl@0
    81
sl@0
    82
/**
sl@0
    83
@SYMTestCaseID          SYSLIB-LOGENG-CT-0994
sl@0
    84
@SYMTestCaseDesc	    Tests for file close
sl@0
    85
@SYMTestPriority 	    High
sl@0
    86
@SYMTestActions  	    Check for errors while testing for file close
sl@0
    87
@SYMTestExpectedResults Test must not fail
sl@0
    88
@SYMREQ                 REQ0000
sl@0
    89
*/
sl@0
    90
LOCAL_C void TestLogClosedL()
sl@0
    91
	{
sl@0
    92
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0994 "));
sl@0
    93
	TEST(!IsLogOpenL());
sl@0
    94
	}
sl@0
    95
sl@0
    96
LOCAL_C void StartBackupL()
sl@0
    97
	{
sl@0
    98
	User::InfoPrint(_L("Backup"));
sl@0
    99
sl@0
   100
	TDriveUnit driveUnit(EDriveC);
sl@0
   101
	TDriveName name = driveUnit.Name();
sl@0
   102
sl@0
   103
	TParse parse;
sl@0
   104
	LEAVE_IF_ERROR(parse.Set(KLogDatabaseName, &name, NULL));
sl@0
   105
sl@0
   106
	delete theBackup;
sl@0
   107
	theBackup = NULL;
sl@0
   108
	theBackup = CBaBackupSessionWrapper::NewL();
sl@0
   109
sl@0
   110
	theBackup->CloseFileL(parse.FullName(), MBackupObserver::EReleaseLockNoAccess);
sl@0
   111
	User::After(1000000);
sl@0
   112
	}
sl@0
   113
sl@0
   114
LOCAL_C void DeleteLogDatabaseL()
sl@0
   115
	{
sl@0
   116
	User::InfoPrint(_L("delete"));
sl@0
   117
	TestUtils::DeleteDatabaseL(EFalse);
sl@0
   118
	}
sl@0
   119
sl@0
   120
LOCAL_C void EndBackupL()
sl@0
   121
	{
sl@0
   122
	delete theBackup;
sl@0
   123
	theBackup = NULL;
sl@0
   124
	User::After(1000000);
sl@0
   125
	}
sl@0
   126
sl@0
   127
LOCAL_C void DelayL(TInt aDelay)
sl@0
   128
	{
sl@0
   129
	CTestTimer* timer = CTestTimer::NewL();
sl@0
   130
	timer->After(aDelay);
sl@0
   131
	CActiveScheduler::Start();
sl@0
   132
	delete timer;
sl@0
   133
	}
sl@0
   134
sl@0
   135
sl@0
   136
const TUid KTestEventUid = {0x10005393};
sl@0
   137
_LIT(KTestEventDesc1, "Event Type Description");
sl@0
   138
_LIT(KTestEventDesc2, "Changed Event Description");
sl@0
   139
sl@0
   140
LOCAL_C void ForceClientImplInstL(CLogClient& aClient)
sl@0
   141
	{
sl@0
   142
	CLogEventType* type = CLogEventType::NewL();
sl@0
   143
	CleanupStack::PushL(type);
sl@0
   144
	type->SetUid(KTestEventUid);
sl@0
   145
	type->SetDescription(KTestEventDesc1);
sl@0
   146
	type->SetLoggingEnabled(ETrue);
sl@0
   147
	
sl@0
   148
	CTestActive* active = new(ELeave)CTestActive;
sl@0
   149
	CleanupStack::PushL(active);
sl@0
   150
	aClient.AddEventType(*type, active->iStatus);
sl@0
   151
	active->StartL();
sl@0
   152
	CActiveScheduler::Start();
sl@0
   153
	CleanupStack::PopAndDestroy(2);//type, active
sl@0
   154
	
sl@0
   155
	}
sl@0
   156
sl@0
   157
/**
sl@0
   158
@SYMTestCaseID          SYSLIB-LOGENG-CT-0995
sl@0
   159
@SYMTestCaseDesc	    Tests for starting and ending the backup session 
sl@0
   160
@SYMTestPriority 	    High
sl@0
   161
@SYMTestActions  	    Test for file open and close,start and end of the backup session
sl@0
   162
@SYMTestExpectedResults Test must not fail
sl@0
   163
@SYMREQ                 REQ0000
sl@0
   164
*/
sl@0
   165
LOCAL_C void TestLockingL()
sl@0
   166
	{
sl@0
   167
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0995 "));
sl@0
   168
	CLogClient* client = CLogClient::NewL(theFs);
sl@0
   169
	CleanupStack::PushL(client);
sl@0
   170
sl@0
   171
	ForceClientImplInstL(*client);
sl@0
   172
sl@0
   173
sl@0
   174
	DelayL(1000000);
sl@0
   175
	TestLogOpenL();
sl@0
   176
	StartBackupL();
sl@0
   177
	DelayL(1000000);
sl@0
   178
sl@0
   179
	TestLogClosedL();
sl@0
   180
sl@0
   181
	EndBackupL();
sl@0
   182
	TestLogOpenL();
sl@0
   183
sl@0
   184
	CleanupStack::PopAndDestroy(); // client
sl@0
   185
	}
sl@0
   186
sl@0
   187
/**
sl@0
   188
@SYMTestCaseID          SYSLIB-LOGENG-CT-0996
sl@0
   189
@SYMTestCaseDesc	    Tests for deleting the file when its locked
sl@0
   190
@SYMTestPriority 	    High
sl@0
   191
@SYMTestActions  	    Attempt for deleting the file when its locked
sl@0
   192
@SYMTestExpectedResults Test must not fail
sl@0
   193
@SYMREQ                 REQ0000
sl@0
   194
*/
sl@0
   195
LOCAL_C void TestDeleteWhileLockedL()
sl@0
   196
	{
sl@0
   197
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0996 "));
sl@0
   198
	CLogClient* client = CLogClient::NewL(theFs);
sl@0
   199
	CleanupStack::PushL(client);
sl@0
   200
	ForceClientImplInstL(*client);
sl@0
   201
sl@0
   202
	TestLogOpenL();
sl@0
   203
	StartBackupL();
sl@0
   204
	DelayL(1000000);
sl@0
   205
	TestLogClosedL();
sl@0
   206
sl@0
   207
	CleanupStack::PopAndDestroy(); // client
sl@0
   208
	TestLogClosedL();
sl@0
   209
sl@0
   210
	client = CLogClient::NewL(theFs);
sl@0
   211
	CleanupStack::PushL(client);
sl@0
   212
	ForceClientImplInstL(*client);
sl@0
   213
	EndBackupL();
sl@0
   214
sl@0
   215
	TestLogOpenL();
sl@0
   216
	StartBackupL();
sl@0
   217
	DelayL(1000000);
sl@0
   218
	TestLogClosedL();
sl@0
   219
	EndBackupL();
sl@0
   220
	TestLogOpenL();
sl@0
   221
sl@0
   222
	CleanupStack::PopAndDestroy(); // client
sl@0
   223
	}
sl@0
   224
sl@0
   225
/**
sl@0
   226
@SYMTestCaseID          SYSLIB-LOGENG-CT-0997
sl@0
   227
@SYMTestCaseDesc	    Tests for deleting the view while its locked
sl@0
   228
@SYMTestPriority 	    High
sl@0
   229
@SYMTestActions  	    Delete the view when its locked
sl@0
   230
@SYMTestExpectedResults Test must not fail
sl@0
   231
@SYMREQ                 REQ0000
sl@0
   232
*/
sl@0
   233
LOCAL_C void TestDeleteViewWhileLockedL()
sl@0
   234
	{
sl@0
   235
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0997 "));
sl@0
   236
	CLogClient* client = CLogClient::NewL(theFs);
sl@0
   237
	CleanupStack::PushL(client);
sl@0
   238
	ForceClientImplInstL(*client);
sl@0
   239
sl@0
   240
	CLogFilter* filter = CLogFilter::NewL();
sl@0
   241
	CleanupStack::PushL(filter);
sl@0
   242
sl@0
   243
	CLogViewEvent* view = CLogViewEvent::NewL(*client);
sl@0
   244
	CleanupStack::PushL(view);
sl@0
   245
sl@0
   246
	TestLogOpenL();
sl@0
   247
	StartBackupL();
sl@0
   248
	DelayL(1000000);
sl@0
   249
	TestLogClosedL();
sl@0
   250
sl@0
   251
	CleanupStack::PopAndDestroy(3); // view, filter, client
sl@0
   252
	TestLogClosedL();
sl@0
   253
sl@0
   254
	client = CLogClient::NewL(theFs);
sl@0
   255
	CleanupStack::PushL(client);
sl@0
   256
	ForceClientImplInstL(*client);
sl@0
   257
sl@0
   258
	filter = CLogFilter::NewL();
sl@0
   259
	CleanupStack::PushL(filter);
sl@0
   260
sl@0
   261
	view = CLogViewEvent::NewL(*client);
sl@0
   262
	CleanupStack::PushL(view);
sl@0
   263
	EndBackupL();
sl@0
   264
sl@0
   265
	TestLogOpenL();
sl@0
   266
	StartBackupL();
sl@0
   267
	DelayL(1000000);
sl@0
   268
	TestLogClosedL();
sl@0
   269
	EndBackupL();
sl@0
   270
	TestLogOpenL();
sl@0
   271
sl@0
   272
	CleanupStack::PopAndDestroy(3); // view, filter, client
sl@0
   273
	}
sl@0
   274
sl@0
   275
/**
sl@0
   276
@SYMTestCaseID          SYSLIB-LOGENG-CT-0998
sl@0
   277
@SYMTestCaseDesc	    Multiple client logging test
sl@0
   278
@SYMTestPriority 	    High
sl@0
   279
@SYMTestActions  	    Open multiple clients and test for starting and ending the backup 
sl@0
   280
@SYMTestExpectedResults Test must not fail
sl@0
   281
@SYMREQ                 REQ0000
sl@0
   282
*/
sl@0
   283
LOCAL_C void TestMultipleClientLockingL()
sl@0
   284
	{
sl@0
   285
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0998 "));
sl@0
   286
	CLogClient* client1 = CLogClient::NewL(theFs);
sl@0
   287
	CleanupStack::PushL(client1);
sl@0
   288
	ForceClientImplInstL(*client1);
sl@0
   289
sl@0
   290
	TestLogOpenL();
sl@0
   291
sl@0
   292
	CLogClient* client2 = CLogClient::NewL(theFs);
sl@0
   293
	CleanupStack::PushL(client2);
sl@0
   294
	ForceClientImplInstL(*client2);
sl@0
   295
sl@0
   296
	TestLogOpenL();
sl@0
   297
sl@0
   298
	StartBackupL();
sl@0
   299
	EndBackupL();
sl@0
   300
	TestLogOpenL();
sl@0
   301
sl@0
   302
	StartBackupL();
sl@0
   303
	TestLogClosedL();
sl@0
   304
sl@0
   305
	EndBackupL();
sl@0
   306
	TestLogOpenL();
sl@0
   307
sl@0
   308
	CleanupStack::PopAndDestroy(2); // client1, client2
sl@0
   309
	}
sl@0
   310
sl@0
   311
/**
sl@0
   312
@SYMTestCaseID          SYSLIB-LOGENG-CT-0999
sl@0
   313
@SYMTestCaseDesc	    Multiple view locking test
sl@0
   314
@SYMTestPriority 	    High
sl@0
   315
@SYMTestActions  	    Open multiple views and test for starting and ending of backup
sl@0
   316
@SYMTestExpectedResults Test must not fail
sl@0
   317
@SYMREQ                 REQ0000
sl@0
   318
*/
sl@0
   319
LOCAL_C void TestMultipleViewLockingL()
sl@0
   320
	{
sl@0
   321
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0999 "));
sl@0
   322
	CLogClient* client = CLogClient::NewL(theFs);
sl@0
   323
	CleanupStack::PushL(client);
sl@0
   324
	ForceClientImplInstL(*client);
sl@0
   325
sl@0
   326
	CLogFilter* filter = CLogFilter::NewL();
sl@0
   327
	CleanupStack::PushL(filter);
sl@0
   328
sl@0
   329
	CLogViewEvent* view1 = CLogViewEvent::NewL(*client);
sl@0
   330
	CleanupStack::PushL(view1);
sl@0
   331
sl@0
   332
	CLogViewEvent* view2 = CLogViewEvent::NewL(*client);
sl@0
   333
	CleanupStack::PushL(view2);
sl@0
   334
sl@0
   335
	TestLogOpenL();
sl@0
   336
	StartBackupL();
sl@0
   337
	TestLogClosedL();
sl@0
   338
	EndBackupL();
sl@0
   339
	TestLogOpenL();
sl@0
   340
sl@0
   341
	CleanupStack::PopAndDestroy(4); // view2, view1, filter, client
sl@0
   342
	}
sl@0
   343
sl@0
   344
LOCAL_C void DoTestLogL(CLogBase& aClient, TInt aError)
sl@0
   345
	{
sl@0
   346
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   347
	CleanupStack::PushL(active);
sl@0
   348
sl@0
   349
	CLogEvent* event = CLogEvent::NewL();
sl@0
   350
	CleanupStack::PushL(event);
sl@0
   351
sl@0
   352
	TTime now;
sl@0
   353
	now.UniversalTime();
sl@0
   354
sl@0
   355
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   356
sl@0
   357
	active->StartL();
sl@0
   358
	aClient.AddEvent(*event, active->iStatus);
sl@0
   359
	CActiveScheduler::Start();
sl@0
   360
	TEST2(active->iStatus.Int(), aError);
sl@0
   361
sl@0
   362
	if (aError == KErrNone)
sl@0
   363
		{
sl@0
   364
		TEST(event->EventType() == KLogCallEventTypeUid);
sl@0
   365
		TEST(event->Description().Length() > 0);
sl@0
   366
		TEST(event->Time() >= now);
sl@0
   367
		now = event->Time();
sl@0
   368
		}
sl@0
   369
	else
sl@0
   370
		{
sl@0
   371
		// User a dummy id to prevent assertion
sl@0
   372
		event->SetId(123);
sl@0
   373
		}
sl@0
   374
sl@0
   375
	TLogId id = event->Id();
sl@0
   376
sl@0
   377
	event->SetRemoteParty(KTestRemoteParty);
sl@0
   378
	event->SetDirection(KTestDirection);
sl@0
   379
	event->SetDurationType(KTestDurationType);
sl@0
   380
	event->SetDuration(KTestDuration);
sl@0
   381
	event->SetStatus(KTestStatus);
sl@0
   382
	event->SetSubject(KTestSubject);
sl@0
   383
	event->SetNumber(KTestNumber);
sl@0
   384
	event->SetContact(KTestContact);
sl@0
   385
	event->SetLink(KTestLink);
sl@0
   386
	event->SetDataL(KTestData);
sl@0
   387
sl@0
   388
	active->StartL();
sl@0
   389
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
   390
	CActiveScheduler::Start();
sl@0
   391
	TEST2(active->iStatus.Int(), aError);
sl@0
   392
sl@0
   393
	if (aError == KErrNone)
sl@0
   394
		{
sl@0
   395
		TEST(event->Id() == id);
sl@0
   396
		TEST(event->EventType() == KLogCallEventTypeUid);
sl@0
   397
		TEST(event->Description().Length() > 0);
sl@0
   398
		TEST(event->Time() == now);
sl@0
   399
		TEST(event->RemoteParty() == KTestRemoteParty);
sl@0
   400
		TEST(event->Direction() == KTestDirection);
sl@0
   401
		TEST(event->DurationType() == KTestDurationType);
sl@0
   402
		TEST(event->Duration() == KTestDuration);
sl@0
   403
		TEST(event->Status() == KTestStatus);
sl@0
   404
		TEST(event->Subject() == KTestSubject);
sl@0
   405
		TEST(event->Number() == KTestNumber);
sl@0
   406
		TEST(event->Contact() == KTestContact);
sl@0
   407
		TEST(event->Link() == KTestLink);
sl@0
   408
		TEST(event->Data() == KTestData);
sl@0
   409
		}
sl@0
   410
sl@0
   411
	CleanupStack::PopAndDestroy(); // event;
sl@0
   412
sl@0
   413
	event = CLogEvent::NewL();
sl@0
   414
	CleanupStack::PushL(event);
sl@0
   415
sl@0
   416
	event->SetId(id);
sl@0
   417
sl@0
   418
	active->StartL();
sl@0
   419
	aClient.GetEvent(*event, active->iStatus);
sl@0
   420
	CActiveScheduler::Start();
sl@0
   421
	TEST2(active->iStatus.Int(), aError);
sl@0
   422
sl@0
   423
	if (aError == KErrNone)
sl@0
   424
		{
sl@0
   425
		TEST(event->Id() == id);
sl@0
   426
		TEST(event->EventType() == KLogCallEventTypeUid);
sl@0
   427
		TEST(event->Description().Length() > 0);
sl@0
   428
		TEST(event->Time() == now);
sl@0
   429
		TEST(event->RemoteParty() == KTestRemoteParty);
sl@0
   430
		TEST(event->Direction() == KTestDirection);
sl@0
   431
		TEST(event->DurationType() == KTestDurationType);
sl@0
   432
		TEST(event->Duration() == KTestDuration);
sl@0
   433
		TEST(event->Status() == KTestStatus);
sl@0
   434
		TEST(event->Subject() == KTestSubject);
sl@0
   435
		TEST(event->Number() == KTestNumber);
sl@0
   436
		TEST(event->Contact() == KTestContact);
sl@0
   437
		TEST(event->Link() == KTestLink);
sl@0
   438
		TEST(event->Data() == KTestData);
sl@0
   439
		}
sl@0
   440
sl@0
   441
	active->StartL();
sl@0
   442
	aClient.DeleteEvent(id, active->iStatus);
sl@0
   443
	CActiveScheduler::Start();
sl@0
   444
	TEST2(active->iStatus.Int(), aError);
sl@0
   445
sl@0
   446
	active->StartL();
sl@0
   447
	aClient.GetEvent(*event, active->iStatus);
sl@0
   448
	CActiveScheduler::Start();
sl@0
   449
	TheTest.Printf(_L("*** active->iStatus.Int()=%d\n"), active->iStatus.Int());
sl@0
   450
	TEST(active->iStatus.Int() == aError || active->iStatus.Int() == KErrNotFound);
sl@0
   451
sl@0
   452
	CleanupStack::PopAndDestroy(2); // event, active
sl@0
   453
	}
sl@0
   454
sl@0
   455
/**
sl@0
   456
@SYMTestCaseID          SYSLIB-LOGENG-CT-1000
sl@0
   457
@SYMTestCaseDesc	    Client requests test
sl@0
   458
@SYMTestPriority 	    High
sl@0
   459
@SYMTestActions  	    Tests for client requests when the file is opened and check for no errors
sl@0
   460
						Tests for client requests when the file is closed and check for access denied errors
sl@0
   461
						Re-test for client requests when file is opened and check for no errors
sl@0
   462
@SYMTestExpectedResults Test must not fail
sl@0
   463
@SYMREQ                 REQ0000
sl@0
   464
*/
sl@0
   465
LOCAL_C void TestClientRequestsL()
sl@0
   466
	{
sl@0
   467
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1000 "));
sl@0
   468
	CLogClient* client1 = CLogClient::NewL(theFs);
sl@0
   469
	CleanupStack::PushL(client1);
sl@0
   470
	ForceClientImplInstL(*client1);
sl@0
   471
sl@0
   472
	TestLogOpenL();
sl@0
   473
sl@0
   474
	CLogClient* client2 = CLogClient::NewL(theFs);
sl@0
   475
	CleanupStack::PushL(client2);
sl@0
   476
	ForceClientImplInstL(*client2);
sl@0
   477
sl@0
   478
	TestLogOpenL();
sl@0
   479
sl@0
   480
	DoTestLogL(*client1, KErrNone);
sl@0
   481
	DoTestLogL(*client2, KErrNone);
sl@0
   482
sl@0
   483
	StartBackupL();
sl@0
   484
	DelayL(1000000);
sl@0
   485
	TestLogClosedL();
sl@0
   486
sl@0
   487
	DoTestLogL(*client1, KErrAccessDenied);
sl@0
   488
	DoTestLogL(*client2, KErrAccessDenied);
sl@0
   489
sl@0
   490
	EndBackupL();
sl@0
   491
	TestLogOpenL();
sl@0
   492
sl@0
   493
	DoTestLogL(*client1, KErrNone);
sl@0
   494
	DoTestLogL(*client2, KErrNone);
sl@0
   495
sl@0
   496
	CleanupStack::PopAndDestroy(2); // client1, client2
sl@0
   497
	}
sl@0
   498
sl@0
   499
/**
sl@0
   500
@SYMTestCaseID          SYSLIB-LOGENG-CT-1001
sl@0
   501
@SYMTestCaseDesc	    Tests for notification changes
sl@0
   502
@SYMTestPriority 	    High
sl@0
   503
@SYMTestActions  	    Set up for client log notification changes.
sl@0
   504
                        Change the log and unlock the log.Try and change the log again and check for access denied error.
sl@0
   505
@SYMTestExpectedResults Test must not fail
sl@0
   506
@SYMREQ                 REQ0000
sl@0
   507
*/
sl@0
   508
LOCAL_C void TestNotificationsL()
sl@0
   509
	{
sl@0
   510
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1001 "));
sl@0
   511
	CTestActive* notify = new(ELeave)CTestActive;
sl@0
   512
	CleanupStack::PushL(notify);
sl@0
   513
sl@0
   514
	CTestTimer* timer = CTestTimer::NewL();
sl@0
   515
	CleanupStack::PushL(timer);
sl@0
   516
sl@0
   517
	CLogClient* client = CLogClient::NewL(theFs);
sl@0
   518
	CleanupStack::PushL(client);
sl@0
   519
	ForceClientImplInstL(*client);
sl@0
   520
	EndBackupL();
sl@0
   521
sl@0
   522
	// Setup change notification
sl@0
   523
	notify->StartL();
sl@0
   524
	client->NotifyChange(10000000, notify->iStatus);
sl@0
   525
sl@0
   526
	// Wait a second
sl@0
   527
	timer->After(1000000);
sl@0
   528
	CActiveScheduler::Start();
sl@0
   529
sl@0
   530
	// Change the log
sl@0
   531
	DoTestLogL(*client, KErrNone);
sl@0
   532
sl@0
   533
	// Unlock the log
sl@0
   534
	TestLogOpenL();
sl@0
   535
	StartBackupL();
sl@0
   536
	DelayL(1000000);
sl@0
   537
	TestLogClosedL();
sl@0
   538
sl@0
   539
	// Try and change the log again
sl@0
   540
	DoTestLogL(*client, KErrAccessDenied);
sl@0
   541
sl@0
   542
	// Make sure the notifier doesn't complete
sl@0
   543
	timer->After(15000000);
sl@0
   544
	CActiveScheduler::Start();
sl@0
   545
	TEST(notify->IsActive());
sl@0
   546
sl@0
   547
	// Lock the log
sl@0
   548
	EndBackupL();
sl@0
   549
	TestLogOpenL();
sl@0
   550
sl@0
   551
	// Wait for notification
sl@0
   552
	CActiveScheduler::Start();
sl@0
   553
	TEST(!notify->IsActive());
sl@0
   554
sl@0
   555
	// Setup change notification
sl@0
   556
	notify->StartL();
sl@0
   557
	client->NotifyChange(10000000, notify->iStatus);
sl@0
   558
sl@0
   559
	// Wait a second
sl@0
   560
	timer->After(1000000);
sl@0
   561
	CActiveScheduler::Start();
sl@0
   562
sl@0
   563
	// Unlock the log
sl@0
   564
	TestLogOpenL();
sl@0
   565
	StartBackupL();
sl@0
   566
	DelayL(1000000);
sl@0
   567
	TestLogClosedL();
sl@0
   568
sl@0
   569
	// Check notification is completed when client destroyed
sl@0
   570
	TEST(notify->IsActive());
sl@0
   571
	CleanupStack::PopAndDestroy(client);
sl@0
   572
sl@0
   573
	// Wait for notification
sl@0
   574
	CActiveScheduler::Start();	
sl@0
   575
	TEST(!notify->IsActive());
sl@0
   576
	TEST2(notify->iStatus.Int(), KErrCancel);
sl@0
   577
sl@0
   578
	// Recreate client
sl@0
   579
	client = CLogClient::NewL(theFs);
sl@0
   580
	CleanupStack::PushL(client);
sl@0
   581
sl@0
   582
	// Setup change notification
sl@0
   583
	notify->StartL();
sl@0
   584
	client->NotifyChange(10000000, notify->iStatus);
sl@0
   585
sl@0
   586
	// Wait a second
sl@0
   587
	timer->After(1000000);
sl@0
   588
	CActiveScheduler::Start();
sl@0
   589
sl@0
   590
	// Check notification is completed when cancelled
sl@0
   591
	TEST(notify->IsActive());
sl@0
   592
	client->NotifyChangeCancel();
sl@0
   593
sl@0
   594
	// Wait for notification
sl@0
   595
	CActiveScheduler::Start();	
sl@0
   596
	TEST(!notify->IsActive());
sl@0
   597
	TEST2(notify->iStatus.Int(), KErrCancel);
sl@0
   598
sl@0
   599
	// Setup change notification
sl@0
   600
	notify->StartL();
sl@0
   601
	client->NotifyChange(10000000, notify->iStatus);
sl@0
   602
sl@0
   603
	// Wait a second
sl@0
   604
	timer->After(1000000);
sl@0
   605
	CActiveScheduler::Start();
sl@0
   606
sl@0
   607
	// Lock the log
sl@0
   608
	EndBackupL();
sl@0
   609
	TestLogOpenL();
sl@0
   610
sl@0
   611
	// Wait for notification
sl@0
   612
	TEST(notify->IsActive());
sl@0
   613
	CActiveScheduler::Start();	
sl@0
   614
	TEST(!notify->IsActive());
sl@0
   615
	TEST(notify->iStatus >= 0);
sl@0
   616
sl@0
   617
	notify->StartL();
sl@0
   618
	client->NotifyChange(10000000, notify->iStatus);
sl@0
   619
sl@0
   620
	// Wait a second
sl@0
   621
	timer->After(1000000);
sl@0
   622
	CActiveScheduler::Start();
sl@0
   623
sl@0
   624
	// Change the log
sl@0
   625
	DoTestLogL(*client, KErrNone);
sl@0
   626
sl@0
   627
	// Wait for notification
sl@0
   628
	TEST(notify->IsActive());
sl@0
   629
	CActiveScheduler::Start();	
sl@0
   630
	TEST(!notify->IsActive());
sl@0
   631
	TEST(notify->iStatus >= 0);
sl@0
   632
sl@0
   633
	CleanupStack::PopAndDestroy(3); // client, timer, notify
sl@0
   634
	}
sl@0
   635
sl@0
   636
/**
sl@0
   637
@SYMTestCaseID          SYSLIB-LOGENG-CT-1002
sl@0
   638
@SYMTestCaseDesc	    Tests for request in progress
sl@0
   639
@SYMTestPriority 	    High
sl@0
   640
@SYMTestActions  	    Add an event when backup is started and check for access denied error
sl@0
   641
@SYMTestExpectedResults Test must not fail
sl@0
   642
@SYMREQ                 REQ0000
sl@0
   643
*/
sl@0
   644
LOCAL_C void TestRequestInProgressL()
sl@0
   645
	{
sl@0
   646
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1002 "));
sl@0
   647
	CLogClient* client = CLogClient::NewL(theFs);
sl@0
   648
	CleanupStack::PushL(client);
sl@0
   649
	ForceClientImplInstL(*client);
sl@0
   650
	EndBackupL();
sl@0
   651
sl@0
   652
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   653
	CleanupStack::PushL(active);
sl@0
   654
sl@0
   655
	CLogEvent* event = CLogEvent::NewL();
sl@0
   656
	CleanupStack::PushL(event);
sl@0
   657
sl@0
   658
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   659
sl@0
   660
	active->StartL();
sl@0
   661
	client->AddEvent(*event, active->iStatus);
sl@0
   662
	StartBackupL();
sl@0
   663
	CActiveScheduler::Start();
sl@0
   664
	TEST2(active->iStatus.Int(), KErrAccessDenied);
sl@0
   665
	DelayL(1000000);
sl@0
   666
sl@0
   667
	// User a dummy id to prevent assertion
sl@0
   668
	event->SetId(123);
sl@0
   669
sl@0
   670
	EndBackupL();
sl@0
   671
	active->StartL();
sl@0
   672
	client->ChangeEvent(*event, active->iStatus);
sl@0
   673
	StartBackupL();
sl@0
   674
sl@0
   675
	CActiveScheduler::Start();
sl@0
   676
	TEST2(active->iStatus.Int(), KErrAccessDenied);
sl@0
   677
	DelayL(1000000);
sl@0
   678
sl@0
   679
	EndBackupL();
sl@0
   680
	active->StartL();
sl@0
   681
	client->GetEvent(*event, active->iStatus);
sl@0
   682
	StartBackupL();
sl@0
   683
sl@0
   684
	CActiveScheduler::Start();
sl@0
   685
	TEST2(active->iStatus.Int(), KErrAccessDenied);
sl@0
   686
	DelayL(1000000);
sl@0
   687
sl@0
   688
	EndBackupL();
sl@0
   689
	active->StartL();
sl@0
   690
	client->DeleteEvent(event->Id(), active->iStatus);
sl@0
   691
	StartBackupL();
sl@0
   692
sl@0
   693
	CActiveScheduler::Start();
sl@0
   694
	TEST2(active->iStatus.Int(), KErrAccessDenied);
sl@0
   695
	DelayL(1000000);
sl@0
   696
sl@0
   697
	EndBackupL();
sl@0
   698
	active->StartL();
sl@0
   699
	client->GetEvent(*event, active->iStatus);
sl@0
   700
	StartBackupL();
sl@0
   701
sl@0
   702
	CActiveScheduler::Start();
sl@0
   703
	TEST2(active->iStatus.Int(), KErrAccessDenied);
sl@0
   704
	DelayL(1000000);
sl@0
   705
sl@0
   706
	// Check the log is useable
sl@0
   707
	EndBackupL();
sl@0
   708
	DoTestLogL(*client, KErrNone);
sl@0
   709
sl@0
   710
	CleanupStack::PopAndDestroy(3); // client, event, active
sl@0
   711
	}
sl@0
   712
sl@0
   713
/**
sl@0
   714
@SYMTestCaseID          SYSLIB-LOGENG-CT-1003
sl@0
   715
@SYMTestCaseDesc	    Tests for log view when request is in progress
sl@0
   716
@SYMTestPriority 	    High
sl@0
   717
@SYMTestActions  	    Add events to the log,set a filter on log view and start the backup session 
sl@0
   718
                        and check for the request status for access denied.
sl@0
   719
@SYMTestExpectedResults Test must not fail
sl@0
   720
@SYMREQ                 REQ0000
sl@0
   721
*/
sl@0
   722
LOCAL_C void TestViewRequestInProgressL()
sl@0
   723
	{
sl@0
   724
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1003 "));
sl@0
   725
	CLogClient* client = CLogClient::NewL(theFs);
sl@0
   726
	CleanupStack::PushL(client);
sl@0
   727
	ForceClientImplInstL(*client);
sl@0
   728
	EndBackupL();
sl@0
   729
sl@0
   730
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   731
	CleanupStack::PushL(active);
sl@0
   732
sl@0
   733
	CLogFilter* filter = CLogFilter::NewL();
sl@0
   734
	CleanupStack::PushL(filter);
sl@0
   735
sl@0
   736
	CLogViewEvent* view = CLogViewEvent::NewL(*client);
sl@0
   737
	CleanupStack::PushL(view);
sl@0
   738
sl@0
   739
	CLogEvent* event = CLogEvent::NewL();
sl@0
   740
	CleanupStack::PushL(event);
sl@0
   741
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   742
sl@0
   743
	active->StartL();
sl@0
   744
	client->AddEvent(*event, active->iStatus);
sl@0
   745
	CActiveScheduler::Start();
sl@0
   746
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   747
sl@0
   748
	active->StartL();
sl@0
   749
	client->AddEvent(*event, active->iStatus);
sl@0
   750
	CActiveScheduler::Start();
sl@0
   751
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   752
sl@0
   753
	TestLogOpenL();
sl@0
   754
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
   755
	active->StartL();
sl@0
   756
	StartBackupL();
sl@0
   757
sl@0
   758
	CActiveScheduler::Start();
sl@0
   759
	TEST2(active->iStatus.Int(), KErrAccessDenied);
sl@0
   760
	DelayL(1000000);
sl@0
   761
	TestLogClosedL();
sl@0
   762
sl@0
   763
	EndBackupL();
sl@0
   764
	TestLogOpenL();
sl@0
   765
sl@0
   766
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
   767
	active->StartL();
sl@0
   768
	CActiveScheduler::Start();
sl@0
   769
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   770
	
sl@0
   771
	TEST(view->NextL(active->iStatus));
sl@0
   772
	active->StartL();
sl@0
   773
	StartBackupL();
sl@0
   774
sl@0
   775
	CActiveScheduler::Start();
sl@0
   776
	TEST2(active->iStatus.Int(), KErrAccessDenied);
sl@0
   777
	DelayL(1000000);
sl@0
   778
	TestLogClosedL();
sl@0
   779
sl@0
   780
	EndBackupL();
sl@0
   781
	TestLogOpenL();
sl@0
   782
sl@0
   783
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
   784
	active->StartL();
sl@0
   785
	CActiveScheduler::Start();
sl@0
   786
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   787
	
sl@0
   788
	TEST(view->NextL(active->iStatus));
sl@0
   789
	active->StartL();
sl@0
   790
	CActiveScheduler::Start();
sl@0
   791
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   792
sl@0
   793
	// Now check a view is no longer valid after a backup
sl@0
   794
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
   795
	active->StartL();
sl@0
   796
	CActiveScheduler::Start();
sl@0
   797
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   798
	TEST(view->CountL() > 1);
sl@0
   799
sl@0
   800
	StartBackupL();
sl@0
   801
	EndBackupL();
sl@0
   802
sl@0
   803
	DelayL(1000000);
sl@0
   804
sl@0
   805
	// Check the view can be setup again
sl@0
   806
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
   807
	active->StartL();
sl@0
   808
	CActiveScheduler::Start();
sl@0
   809
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   810
	TEST(view->CountL() > 1);
sl@0
   811
sl@0
   812
	TEST(view->NextL(active->iStatus));
sl@0
   813
	active->StartL();
sl@0
   814
	CActiveScheduler::Start();
sl@0
   815
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   816
sl@0
   817
	CleanupStack::PopAndDestroy(5); // event, view, filter, active, client
sl@0
   818
	}
sl@0
   819
sl@0
   820
/**
sl@0
   821
@SYMTestCaseID          SYSLIB-LOGENG-CT-1004
sl@0
   822
@SYMTestCaseDesc	    Tests for view event log
sl@0
   823
@SYMTestPriority 	    High
sl@0
   824
@SYMTestActions  	    Create an event type and add the event to the log.
sl@0
   825
                        Close the log and try setting the filter on view.Check for access denied error.
sl@0
   826
						Repeat the operation after opening the log and check for no error
sl@0
   827
@SYMTestExpectedResults Test must not fail
sl@0
   828
@SYMREQ                 REQ0000
sl@0
   829
*/
sl@0
   830
LOCAL_C void TestViewSetup1L()
sl@0
   831
	{
sl@0
   832
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1004 "));
sl@0
   833
	CLogClient* client = CLogClient::NewL(theFs);
sl@0
   834
	CleanupStack::PushL(client);
sl@0
   835
	ForceClientImplInstL(*client);
sl@0
   836
	EndBackupL();
sl@0
   837
sl@0
   838
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   839
	CleanupStack::PushL(active);
sl@0
   840
sl@0
   841
	CLogFilter* filter = CLogFilter::NewL();
sl@0
   842
	CleanupStack::PushL(filter);
sl@0
   843
sl@0
   844
	CLogViewEvent* view = CLogViewEvent::NewL(*client);
sl@0
   845
	CleanupStack::PushL(view);
sl@0
   846
sl@0
   847
	CLogEvent* event = CLogEvent::NewL();
sl@0
   848
	CleanupStack::PushL(event);
sl@0
   849
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   850
sl@0
   851
	active->StartL();
sl@0
   852
	client->AddEvent(*event, active->iStatus);
sl@0
   853
	CActiveScheduler::Start();
sl@0
   854
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   855
sl@0
   856
	TestLogOpenL();
sl@0
   857
	StartBackupL();
sl@0
   858
	DelayL(1000000);
sl@0
   859
	TestLogClosedL();
sl@0
   860
sl@0
   861
	TRAPD(error, view->SetFilterL(*filter, active->iStatus));
sl@0
   862
	TEST2(error, KErrAccessDenied);
sl@0
   863
sl@0
   864
	EndBackupL();
sl@0
   865
	TestLogOpenL();
sl@0
   866
sl@0
   867
	DelayL(1000000);
sl@0
   868
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
   869
	active->StartL();
sl@0
   870
	CActiveScheduler::Start();
sl@0
   871
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   872
sl@0
   873
	StartBackupL();
sl@0
   874
	DelayL(1000000);
sl@0
   875
	TestLogClosedL();
sl@0
   876
	//
sl@0
   877
	CleanupStack::PopAndDestroy(5); // event, view, filter, active, client
sl@0
   878
	}
sl@0
   879
sl@0
   880
/**
sl@0
   881
@SYMTestCaseID          SYSLIB-LOGENG-CT-1005
sl@0
   882
@SYMTestCaseDesc	    Tests for view event log
sl@0
   883
@SYMTestPriority 	    High
sl@0
   884
@SYMTestActions  	    Create an event type and add the event to the log.
sl@0
   885
                        Close the log and try setting the filter on view twice with an interval of one second.Check for access denied errors.
sl@0
   886
						Repeat the operation after opening the log and check for no error
sl@0
   887
@SYMTestExpectedResults Test must not fail
sl@0
   888
@SYMREQ                 REQ0000
sl@0
   889
*/
sl@0
   890
LOCAL_C void TestViewSetup2L()
sl@0
   891
 	{
sl@0
   892
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1005 "));
sl@0
   893
 	CLogClient* client = CLogClient::NewL(theFs);
sl@0
   894
 	CleanupStack::PushL(client);
sl@0
   895
 	ForceClientImplInstL(*client);
sl@0
   896
 	EndBackupL();
sl@0
   897
 
sl@0
   898
 	CTestActive* active = new(ELeave)CTestActive();
sl@0
   899
 	CleanupStack::PushL(active);
sl@0
   900
 
sl@0
   901
 	CLogFilter* filter = CLogFilter::NewL();
sl@0
   902
 	CleanupStack::PushL(filter);
sl@0
   903
 
sl@0
   904
 	CLogViewEvent* view = CLogViewEvent::NewL(*client);
sl@0
   905
 	CleanupStack::PushL(view);
sl@0
   906
 
sl@0
   907
 	CLogEvent* event = CLogEvent::NewL();
sl@0
   908
 	CleanupStack::PushL(event);
sl@0
   909
 	event->SetEventType(KLogCallEventTypeUid);
sl@0
   910
 
sl@0
   911
 	active->StartL();
sl@0
   912
 	client->AddEvent(*event, active->iStatus);
sl@0
   913
 	CActiveScheduler::Start();
sl@0
   914
 	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   915
 
sl@0
   916
 	DelayL(1000000);
sl@0
   917
 	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
   918
 	active->StartL();
sl@0
   919
 	CActiveScheduler::Start();
sl@0
   920
 	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   921
 
sl@0
   922
 	TestLogOpenL();
sl@0
   923
 	StartBackupL();
sl@0
   924
 	TestLogClosedL();
sl@0
   925
 
sl@0
   926
 	TRAPD(error, view->SetFilterL(*filter, active->iStatus));
sl@0
   927
 	TEST2(error, KErrAccessDenied);
sl@0
   928
 
sl@0
   929
 	DelayL(1000000);
sl@0
   930
 
sl@0
   931
 	TRAP(error, view->SetFilterL(*filter, active->iStatus));
sl@0
   932
 	TEST2(error, KErrAccessDenied);
sl@0
   933
 
sl@0
   934
 	EndBackupL();
sl@0
   935
 	TestLogOpenL();
sl@0
   936
 
sl@0
   937
 //	DelayL(1000000);
sl@0
   938
 	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
   939
 	active->StartL();
sl@0
   940
 	CActiveScheduler::Start();
sl@0
   941
 	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   942
 
sl@0
   943
 	StartBackupL();
sl@0
   944
 	DelayL(1000000);
sl@0
   945
 	TestLogClosedL();
sl@0
   946
 	//
sl@0
   947
 	CleanupStack::PopAndDestroy(5); // event, view, filter, active, client
sl@0
   948
 	}
sl@0
   949
sl@0
   950
/**
sl@0
   951
Check that a KLogClientChangeEventRefreshView message is sent if the database is changed
sl@0
   952
during a backup.  This could occur if the database is restored.
sl@0
   953
 
sl@0
   954
This was added to test the fix for DEF051602 - Problems with MLogViewChangeObserver when a backup occurs
sl@0
   955
sl@0
   956
@SYMTestCaseID          SYSLIB-LOGENG-CT-1006
sl@0
   957
@SYMTestCaseDesc	    Check for any problems with MLogViewChangeObserver when a backup occurs
sl@0
   958
@SYMTestPriority 	    High
sl@0
   959
@SYMTestActions  	    Check that a KLogClientChangeEventRefreshView message is sent if the database is changed
sl@0
   960
						during a backup.  This could occur if the database is restored.
sl@0
   961
@SYMTestExpectedResults Test must not fail
sl@0
   962
@SYMREQ                 REQ0000
sl@0
   963
*/
sl@0
   964
LOCAL_C void TestRefreshViewL()
sl@0
   965
{
sl@0
   966
    TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1006 "));
sl@0
   967
	CLogClient* client = CLogClient::NewL(theFs);
sl@0
   968
	CleanupStack::PushL(client);
sl@0
   969
sl@0
   970
	// Create a test observer MLogClientChangeObserver
sl@0
   971
	TBool logRefreshViewFlag = EFalse;
sl@0
   972
	TClientObserverTestReceiver testReceiver(logRefreshViewFlag);
sl@0
   973
	client->SetGlobalChangeObserverL(&testReceiver);
sl@0
   974
sl@0
   975
	// start a backup
sl@0
   976
	TestLogOpenL();
sl@0
   977
	StartBackupL();
sl@0
   978
	DelayL(1000000);
sl@0
   979
	TestLogClosedL();
sl@0
   980
	
sl@0
   981
	// delete the database so a new empty db will be created
sl@0
   982
	// This will cause a KLogClientChangeEventRefreshViewRefresh 
sl@0
   983
	// message to be sent
sl@0
   984
	DeleteLogDatabaseL();
sl@0
   985
sl@0
   986
	// end the backup
sl@0
   987
	EndBackupL();
sl@0
   988
	DelayL(1000000);
sl@0
   989
	
sl@0
   990
sl@0
   991
	// check the obsever hs recieved a message
sl@0
   992
	TEST(logRefreshViewFlag);
sl@0
   993
	// 
sl@0
   994
	
sl@0
   995
	CleanupStack::PopAndDestroy(client);
sl@0
   996
}
sl@0
   997
sl@0
   998
sl@0
   999
#endif//__WINS__
sl@0
  1000
/////////////////////////////////////////////////////////////////////////////////////
sl@0
  1001
/////////////////////////////////////////////////////////////////////////////////////
sl@0
  1002
/////////////////////////////////////////////////////////////////////////////////////
sl@0
  1003
sl@0
  1004
void doTestsL()
sl@0
  1005
	{
sl@0
  1006
	TestUtils::Initialize(_L("t_logbackup"));
sl@0
  1007
	TestUtils::DeleteDatabaseL();
sl@0
  1008
sl@0
  1009
    TheTest.Start(_L("t_logbackup"));
sl@0
  1010
	
sl@0
  1011
#ifndef __WINS__
sl@0
  1012
	TheTest.Printf(_L("This test harness will only work on WINS\n"));
sl@0
  1013
	User::After(5000000);
sl@0
  1014
#else//__WINS__
sl@0
  1015
	CLogChangeNotifier* notifier = CLogChangeNotifier::NewL();
sl@0
  1016
	CleanupStack::PushL(notifier);
sl@0
  1017
sl@0
  1018
	TheTest.Next(_L("Locking"));
sl@0
  1019
	TestLockingL();
sl@0
  1020
	theLog.Write(_L8("Test 1 OK\n"));
sl@0
  1021
sl@0
  1022
	TheTest.Next(_L("Delete client while locked"));
sl@0
  1023
	TestDeleteWhileLockedL();
sl@0
  1024
	theLog.Write(_L8("Test 2 OK\n"));
sl@0
  1025
sl@0
  1026
	TheTest.Next(_L("Delete view while locked"));
sl@0
  1027
	TestDeleteViewWhileLockedL();
sl@0
  1028
	theLog.Write(_L8("Test 3 OK\n"));
sl@0
  1029
sl@0
  1030
	TheTest.Next(_L("Multiple clients"));
sl@0
  1031
	TestMultipleClientLockingL();
sl@0
  1032
	theLog.Write(_L8("Test 4 OK\n"));
sl@0
  1033
sl@0
  1034
	TheTest.Next(_L("Multiple views"));
sl@0
  1035
	TestMultipleViewLockingL();
sl@0
  1036
	theLog.Write(_L8("Test 5 OK\n"));
sl@0
  1037
sl@0
  1038
	TheTest.Next(_L("Client Requests"));
sl@0
  1039
	TestClientRequestsL();
sl@0
  1040
	theLog.Write(_L8("Test 6 OK\n"));
sl@0
  1041
sl@0
  1042
	TheTest.Next(_L("View setup"));
sl@0
  1043
	TestViewSetup1L();
sl@0
  1044
	TestViewSetup2L();
sl@0
  1045
	theLog.Write(_L8("Test 7 OK\n"));
sl@0
  1046
sl@0
  1047
	TheTest.Next(_L("Notifications"));
sl@0
  1048
	TestNotificationsL();
sl@0
  1049
	theLog.Write(_L8("Test 8 OK\n"));
sl@0
  1050
sl@0
  1051
	TheTest.Next(_L("Request in progress"));
sl@0
  1052
	TestRequestInProgressL();
sl@0
  1053
	theLog.Write(_L8("Test 9 OK\n"));
sl@0
  1054
sl@0
  1055
	TheTest.Next(_L("View request in progress"));
sl@0
  1056
	TestViewRequestInProgressL();
sl@0
  1057
	theLog.Write(_L8("Test 10 OK\n"));
sl@0
  1058
sl@0
  1059
	TheTest.Next(_L("Refresh view"));
sl@0
  1060
	TestRefreshViewL();
sl@0
  1061
	theLog.Write(_L8("Test 11 OK\n"));
sl@0
  1062
sl@0
  1063
	CleanupStack::PopAndDestroy(notifier);
sl@0
  1064
#endif//__WINS__
sl@0
  1065
	}