os/persistentdata/traceservices/commsdebugutility/TE_commsdebugutility/src/step_028_xx.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) 2003-2009 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
// See the test specification for details of what these test cases do.
sl@0
    15
sl@0
    16
#include "teststepcomsdbg.h"
sl@0
    17
#include "TestMessage.h"
sl@0
    18
#include "step_028_xx.h"
sl@0
    19
sl@0
    20
sl@0
    21
#include <comms-infras/commsdebugutility.h>
sl@0
    22
sl@0
    23
const TInt KWaitForFloggerShutdown = 2000000;
sl@0
    24
const TInt KMultipleWriteStressTimes = 100;
sl@0
    25
sl@0
    26
/**
sl@0
    27
* 028_Sync_Setup - creates flogger.ini to include token "synchronous"
sl@0
    28
* doTestStep returns whether test case passed or failed.
sl@0
    29
*/ 
sl@0
    30
sl@0
    31
sl@0
    32
CFloggerTest028_Sync_Setup::CFloggerTest028_Sync_Setup()
sl@0
    33
	{
sl@0
    34
	// Store the name of this test case
sl@0
    35
	SetTestStepName(_L("step_028_Sync_Setup"));
sl@0
    36
	}
sl@0
    37
sl@0
    38
sl@0
    39
CFloggerTest028_Sync_Setup::~CFloggerTest028_Sync_Setup()
sl@0
    40
	{
sl@0
    41
	}
sl@0
    42
sl@0
    43
sl@0
    44
sl@0
    45
TVerdict CFloggerTest028_Sync_Setup::doTestStepL( )
sl@0
    46
	{
sl@0
    47
	if ( executeStepL() == KErrNone  )
sl@0
    48
		SetTestStepResult(EPass);
sl@0
    49
sl@0
    50
	else
sl@0
    51
		SetTestStepResult(EFail);
sl@0
    52
sl@0
    53
	
sl@0
    54
	return TestStepResult();
sl@0
    55
	}
sl@0
    56
sl@0
    57
sl@0
    58
TInt CFloggerTest028_Sync_Setup::executeStepL(TBool)
sl@0
    59
	{
sl@0
    60
	return KErrGeneral;
sl@0
    61
	}
sl@0
    62
sl@0
    63
TInt CFloggerTest028_Sync_Setup::executeStepL()
sl@0
    64
	{
sl@0
    65
	TInt ret;
sl@0
    66
	RFileLogger flogger;
sl@0
    67
	flogger.Connect();
sl@0
    68
	flogger.__DbgShutDownServer();
sl@0
    69
	flogger.Close();
sl@0
    70
	User::After(KWaitForFloggerShutdown);
sl@0
    71
	TRAP(ret,constructFloggerIniL(KSyncTestsIniFileSettings));
sl@0
    72
	flogger.Connect();
sl@0
    73
	flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
    74
	flogger.Close();
sl@0
    75
	return ret;
sl@0
    76
	}
sl@0
    77
sl@0
    78
sl@0
    79
sl@0
    80
/**
sl@0
    81
* 028_Sync_ConWriteUni - test sync with connected unicode write
sl@0
    82
* doTestStep returns whether test case passed or failed.
sl@0
    83
*/ 
sl@0
    84
sl@0
    85
CFloggerTest028_Sync_ConWriteUni::CFloggerTest028_Sync_ConWriteUni()
sl@0
    86
	{
sl@0
    87
	// Store the name of this test case
sl@0
    88
	SetTestStepName(_L("step_028_Sync_ConWriteUni"));
sl@0
    89
	}
sl@0
    90
sl@0
    91
sl@0
    92
sl@0
    93
sl@0
    94
CFloggerTest028_Sync_ConWriteUni::~CFloggerTest028_Sync_ConWriteUni()
sl@0
    95
	{
sl@0
    96
	}
sl@0
    97
sl@0
    98
sl@0
    99
sl@0
   100
sl@0
   101
TVerdict CFloggerTest028_Sync_ConWriteUni::doTestStepL( )
sl@0
   102
	{
sl@0
   103
	if ( executeStepL() == KErrNone  )
sl@0
   104
		SetTestStepResult(EPass);
sl@0
   105
sl@0
   106
	else
sl@0
   107
		SetTestStepResult(EFail);
sl@0
   108
sl@0
   109
	
sl@0
   110
	return TestStepResult();
sl@0
   111
	}
sl@0
   112
sl@0
   113
sl@0
   114
sl@0
   115
TInt CFloggerTest028_Sync_ConWriteUni::executeStepL(TBool)
sl@0
   116
	{
sl@0
   117
	return KErrGeneral;
sl@0
   118
	}
sl@0
   119
sl@0
   120
TInt CFloggerTest028_Sync_ConWriteUni::executeStepL()
sl@0
   121
	{
sl@0
   122
	TInt ret;
sl@0
   123
	
sl@0
   124
	RFileLogger flogger;
sl@0
   125
	ret = flogger.Connect();
sl@0
   126
	
sl@0
   127
	if ( ret == KErrNone )
sl@0
   128
		{
sl@0
   129
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
   130
		flogger.ClearLog();
sl@0
   131
		flogger.Write(KTestMessage);
sl@0
   132
		flogger.Close();
sl@0
   133
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
   134
		if (r != KErrNone)
sl@0
   135
			ret = r;
sl@0
   136
		}
sl@0
   137
	
sl@0
   138
	return ret;		
sl@0
   139
sl@0
   140
	}
sl@0
   141
sl@0
   142
sl@0
   143
sl@0
   144
TInt CFloggerTest028_Sync_ConWriteUni::DoTestCheckWriteL()
sl@0
   145
	{
sl@0
   146
	RFile logFile;
sl@0
   147
	HBufC8* hBuffer;
sl@0
   148
	TInt listfilesize,returnCode;
sl@0
   149
	RFs fileSystem; //For file operation create a file system
sl@0
   150
	TBuf8<KTestMessageSize> testData; //To hold the test descriptor
sl@0
   151
sl@0
   152
	User::LeaveIfError(fileSystem.Connect());
sl@0
   153
	
sl@0
   154
	//Open the file in the read mode
sl@0
   155
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
   156
sl@0
   157
	CleanupClosePushL(logFile);
sl@0
   158
sl@0
   159
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
   160
	
sl@0
   161
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
   162
	CleanupStack::PushL(hBuffer);
sl@0
   163
sl@0
   164
	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
sl@0
   165
sl@0
   166
	// Read from position 0: start of file
sl@0
   167
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
   168
	
sl@0
   169
	testData.Copy(KTestMessage); //Copy the test descriptor
sl@0
   170
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
sl@0
   171
											//from the file
sl@0
   172
sl@0
   173
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
   174
	CleanupStack::PopAndDestroy();	//logFile
sl@0
   175
	if (returnCode > 0)
sl@0
   176
		return KErrNone;
sl@0
   177
	else
sl@0
   178
		return KErrNotFound;
sl@0
   179
	}
sl@0
   180
sl@0
   181
sl@0
   182
sl@0
   183
/**
sl@0
   184
* 028_Sync_ConWriteUniBound - test sync with connected unicode write and long string
sl@0
   185
* doTestStep returns whether test case passed or failed.
sl@0
   186
*/ 
sl@0
   187
sl@0
   188
CFloggerTest028_Sync_ConWriteUniBound::CFloggerTest028_Sync_ConWriteUniBound()
sl@0
   189
	{
sl@0
   190
	// Store the name of this test case
sl@0
   191
	SetTestStepName(_L("step_028_Sync_ConWriteUniBound"));
sl@0
   192
	}
sl@0
   193
sl@0
   194
sl@0
   195
sl@0
   196
sl@0
   197
CFloggerTest028_Sync_ConWriteUniBound::~CFloggerTest028_Sync_ConWriteUniBound()
sl@0
   198
	{
sl@0
   199
	}
sl@0
   200
sl@0
   201
sl@0
   202
sl@0
   203
sl@0
   204
TVerdict CFloggerTest028_Sync_ConWriteUniBound::doTestStepL( )
sl@0
   205
	{
sl@0
   206
	if ( executeStepL() == KErrNone  )
sl@0
   207
		SetTestStepResult(EPass);
sl@0
   208
sl@0
   209
	else
sl@0
   210
		SetTestStepResult(EFail);
sl@0
   211
sl@0
   212
	
sl@0
   213
	return TestStepResult();
sl@0
   214
	}
sl@0
   215
sl@0
   216
sl@0
   217
TInt CFloggerTest028_Sync_ConWriteUniBound::executeStepL(TBool)
sl@0
   218
	{
sl@0
   219
	return KErrGeneral;
sl@0
   220
	}
sl@0
   221
sl@0
   222
sl@0
   223
TInt CFloggerTest028_Sync_ConWriteUniBound::executeStepL()
sl@0
   224
	{
sl@0
   225
	TInt ret;
sl@0
   226
	
sl@0
   227
	RFileLogger flogger;
sl@0
   228
	ret = flogger.Connect();
sl@0
   229
	
sl@0
   230
	if ( ret == KErrNone )
sl@0
   231
		{
sl@0
   232
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
   233
		flogger.ClearLog();
sl@0
   234
		flogger.Write(KTestTooLongMessage16);
sl@0
   235
		flogger.Close();
sl@0
   236
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
   237
		if (r != KErrNone)
sl@0
   238
			ret = r;
sl@0
   239
		}
sl@0
   240
	
sl@0
   241
	return ret;		
sl@0
   242
sl@0
   243
	}
sl@0
   244
sl@0
   245
sl@0
   246
sl@0
   247
TInt CFloggerTest028_Sync_ConWriteUniBound::DoTestCheckWriteL()
sl@0
   248
	{
sl@0
   249
	RFile logFile;
sl@0
   250
	HBufC8* hBuffer;
sl@0
   251
	TInt listfilesize,returnCode;
sl@0
   252
	RFs fileSystem; //For file operation create a file system
sl@0
   253
	TBuf8<KLogBufferSize> testData; //We expect the maximum chars this time
sl@0
   254
sl@0
   255
	User::LeaveIfError(fileSystem.Connect());
sl@0
   256
	
sl@0
   257
	//Open the file in the read mode
sl@0
   258
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
   259
sl@0
   260
	CleanupClosePushL(logFile);
sl@0
   261
sl@0
   262
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
   263
	
sl@0
   264
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
   265
	CleanupStack::PushL(hBuffer);
sl@0
   266
sl@0
   267
	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
sl@0
   268
sl@0
   269
	// Read from position 0: start of file
sl@0
   270
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
   271
	
sl@0
   272
	testData.Copy(KTestTooLongExpectedMessage); //Copy the test descriptor
sl@0
   273
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
sl@0
   274
											//from the file
sl@0
   275
sl@0
   276
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
   277
	CleanupStack::PopAndDestroy();	//logFile
sl@0
   278
	if (returnCode > 0)
sl@0
   279
		return KErrNone;
sl@0
   280
	else
sl@0
   281
		return KErrNotFound;
sl@0
   282
	}
sl@0
   283
sl@0
   284
sl@0
   285
/**
sl@0
   286
* 028_Sync_ConWriteFormatEUni - test sync with connected unicode write
sl@0
   287
* doTestStep returns whether test case passed or failed.
sl@0
   288
*/ 
sl@0
   289
sl@0
   290
CFloggerTest028_Sync_ConWriteFormatEUni::CFloggerTest028_Sync_ConWriteFormatEUni()
sl@0
   291
	{
sl@0
   292
	// Store the name of this test case
sl@0
   293
	SetTestStepName(_L("step_028_Sync_ConWriteFormatEUni"));
sl@0
   294
	}
sl@0
   295
sl@0
   296
sl@0
   297
sl@0
   298
sl@0
   299
CFloggerTest028_Sync_ConWriteFormatEUni::~CFloggerTest028_Sync_ConWriteFormatEUni()
sl@0
   300
	{
sl@0
   301
	}
sl@0
   302
sl@0
   303
sl@0
   304
sl@0
   305
sl@0
   306
TVerdict CFloggerTest028_Sync_ConWriteFormatEUni::doTestStepL( )
sl@0
   307
	{
sl@0
   308
	if ( executeStepL() == KErrNone  )
sl@0
   309
		SetTestStepResult(EPass);
sl@0
   310
sl@0
   311
	else
sl@0
   312
		SetTestStepResult(EFail);
sl@0
   313
sl@0
   314
	
sl@0
   315
	return TestStepResult();
sl@0
   316
	}
sl@0
   317
sl@0
   318
TInt CFloggerTest028_Sync_ConWriteFormatEUni::executeStepL(TBool)
sl@0
   319
	{
sl@0
   320
	return KErrGeneral;
sl@0
   321
	}
sl@0
   322
sl@0
   323
sl@0
   324
TInt CFloggerTest028_Sync_ConWriteFormatEUni::executeStepL()
sl@0
   325
	{
sl@0
   326
	TInt ret;
sl@0
   327
	
sl@0
   328
	RFileLogger flogger;
sl@0
   329
	ret = flogger.Connect();
sl@0
   330
	
sl@0
   331
	if ( ret == KErrNone )
sl@0
   332
		{
sl@0
   333
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
   334
		flogger.ClearLog();
sl@0
   335
		flogger.WriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
sl@0
   336
		flogger.Close();
sl@0
   337
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
   338
		if (r != KErrNone)
sl@0
   339
			ret = r;
sl@0
   340
		}
sl@0
   341
	
sl@0
   342
	return ret;		
sl@0
   343
sl@0
   344
	}
sl@0
   345
sl@0
   346
sl@0
   347
sl@0
   348
TInt CFloggerTest028_Sync_ConWriteFormatEUni::DoTestCheckWriteL()
sl@0
   349
	{
sl@0
   350
	RFile logFile;
sl@0
   351
	HBufC8* hBuffer;
sl@0
   352
	TInt listfilesize,returnCode;
sl@0
   353
	RFs fileSystem; //For file operation create a file system
sl@0
   354
	TBuf8<KTestMessageSize> testData; //To hold the test descriptor
sl@0
   355
sl@0
   356
	User::LeaveIfError(fileSystem.Connect());
sl@0
   357
	
sl@0
   358
	//Open the file in the read mode
sl@0
   359
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
   360
sl@0
   361
	CleanupClosePushL(logFile);
sl@0
   362
sl@0
   363
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
   364
	
sl@0
   365
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
   366
	CleanupStack::PushL(hBuffer);
sl@0
   367
sl@0
   368
	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
sl@0
   369
sl@0
   370
	// Read from position 0: start of file
sl@0
   371
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
   372
	
sl@0
   373
	testData.Copy(KTestMessageOneParamExpected); //Copy the test descriptor
sl@0
   374
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
sl@0
   375
											//from the file
sl@0
   376
sl@0
   377
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
   378
	CleanupStack::PopAndDestroy();	//logFile
sl@0
   379
	if (returnCode > 0)
sl@0
   380
		return KErrNone;
sl@0
   381
	else
sl@0
   382
		return KErrNotFound;
sl@0
   383
	}
sl@0
   384
sl@0
   385
sl@0
   386
sl@0
   387
/**
sl@0
   388
* 028_Sync_ConWriteFormatEUniBound - test sync with connected unicode write and long string
sl@0
   389
* doTestStep returns whether test case passed or failed.
sl@0
   390
*/ 
sl@0
   391
sl@0
   392
CFloggerTest028_Sync_ConWriteFormatEUniBound::CFloggerTest028_Sync_ConWriteFormatEUniBound()
sl@0
   393
	{
sl@0
   394
	// Store the name of this test case
sl@0
   395
	SetTestStepName(_L("step_028_Sync_ConWriteFormatEUniBound"));
sl@0
   396
	}
sl@0
   397
sl@0
   398
sl@0
   399
sl@0
   400
sl@0
   401
CFloggerTest028_Sync_ConWriteFormatEUniBound::~CFloggerTest028_Sync_ConWriteFormatEUniBound()
sl@0
   402
	{
sl@0
   403
	}
sl@0
   404
sl@0
   405
sl@0
   406
sl@0
   407
sl@0
   408
TVerdict CFloggerTest028_Sync_ConWriteFormatEUniBound::doTestStepL( )
sl@0
   409
	{
sl@0
   410
	if ( executeStepL() == KErrNone  )
sl@0
   411
		SetTestStepResult(EPass);
sl@0
   412
sl@0
   413
	else
sl@0
   414
		SetTestStepResult(EFail);
sl@0
   415
sl@0
   416
	
sl@0
   417
	return TestStepResult();
sl@0
   418
	}
sl@0
   419
sl@0
   420
sl@0
   421
TInt CFloggerTest028_Sync_ConWriteFormatEUniBound::executeStepL(TBool)
sl@0
   422
	{
sl@0
   423
	return KErrGeneral;
sl@0
   424
	}
sl@0
   425
sl@0
   426
TInt CFloggerTest028_Sync_ConWriteFormatEUniBound::executeStepL()
sl@0
   427
	{
sl@0
   428
	TInt ret;
sl@0
   429
	
sl@0
   430
	RFileLogger flogger;
sl@0
   431
	ret = flogger.Connect();
sl@0
   432
	
sl@0
   433
	if ( ret == KErrNone )
sl@0
   434
		{
sl@0
   435
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
   436
		flogger.ClearLog();
sl@0
   437
		flogger.WriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
sl@0
   438
		flogger.Close();
sl@0
   439
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
   440
		if (r != KErrNone)
sl@0
   441
			ret = r;
sl@0
   442
		}
sl@0
   443
	
sl@0
   444
	return ret;		
sl@0
   445
sl@0
   446
	}
sl@0
   447
sl@0
   448
sl@0
   449
sl@0
   450
TInt CFloggerTest028_Sync_ConWriteFormatEUniBound::DoTestCheckWriteL()
sl@0
   451
	{
sl@0
   452
	RFile logFile;
sl@0
   453
	HBufC8* hBuffer;
sl@0
   454
	TInt listfilesize,returnCode;
sl@0
   455
	RFs fileSystem; //For file operation create a file system
sl@0
   456
	TBuf8<KLogBufferSize> testData; //We expect the maximum chars for this case
sl@0
   457
sl@0
   458
	User::LeaveIfError(fileSystem.Connect());
sl@0
   459
	
sl@0
   460
	//Open the file in the read mode
sl@0
   461
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
   462
sl@0
   463
	CleanupClosePushL(logFile);
sl@0
   464
sl@0
   465
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
   466
	
sl@0
   467
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
   468
	CleanupStack::PushL(hBuffer);
sl@0
   469
sl@0
   470
	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
sl@0
   471
sl@0
   472
	// Read from position 0: start of file
sl@0
   473
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
   474
	
sl@0
   475
	testData.Copy(KTestTooLongMessageOneParamExpected); //Copy the test descriptor
sl@0
   476
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
sl@0
   477
											//from the file
sl@0
   478
sl@0
   479
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
   480
	CleanupStack::PopAndDestroy();	//logFile
sl@0
   481
	if (returnCode > 0)
sl@0
   482
		return KErrNone;
sl@0
   483
	else
sl@0
   484
		return KErrNotFound;
sl@0
   485
	}
sl@0
   486
sl@0
   487
sl@0
   488
sl@0
   489
/**
sl@0
   490
* 028_Sync_ConWriteFormatV8Bit - test sync with connected unicode write
sl@0
   491
* doTestStep returns whether test case passed or failed.
sl@0
   492
*/ 
sl@0
   493
sl@0
   494
CFloggerTest028_Sync_ConWriteFormatV8Bit::CFloggerTest028_Sync_ConWriteFormatV8Bit()
sl@0
   495
	{
sl@0
   496
	// Store the name of this test case
sl@0
   497
	SetTestStepName(_L("step_028_Sync_ConWriteFormatV8Bit"));
sl@0
   498
	}
sl@0
   499
sl@0
   500
sl@0
   501
sl@0
   502
sl@0
   503
CFloggerTest028_Sync_ConWriteFormatV8Bit::~CFloggerTest028_Sync_ConWriteFormatV8Bit()
sl@0
   504
	{
sl@0
   505
	}
sl@0
   506
sl@0
   507
sl@0
   508
sl@0
   509
sl@0
   510
TVerdict CFloggerTest028_Sync_ConWriteFormatV8Bit::doTestStepL( )
sl@0
   511
	{
sl@0
   512
	if ( executeStepL() == KErrNone  )
sl@0
   513
		SetTestStepResult(EPass);
sl@0
   514
sl@0
   515
	else
sl@0
   516
		SetTestStepResult(EFail);
sl@0
   517
sl@0
   518
	
sl@0
   519
	return TestStepResult();
sl@0
   520
	}
sl@0
   521
sl@0
   522
sl@0
   523
TInt CFloggerTest028_Sync_ConWriteFormatV8Bit::executeStepL(TBool)
sl@0
   524
	{
sl@0
   525
	return KErrGeneral;
sl@0
   526
	}
sl@0
   527
sl@0
   528
TInt CFloggerTest028_Sync_ConWriteFormatV8Bit::executeStepL()
sl@0
   529
	{
sl@0
   530
	TInt ret;
sl@0
   531
	
sl@0
   532
	ret = flogger.Connect();
sl@0
   533
	
sl@0
   534
	if ( ret == KErrNone )
sl@0
   535
		{
sl@0
   536
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
   537
		flogger.ClearLog();
sl@0
   538
		DoTestWriteFormat(KTestMessageOneParam8,KTestMessageOneParamValue);
sl@0
   539
		flogger.Close();
sl@0
   540
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
   541
		if (r != KErrNone)
sl@0
   542
			ret = r;
sl@0
   543
		}
sl@0
   544
	
sl@0
   545
	return ret;		
sl@0
   546
sl@0
   547
	}
sl@0
   548
sl@0
   549
sl@0
   550
void CFloggerTest028_Sync_ConWriteFormatV8Bit::DoTestWriteFormat(TRefByValue<const TDesC8> aFmt,...)
sl@0
   551
	{
sl@0
   552
	VA_LIST list;
sl@0
   553
	VA_START(list,aFmt);
sl@0
   554
	flogger.WriteFormat(aFmt,list);
sl@0
   555
	}
sl@0
   556
sl@0
   557
sl@0
   558
sl@0
   559
TInt CFloggerTest028_Sync_ConWriteFormatV8Bit::DoTestCheckWriteL()
sl@0
   560
	{
sl@0
   561
	RFile logFile;
sl@0
   562
	HBufC8* hBuffer;
sl@0
   563
	TInt listfilesize,returnCode;
sl@0
   564
	RFs fileSystem; //For file operation create a file system
sl@0
   565
	TBuf8<KTestMessageSize> testData; //To hold the test descriptor
sl@0
   566
sl@0
   567
	User::LeaveIfError(fileSystem.Connect());
sl@0
   568
	
sl@0
   569
	//Open the file in the read mode
sl@0
   570
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
   571
sl@0
   572
	CleanupClosePushL(logFile);
sl@0
   573
sl@0
   574
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
   575
	
sl@0
   576
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
   577
	CleanupStack::PushL(hBuffer);
sl@0
   578
sl@0
   579
	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
sl@0
   580
sl@0
   581
	// Read from position 0: start of file
sl@0
   582
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
   583
	
sl@0
   584
	testData.Copy(KTestMessageOneParamExpected); //Copy the test descriptor
sl@0
   585
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
sl@0
   586
											//from the file
sl@0
   587
sl@0
   588
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
   589
	CleanupStack::PopAndDestroy();	//logFile
sl@0
   590
	if (returnCode > 0)
sl@0
   591
		return KErrNone;
sl@0
   592
	else
sl@0
   593
		return KErrNotFound;
sl@0
   594
	}
sl@0
   595
sl@0
   596
sl@0
   597
sl@0
   598
/**
sl@0
   599
* 028_Sync_ConWriteFormatV8BitBound - test sync with connected unicode write and long string
sl@0
   600
* doTestStep returns whether test case passed or failed.
sl@0
   601
*/ 
sl@0
   602
sl@0
   603
CFloggerTest028_Sync_ConWriteFormatV8BitBound::CFloggerTest028_Sync_ConWriteFormatV8BitBound()
sl@0
   604
	{
sl@0
   605
	// Store the name of this test case
sl@0
   606
	SetTestStepName(_L("step_028_Sync_ConWriteFormatV8BitBound"));
sl@0
   607
	}
sl@0
   608
sl@0
   609
sl@0
   610
sl@0
   611
sl@0
   612
CFloggerTest028_Sync_ConWriteFormatV8BitBound::~CFloggerTest028_Sync_ConWriteFormatV8BitBound()
sl@0
   613
	{
sl@0
   614
	}
sl@0
   615
sl@0
   616
sl@0
   617
sl@0
   618
sl@0
   619
TVerdict CFloggerTest028_Sync_ConWriteFormatV8BitBound::doTestStepL( )
sl@0
   620
	{
sl@0
   621
	if ( executeStepL() == KErrNone  )
sl@0
   622
		SetTestStepResult(EPass);
sl@0
   623
sl@0
   624
	else
sl@0
   625
		SetTestStepResult(EFail);
sl@0
   626
sl@0
   627
	
sl@0
   628
	return TestStepResult();
sl@0
   629
	}
sl@0
   630
sl@0
   631
sl@0
   632
TInt CFloggerTest028_Sync_ConWriteFormatV8BitBound::executeStepL(TBool)
sl@0
   633
	{
sl@0
   634
	return KErrGeneral;
sl@0
   635
	}
sl@0
   636
sl@0
   637
TInt CFloggerTest028_Sync_ConWriteFormatV8BitBound::executeStepL()
sl@0
   638
	{
sl@0
   639
	TInt ret;
sl@0
   640
	
sl@0
   641
	ret = flogger.Connect();
sl@0
   642
	
sl@0
   643
	if ( ret == KErrNone )
sl@0
   644
		{
sl@0
   645
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
   646
		flogger.ClearLog();
sl@0
   647
		DoTestWriteFormat(KTestTooLongMessageOneParam8,KTestTooLongMessageOneParamValue);
sl@0
   648
		flogger.Close();
sl@0
   649
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
   650
		if (r != KErrNone)
sl@0
   651
			ret = r;
sl@0
   652
		}
sl@0
   653
	
sl@0
   654
	return ret;		
sl@0
   655
sl@0
   656
	}
sl@0
   657
sl@0
   658
sl@0
   659
void CFloggerTest028_Sync_ConWriteFormatV8BitBound::DoTestWriteFormat(TRefByValue<const TDesC8> aFmt,...)
sl@0
   660
	{
sl@0
   661
	VA_LIST list;
sl@0
   662
	VA_START(list,aFmt);
sl@0
   663
	flogger.WriteFormat(aFmt,list);
sl@0
   664
	}
sl@0
   665
sl@0
   666
sl@0
   667
TInt CFloggerTest028_Sync_ConWriteFormatV8BitBound::DoTestCheckWriteL()
sl@0
   668
	{
sl@0
   669
	RFile logFile;
sl@0
   670
	HBufC8* hBuffer;
sl@0
   671
	TInt listfilesize,returnCode;
sl@0
   672
	RFs fileSystem; //For file operation create a file system
sl@0
   673
	TBuf8<KLogBufferSize> testData; //We expect the maximum chars for this case
sl@0
   674
sl@0
   675
	User::LeaveIfError(fileSystem.Connect());
sl@0
   676
	
sl@0
   677
	//Open the file in the read mode
sl@0
   678
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
   679
sl@0
   680
	CleanupClosePushL(logFile);
sl@0
   681
sl@0
   682
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
   683
	
sl@0
   684
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
   685
	CleanupStack::PushL(hBuffer);
sl@0
   686
sl@0
   687
	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
sl@0
   688
sl@0
   689
	// Read from position 0: start of file
sl@0
   690
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
   691
	
sl@0
   692
	testData.Copy(KTestTooLongMessageOneParamExpected); //Copy the test descriptor
sl@0
   693
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
sl@0
   694
											//from the file
sl@0
   695
sl@0
   696
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
   697
	CleanupStack::PopAndDestroy();	//logFile
sl@0
   698
	if (returnCode > 0)
sl@0
   699
		return KErrNone;
sl@0
   700
	else
sl@0
   701
		return KErrNotFound;
sl@0
   702
	}
sl@0
   703
sl@0
   704
sl@0
   705
sl@0
   706
sl@0
   707
/**
sl@0
   708
* 028_Sync_Static_WriteUni - test sync with connected unicode write
sl@0
   709
* doTestStep returns whether test case passed or failed.
sl@0
   710
*/ 
sl@0
   711
sl@0
   712
CFloggerTest028_Sync_Static_WriteUni::CFloggerTest028_Sync_Static_WriteUni()
sl@0
   713
	{
sl@0
   714
	// Store the name of this test case
sl@0
   715
	SetTestStepName(_L("step_028_Sync_Static_WriteUni"));
sl@0
   716
	}
sl@0
   717
sl@0
   718
sl@0
   719
sl@0
   720
sl@0
   721
CFloggerTest028_Sync_Static_WriteUni::~CFloggerTest028_Sync_Static_WriteUni()
sl@0
   722
	{
sl@0
   723
	}
sl@0
   724
sl@0
   725
sl@0
   726
sl@0
   727
sl@0
   728
TVerdict CFloggerTest028_Sync_Static_WriteUni::doTestStepL( )
sl@0
   729
	{
sl@0
   730
	if ( executeStepL() == KErrNone  )
sl@0
   731
		SetTestStepResult(EPass);
sl@0
   732
sl@0
   733
	else
sl@0
   734
		SetTestStepResult(EFail);
sl@0
   735
sl@0
   736
	
sl@0
   737
	return TestStepResult();
sl@0
   738
	}
sl@0
   739
sl@0
   740
sl@0
   741
TInt CFloggerTest028_Sync_Static_WriteUni::executeStepL(TBool)
sl@0
   742
	{
sl@0
   743
	return KErrGeneral;
sl@0
   744
	}
sl@0
   745
sl@0
   746
TInt CFloggerTest028_Sync_Static_WriteUni::executeStepL()
sl@0
   747
	{
sl@0
   748
	TInt ret;
sl@0
   749
	
sl@0
   750
	// clear the old log messages
sl@0
   751
	RFileLogger flogger;
sl@0
   752
	ret = flogger.Connect();
sl@0
   753
	
sl@0
   754
	if ( ret == KErrNone )
sl@0
   755
		{
sl@0
   756
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
   757
		flogger.ClearLog();
sl@0
   758
		flogger.Close();
sl@0
   759
		
sl@0
   760
		RFileLogger::Write(KStdSubsysTag8, KStdCompTag8, KTestMessage);
sl@0
   761
		
sl@0
   762
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
   763
		if (r != KErrNone)
sl@0
   764
			ret = r;
sl@0
   765
		}
sl@0
   766
		
sl@0
   767
	
sl@0
   768
	return ret;		
sl@0
   769
sl@0
   770
	}
sl@0
   771
sl@0
   772
sl@0
   773
TInt CFloggerTest028_Sync_Static_WriteUni::DoTestCheckWriteL()
sl@0
   774
	{
sl@0
   775
	RFile logFile;
sl@0
   776
	HBufC8* hBuffer;
sl@0
   777
	TInt listfilesize,returnCode;
sl@0
   778
	RFs fileSystem; //For file operation create a file system
sl@0
   779
	TBuf8<KTestMessageSize> testData; //To hold the test descriptor
sl@0
   780
sl@0
   781
	User::LeaveIfError(fileSystem.Connect());
sl@0
   782
	
sl@0
   783
	//Open the file in the read mode
sl@0
   784
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
   785
sl@0
   786
	CleanupClosePushL(logFile);
sl@0
   787
sl@0
   788
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
   789
	
sl@0
   790
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
   791
	CleanupStack::PushL(hBuffer);
sl@0
   792
sl@0
   793
	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
sl@0
   794
sl@0
   795
	// Read from position 0: start of file
sl@0
   796
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
   797
	
sl@0
   798
	testData.Copy(KTestMessage); //Copy the test descriptor
sl@0
   799
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
sl@0
   800
											//from the file
sl@0
   801
sl@0
   802
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
   803
	CleanupStack::PopAndDestroy();	//logFile
sl@0
   804
	if (returnCode > 0)
sl@0
   805
		return KErrNone;
sl@0
   806
	else
sl@0
   807
		return KErrNotFound;
sl@0
   808
	}
sl@0
   809
sl@0
   810
sl@0
   811
sl@0
   812
/**
sl@0
   813
* 028_Sync_Static_WriteUniBound - test sync with connected unicode write and long string
sl@0
   814
* doTestStep returns whether test case passed or failed.
sl@0
   815
*/ 
sl@0
   816
sl@0
   817
CFloggerTest028_Sync_Static_WriteUniBound::CFloggerTest028_Sync_Static_WriteUniBound()
sl@0
   818
	{
sl@0
   819
	// Store the name of this test case
sl@0
   820
	SetTestStepName(_L("step_028_Sync_Static_WriteUniBound"));
sl@0
   821
	}
sl@0
   822
sl@0
   823
sl@0
   824
sl@0
   825
sl@0
   826
CFloggerTest028_Sync_Static_WriteUniBound::~CFloggerTest028_Sync_Static_WriteUniBound()
sl@0
   827
	{
sl@0
   828
	}
sl@0
   829
sl@0
   830
sl@0
   831
sl@0
   832
sl@0
   833
TVerdict CFloggerTest028_Sync_Static_WriteUniBound::doTestStepL( )
sl@0
   834
	{
sl@0
   835
	if ( executeStepL() == KErrNone  )
sl@0
   836
		SetTestStepResult(EPass);
sl@0
   837
sl@0
   838
	else
sl@0
   839
		SetTestStepResult(EFail);
sl@0
   840
sl@0
   841
	
sl@0
   842
	return TestStepResult();
sl@0
   843
	}
sl@0
   844
sl@0
   845
sl@0
   846
TInt CFloggerTest028_Sync_Static_WriteUniBound::executeStepL(TBool)
sl@0
   847
	{
sl@0
   848
	return KErrGeneral;
sl@0
   849
	}
sl@0
   850
sl@0
   851
TInt CFloggerTest028_Sync_Static_WriteUniBound::executeStepL()
sl@0
   852
	{
sl@0
   853
	TInt ret;
sl@0
   854
	
sl@0
   855
	
sl@0
   856
	// clear the old log messages
sl@0
   857
	RFileLogger flogger;
sl@0
   858
	ret = flogger.Connect();
sl@0
   859
	
sl@0
   860
	if ( ret == KErrNone )
sl@0
   861
		{
sl@0
   862
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
   863
		flogger.ClearLog();
sl@0
   864
		flogger.Close();
sl@0
   865
		
sl@0
   866
		RFileLogger::Write(KStdSubsysTag8, KStdCompTag8, KTestTooLongMessage16);
sl@0
   867
		
sl@0
   868
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
   869
		if (r != KErrNone)
sl@0
   870
			ret = r;
sl@0
   871
		}
sl@0
   872
	
sl@0
   873
	return ret;		
sl@0
   874
	
sl@0
   875
sl@0
   876
	}
sl@0
   877
sl@0
   878
sl@0
   879
TInt CFloggerTest028_Sync_Static_WriteUniBound::DoTestCheckWriteL()
sl@0
   880
	{
sl@0
   881
	RFile logFile;
sl@0
   882
	HBufC8* hBuffer;
sl@0
   883
	TInt listfilesize,returnCode;
sl@0
   884
	RFs fileSystem; //For file operation create a file system
sl@0
   885
	TBuf8<KLogBufferSize> testData; //We expect the maximum chars for this case
sl@0
   886
sl@0
   887
	User::LeaveIfError(fileSystem.Connect());
sl@0
   888
	
sl@0
   889
	//Open the file in the read mode
sl@0
   890
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
   891
sl@0
   892
	CleanupClosePushL(logFile);
sl@0
   893
sl@0
   894
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
   895
	
sl@0
   896
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
   897
	CleanupStack::PushL(hBuffer);
sl@0
   898
sl@0
   899
	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
sl@0
   900
sl@0
   901
	// Read from position 0: start of file
sl@0
   902
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
   903
	
sl@0
   904
	testData.Copy(KTestTooLongExpectedMessage); //Copy the test descriptor
sl@0
   905
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
sl@0
   906
											//from the file
sl@0
   907
sl@0
   908
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
   909
	CleanupStack::PopAndDestroy();	//logFile
sl@0
   910
	if (returnCode > 0)
sl@0
   911
		return KErrNone;
sl@0
   912
	else
sl@0
   913
		return KErrNotFound;
sl@0
   914
	}
sl@0
   915
sl@0
   916
sl@0
   917
sl@0
   918
sl@0
   919
sl@0
   920
/**
sl@0
   921
* 028_Sync_Static_WriteFormatVUni - test sync with static formatted VA_LIST unicode write
sl@0
   922
* doTestStep returns whether test case passed or failed.
sl@0
   923
*/ 
sl@0
   924
sl@0
   925
CFloggerTest028_Sync_Static_WriteFormatVUni::CFloggerTest028_Sync_Static_WriteFormatVUni()
sl@0
   926
	{
sl@0
   927
	// Store the name of this test case
sl@0
   928
	SetTestStepName(_L("step_028_Sync_Static_WriteFormatVUni"));
sl@0
   929
	}
sl@0
   930
sl@0
   931
sl@0
   932
sl@0
   933
sl@0
   934
CFloggerTest028_Sync_Static_WriteFormatVUni::~CFloggerTest028_Sync_Static_WriteFormatVUni()
sl@0
   935
	{
sl@0
   936
	}
sl@0
   937
sl@0
   938
sl@0
   939
sl@0
   940
sl@0
   941
TVerdict CFloggerTest028_Sync_Static_WriteFormatVUni::doTestStepL( )
sl@0
   942
	{
sl@0
   943
	if ( executeStepL() == KErrNone  )
sl@0
   944
		SetTestStepResult(EPass);
sl@0
   945
sl@0
   946
	else
sl@0
   947
		SetTestStepResult(EFail);
sl@0
   948
sl@0
   949
	
sl@0
   950
	return TestStepResult();
sl@0
   951
	}
sl@0
   952
sl@0
   953
sl@0
   954
TInt CFloggerTest028_Sync_Static_WriteFormatVUni::executeStepL(TBool)
sl@0
   955
	{
sl@0
   956
	return KErrGeneral;
sl@0
   957
	}
sl@0
   958
sl@0
   959
TInt CFloggerTest028_Sync_Static_WriteFormatVUni::executeStepL()
sl@0
   960
	{
sl@0
   961
	TInt ret;
sl@0
   962
	
sl@0
   963
	// clear the old log messages
sl@0
   964
	RFileLogger flogger;
sl@0
   965
	ret = flogger.Connect();
sl@0
   966
	
sl@0
   967
	if ( ret == KErrNone )
sl@0
   968
		{
sl@0
   969
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
   970
		flogger.ClearLog();
sl@0
   971
		flogger.Close();
sl@0
   972
		
sl@0
   973
		DoTestWriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
sl@0
   974
		
sl@0
   975
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
   976
		if (r != KErrNone)
sl@0
   977
			ret = r;
sl@0
   978
		}
sl@0
   979
		
sl@0
   980
	
sl@0
   981
	return ret;		
sl@0
   982
sl@0
   983
	}
sl@0
   984
sl@0
   985
sl@0
   986
void CFloggerTest028_Sync_Static_WriteFormatVUni::DoTestWriteFormat(TRefByValue<const TDesC16> aFmt,...)
sl@0
   987
	{
sl@0
   988
	VA_LIST list;
sl@0
   989
	VA_START(list,aFmt);
sl@0
   990
	RFileLogger::WriteFormat(KStdSubsysTag8,KStdCompTag8,aFmt,list);
sl@0
   991
	}
sl@0
   992
sl@0
   993
sl@0
   994
sl@0
   995
TInt CFloggerTest028_Sync_Static_WriteFormatVUni::DoTestCheckWriteL()
sl@0
   996
	{
sl@0
   997
	RFile logFile;
sl@0
   998
	HBufC8* hBuffer;
sl@0
   999
	TInt listfilesize,returnCode;
sl@0
  1000
	RFs fileSystem; //For file operation create a file system
sl@0
  1001
	TBuf8<KTestMessageSize> testData; //To hold the test descriptor
sl@0
  1002
sl@0
  1003
	User::LeaveIfError(fileSystem.Connect());
sl@0
  1004
	
sl@0
  1005
	//Open the file in the read mode
sl@0
  1006
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
  1007
sl@0
  1008
	CleanupClosePushL(logFile);
sl@0
  1009
sl@0
  1010
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
  1011
	
sl@0
  1012
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
  1013
	CleanupStack::PushL(hBuffer);
sl@0
  1014
sl@0
  1015
	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
sl@0
  1016
sl@0
  1017
	// Read from position 0: start of file
sl@0
  1018
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
  1019
	
sl@0
  1020
	testData.Copy(KTestMessageOneParamExpected); //Copy the test descriptor
sl@0
  1021
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
sl@0
  1022
											//from the file
sl@0
  1023
sl@0
  1024
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
  1025
	CleanupStack::PopAndDestroy();	//logFile
sl@0
  1026
	if (returnCode > 0)
sl@0
  1027
		return KErrNone;
sl@0
  1028
	else
sl@0
  1029
		return KErrNotFound;
sl@0
  1030
	}
sl@0
  1031
sl@0
  1032
sl@0
  1033
sl@0
  1034
/**
sl@0
  1035
* 028_Sync_Static_WriteFormatVUniBound - test sync with static formatted VA_LIST unicode write and long string
sl@0
  1036
* doTestStep returns whether test case passed or failed.
sl@0
  1037
*/ 
sl@0
  1038
sl@0
  1039
CFloggerTest028_Sync_Static_WriteFormatVUniBound::CFloggerTest028_Sync_Static_WriteFormatVUniBound()
sl@0
  1040
	{
sl@0
  1041
	// Store the name of this test case
sl@0
  1042
	SetTestStepName(_L("step_028_Sync_Static_WriteFormatVUniBound"));
sl@0
  1043
	}
sl@0
  1044
sl@0
  1045
sl@0
  1046
sl@0
  1047
sl@0
  1048
CFloggerTest028_Sync_Static_WriteFormatVUniBound::~CFloggerTest028_Sync_Static_WriteFormatVUniBound()
sl@0
  1049
	{
sl@0
  1050
	}
sl@0
  1051
sl@0
  1052
sl@0
  1053
sl@0
  1054
sl@0
  1055
TVerdict CFloggerTest028_Sync_Static_WriteFormatVUniBound::doTestStepL( )
sl@0
  1056
	{
sl@0
  1057
	if ( executeStepL() == KErrNone  )
sl@0
  1058
		SetTestStepResult(EPass);
sl@0
  1059
sl@0
  1060
	else
sl@0
  1061
		SetTestStepResult(EFail);
sl@0
  1062
sl@0
  1063
	
sl@0
  1064
	return TestStepResult();
sl@0
  1065
	}
sl@0
  1066
sl@0
  1067
sl@0
  1068
TInt CFloggerTest028_Sync_Static_WriteFormatVUniBound::executeStepL(TBool)
sl@0
  1069
	{
sl@0
  1070
	return KErrGeneral;
sl@0
  1071
	}
sl@0
  1072
sl@0
  1073
TInt CFloggerTest028_Sync_Static_WriteFormatVUniBound::executeStepL()
sl@0
  1074
	{
sl@0
  1075
	TInt ret;
sl@0
  1076
	
sl@0
  1077
	
sl@0
  1078
	// clear the old log messages
sl@0
  1079
	RFileLogger flogger;
sl@0
  1080
	ret = flogger.Connect();
sl@0
  1081
	
sl@0
  1082
	if ( ret == KErrNone )
sl@0
  1083
		{
sl@0
  1084
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
  1085
		flogger.ClearLog();
sl@0
  1086
		flogger.Close();
sl@0
  1087
		
sl@0
  1088
		DoTestWriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
sl@0
  1089
		
sl@0
  1090
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
  1091
		if (r != KErrNone)
sl@0
  1092
			ret = r;
sl@0
  1093
		}
sl@0
  1094
	
sl@0
  1095
	return ret;		
sl@0
  1096
	}
sl@0
  1097
sl@0
  1098
sl@0
  1099
sl@0
  1100
void CFloggerTest028_Sync_Static_WriteFormatVUniBound::DoTestWriteFormat(TRefByValue<const TDesC16> aFmt,...)
sl@0
  1101
	{
sl@0
  1102
	VA_LIST list;
sl@0
  1103
	VA_START(list,aFmt);
sl@0
  1104
	RFileLogger::WriteFormat(KStdSubsysTag8, KStdCompTag8, aFmt,list);
sl@0
  1105
	}
sl@0
  1106
	
sl@0
  1107
	
sl@0
  1108
sl@0
  1109
TInt CFloggerTest028_Sync_Static_WriteFormatVUniBound::DoTestCheckWriteL()
sl@0
  1110
	{
sl@0
  1111
	RFile logFile;
sl@0
  1112
	HBufC8* hBuffer;
sl@0
  1113
	TInt listfilesize,returnCode;
sl@0
  1114
	RFs fileSystem; //For file operation create a file system
sl@0
  1115
	TBuf8<KLogBufferSize> testData; //We expect the maximum chars for this case
sl@0
  1116
sl@0
  1117
	User::LeaveIfError(fileSystem.Connect());
sl@0
  1118
	
sl@0
  1119
	//Open the file in the read mode
sl@0
  1120
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
  1121
sl@0
  1122
	CleanupClosePushL(logFile);
sl@0
  1123
sl@0
  1124
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
  1125
	
sl@0
  1126
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
  1127
	CleanupStack::PushL(hBuffer);
sl@0
  1128
sl@0
  1129
	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
sl@0
  1130
sl@0
  1131
	// Read from position 0: start of file
sl@0
  1132
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
  1133
	
sl@0
  1134
	testData.Copy(KTestTooLongMessageOneParamExpected); //Copy the test descriptor
sl@0
  1135
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
sl@0
  1136
											//from the file
sl@0
  1137
sl@0
  1138
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
  1139
	CleanupStack::PopAndDestroy();	//logFile
sl@0
  1140
	if (returnCode > 0)
sl@0
  1141
		return KErrNone;
sl@0
  1142
	else
sl@0
  1143
		return KErrNotFound;
sl@0
  1144
	}
sl@0
  1145
sl@0
  1146
sl@0
  1147
sl@0
  1148
sl@0
  1149
/**
sl@0
  1150
* 028_Sync_Static_HexDump - test sync with connected unicode write
sl@0
  1151
* doTestStep returns whether test case passed or failed.
sl@0
  1152
*/ 
sl@0
  1153
sl@0
  1154
CFloggerTest028_Sync_Static_HexDump::CFloggerTest028_Sync_Static_HexDump()
sl@0
  1155
	{
sl@0
  1156
	// Store the name of this test case
sl@0
  1157
	SetTestStepName(_L("step_028_Sync_Static_HexDump"));
sl@0
  1158
	}
sl@0
  1159
sl@0
  1160
sl@0
  1161
sl@0
  1162
sl@0
  1163
CFloggerTest028_Sync_Static_HexDump::~CFloggerTest028_Sync_Static_HexDump()
sl@0
  1164
	{
sl@0
  1165
	}
sl@0
  1166
sl@0
  1167
sl@0
  1168
sl@0
  1169
sl@0
  1170
TVerdict CFloggerTest028_Sync_Static_HexDump::doTestStepL( )
sl@0
  1171
	{
sl@0
  1172
	if ( executeStepL() == KErrNone  )
sl@0
  1173
		SetTestStepResult(EPass);
sl@0
  1174
sl@0
  1175
	else
sl@0
  1176
		SetTestStepResult(EFail);
sl@0
  1177
sl@0
  1178
	
sl@0
  1179
	return TestStepResult();
sl@0
  1180
	}
sl@0
  1181
sl@0
  1182
sl@0
  1183
TInt CFloggerTest028_Sync_Static_HexDump::executeStepL(TBool)
sl@0
  1184
	{
sl@0
  1185
	return KErrGeneral;
sl@0
  1186
	}
sl@0
  1187
sl@0
  1188
TInt CFloggerTest028_Sync_Static_HexDump::executeStepL()
sl@0
  1189
	{
sl@0
  1190
	TInt ret;
sl@0
  1191
	
sl@0
  1192
	// clear the old log messages
sl@0
  1193
	RFileLogger flogger;
sl@0
  1194
	ret = flogger.Connect();
sl@0
  1195
	
sl@0
  1196
	if ( ret == KErrNone )
sl@0
  1197
		{
sl@0
  1198
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
  1199
		flogger.ClearLog();
sl@0
  1200
		flogger.Close();
sl@0
  1201
		
sl@0
  1202
		RFileLogger::HexDump(KStdSubsysTag8, KStdCompTag8, KTestMessage8);
sl@0
  1203
		
sl@0
  1204
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
  1205
		if (r != KErrNone)
sl@0
  1206
			ret = r;
sl@0
  1207
		}
sl@0
  1208
		
sl@0
  1209
	
sl@0
  1210
	return ret;		
sl@0
  1211
sl@0
  1212
	}
sl@0
  1213
sl@0
  1214
sl@0
  1215
TInt CFloggerTest028_Sync_Static_HexDump::DoTestCheckWriteL()
sl@0
  1216
	{
sl@0
  1217
	RFile logFile;
sl@0
  1218
	HBufC8* hBuffer;
sl@0
  1219
	TInt listfilesize,returnCode;
sl@0
  1220
	RFs fileSystem; //For file operation create a file system
sl@0
  1221
sl@0
  1222
	User::LeaveIfError(fileSystem.Connect());
sl@0
  1223
	
sl@0
  1224
	//Open the file in the read mode
sl@0
  1225
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
  1226
sl@0
  1227
	CleanupClosePushL(logFile);
sl@0
  1228
sl@0
  1229
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
  1230
	
sl@0
  1231
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
  1232
	CleanupStack::PushL(hBuffer);
sl@0
  1233
sl@0
  1234
	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
sl@0
  1235
sl@0
  1236
	// Read from position 0: start of file
sl@0
  1237
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
  1238
	
sl@0
  1239
	returnCode = ptrString.Find(KTestMessageAsHex8); //find the test descriptor in the buffer read
sl@0
  1240
											//from the file
sl@0
  1241
sl@0
  1242
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
  1243
	CleanupStack::PopAndDestroy();	//logFile
sl@0
  1244
	if (returnCode > 0)
sl@0
  1245
		return KErrNone;
sl@0
  1246
	else
sl@0
  1247
		return KErrNotFound;
sl@0
  1248
	}
sl@0
  1249
	
sl@0
  1250
	
sl@0
  1251
	
sl@0
  1252
/**
sl@0
  1253
* 028_Sync_ClearLog - test sync with clearlog
sl@0
  1254
* doTestStep returns whether test case passed or failed.
sl@0
  1255
*/ 
sl@0
  1256
sl@0
  1257
CFloggerTest028_Sync_ClearLog::CFloggerTest028_Sync_ClearLog()
sl@0
  1258
	{
sl@0
  1259
	// Store the name of this test case
sl@0
  1260
	SetTestStepName(_L("step_028_Sync_ClearLog"));
sl@0
  1261
	}
sl@0
  1262
sl@0
  1263
sl@0
  1264
sl@0
  1265
sl@0
  1266
CFloggerTest028_Sync_ClearLog::~CFloggerTest028_Sync_ClearLog()
sl@0
  1267
	{
sl@0
  1268
	}
sl@0
  1269
sl@0
  1270
sl@0
  1271
sl@0
  1272
sl@0
  1273
TVerdict CFloggerTest028_Sync_ClearLog::doTestStepL( )
sl@0
  1274
	{
sl@0
  1275
	if ( executeStepL() == KErrNone  )
sl@0
  1276
		SetTestStepResult(EPass);
sl@0
  1277
sl@0
  1278
	else
sl@0
  1279
		SetTestStepResult(EFail);
sl@0
  1280
sl@0
  1281
	
sl@0
  1282
	return TestStepResult();
sl@0
  1283
	}
sl@0
  1284
sl@0
  1285
sl@0
  1286
TInt CFloggerTest028_Sync_ClearLog::executeStepL(TBool)
sl@0
  1287
	{
sl@0
  1288
	return KErrGeneral;
sl@0
  1289
	}
sl@0
  1290
sl@0
  1291
TInt CFloggerTest028_Sync_ClearLog::executeStepL()
sl@0
  1292
	{
sl@0
  1293
	TInt ret;
sl@0
  1294
	
sl@0
  1295
	// clear the old log messages
sl@0
  1296
	RFileLogger flogger;
sl@0
  1297
	ret = flogger.Connect();
sl@0
  1298
	
sl@0
  1299
	if ( ret == KErrNone )
sl@0
  1300
		{
sl@0
  1301
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
  1302
		flogger.ClearLog();
sl@0
  1303
		flogger.Close();
sl@0
  1304
		
sl@0
  1305
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
  1306
		if (r != KErrNone)
sl@0
  1307
			ret = r;
sl@0
  1308
		}
sl@0
  1309
		
sl@0
  1310
	
sl@0
  1311
	return ret;		
sl@0
  1312
sl@0
  1313
	}
sl@0
  1314
sl@0
  1315
sl@0
  1316
TInt CFloggerTest028_Sync_ClearLog::DoTestCheckWriteL()
sl@0
  1317
	{
sl@0
  1318
	RFile logFile;
sl@0
  1319
	HBufC8* hBuffer;
sl@0
  1320
	TInt listfilesize,returnCode;
sl@0
  1321
	RFs fileSystem; //For file operation create a file system
sl@0
  1322
	TBuf8<KTestMessageSize> testData; //To hold the test descriptor
sl@0
  1323
sl@0
  1324
	User::LeaveIfError(fileSystem.Connect());
sl@0
  1325
	
sl@0
  1326
	//Open the file in the read mode
sl@0
  1327
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
  1328
sl@0
  1329
	CleanupClosePushL(logFile);
sl@0
  1330
sl@0
  1331
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
  1332
	
sl@0
  1333
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
  1334
	CleanupStack::PushL(hBuffer);
sl@0
  1335
sl@0
  1336
	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
sl@0
  1337
sl@0
  1338
	// Read from position 0: start of file
sl@0
  1339
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
  1340
	
sl@0
  1341
	testData.Copy(KTestMessage); //Copy the test descriptor
sl@0
  1342
	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
sl@0
  1343
											//from the file
sl@0
  1344
sl@0
  1345
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
  1346
	CleanupStack::PopAndDestroy();	//logFile
sl@0
  1347
	if (returnCode == KErrNotFound)
sl@0
  1348
		return KErrNone;
sl@0
  1349
	else
sl@0
  1350
		return KErrUnknown;
sl@0
  1351
	}
sl@0
  1352
	
sl@0
  1353
	
sl@0
  1354
	
sl@0
  1355
	
sl@0
  1356
/**
sl@0
  1357
* 028_Sync_Binary - test sync with write binary
sl@0
  1358
* doTestStep returns whether test case passed or failed.
sl@0
  1359
*/ 
sl@0
  1360
sl@0
  1361
CFloggerTest028_Sync_Binary::CFloggerTest028_Sync_Binary()
sl@0
  1362
	{
sl@0
  1363
	// Store the name of this test case
sl@0
  1364
	SetTestStepName(_L("step_028_Sync_Binary"));
sl@0
  1365
	}
sl@0
  1366
sl@0
  1367
sl@0
  1368
sl@0
  1369
sl@0
  1370
CFloggerTest028_Sync_Binary::~CFloggerTest028_Sync_Binary()
sl@0
  1371
	{
sl@0
  1372
	}
sl@0
  1373
sl@0
  1374
sl@0
  1375
sl@0
  1376
sl@0
  1377
TVerdict CFloggerTest028_Sync_Binary::doTestStepL( )
sl@0
  1378
	{
sl@0
  1379
	if ( executeStepL() == KErrNone  )
sl@0
  1380
		SetTestStepResult(EPass);
sl@0
  1381
sl@0
  1382
	else
sl@0
  1383
		SetTestStepResult(EFail);
sl@0
  1384
sl@0
  1385
	
sl@0
  1386
	return TestStepResult();
sl@0
  1387
	}
sl@0
  1388
sl@0
  1389
sl@0
  1390
TInt CFloggerTest028_Sync_Binary::executeStepL(TBool)
sl@0
  1391
	{
sl@0
  1392
	return KErrGeneral;
sl@0
  1393
	}	
sl@0
  1394
sl@0
  1395
TInt CFloggerTest028_Sync_Binary::executeStepL()
sl@0
  1396
	{
sl@0
  1397
	TInt ret;
sl@0
  1398
	
sl@0
  1399
	// clear the old log messages
sl@0
  1400
	ret = flogger.Connect();
sl@0
  1401
	
sl@0
  1402
	if ( ret == KErrNone )
sl@0
  1403
		{
sl@0
  1404
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
  1405
		flogger.ClearLog();
sl@0
  1406
		
sl@0
  1407
		flogger.WriteBinary(KTestMessage8);
sl@0
  1408
		
sl@0
  1409
		flogger.Close();
sl@0
  1410
		
sl@0
  1411
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
  1412
		if (r != KErrNone)
sl@0
  1413
			ret = r;
sl@0
  1414
		}
sl@0
  1415
		
sl@0
  1416
	
sl@0
  1417
	return ret;		
sl@0
  1418
sl@0
  1419
	}
sl@0
  1420
sl@0
  1421
sl@0
  1422
TInt CFloggerTest028_Sync_Binary::DoTestCheckWriteL()
sl@0
  1423
	{
sl@0
  1424
	RFile logFile;
sl@0
  1425
	HBufC8* hBuffer;
sl@0
  1426
	TInt listfilesize,returnCode;
sl@0
  1427
	RFs fileSystem; //For file operation create a file system
sl@0
  1428
	TInt numSuccessful = 0;
sl@0
  1429
sl@0
  1430
	User::LeaveIfError(fileSystem.Connect());
sl@0
  1431
	
sl@0
  1432
	//Open the file in the read mode
sl@0
  1433
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
  1434
sl@0
  1435
	CleanupClosePushL(logFile);
sl@0
  1436
sl@0
  1437
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
  1438
	
sl@0
  1439
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
  1440
	CleanupStack::PushL(hBuffer);
sl@0
  1441
sl@0
  1442
	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
sl@0
  1443
sl@0
  1444
	// Read from position 0: start of file
sl@0
  1445
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
  1446
	
sl@0
  1447
	returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read
sl@0
  1448
											//from the file
sl@0
  1449
	if (returnCode > 0)
sl@0
  1450
		{
sl@0
  1451
		numSuccessful++;
sl@0
  1452
		}
sl@0
  1453
sl@0
  1454
	returnCode = ptrString.Find(KStdSubsysTag8); 
sl@0
  1455
	if (returnCode > 0)
sl@0
  1456
		{
sl@0
  1457
		numSuccessful++;
sl@0
  1458
		}
sl@0
  1459
sl@0
  1460
	returnCode = ptrString.Find(KStdCompTag8); 
sl@0
  1461
	if (returnCode > 0)
sl@0
  1462
		{
sl@0
  1463
		numSuccessful++;
sl@0
  1464
		}
sl@0
  1465
		
sl@0
  1466
sl@0
  1467
sl@0
  1468
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
  1469
	CleanupStack::PopAndDestroy();	//logFile
sl@0
  1470
	if (numSuccessful ==3)
sl@0
  1471
		return KErrNone;
sl@0
  1472
	else
sl@0
  1473
		return KErrUnknown;
sl@0
  1474
	}
sl@0
  1475
	
sl@0
  1476
	
sl@0
  1477
	
sl@0
  1478
/**
sl@0
  1479
* 028_Sync_ConMultiple - test connect and multiple writes
sl@0
  1480
* doTestStep returns whether test case passed or failed.
sl@0
  1481
*/ 
sl@0
  1482
sl@0
  1483
CFloggerTest028_Sync_ConMultiple::CFloggerTest028_Sync_ConMultiple()
sl@0
  1484
	{
sl@0
  1485
	// Store the name of this test case
sl@0
  1486
	SetTestStepName(_L("step_028_Sync_ConMultiple"));
sl@0
  1487
	}
sl@0
  1488
sl@0
  1489
sl@0
  1490
sl@0
  1491
sl@0
  1492
CFloggerTest028_Sync_ConMultiple::~CFloggerTest028_Sync_ConMultiple()
sl@0
  1493
	{
sl@0
  1494
	}
sl@0
  1495
sl@0
  1496
sl@0
  1497
sl@0
  1498
sl@0
  1499
TVerdict CFloggerTest028_Sync_ConMultiple::doTestStepL( )
sl@0
  1500
	{
sl@0
  1501
	if ( executeStepL() == KErrNone  )
sl@0
  1502
		SetTestStepResult(EPass);
sl@0
  1503
sl@0
  1504
	else
sl@0
  1505
		SetTestStepResult(EFail);
sl@0
  1506
sl@0
  1507
	
sl@0
  1508
	return TestStepResult();
sl@0
  1509
	}
sl@0
  1510
sl@0
  1511
TInt CFloggerTest028_Sync_ConMultiple::executeStepL(TBool)
sl@0
  1512
	{
sl@0
  1513
	return KErrGeneral;
sl@0
  1514
	}
sl@0
  1515
sl@0
  1516
sl@0
  1517
TInt CFloggerTest028_Sync_ConMultiple::executeStepL()
sl@0
  1518
	{
sl@0
  1519
	TInt ret;
sl@0
  1520
	
sl@0
  1521
	// clear the old log messages
sl@0
  1522
	ret = flogger.Connect();
sl@0
  1523
	
sl@0
  1524
	if ( ret == KErrNone )
sl@0
  1525
		{
sl@0
  1526
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
  1527
		flogger.ClearLog();
sl@0
  1528
		
sl@0
  1529
		flogger.Write(KTestMessage);
sl@0
  1530
		flogger.WriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
sl@0
  1531
		flogger.Write(KTestTooLongMessage16);
sl@0
  1532
		flogger.WriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
sl@0
  1533
		DoTestWriteFormat(KTestMessageOneParam8,KTestMessageOneParamValue);
sl@0
  1534
		
sl@0
  1535
		TPtrC8 dataSeg;
sl@0
  1536
		dataSeg.Set(K1KilobyteOfData,K1KilobyteOfDataSize);
sl@0
  1537
		flogger.WriteBinary(dataSeg);
sl@0
  1538
		
sl@0
  1539
		flogger.Close();
sl@0
  1540
		
sl@0
  1541
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
  1542
		if (r != KErrNone)
sl@0
  1543
			ret = r;
sl@0
  1544
		}
sl@0
  1545
		
sl@0
  1546
	
sl@0
  1547
	return ret;		
sl@0
  1548
sl@0
  1549
	}
sl@0
  1550
sl@0
  1551
void CFloggerTest028_Sync_ConMultiple::DoTestWriteFormat(TRefByValue<const TDesC8> aFmt,...)
sl@0
  1552
	{
sl@0
  1553
	VA_LIST list;
sl@0
  1554
	VA_START(list,aFmt);
sl@0
  1555
	flogger.WriteFormat(aFmt,list);
sl@0
  1556
	}
sl@0
  1557
sl@0
  1558
TInt CFloggerTest028_Sync_ConMultiple::DoTestCheckWriteL()
sl@0
  1559
	{
sl@0
  1560
	RFile logFile;
sl@0
  1561
	HBufC8* hBuffer;
sl@0
  1562
	TInt listfilesize,returnCode;
sl@0
  1563
	RFs fileSystem; //For file operation create a file system
sl@0
  1564
	TInt numSuccessful = 0;
sl@0
  1565
sl@0
  1566
	User::LeaveIfError(fileSystem.Connect());
sl@0
  1567
	
sl@0
  1568
	//Open the file in the read mode
sl@0
  1569
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
  1570
sl@0
  1571
	CleanupClosePushL(logFile);
sl@0
  1572
sl@0
  1573
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
  1574
	
sl@0
  1575
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
  1576
	CleanupStack::PushL(hBuffer);
sl@0
  1577
sl@0
  1578
	TPtr8 ptrString = hBuffer->Des();  //To access the buffer
sl@0
  1579
sl@0
  1580
	// Read from position 0: start of file
sl@0
  1581
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
  1582
	
sl@0
  1583
	returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read
sl@0
  1584
											//from the file
sl@0
  1585
	if (returnCode > 0)
sl@0
  1586
		{
sl@0
  1587
		numSuccessful++;
sl@0
  1588
		}
sl@0
  1589
sl@0
  1590
sl@0
  1591
	returnCode = ptrString.Find(KTestMessageOneParamExpected); 
sl@0
  1592
	if (returnCode > 0)
sl@0
  1593
		{
sl@0
  1594
		numSuccessful++;
sl@0
  1595
		}
sl@0
  1596
sl@0
  1597
	TPtrC8 ptrStringOffsetForSearching = ptrString.Right((ptrString.Length()-returnCode)-KTestMessageOneParamExpected().Length());
sl@0
  1598
sl@0
  1599
	returnCode = ptrStringOffsetForSearching.Find(KTestMessageOneParamExpected); //find the next occurance
sl@0
  1600
	if (returnCode > 0)
sl@0
  1601
		{
sl@0
  1602
		numSuccessful++;
sl@0
  1603
		}
sl@0
  1604
sl@0
  1605
	returnCode = ptrString.Find(KTestTooLongExpectedMessage); 
sl@0
  1606
	if (returnCode > 0)
sl@0
  1607
		{
sl@0
  1608
		numSuccessful++;
sl@0
  1609
		}
sl@0
  1610
		
sl@0
  1611
	returnCode = ptrString.Find(KTestTooLongMessageOneParamExpected); 
sl@0
  1612
	if (returnCode > 0)
sl@0
  1613
		{
sl@0
  1614
		numSuccessful++;
sl@0
  1615
		}
sl@0
  1616
sl@0
  1617
	// we don't check that all the binary data is there - just that the file is nice and long		
sl@0
  1618
	if ( listfilesize > K1KilobyteOfDataSize)
sl@0
  1619
		{
sl@0
  1620
		numSuccessful++;
sl@0
  1621
		}
sl@0
  1622
sl@0
  1623
sl@0
  1624
sl@0
  1625
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
  1626
	CleanupStack::PopAndDestroy();	//logFile
sl@0
  1627
	if ( numSuccessful == 6 )
sl@0
  1628
		return KErrNone;
sl@0
  1629
	else
sl@0
  1630
		return KErrUnknown;
sl@0
  1631
	}
sl@0
  1632
	
sl@0
  1633
	
sl@0
  1634
	
sl@0
  1635
	
sl@0
  1636
	
sl@0
  1637
	
sl@0
  1638
/**
sl@0
  1639
* 028_Sync_Static_Multiple - test static multiple writes
sl@0
  1640
* doTestStep returns whether test case passed or failed.
sl@0
  1641
*/ 
sl@0
  1642
sl@0
  1643
CFloggerTest028_Sync_Static_Multiple::CFloggerTest028_Sync_Static_Multiple()
sl@0
  1644
	{
sl@0
  1645
	// Store the name of this test case
sl@0
  1646
	SetTestStepName(_L("step_028_Sync_Static_Multiple"));
sl@0
  1647
	}
sl@0
  1648
sl@0
  1649
sl@0
  1650
sl@0
  1651
sl@0
  1652
CFloggerTest028_Sync_Static_Multiple::~CFloggerTest028_Sync_Static_Multiple()
sl@0
  1653
	{
sl@0
  1654
	}
sl@0
  1655
sl@0
  1656
sl@0
  1657
sl@0
  1658
sl@0
  1659
TVerdict CFloggerTest028_Sync_Static_Multiple::doTestStepL( )
sl@0
  1660
	{
sl@0
  1661
	if ( executeStepL() == KErrNone  )
sl@0
  1662
		SetTestStepResult(EPass);
sl@0
  1663
sl@0
  1664
	else
sl@0
  1665
		SetTestStepResult(EFail);
sl@0
  1666
sl@0
  1667
	
sl@0
  1668
	return TestStepResult();
sl@0
  1669
	}
sl@0
  1670
sl@0
  1671
TInt CFloggerTest028_Sync_Static_Multiple::executeStepL(TBool)
sl@0
  1672
	{
sl@0
  1673
	return KErrGeneral;
sl@0
  1674
	}
sl@0
  1675
sl@0
  1676
sl@0
  1677
TInt CFloggerTest028_Sync_Static_Multiple::executeStepL()
sl@0
  1678
	{
sl@0
  1679
	TInt ret;
sl@0
  1680
	
sl@0
  1681
	// clear the old log messages
sl@0
  1682
	RFileLogger flogger;
sl@0
  1683
	ret = flogger.Connect();
sl@0
  1684
	
sl@0
  1685
	if ( ret == KErrNone )
sl@0
  1686
		{
sl@0
  1687
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
  1688
		flogger.ClearLog();
sl@0
  1689
		flogger.Close();
sl@0
  1690
		
sl@0
  1691
		RFileLogger::Write(KStdSubsysTag8, KStdCompTag8,KTestMessage);
sl@0
  1692
		RFileLogger::WriteFormat(KStdSubsysTag8, KStdCompTag8,KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
sl@0
  1693
		DoTestWriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
sl@0
  1694
		DoTestWriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
sl@0
  1695
		
sl@0
  1696
		RFileLogger::HexDump(KStdSubsysTag8, KStdCompTag8,KTestMessage8);
sl@0
  1697
		
sl@0
  1698
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
  1699
		if (r != KErrNone)
sl@0
  1700
			ret = r;
sl@0
  1701
		}
sl@0
  1702
		
sl@0
  1703
	
sl@0
  1704
	return ret;		
sl@0
  1705
sl@0
  1706
	}
sl@0
  1707
sl@0
  1708
void CFloggerTest028_Sync_Static_Multiple::DoTestWriteFormat(TRefByValue<const TDesC16> aFmt,...)
sl@0
  1709
	{
sl@0
  1710
	VA_LIST list;
sl@0
  1711
	VA_START(list,aFmt);
sl@0
  1712
	RFileLogger::WriteFormat(KStdSubsysTag8, KStdCompTag8,aFmt,list);
sl@0
  1713
	}
sl@0
  1714
sl@0
  1715
sl@0
  1716
sl@0
  1717
TInt CFloggerTest028_Sync_Static_Multiple::DoTestCheckWriteL()
sl@0
  1718
	{
sl@0
  1719
	RFile logFile;
sl@0
  1720
	HBufC8* hBuffer;
sl@0
  1721
	TInt listfilesize,returnCode;
sl@0
  1722
	RFs fileSystem; //For file operation create a file system
sl@0
  1723
	TInt numSuccessful = 0;
sl@0
  1724
sl@0
  1725
	User::LeaveIfError(fileSystem.Connect());
sl@0
  1726
	
sl@0
  1727
	//Open the file in the read mode
sl@0
  1728
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
  1729
sl@0
  1730
	CleanupClosePushL(logFile);
sl@0
  1731
sl@0
  1732
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
  1733
	
sl@0
  1734
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
  1735
	CleanupStack::PushL(hBuffer);
sl@0
  1736
sl@0
  1737
	TPtr8 ptrString = hBuffer->Des();  //To access the buffer
sl@0
  1738
sl@0
  1739
	// Read from position 0: start of file
sl@0
  1740
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
  1741
	
sl@0
  1742
	returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read
sl@0
  1743
											//from the file
sl@0
  1744
	if (returnCode > 0)
sl@0
  1745
		{
sl@0
  1746
		numSuccessful++;
sl@0
  1747
		}
sl@0
  1748
sl@0
  1749
	returnCode = ptrString.Find(KTestTooLongMessageOneParamExpected); 
sl@0
  1750
	if (returnCode > 0)
sl@0
  1751
		{
sl@0
  1752
		numSuccessful++;
sl@0
  1753
		}
sl@0
  1754
sl@0
  1755
	// search for the occurance that the VA_LIST put in
sl@0
  1756
	// when testing serial, the length will be negative, so skip
sl@0
  1757
	TInt len;
sl@0
  1758
	len = (ptrString.Length()-returnCode)-KTestTooLongMessageOneParamExpected().Length();
sl@0
  1759
	if (len > 0)
sl@0
  1760
		{
sl@0
  1761
		TPtrC8 ptrStringOffsetForSearching = ptrString.Right(len);
sl@0
  1762
		
sl@0
  1763
		returnCode = ptrStringOffsetForSearching.Find(KTestTooLongMessageOneParamExpected); //find the next occurance
sl@0
  1764
		if (returnCode > 0)
sl@0
  1765
			{
sl@0
  1766
			numSuccessful++;
sl@0
  1767
			}
sl@0
  1768
		}
sl@0
  1769
sl@0
  1770
sl@0
  1771
	returnCode = ptrString.Find(KTestMessageOneParamExpected); 
sl@0
  1772
	if (returnCode > 0)
sl@0
  1773
		{
sl@0
  1774
		numSuccessful++;
sl@0
  1775
		}
sl@0
  1776
sl@0
  1777
	returnCode = ptrString.Find(KTestMessageAsHex8); 
sl@0
  1778
	if (returnCode > 0)
sl@0
  1779
		{
sl@0
  1780
		numSuccessful++;
sl@0
  1781
		}
sl@0
  1782
sl@0
  1783
	
sl@0
  1784
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
  1785
	CleanupStack::PopAndDestroy();	//logFile
sl@0
  1786
	if ( numSuccessful == 5 )
sl@0
  1787
		return KErrNone;
sl@0
  1788
	else
sl@0
  1789
		return KErrUnknown;
sl@0
  1790
	}
sl@0
  1791
	
sl@0
  1792
	
sl@0
  1793
	
sl@0
  1794
/**
sl@0
  1795
* 028_Sync_ConMultiple2 - test connect and multiple2 writes
sl@0
  1796
* doTestStep returns whether test case passed or failed.
sl@0
  1797
*/ 
sl@0
  1798
sl@0
  1799
CFloggerTest028_Sync_ConMultiple2::CFloggerTest028_Sync_ConMultiple2()
sl@0
  1800
	{
sl@0
  1801
	// Store the name of this test case
sl@0
  1802
	SetTestStepName(_L("step_028_Sync_ConMultiple2"));
sl@0
  1803
	}
sl@0
  1804
sl@0
  1805
sl@0
  1806
sl@0
  1807
sl@0
  1808
CFloggerTest028_Sync_ConMultiple2::~CFloggerTest028_Sync_ConMultiple2()
sl@0
  1809
	{
sl@0
  1810
	}
sl@0
  1811
sl@0
  1812
sl@0
  1813
sl@0
  1814
sl@0
  1815
TVerdict CFloggerTest028_Sync_ConMultiple2::doTestStepL( )
sl@0
  1816
	{
sl@0
  1817
	if ( executeStepL() == KErrNone  )
sl@0
  1818
		SetTestStepResult(EPass);
sl@0
  1819
sl@0
  1820
	else
sl@0
  1821
		SetTestStepResult(EFail);
sl@0
  1822
sl@0
  1823
	
sl@0
  1824
	return TestStepResult();
sl@0
  1825
	}
sl@0
  1826
sl@0
  1827
TInt CFloggerTest028_Sync_ConMultiple2::executeStepL(TBool)
sl@0
  1828
	{
sl@0
  1829
	return KErrGeneral;
sl@0
  1830
	}
sl@0
  1831
sl@0
  1832
sl@0
  1833
TInt CFloggerTest028_Sync_ConMultiple2::executeStepL()
sl@0
  1834
	{
sl@0
  1835
	TInt ret;
sl@0
  1836
	
sl@0
  1837
	// clear the old log messages
sl@0
  1838
	ret = flogger.Connect();
sl@0
  1839
	
sl@0
  1840
	if ( ret == KErrNone )
sl@0
  1841
		{
sl@0
  1842
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
  1843
		flogger.ClearLog();
sl@0
  1844
		
sl@0
  1845
		for (TInt loop = 1; loop <= KMultipleWriteStressTimes; loop++)
sl@0
  1846
			{
sl@0
  1847
			flogger.Write(KTestMessage);
sl@0
  1848
			flogger.WriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
sl@0
  1849
			flogger.Write(KTestTooLongMessage16);
sl@0
  1850
			flogger.WriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
sl@0
  1851
			DoTestWriteFormat(KTestTooLongMessageOneParam8,KTestTooLongMessageOneParamValue);
sl@0
  1852
			
sl@0
  1853
			TPtrC8 dataSeg;
sl@0
  1854
			dataSeg.Set(K1KilobyteOfData,K1KilobyteOfDataSize);
sl@0
  1855
			flogger.WriteBinary(dataSeg);
sl@0
  1856
			}
sl@0
  1857
		flogger.Write(KTestEndMessage8);
sl@0
  1858
		
sl@0
  1859
		flogger.Close();
sl@0
  1860
		
sl@0
  1861
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
  1862
		if (r != KErrNone)
sl@0
  1863
			ret = r;
sl@0
  1864
		}
sl@0
  1865
		
sl@0
  1866
	
sl@0
  1867
	return ret;		
sl@0
  1868
sl@0
  1869
	}
sl@0
  1870
sl@0
  1871
void CFloggerTest028_Sync_ConMultiple2::DoTestWriteFormat(TRefByValue<const TDesC8> aFmt,...)
sl@0
  1872
	{
sl@0
  1873
	VA_LIST list;
sl@0
  1874
	VA_START(list,aFmt);
sl@0
  1875
	flogger.WriteFormat(aFmt,list);
sl@0
  1876
	}
sl@0
  1877
sl@0
  1878
TInt CFloggerTest028_Sync_ConMultiple2::DoTestCheckWriteL()
sl@0
  1879
	{
sl@0
  1880
	RFile logFile;
sl@0
  1881
	HBufC8* hBuffer;
sl@0
  1882
	TInt listfilesize,returnCode;
sl@0
  1883
	RFs fileSystem; //For file operation create a file system
sl@0
  1884
	TInt numSuccessful = 0;
sl@0
  1885
	TInt loop = 0;
sl@0
  1886
sl@0
  1887
	User::LeaveIfError(fileSystem.Connect());
sl@0
  1888
	
sl@0
  1889
	//Open the file in the read mode
sl@0
  1890
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
  1891
sl@0
  1892
	CleanupClosePushL(logFile);
sl@0
  1893
sl@0
  1894
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
  1895
	
sl@0
  1896
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer. This is about 176K in size
sl@0
  1897
	CleanupStack::PushL(hBuffer);
sl@0
  1898
sl@0
  1899
	TPtr8 ptrString = hBuffer->Des();  //To access the buffer
sl@0
  1900
sl@0
  1901
	// Read from position 0: start of file
sl@0
  1902
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
  1903
	
sl@0
  1904
	// the test case writes 6 elements 100 times, but we only check these things:
sl@0
  1905
	// 1. that the test message with one parameter is written 100 times
sl@0
  1906
	// 2. that the long message is written 100 times
sl@0
  1907
	// 3. that the end of test message has been written
sl@0
  1908
	// 4. that the file is suitably big enough to be expected to contain the
sl@0
  1909
	//    1K data segment 100 times in it.
sl@0
  1910
	
sl@0
  1911
	TPtrC8 ptrStringOffsetForSearching;
sl@0
  1912
	returnCode = ptrString.Find(KTestMessageOneParamExpected);
sl@0
  1913
sl@0
  1914
	if (returnCode > 0)
sl@0
  1915
		{
sl@0
  1916
		numSuccessful++;
sl@0
  1917
		}
sl@0
  1918
		
sl@0
  1919
	TInt newLength;
sl@0
  1920
	ptrStringOffsetForSearching.Set(ptrString.Right((ptrString.Length()-returnCode)-KTestMessageOneParamExpected().Length()));
sl@0
  1921
	for (loop=0; loop < KMultipleWriteStressTimes; loop++)
sl@0
  1922
		{
sl@0
  1923
		returnCode = ptrStringOffsetForSearching.Find(KTestMessageOneParamExpected); //find the next occurance
sl@0
  1924
		if (returnCode > 0)
sl@0
  1925
			{
sl@0
  1926
			numSuccessful++;
sl@0
  1927
			}
sl@0
  1928
			
sl@0
  1929
		newLength = ptrStringOffsetForSearching.Length() - returnCode - KTestMessageOneParamExpected().Length();
sl@0
  1930
		if (newLength < 0)
sl@0
  1931
			{
sl@0
  1932
			User::Leave(KErrUnknown);
sl@0
  1933
			}
sl@0
  1934
		ptrStringOffsetForSearching.Set(ptrStringOffsetForSearching.Right(newLength));
sl@0
  1935
		
sl@0
  1936
		}
sl@0
  1937
sl@0
  1938
	returnCode = ptrString.Find(KTestTooLongExpectedMessage); 
sl@0
  1939
	
sl@0
  1940
	if (returnCode > 0)
sl@0
  1941
		{
sl@0
  1942
		numSuccessful++;
sl@0
  1943
		}
sl@0
  1944
		
sl@0
  1945
	ptrStringOffsetForSearching.Set(ptrString.Right((ptrString.Length()-returnCode)-KTestTooLongExpectedMessage().Length()));
sl@0
  1946
sl@0
  1947
	for (loop=0; loop < KMultipleWriteStressTimes; loop++)
sl@0
  1948
		{
sl@0
  1949
sl@0
  1950
		returnCode = ptrStringOffsetForSearching.Find(KTestTooLongExpectedMessage); //find the next occurance
sl@0
  1951
		if (returnCode > 0)
sl@0
  1952
			{
sl@0
  1953
			numSuccessful++;
sl@0
  1954
			}
sl@0
  1955
		newLength = ptrStringOffsetForSearching.Length() - returnCode - KTestTooLongExpectedMessage().Length();
sl@0
  1956
		if (newLength <0)
sl@0
  1957
			{
sl@0
  1958
			User::Leave(KErrUnknown);
sl@0
  1959
			}
sl@0
  1960
		ptrStringOffsetForSearching.Set(ptrStringOffsetForSearching.Right(newLength));
sl@0
  1961
			
sl@0
  1962
		}
sl@0
  1963
sl@0
  1964
sl@0
  1965
	returnCode = ptrString.Find(KTestEndMessage8); 
sl@0
  1966
	if (returnCode > 0)
sl@0
  1967
		{
sl@0
  1968
		numSuccessful++;
sl@0
  1969
		}
sl@0
  1970
		
sl@0
  1971
sl@0
  1972
	// we don't check that all the binary data is there - just that the file is nice and long		
sl@0
  1973
	if ( listfilesize > (K1KilobyteOfDataSize * KMultipleWriteStressTimes))
sl@0
  1974
		{
sl@0
  1975
		numSuccessful++;
sl@0
  1976
		}
sl@0
  1977
	
sl@0
  1978
sl@0
  1979
sl@0
  1980
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
  1981
	CleanupStack::PopAndDestroy();	//logFile
sl@0
  1982
	if ( numSuccessful == 202 )
sl@0
  1983
		return KErrNone;
sl@0
  1984
	else
sl@0
  1985
		return KErrUnknown;
sl@0
  1986
	}
sl@0
  1987
	
sl@0
  1988
	
sl@0
  1989
	
sl@0
  1990
	
sl@0
  1991
	
sl@0
  1992
	
sl@0
  1993
/**
sl@0
  1994
* 028_Sync_Static_Multiple2 - test static multiple2 writes
sl@0
  1995
* doTestStep returns whether test case passed or failed.
sl@0
  1996
*/ 
sl@0
  1997
sl@0
  1998
CFloggerTest028_Sync_Static_Multiple2::CFloggerTest028_Sync_Static_Multiple2()
sl@0
  1999
	{
sl@0
  2000
	// Store the name of this test case
sl@0
  2001
	SetTestStepName(_L("step_028_Sync_Static_Multiple2"));
sl@0
  2002
	}
sl@0
  2003
sl@0
  2004
sl@0
  2005
sl@0
  2006
sl@0
  2007
CFloggerTest028_Sync_Static_Multiple2::~CFloggerTest028_Sync_Static_Multiple2()
sl@0
  2008
	{
sl@0
  2009
	}
sl@0
  2010
sl@0
  2011
sl@0
  2012
sl@0
  2013
sl@0
  2014
TVerdict CFloggerTest028_Sync_Static_Multiple2::doTestStepL( )
sl@0
  2015
	{
sl@0
  2016
	if ( executeStepL() == KErrNone  )
sl@0
  2017
		SetTestStepResult(EPass);
sl@0
  2018
sl@0
  2019
	else
sl@0
  2020
		SetTestStepResult(EFail);
sl@0
  2021
sl@0
  2022
	
sl@0
  2023
	return TestStepResult();
sl@0
  2024
	}
sl@0
  2025
sl@0
  2026
sl@0
  2027
TInt CFloggerTest028_Sync_Static_Multiple2::executeStepL(TBool)
sl@0
  2028
	{
sl@0
  2029
	return KErrGeneral;
sl@0
  2030
	}
sl@0
  2031
sl@0
  2032
TInt CFloggerTest028_Sync_Static_Multiple2::executeStepL()
sl@0
  2033
	{
sl@0
  2034
	TInt ret;
sl@0
  2035
	
sl@0
  2036
	// clear the old log messages
sl@0
  2037
	RFileLogger flogger;
sl@0
  2038
	ret = flogger.Connect();
sl@0
  2039
	
sl@0
  2040
	if ( ret == KErrNone )
sl@0
  2041
		{
sl@0
  2042
		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
sl@0
  2043
		flogger.ClearLog();
sl@0
  2044
		flogger.Close();
sl@0
  2045
		
sl@0
  2046
		for (TInt loop = 1; loop <= KMultipleWriteStressTimes; loop++)
sl@0
  2047
			{		
sl@0
  2048
			RFileLogger::Write(KStdSubsysTag8, KStdCompTag8,KTestMessage);
sl@0
  2049
			RFileLogger::Write(KStdSubsysTag8, KStdCompTag8,KTestTooLongMessage16);
sl@0
  2050
			DoTestWriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
sl@0
  2051
			DoTestWriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
sl@0
  2052
			
sl@0
  2053
			RFileLogger::HexDump(KStdSubsysTag8, KStdCompTag8,KTestMessage8);
sl@0
  2054
			}
sl@0
  2055
		RFileLogger::Write(KStdSubsysTag8, KStdCompTag8,KTestEndMessage8);
sl@0
  2056
		
sl@0
  2057
		TRAPD(r, ret = DoTestCheckWriteL());
sl@0
  2058
		if (r != KErrNone)
sl@0
  2059
			ret = r;
sl@0
  2060
		}
sl@0
  2061
		
sl@0
  2062
	
sl@0
  2063
	return ret;		
sl@0
  2064
sl@0
  2065
	}
sl@0
  2066
sl@0
  2067
void CFloggerTest028_Sync_Static_Multiple2::DoTestWriteFormat(TRefByValue<const TDesC16> aFmt,...)
sl@0
  2068
	{
sl@0
  2069
	VA_LIST list;
sl@0
  2070
	VA_START(list,aFmt);
sl@0
  2071
	RFileLogger::WriteFormat(KStdSubsysTag8, KStdCompTag8,aFmt,list);
sl@0
  2072
	}
sl@0
  2073
sl@0
  2074
sl@0
  2075
sl@0
  2076
TInt CFloggerTest028_Sync_Static_Multiple2::DoTestCheckWriteL()
sl@0
  2077
	{
sl@0
  2078
	RFile logFile;
sl@0
  2079
	HBufC8* hBuffer;
sl@0
  2080
	TInt listfilesize,returnCode;
sl@0
  2081
	RFs fileSystem; //For file operation create a file system
sl@0
  2082
	TInt numSuccessful = 0;
sl@0
  2083
sl@0
  2084
	User::LeaveIfError(fileSystem.Connect());
sl@0
  2085
	
sl@0
  2086
	//Open the file in the read mode
sl@0
  2087
	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
sl@0
  2088
sl@0
  2089
	CleanupClosePushL(logFile);
sl@0
  2090
sl@0
  2091
	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
sl@0
  2092
	
sl@0
  2093
	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
sl@0
  2094
	CleanupStack::PushL(hBuffer);
sl@0
  2095
sl@0
  2096
	TPtr8 ptrString = hBuffer->Des();  //To access the buffer
sl@0
  2097
sl@0
  2098
	// Read from position 0: start of file
sl@0
  2099
	User::LeaveIfError(returnCode = logFile.Read(ptrString));
sl@0
  2100
	
sl@0
  2101
	
sl@0
  2102
	// the test case writes 5 elements 100 times, but we only check these things:
sl@0
  2103
	// 1. that the long test message with one parameter is written 100 times
sl@0
  2104
	// 2. that the test message with one param is written 100 times
sl@0
  2105
	// 3. that the end of test message has been written
sl@0
  2106
	
sl@0
  2107
	TPtrC8 ptrStringOffsetForSearching;
sl@0
  2108
	returnCode = ptrString.Find(KTestMessageOneParamExpected);
sl@0
  2109
sl@0
  2110
	if (returnCode > 0)
sl@0
  2111
		{
sl@0
  2112
		numSuccessful++;
sl@0
  2113
		}
sl@0
  2114
		
sl@0
  2115
	TInt newLength;   // allow length to be watched during debugging
sl@0
  2116
	TInt loop;
sl@0
  2117
	
sl@0
  2118
	ptrStringOffsetForSearching.Set(ptrString.Right((ptrString.Length()-returnCode)-KTestMessageOneParamExpected().Length()));
sl@0
  2119
	for (loop=0; loop < KMultipleWriteStressTimes; loop++)
sl@0
  2120
		{
sl@0
  2121
		returnCode = ptrStringOffsetForSearching.Find(KTestMessageOneParamExpected); //find the next occurance
sl@0
  2122
		if (returnCode > 0)
sl@0
  2123
			{
sl@0
  2124
			numSuccessful++;
sl@0
  2125
			}
sl@0
  2126
			
sl@0
  2127
		newLength = ptrStringOffsetForSearching.Length() - returnCode - KTestMessageOneParamExpected().Length();
sl@0
  2128
	 	if (newLength < 0)
sl@0
  2129
	 		{
sl@0
  2130
	 		User::Leave(KErrUnknown);
sl@0
  2131
	 		}
sl@0
  2132
sl@0
  2133
		ptrStringOffsetForSearching.Set(ptrStringOffsetForSearching.Right(newLength));
sl@0
  2134
		
sl@0
  2135
		}
sl@0
  2136
sl@0
  2137
sl@0
  2138
	returnCode = ptrString.Find(KTestTooLongMessageOneParamExpected);
sl@0
  2139
sl@0
  2140
	if (returnCode > 0)
sl@0
  2141
		{
sl@0
  2142
		numSuccessful++;
sl@0
  2143
		}
sl@0
  2144
		
sl@0
  2145
	newLength = ptrString.Length()-returnCode-KTestTooLongMessageOneParamExpected().Length();
sl@0
  2146
	ptrStringOffsetForSearching.Set(ptrString.Right(newLength));
sl@0
  2147
	for (loop=0; loop < KMultipleWriteStressTimes; loop++)
sl@0
  2148
		{
sl@0
  2149
		returnCode = ptrStringOffsetForSearching.Find(KTestTooLongMessageOneParamExpected); //find the next occurance
sl@0
  2150
		if (returnCode > 0)
sl@0
  2151
			{
sl@0
  2152
			numSuccessful++;
sl@0
  2153
			}
sl@0
  2154
			
sl@0
  2155
		if (loop < (KMultipleWriteStressTimes - 1))
sl@0
  2156
			{
sl@0
  2157
			newLength = ptrStringOffsetForSearching.Length() - returnCode - KTestTooLongMessageOneParamExpected().Length();
sl@0
  2158
	 		if (newLength < 0)
sl@0
  2159
	 			{
sl@0
  2160
	 			User::Leave(KErrUnknown);
sl@0
  2161
	 			}
sl@0
  2162
			ptrStringOffsetForSearching.Set(ptrStringOffsetForSearching.Right(newLength));
sl@0
  2163
			}
sl@0
  2164
		
sl@0
  2165
		}
sl@0
  2166
sl@0
  2167
	returnCode = ptrString.Find(KTestEndMessage8); 
sl@0
  2168
	if (returnCode > 0)
sl@0
  2169
		{
sl@0
  2170
		numSuccessful++;
sl@0
  2171
		}
sl@0
  2172
sl@0
  2173
	
sl@0
  2174
	CleanupStack::PopAndDestroy(hBuffer);
sl@0
  2175
	CleanupStack::PopAndDestroy();	//logFile
sl@0
  2176
	if ( numSuccessful == 201 )
sl@0
  2177
		return KErrNone;
sl@0
  2178
	else
sl@0
  2179
		return KErrUnknown;
sl@0
  2180
	}