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