os/persistentdata/traceservices/commsdebugutility/TE_commsdebugutility/src/step_028_xx.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/traceservices/commsdebugutility/TE_commsdebugutility/src/step_028_xx.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,2180 @@
     1.4 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// See the test specification for details of what these test cases do.
    1.18 +
    1.19 +#include "teststepcomsdbg.h"
    1.20 +#include "TestMessage.h"
    1.21 +#include "step_028_xx.h"
    1.22 +
    1.23 +
    1.24 +#include <comms-infras/commsdebugutility.h>
    1.25 +
    1.26 +const TInt KWaitForFloggerShutdown = 2000000;
    1.27 +const TInt KMultipleWriteStressTimes = 100;
    1.28 +
    1.29 +/**
    1.30 +* 028_Sync_Setup - creates flogger.ini to include token "synchronous"
    1.31 +* doTestStep returns whether test case passed or failed.
    1.32 +*/ 
    1.33 +
    1.34 +
    1.35 +CFloggerTest028_Sync_Setup::CFloggerTest028_Sync_Setup()
    1.36 +	{
    1.37 +	// Store the name of this test case
    1.38 +	SetTestStepName(_L("step_028_Sync_Setup"));
    1.39 +	}
    1.40 +
    1.41 +
    1.42 +CFloggerTest028_Sync_Setup::~CFloggerTest028_Sync_Setup()
    1.43 +	{
    1.44 +	}
    1.45 +
    1.46 +
    1.47 +
    1.48 +TVerdict CFloggerTest028_Sync_Setup::doTestStepL( )
    1.49 +	{
    1.50 +	if ( executeStepL() == KErrNone  )
    1.51 +		SetTestStepResult(EPass);
    1.52 +
    1.53 +	else
    1.54 +		SetTestStepResult(EFail);
    1.55 +
    1.56 +	
    1.57 +	return TestStepResult();
    1.58 +	}
    1.59 +
    1.60 +
    1.61 +TInt CFloggerTest028_Sync_Setup::executeStepL(TBool)
    1.62 +	{
    1.63 +	return KErrGeneral;
    1.64 +	}
    1.65 +
    1.66 +TInt CFloggerTest028_Sync_Setup::executeStepL()
    1.67 +	{
    1.68 +	TInt ret;
    1.69 +	RFileLogger flogger;
    1.70 +	flogger.Connect();
    1.71 +	flogger.__DbgShutDownServer();
    1.72 +	flogger.Close();
    1.73 +	User::After(KWaitForFloggerShutdown);
    1.74 +	TRAP(ret,constructFloggerIniL(KSyncTestsIniFileSettings));
    1.75 +	flogger.Connect();
    1.76 +	flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
    1.77 +	flogger.Close();
    1.78 +	return ret;
    1.79 +	}
    1.80 +
    1.81 +
    1.82 +
    1.83 +/**
    1.84 +* 028_Sync_ConWriteUni - test sync with connected unicode write
    1.85 +* doTestStep returns whether test case passed or failed.
    1.86 +*/ 
    1.87 +
    1.88 +CFloggerTest028_Sync_ConWriteUni::CFloggerTest028_Sync_ConWriteUni()
    1.89 +	{
    1.90 +	// Store the name of this test case
    1.91 +	SetTestStepName(_L("step_028_Sync_ConWriteUni"));
    1.92 +	}
    1.93 +
    1.94 +
    1.95 +
    1.96 +
    1.97 +CFloggerTest028_Sync_ConWriteUni::~CFloggerTest028_Sync_ConWriteUni()
    1.98 +	{
    1.99 +	}
   1.100 +
   1.101 +
   1.102 +
   1.103 +
   1.104 +TVerdict CFloggerTest028_Sync_ConWriteUni::doTestStepL( )
   1.105 +	{
   1.106 +	if ( executeStepL() == KErrNone  )
   1.107 +		SetTestStepResult(EPass);
   1.108 +
   1.109 +	else
   1.110 +		SetTestStepResult(EFail);
   1.111 +
   1.112 +	
   1.113 +	return TestStepResult();
   1.114 +	}
   1.115 +
   1.116 +
   1.117 +
   1.118 +TInt CFloggerTest028_Sync_ConWriteUni::executeStepL(TBool)
   1.119 +	{
   1.120 +	return KErrGeneral;
   1.121 +	}
   1.122 +
   1.123 +TInt CFloggerTest028_Sync_ConWriteUni::executeStepL()
   1.124 +	{
   1.125 +	TInt ret;
   1.126 +	
   1.127 +	RFileLogger flogger;
   1.128 +	ret = flogger.Connect();
   1.129 +	
   1.130 +	if ( ret == KErrNone )
   1.131 +		{
   1.132 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
   1.133 +		flogger.ClearLog();
   1.134 +		flogger.Write(KTestMessage);
   1.135 +		flogger.Close();
   1.136 +		TRAPD(r, ret = DoTestCheckWriteL());
   1.137 +		if (r != KErrNone)
   1.138 +			ret = r;
   1.139 +		}
   1.140 +	
   1.141 +	return ret;		
   1.142 +
   1.143 +	}
   1.144 +
   1.145 +
   1.146 +
   1.147 +TInt CFloggerTest028_Sync_ConWriteUni::DoTestCheckWriteL()
   1.148 +	{
   1.149 +	RFile logFile;
   1.150 +	HBufC8* hBuffer;
   1.151 +	TInt listfilesize,returnCode;
   1.152 +	RFs fileSystem; //For file operation create a file system
   1.153 +	TBuf8<KTestMessageSize> testData; //To hold the test descriptor
   1.154 +
   1.155 +	User::LeaveIfError(fileSystem.Connect());
   1.156 +	
   1.157 +	//Open the file in the read mode
   1.158 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
   1.159 +
   1.160 +	CleanupClosePushL(logFile);
   1.161 +
   1.162 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
   1.163 +	
   1.164 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
   1.165 +	CleanupStack::PushL(hBuffer);
   1.166 +
   1.167 +	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
   1.168 +
   1.169 +	// Read from position 0: start of file
   1.170 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
   1.171 +	
   1.172 +	testData.Copy(KTestMessage); //Copy the test descriptor
   1.173 +	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
   1.174 +											//from the file
   1.175 +
   1.176 +	CleanupStack::PopAndDestroy(hBuffer);
   1.177 +	CleanupStack::PopAndDestroy();	//logFile
   1.178 +	if (returnCode > 0)
   1.179 +		return KErrNone;
   1.180 +	else
   1.181 +		return KErrNotFound;
   1.182 +	}
   1.183 +
   1.184 +
   1.185 +
   1.186 +/**
   1.187 +* 028_Sync_ConWriteUniBound - test sync with connected unicode write and long string
   1.188 +* doTestStep returns whether test case passed or failed.
   1.189 +*/ 
   1.190 +
   1.191 +CFloggerTest028_Sync_ConWriteUniBound::CFloggerTest028_Sync_ConWriteUniBound()
   1.192 +	{
   1.193 +	// Store the name of this test case
   1.194 +	SetTestStepName(_L("step_028_Sync_ConWriteUniBound"));
   1.195 +	}
   1.196 +
   1.197 +
   1.198 +
   1.199 +
   1.200 +CFloggerTest028_Sync_ConWriteUniBound::~CFloggerTest028_Sync_ConWriteUniBound()
   1.201 +	{
   1.202 +	}
   1.203 +
   1.204 +
   1.205 +
   1.206 +
   1.207 +TVerdict CFloggerTest028_Sync_ConWriteUniBound::doTestStepL( )
   1.208 +	{
   1.209 +	if ( executeStepL() == KErrNone  )
   1.210 +		SetTestStepResult(EPass);
   1.211 +
   1.212 +	else
   1.213 +		SetTestStepResult(EFail);
   1.214 +
   1.215 +	
   1.216 +	return TestStepResult();
   1.217 +	}
   1.218 +
   1.219 +
   1.220 +TInt CFloggerTest028_Sync_ConWriteUniBound::executeStepL(TBool)
   1.221 +	{
   1.222 +	return KErrGeneral;
   1.223 +	}
   1.224 +
   1.225 +
   1.226 +TInt CFloggerTest028_Sync_ConWriteUniBound::executeStepL()
   1.227 +	{
   1.228 +	TInt ret;
   1.229 +	
   1.230 +	RFileLogger flogger;
   1.231 +	ret = flogger.Connect();
   1.232 +	
   1.233 +	if ( ret == KErrNone )
   1.234 +		{
   1.235 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
   1.236 +		flogger.ClearLog();
   1.237 +		flogger.Write(KTestTooLongMessage16);
   1.238 +		flogger.Close();
   1.239 +		TRAPD(r, ret = DoTestCheckWriteL());
   1.240 +		if (r != KErrNone)
   1.241 +			ret = r;
   1.242 +		}
   1.243 +	
   1.244 +	return ret;		
   1.245 +
   1.246 +	}
   1.247 +
   1.248 +
   1.249 +
   1.250 +TInt CFloggerTest028_Sync_ConWriteUniBound::DoTestCheckWriteL()
   1.251 +	{
   1.252 +	RFile logFile;
   1.253 +	HBufC8* hBuffer;
   1.254 +	TInt listfilesize,returnCode;
   1.255 +	RFs fileSystem; //For file operation create a file system
   1.256 +	TBuf8<KLogBufferSize> testData; //We expect the maximum chars this time
   1.257 +
   1.258 +	User::LeaveIfError(fileSystem.Connect());
   1.259 +	
   1.260 +	//Open the file in the read mode
   1.261 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
   1.262 +
   1.263 +	CleanupClosePushL(logFile);
   1.264 +
   1.265 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
   1.266 +	
   1.267 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
   1.268 +	CleanupStack::PushL(hBuffer);
   1.269 +
   1.270 +	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
   1.271 +
   1.272 +	// Read from position 0: start of file
   1.273 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
   1.274 +	
   1.275 +	testData.Copy(KTestTooLongExpectedMessage); //Copy the test descriptor
   1.276 +	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
   1.277 +											//from the file
   1.278 +
   1.279 +	CleanupStack::PopAndDestroy(hBuffer);
   1.280 +	CleanupStack::PopAndDestroy();	//logFile
   1.281 +	if (returnCode > 0)
   1.282 +		return KErrNone;
   1.283 +	else
   1.284 +		return KErrNotFound;
   1.285 +	}
   1.286 +
   1.287 +
   1.288 +/**
   1.289 +* 028_Sync_ConWriteFormatEUni - test sync with connected unicode write
   1.290 +* doTestStep returns whether test case passed or failed.
   1.291 +*/ 
   1.292 +
   1.293 +CFloggerTest028_Sync_ConWriteFormatEUni::CFloggerTest028_Sync_ConWriteFormatEUni()
   1.294 +	{
   1.295 +	// Store the name of this test case
   1.296 +	SetTestStepName(_L("step_028_Sync_ConWriteFormatEUni"));
   1.297 +	}
   1.298 +
   1.299 +
   1.300 +
   1.301 +
   1.302 +CFloggerTest028_Sync_ConWriteFormatEUni::~CFloggerTest028_Sync_ConWriteFormatEUni()
   1.303 +	{
   1.304 +	}
   1.305 +
   1.306 +
   1.307 +
   1.308 +
   1.309 +TVerdict CFloggerTest028_Sync_ConWriteFormatEUni::doTestStepL( )
   1.310 +	{
   1.311 +	if ( executeStepL() == KErrNone  )
   1.312 +		SetTestStepResult(EPass);
   1.313 +
   1.314 +	else
   1.315 +		SetTestStepResult(EFail);
   1.316 +
   1.317 +	
   1.318 +	return TestStepResult();
   1.319 +	}
   1.320 +
   1.321 +TInt CFloggerTest028_Sync_ConWriteFormatEUni::executeStepL(TBool)
   1.322 +	{
   1.323 +	return KErrGeneral;
   1.324 +	}
   1.325 +
   1.326 +
   1.327 +TInt CFloggerTest028_Sync_ConWriteFormatEUni::executeStepL()
   1.328 +	{
   1.329 +	TInt ret;
   1.330 +	
   1.331 +	RFileLogger flogger;
   1.332 +	ret = flogger.Connect();
   1.333 +	
   1.334 +	if ( ret == KErrNone )
   1.335 +		{
   1.336 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
   1.337 +		flogger.ClearLog();
   1.338 +		flogger.WriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
   1.339 +		flogger.Close();
   1.340 +		TRAPD(r, ret = DoTestCheckWriteL());
   1.341 +		if (r != KErrNone)
   1.342 +			ret = r;
   1.343 +		}
   1.344 +	
   1.345 +	return ret;		
   1.346 +
   1.347 +	}
   1.348 +
   1.349 +
   1.350 +
   1.351 +TInt CFloggerTest028_Sync_ConWriteFormatEUni::DoTestCheckWriteL()
   1.352 +	{
   1.353 +	RFile logFile;
   1.354 +	HBufC8* hBuffer;
   1.355 +	TInt listfilesize,returnCode;
   1.356 +	RFs fileSystem; //For file operation create a file system
   1.357 +	TBuf8<KTestMessageSize> testData; //To hold the test descriptor
   1.358 +
   1.359 +	User::LeaveIfError(fileSystem.Connect());
   1.360 +	
   1.361 +	//Open the file in the read mode
   1.362 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
   1.363 +
   1.364 +	CleanupClosePushL(logFile);
   1.365 +
   1.366 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
   1.367 +	
   1.368 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
   1.369 +	CleanupStack::PushL(hBuffer);
   1.370 +
   1.371 +	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
   1.372 +
   1.373 +	// Read from position 0: start of file
   1.374 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
   1.375 +	
   1.376 +	testData.Copy(KTestMessageOneParamExpected); //Copy the test descriptor
   1.377 +	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
   1.378 +											//from the file
   1.379 +
   1.380 +	CleanupStack::PopAndDestroy(hBuffer);
   1.381 +	CleanupStack::PopAndDestroy();	//logFile
   1.382 +	if (returnCode > 0)
   1.383 +		return KErrNone;
   1.384 +	else
   1.385 +		return KErrNotFound;
   1.386 +	}
   1.387 +
   1.388 +
   1.389 +
   1.390 +/**
   1.391 +* 028_Sync_ConWriteFormatEUniBound - test sync with connected unicode write and long string
   1.392 +* doTestStep returns whether test case passed or failed.
   1.393 +*/ 
   1.394 +
   1.395 +CFloggerTest028_Sync_ConWriteFormatEUniBound::CFloggerTest028_Sync_ConWriteFormatEUniBound()
   1.396 +	{
   1.397 +	// Store the name of this test case
   1.398 +	SetTestStepName(_L("step_028_Sync_ConWriteFormatEUniBound"));
   1.399 +	}
   1.400 +
   1.401 +
   1.402 +
   1.403 +
   1.404 +CFloggerTest028_Sync_ConWriteFormatEUniBound::~CFloggerTest028_Sync_ConWriteFormatEUniBound()
   1.405 +	{
   1.406 +	}
   1.407 +
   1.408 +
   1.409 +
   1.410 +
   1.411 +TVerdict CFloggerTest028_Sync_ConWriteFormatEUniBound::doTestStepL( )
   1.412 +	{
   1.413 +	if ( executeStepL() == KErrNone  )
   1.414 +		SetTestStepResult(EPass);
   1.415 +
   1.416 +	else
   1.417 +		SetTestStepResult(EFail);
   1.418 +
   1.419 +	
   1.420 +	return TestStepResult();
   1.421 +	}
   1.422 +
   1.423 +
   1.424 +TInt CFloggerTest028_Sync_ConWriteFormatEUniBound::executeStepL(TBool)
   1.425 +	{
   1.426 +	return KErrGeneral;
   1.427 +	}
   1.428 +
   1.429 +TInt CFloggerTest028_Sync_ConWriteFormatEUniBound::executeStepL()
   1.430 +	{
   1.431 +	TInt ret;
   1.432 +	
   1.433 +	RFileLogger flogger;
   1.434 +	ret = flogger.Connect();
   1.435 +	
   1.436 +	if ( ret == KErrNone )
   1.437 +		{
   1.438 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
   1.439 +		flogger.ClearLog();
   1.440 +		flogger.WriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
   1.441 +		flogger.Close();
   1.442 +		TRAPD(r, ret = DoTestCheckWriteL());
   1.443 +		if (r != KErrNone)
   1.444 +			ret = r;
   1.445 +		}
   1.446 +	
   1.447 +	return ret;		
   1.448 +
   1.449 +	}
   1.450 +
   1.451 +
   1.452 +
   1.453 +TInt CFloggerTest028_Sync_ConWriteFormatEUniBound::DoTestCheckWriteL()
   1.454 +	{
   1.455 +	RFile logFile;
   1.456 +	HBufC8* hBuffer;
   1.457 +	TInt listfilesize,returnCode;
   1.458 +	RFs fileSystem; //For file operation create a file system
   1.459 +	TBuf8<KLogBufferSize> testData; //We expect the maximum chars for this case
   1.460 +
   1.461 +	User::LeaveIfError(fileSystem.Connect());
   1.462 +	
   1.463 +	//Open the file in the read mode
   1.464 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
   1.465 +
   1.466 +	CleanupClosePushL(logFile);
   1.467 +
   1.468 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
   1.469 +	
   1.470 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
   1.471 +	CleanupStack::PushL(hBuffer);
   1.472 +
   1.473 +	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
   1.474 +
   1.475 +	// Read from position 0: start of file
   1.476 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
   1.477 +	
   1.478 +	testData.Copy(KTestTooLongMessageOneParamExpected); //Copy the test descriptor
   1.479 +	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
   1.480 +											//from the file
   1.481 +
   1.482 +	CleanupStack::PopAndDestroy(hBuffer);
   1.483 +	CleanupStack::PopAndDestroy();	//logFile
   1.484 +	if (returnCode > 0)
   1.485 +		return KErrNone;
   1.486 +	else
   1.487 +		return KErrNotFound;
   1.488 +	}
   1.489 +
   1.490 +
   1.491 +
   1.492 +/**
   1.493 +* 028_Sync_ConWriteFormatV8Bit - test sync with connected unicode write
   1.494 +* doTestStep returns whether test case passed or failed.
   1.495 +*/ 
   1.496 +
   1.497 +CFloggerTest028_Sync_ConWriteFormatV8Bit::CFloggerTest028_Sync_ConWriteFormatV8Bit()
   1.498 +	{
   1.499 +	// Store the name of this test case
   1.500 +	SetTestStepName(_L("step_028_Sync_ConWriteFormatV8Bit"));
   1.501 +	}
   1.502 +
   1.503 +
   1.504 +
   1.505 +
   1.506 +CFloggerTest028_Sync_ConWriteFormatV8Bit::~CFloggerTest028_Sync_ConWriteFormatV8Bit()
   1.507 +	{
   1.508 +	}
   1.509 +
   1.510 +
   1.511 +
   1.512 +
   1.513 +TVerdict CFloggerTest028_Sync_ConWriteFormatV8Bit::doTestStepL( )
   1.514 +	{
   1.515 +	if ( executeStepL() == KErrNone  )
   1.516 +		SetTestStepResult(EPass);
   1.517 +
   1.518 +	else
   1.519 +		SetTestStepResult(EFail);
   1.520 +
   1.521 +	
   1.522 +	return TestStepResult();
   1.523 +	}
   1.524 +
   1.525 +
   1.526 +TInt CFloggerTest028_Sync_ConWriteFormatV8Bit::executeStepL(TBool)
   1.527 +	{
   1.528 +	return KErrGeneral;
   1.529 +	}
   1.530 +
   1.531 +TInt CFloggerTest028_Sync_ConWriteFormatV8Bit::executeStepL()
   1.532 +	{
   1.533 +	TInt ret;
   1.534 +	
   1.535 +	ret = flogger.Connect();
   1.536 +	
   1.537 +	if ( ret == KErrNone )
   1.538 +		{
   1.539 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
   1.540 +		flogger.ClearLog();
   1.541 +		DoTestWriteFormat(KTestMessageOneParam8,KTestMessageOneParamValue);
   1.542 +		flogger.Close();
   1.543 +		TRAPD(r, ret = DoTestCheckWriteL());
   1.544 +		if (r != KErrNone)
   1.545 +			ret = r;
   1.546 +		}
   1.547 +	
   1.548 +	return ret;		
   1.549 +
   1.550 +	}
   1.551 +
   1.552 +
   1.553 +void CFloggerTest028_Sync_ConWriteFormatV8Bit::DoTestWriteFormat(TRefByValue<const TDesC8> aFmt,...)
   1.554 +	{
   1.555 +	VA_LIST list;
   1.556 +	VA_START(list,aFmt);
   1.557 +	flogger.WriteFormat(aFmt,list);
   1.558 +	}
   1.559 +
   1.560 +
   1.561 +
   1.562 +TInt CFloggerTest028_Sync_ConWriteFormatV8Bit::DoTestCheckWriteL()
   1.563 +	{
   1.564 +	RFile logFile;
   1.565 +	HBufC8* hBuffer;
   1.566 +	TInt listfilesize,returnCode;
   1.567 +	RFs fileSystem; //For file operation create a file system
   1.568 +	TBuf8<KTestMessageSize> testData; //To hold the test descriptor
   1.569 +
   1.570 +	User::LeaveIfError(fileSystem.Connect());
   1.571 +	
   1.572 +	//Open the file in the read mode
   1.573 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
   1.574 +
   1.575 +	CleanupClosePushL(logFile);
   1.576 +
   1.577 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
   1.578 +	
   1.579 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
   1.580 +	CleanupStack::PushL(hBuffer);
   1.581 +
   1.582 +	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
   1.583 +
   1.584 +	// Read from position 0: start of file
   1.585 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
   1.586 +	
   1.587 +	testData.Copy(KTestMessageOneParamExpected); //Copy the test descriptor
   1.588 +	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
   1.589 +											//from the file
   1.590 +
   1.591 +	CleanupStack::PopAndDestroy(hBuffer);
   1.592 +	CleanupStack::PopAndDestroy();	//logFile
   1.593 +	if (returnCode > 0)
   1.594 +		return KErrNone;
   1.595 +	else
   1.596 +		return KErrNotFound;
   1.597 +	}
   1.598 +
   1.599 +
   1.600 +
   1.601 +/**
   1.602 +* 028_Sync_ConWriteFormatV8BitBound - test sync with connected unicode write and long string
   1.603 +* doTestStep returns whether test case passed or failed.
   1.604 +*/ 
   1.605 +
   1.606 +CFloggerTest028_Sync_ConWriteFormatV8BitBound::CFloggerTest028_Sync_ConWriteFormatV8BitBound()
   1.607 +	{
   1.608 +	// Store the name of this test case
   1.609 +	SetTestStepName(_L("step_028_Sync_ConWriteFormatV8BitBound"));
   1.610 +	}
   1.611 +
   1.612 +
   1.613 +
   1.614 +
   1.615 +CFloggerTest028_Sync_ConWriteFormatV8BitBound::~CFloggerTest028_Sync_ConWriteFormatV8BitBound()
   1.616 +	{
   1.617 +	}
   1.618 +
   1.619 +
   1.620 +
   1.621 +
   1.622 +TVerdict CFloggerTest028_Sync_ConWriteFormatV8BitBound::doTestStepL( )
   1.623 +	{
   1.624 +	if ( executeStepL() == KErrNone  )
   1.625 +		SetTestStepResult(EPass);
   1.626 +
   1.627 +	else
   1.628 +		SetTestStepResult(EFail);
   1.629 +
   1.630 +	
   1.631 +	return TestStepResult();
   1.632 +	}
   1.633 +
   1.634 +
   1.635 +TInt CFloggerTest028_Sync_ConWriteFormatV8BitBound::executeStepL(TBool)
   1.636 +	{
   1.637 +	return KErrGeneral;
   1.638 +	}
   1.639 +
   1.640 +TInt CFloggerTest028_Sync_ConWriteFormatV8BitBound::executeStepL()
   1.641 +	{
   1.642 +	TInt ret;
   1.643 +	
   1.644 +	ret = flogger.Connect();
   1.645 +	
   1.646 +	if ( ret == KErrNone )
   1.647 +		{
   1.648 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
   1.649 +		flogger.ClearLog();
   1.650 +		DoTestWriteFormat(KTestTooLongMessageOneParam8,KTestTooLongMessageOneParamValue);
   1.651 +		flogger.Close();
   1.652 +		TRAPD(r, ret = DoTestCheckWriteL());
   1.653 +		if (r != KErrNone)
   1.654 +			ret = r;
   1.655 +		}
   1.656 +	
   1.657 +	return ret;		
   1.658 +
   1.659 +	}
   1.660 +
   1.661 +
   1.662 +void CFloggerTest028_Sync_ConWriteFormatV8BitBound::DoTestWriteFormat(TRefByValue<const TDesC8> aFmt,...)
   1.663 +	{
   1.664 +	VA_LIST list;
   1.665 +	VA_START(list,aFmt);
   1.666 +	flogger.WriteFormat(aFmt,list);
   1.667 +	}
   1.668 +
   1.669 +
   1.670 +TInt CFloggerTest028_Sync_ConWriteFormatV8BitBound::DoTestCheckWriteL()
   1.671 +	{
   1.672 +	RFile logFile;
   1.673 +	HBufC8* hBuffer;
   1.674 +	TInt listfilesize,returnCode;
   1.675 +	RFs fileSystem; //For file operation create a file system
   1.676 +	TBuf8<KLogBufferSize> testData; //We expect the maximum chars for this case
   1.677 +
   1.678 +	User::LeaveIfError(fileSystem.Connect());
   1.679 +	
   1.680 +	//Open the file in the read mode
   1.681 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
   1.682 +
   1.683 +	CleanupClosePushL(logFile);
   1.684 +
   1.685 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
   1.686 +	
   1.687 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
   1.688 +	CleanupStack::PushL(hBuffer);
   1.689 +
   1.690 +	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
   1.691 +
   1.692 +	// Read from position 0: start of file
   1.693 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
   1.694 +	
   1.695 +	testData.Copy(KTestTooLongMessageOneParamExpected); //Copy the test descriptor
   1.696 +	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
   1.697 +											//from the file
   1.698 +
   1.699 +	CleanupStack::PopAndDestroy(hBuffer);
   1.700 +	CleanupStack::PopAndDestroy();	//logFile
   1.701 +	if (returnCode > 0)
   1.702 +		return KErrNone;
   1.703 +	else
   1.704 +		return KErrNotFound;
   1.705 +	}
   1.706 +
   1.707 +
   1.708 +
   1.709 +
   1.710 +/**
   1.711 +* 028_Sync_Static_WriteUni - test sync with connected unicode write
   1.712 +* doTestStep returns whether test case passed or failed.
   1.713 +*/ 
   1.714 +
   1.715 +CFloggerTest028_Sync_Static_WriteUni::CFloggerTest028_Sync_Static_WriteUni()
   1.716 +	{
   1.717 +	// Store the name of this test case
   1.718 +	SetTestStepName(_L("step_028_Sync_Static_WriteUni"));
   1.719 +	}
   1.720 +
   1.721 +
   1.722 +
   1.723 +
   1.724 +CFloggerTest028_Sync_Static_WriteUni::~CFloggerTest028_Sync_Static_WriteUni()
   1.725 +	{
   1.726 +	}
   1.727 +
   1.728 +
   1.729 +
   1.730 +
   1.731 +TVerdict CFloggerTest028_Sync_Static_WriteUni::doTestStepL( )
   1.732 +	{
   1.733 +	if ( executeStepL() == KErrNone  )
   1.734 +		SetTestStepResult(EPass);
   1.735 +
   1.736 +	else
   1.737 +		SetTestStepResult(EFail);
   1.738 +
   1.739 +	
   1.740 +	return TestStepResult();
   1.741 +	}
   1.742 +
   1.743 +
   1.744 +TInt CFloggerTest028_Sync_Static_WriteUni::executeStepL(TBool)
   1.745 +	{
   1.746 +	return KErrGeneral;
   1.747 +	}
   1.748 +
   1.749 +TInt CFloggerTest028_Sync_Static_WriteUni::executeStepL()
   1.750 +	{
   1.751 +	TInt ret;
   1.752 +	
   1.753 +	// clear the old log messages
   1.754 +	RFileLogger flogger;
   1.755 +	ret = flogger.Connect();
   1.756 +	
   1.757 +	if ( ret == KErrNone )
   1.758 +		{
   1.759 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
   1.760 +		flogger.ClearLog();
   1.761 +		flogger.Close();
   1.762 +		
   1.763 +		RFileLogger::Write(KStdSubsysTag8, KStdCompTag8, KTestMessage);
   1.764 +		
   1.765 +		TRAPD(r, ret = DoTestCheckWriteL());
   1.766 +		if (r != KErrNone)
   1.767 +			ret = r;
   1.768 +		}
   1.769 +		
   1.770 +	
   1.771 +	return ret;		
   1.772 +
   1.773 +	}
   1.774 +
   1.775 +
   1.776 +TInt CFloggerTest028_Sync_Static_WriteUni::DoTestCheckWriteL()
   1.777 +	{
   1.778 +	RFile logFile;
   1.779 +	HBufC8* hBuffer;
   1.780 +	TInt listfilesize,returnCode;
   1.781 +	RFs fileSystem; //For file operation create a file system
   1.782 +	TBuf8<KTestMessageSize> testData; //To hold the test descriptor
   1.783 +
   1.784 +	User::LeaveIfError(fileSystem.Connect());
   1.785 +	
   1.786 +	//Open the file in the read mode
   1.787 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
   1.788 +
   1.789 +	CleanupClosePushL(logFile);
   1.790 +
   1.791 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
   1.792 +	
   1.793 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
   1.794 +	CleanupStack::PushL(hBuffer);
   1.795 +
   1.796 +	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
   1.797 +
   1.798 +	// Read from position 0: start of file
   1.799 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
   1.800 +	
   1.801 +	testData.Copy(KTestMessage); //Copy the test descriptor
   1.802 +	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
   1.803 +											//from the file
   1.804 +
   1.805 +	CleanupStack::PopAndDestroy(hBuffer);
   1.806 +	CleanupStack::PopAndDestroy();	//logFile
   1.807 +	if (returnCode > 0)
   1.808 +		return KErrNone;
   1.809 +	else
   1.810 +		return KErrNotFound;
   1.811 +	}
   1.812 +
   1.813 +
   1.814 +
   1.815 +/**
   1.816 +* 028_Sync_Static_WriteUniBound - test sync with connected unicode write and long string
   1.817 +* doTestStep returns whether test case passed or failed.
   1.818 +*/ 
   1.819 +
   1.820 +CFloggerTest028_Sync_Static_WriteUniBound::CFloggerTest028_Sync_Static_WriteUniBound()
   1.821 +	{
   1.822 +	// Store the name of this test case
   1.823 +	SetTestStepName(_L("step_028_Sync_Static_WriteUniBound"));
   1.824 +	}
   1.825 +
   1.826 +
   1.827 +
   1.828 +
   1.829 +CFloggerTest028_Sync_Static_WriteUniBound::~CFloggerTest028_Sync_Static_WriteUniBound()
   1.830 +	{
   1.831 +	}
   1.832 +
   1.833 +
   1.834 +
   1.835 +
   1.836 +TVerdict CFloggerTest028_Sync_Static_WriteUniBound::doTestStepL( )
   1.837 +	{
   1.838 +	if ( executeStepL() == KErrNone  )
   1.839 +		SetTestStepResult(EPass);
   1.840 +
   1.841 +	else
   1.842 +		SetTestStepResult(EFail);
   1.843 +
   1.844 +	
   1.845 +	return TestStepResult();
   1.846 +	}
   1.847 +
   1.848 +
   1.849 +TInt CFloggerTest028_Sync_Static_WriteUniBound::executeStepL(TBool)
   1.850 +	{
   1.851 +	return KErrGeneral;
   1.852 +	}
   1.853 +
   1.854 +TInt CFloggerTest028_Sync_Static_WriteUniBound::executeStepL()
   1.855 +	{
   1.856 +	TInt ret;
   1.857 +	
   1.858 +	
   1.859 +	// clear the old log messages
   1.860 +	RFileLogger flogger;
   1.861 +	ret = flogger.Connect();
   1.862 +	
   1.863 +	if ( ret == KErrNone )
   1.864 +		{
   1.865 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
   1.866 +		flogger.ClearLog();
   1.867 +		flogger.Close();
   1.868 +		
   1.869 +		RFileLogger::Write(KStdSubsysTag8, KStdCompTag8, KTestTooLongMessage16);
   1.870 +		
   1.871 +		TRAPD(r, ret = DoTestCheckWriteL());
   1.872 +		if (r != KErrNone)
   1.873 +			ret = r;
   1.874 +		}
   1.875 +	
   1.876 +	return ret;		
   1.877 +	
   1.878 +
   1.879 +	}
   1.880 +
   1.881 +
   1.882 +TInt CFloggerTest028_Sync_Static_WriteUniBound::DoTestCheckWriteL()
   1.883 +	{
   1.884 +	RFile logFile;
   1.885 +	HBufC8* hBuffer;
   1.886 +	TInt listfilesize,returnCode;
   1.887 +	RFs fileSystem; //For file operation create a file system
   1.888 +	TBuf8<KLogBufferSize> testData; //We expect the maximum chars for this case
   1.889 +
   1.890 +	User::LeaveIfError(fileSystem.Connect());
   1.891 +	
   1.892 +	//Open the file in the read mode
   1.893 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
   1.894 +
   1.895 +	CleanupClosePushL(logFile);
   1.896 +
   1.897 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
   1.898 +	
   1.899 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
   1.900 +	CleanupStack::PushL(hBuffer);
   1.901 +
   1.902 +	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
   1.903 +
   1.904 +	// Read from position 0: start of file
   1.905 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
   1.906 +	
   1.907 +	testData.Copy(KTestTooLongExpectedMessage); //Copy the test descriptor
   1.908 +	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
   1.909 +											//from the file
   1.910 +
   1.911 +	CleanupStack::PopAndDestroy(hBuffer);
   1.912 +	CleanupStack::PopAndDestroy();	//logFile
   1.913 +	if (returnCode > 0)
   1.914 +		return KErrNone;
   1.915 +	else
   1.916 +		return KErrNotFound;
   1.917 +	}
   1.918 +
   1.919 +
   1.920 +
   1.921 +
   1.922 +
   1.923 +/**
   1.924 +* 028_Sync_Static_WriteFormatVUni - test sync with static formatted VA_LIST unicode write
   1.925 +* doTestStep returns whether test case passed or failed.
   1.926 +*/ 
   1.927 +
   1.928 +CFloggerTest028_Sync_Static_WriteFormatVUni::CFloggerTest028_Sync_Static_WriteFormatVUni()
   1.929 +	{
   1.930 +	// Store the name of this test case
   1.931 +	SetTestStepName(_L("step_028_Sync_Static_WriteFormatVUni"));
   1.932 +	}
   1.933 +
   1.934 +
   1.935 +
   1.936 +
   1.937 +CFloggerTest028_Sync_Static_WriteFormatVUni::~CFloggerTest028_Sync_Static_WriteFormatVUni()
   1.938 +	{
   1.939 +	}
   1.940 +
   1.941 +
   1.942 +
   1.943 +
   1.944 +TVerdict CFloggerTest028_Sync_Static_WriteFormatVUni::doTestStepL( )
   1.945 +	{
   1.946 +	if ( executeStepL() == KErrNone  )
   1.947 +		SetTestStepResult(EPass);
   1.948 +
   1.949 +	else
   1.950 +		SetTestStepResult(EFail);
   1.951 +
   1.952 +	
   1.953 +	return TestStepResult();
   1.954 +	}
   1.955 +
   1.956 +
   1.957 +TInt CFloggerTest028_Sync_Static_WriteFormatVUni::executeStepL(TBool)
   1.958 +	{
   1.959 +	return KErrGeneral;
   1.960 +	}
   1.961 +
   1.962 +TInt CFloggerTest028_Sync_Static_WriteFormatVUni::executeStepL()
   1.963 +	{
   1.964 +	TInt ret;
   1.965 +	
   1.966 +	// clear the old log messages
   1.967 +	RFileLogger flogger;
   1.968 +	ret = flogger.Connect();
   1.969 +	
   1.970 +	if ( ret == KErrNone )
   1.971 +		{
   1.972 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
   1.973 +		flogger.ClearLog();
   1.974 +		flogger.Close();
   1.975 +		
   1.976 +		DoTestWriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
   1.977 +		
   1.978 +		TRAPD(r, ret = DoTestCheckWriteL());
   1.979 +		if (r != KErrNone)
   1.980 +			ret = r;
   1.981 +		}
   1.982 +		
   1.983 +	
   1.984 +	return ret;		
   1.985 +
   1.986 +	}
   1.987 +
   1.988 +
   1.989 +void CFloggerTest028_Sync_Static_WriteFormatVUni::DoTestWriteFormat(TRefByValue<const TDesC16> aFmt,...)
   1.990 +	{
   1.991 +	VA_LIST list;
   1.992 +	VA_START(list,aFmt);
   1.993 +	RFileLogger::WriteFormat(KStdSubsysTag8,KStdCompTag8,aFmt,list);
   1.994 +	}
   1.995 +
   1.996 +
   1.997 +
   1.998 +TInt CFloggerTest028_Sync_Static_WriteFormatVUni::DoTestCheckWriteL()
   1.999 +	{
  1.1000 +	RFile logFile;
  1.1001 +	HBufC8* hBuffer;
  1.1002 +	TInt listfilesize,returnCode;
  1.1003 +	RFs fileSystem; //For file operation create a file system
  1.1004 +	TBuf8<KTestMessageSize> testData; //To hold the test descriptor
  1.1005 +
  1.1006 +	User::LeaveIfError(fileSystem.Connect());
  1.1007 +	
  1.1008 +	//Open the file in the read mode
  1.1009 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
  1.1010 +
  1.1011 +	CleanupClosePushL(logFile);
  1.1012 +
  1.1013 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
  1.1014 +	
  1.1015 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
  1.1016 +	CleanupStack::PushL(hBuffer);
  1.1017 +
  1.1018 +	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
  1.1019 +
  1.1020 +	// Read from position 0: start of file
  1.1021 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
  1.1022 +	
  1.1023 +	testData.Copy(KTestMessageOneParamExpected); //Copy the test descriptor
  1.1024 +	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
  1.1025 +											//from the file
  1.1026 +
  1.1027 +	CleanupStack::PopAndDestroy(hBuffer);
  1.1028 +	CleanupStack::PopAndDestroy();	//logFile
  1.1029 +	if (returnCode > 0)
  1.1030 +		return KErrNone;
  1.1031 +	else
  1.1032 +		return KErrNotFound;
  1.1033 +	}
  1.1034 +
  1.1035 +
  1.1036 +
  1.1037 +/**
  1.1038 +* 028_Sync_Static_WriteFormatVUniBound - test sync with static formatted VA_LIST unicode write and long string
  1.1039 +* doTestStep returns whether test case passed or failed.
  1.1040 +*/ 
  1.1041 +
  1.1042 +CFloggerTest028_Sync_Static_WriteFormatVUniBound::CFloggerTest028_Sync_Static_WriteFormatVUniBound()
  1.1043 +	{
  1.1044 +	// Store the name of this test case
  1.1045 +	SetTestStepName(_L("step_028_Sync_Static_WriteFormatVUniBound"));
  1.1046 +	}
  1.1047 +
  1.1048 +
  1.1049 +
  1.1050 +
  1.1051 +CFloggerTest028_Sync_Static_WriteFormatVUniBound::~CFloggerTest028_Sync_Static_WriteFormatVUniBound()
  1.1052 +	{
  1.1053 +	}
  1.1054 +
  1.1055 +
  1.1056 +
  1.1057 +
  1.1058 +TVerdict CFloggerTest028_Sync_Static_WriteFormatVUniBound::doTestStepL( )
  1.1059 +	{
  1.1060 +	if ( executeStepL() == KErrNone  )
  1.1061 +		SetTestStepResult(EPass);
  1.1062 +
  1.1063 +	else
  1.1064 +		SetTestStepResult(EFail);
  1.1065 +
  1.1066 +	
  1.1067 +	return TestStepResult();
  1.1068 +	}
  1.1069 +
  1.1070 +
  1.1071 +TInt CFloggerTest028_Sync_Static_WriteFormatVUniBound::executeStepL(TBool)
  1.1072 +	{
  1.1073 +	return KErrGeneral;
  1.1074 +	}
  1.1075 +
  1.1076 +TInt CFloggerTest028_Sync_Static_WriteFormatVUniBound::executeStepL()
  1.1077 +	{
  1.1078 +	TInt ret;
  1.1079 +	
  1.1080 +	
  1.1081 +	// clear the old log messages
  1.1082 +	RFileLogger flogger;
  1.1083 +	ret = flogger.Connect();
  1.1084 +	
  1.1085 +	if ( ret == KErrNone )
  1.1086 +		{
  1.1087 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
  1.1088 +		flogger.ClearLog();
  1.1089 +		flogger.Close();
  1.1090 +		
  1.1091 +		DoTestWriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
  1.1092 +		
  1.1093 +		TRAPD(r, ret = DoTestCheckWriteL());
  1.1094 +		if (r != KErrNone)
  1.1095 +			ret = r;
  1.1096 +		}
  1.1097 +	
  1.1098 +	return ret;		
  1.1099 +	}
  1.1100 +
  1.1101 +
  1.1102 +
  1.1103 +void CFloggerTest028_Sync_Static_WriteFormatVUniBound::DoTestWriteFormat(TRefByValue<const TDesC16> aFmt,...)
  1.1104 +	{
  1.1105 +	VA_LIST list;
  1.1106 +	VA_START(list,aFmt);
  1.1107 +	RFileLogger::WriteFormat(KStdSubsysTag8, KStdCompTag8, aFmt,list);
  1.1108 +	}
  1.1109 +	
  1.1110 +	
  1.1111 +
  1.1112 +TInt CFloggerTest028_Sync_Static_WriteFormatVUniBound::DoTestCheckWriteL()
  1.1113 +	{
  1.1114 +	RFile logFile;
  1.1115 +	HBufC8* hBuffer;
  1.1116 +	TInt listfilesize,returnCode;
  1.1117 +	RFs fileSystem; //For file operation create a file system
  1.1118 +	TBuf8<KLogBufferSize> testData; //We expect the maximum chars for this case
  1.1119 +
  1.1120 +	User::LeaveIfError(fileSystem.Connect());
  1.1121 +	
  1.1122 +	//Open the file in the read mode
  1.1123 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
  1.1124 +
  1.1125 +	CleanupClosePushL(logFile);
  1.1126 +
  1.1127 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
  1.1128 +	
  1.1129 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
  1.1130 +	CleanupStack::PushL(hBuffer);
  1.1131 +
  1.1132 +	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
  1.1133 +
  1.1134 +	// Read from position 0: start of file
  1.1135 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
  1.1136 +	
  1.1137 +	testData.Copy(KTestTooLongMessageOneParamExpected); //Copy the test descriptor
  1.1138 +	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
  1.1139 +											//from the file
  1.1140 +
  1.1141 +	CleanupStack::PopAndDestroy(hBuffer);
  1.1142 +	CleanupStack::PopAndDestroy();	//logFile
  1.1143 +	if (returnCode > 0)
  1.1144 +		return KErrNone;
  1.1145 +	else
  1.1146 +		return KErrNotFound;
  1.1147 +	}
  1.1148 +
  1.1149 +
  1.1150 +
  1.1151 +
  1.1152 +/**
  1.1153 +* 028_Sync_Static_HexDump - test sync with connected unicode write
  1.1154 +* doTestStep returns whether test case passed or failed.
  1.1155 +*/ 
  1.1156 +
  1.1157 +CFloggerTest028_Sync_Static_HexDump::CFloggerTest028_Sync_Static_HexDump()
  1.1158 +	{
  1.1159 +	// Store the name of this test case
  1.1160 +	SetTestStepName(_L("step_028_Sync_Static_HexDump"));
  1.1161 +	}
  1.1162 +
  1.1163 +
  1.1164 +
  1.1165 +
  1.1166 +CFloggerTest028_Sync_Static_HexDump::~CFloggerTest028_Sync_Static_HexDump()
  1.1167 +	{
  1.1168 +	}
  1.1169 +
  1.1170 +
  1.1171 +
  1.1172 +
  1.1173 +TVerdict CFloggerTest028_Sync_Static_HexDump::doTestStepL( )
  1.1174 +	{
  1.1175 +	if ( executeStepL() == KErrNone  )
  1.1176 +		SetTestStepResult(EPass);
  1.1177 +
  1.1178 +	else
  1.1179 +		SetTestStepResult(EFail);
  1.1180 +
  1.1181 +	
  1.1182 +	return TestStepResult();
  1.1183 +	}
  1.1184 +
  1.1185 +
  1.1186 +TInt CFloggerTest028_Sync_Static_HexDump::executeStepL(TBool)
  1.1187 +	{
  1.1188 +	return KErrGeneral;
  1.1189 +	}
  1.1190 +
  1.1191 +TInt CFloggerTest028_Sync_Static_HexDump::executeStepL()
  1.1192 +	{
  1.1193 +	TInt ret;
  1.1194 +	
  1.1195 +	// clear the old log messages
  1.1196 +	RFileLogger flogger;
  1.1197 +	ret = flogger.Connect();
  1.1198 +	
  1.1199 +	if ( ret == KErrNone )
  1.1200 +		{
  1.1201 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
  1.1202 +		flogger.ClearLog();
  1.1203 +		flogger.Close();
  1.1204 +		
  1.1205 +		RFileLogger::HexDump(KStdSubsysTag8, KStdCompTag8, KTestMessage8);
  1.1206 +		
  1.1207 +		TRAPD(r, ret = DoTestCheckWriteL());
  1.1208 +		if (r != KErrNone)
  1.1209 +			ret = r;
  1.1210 +		}
  1.1211 +		
  1.1212 +	
  1.1213 +	return ret;		
  1.1214 +
  1.1215 +	}
  1.1216 +
  1.1217 +
  1.1218 +TInt CFloggerTest028_Sync_Static_HexDump::DoTestCheckWriteL()
  1.1219 +	{
  1.1220 +	RFile logFile;
  1.1221 +	HBufC8* hBuffer;
  1.1222 +	TInt listfilesize,returnCode;
  1.1223 +	RFs fileSystem; //For file operation create a file system
  1.1224 +
  1.1225 +	User::LeaveIfError(fileSystem.Connect());
  1.1226 +	
  1.1227 +	//Open the file in the read mode
  1.1228 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
  1.1229 +
  1.1230 +	CleanupClosePushL(logFile);
  1.1231 +
  1.1232 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
  1.1233 +	
  1.1234 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
  1.1235 +	CleanupStack::PushL(hBuffer);
  1.1236 +
  1.1237 +	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
  1.1238 +
  1.1239 +	// Read from position 0: start of file
  1.1240 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
  1.1241 +	
  1.1242 +	returnCode = ptrString.Find(KTestMessageAsHex8); //find the test descriptor in the buffer read
  1.1243 +											//from the file
  1.1244 +
  1.1245 +	CleanupStack::PopAndDestroy(hBuffer);
  1.1246 +	CleanupStack::PopAndDestroy();	//logFile
  1.1247 +	if (returnCode > 0)
  1.1248 +		return KErrNone;
  1.1249 +	else
  1.1250 +		return KErrNotFound;
  1.1251 +	}
  1.1252 +	
  1.1253 +	
  1.1254 +	
  1.1255 +/**
  1.1256 +* 028_Sync_ClearLog - test sync with clearlog
  1.1257 +* doTestStep returns whether test case passed or failed.
  1.1258 +*/ 
  1.1259 +
  1.1260 +CFloggerTest028_Sync_ClearLog::CFloggerTest028_Sync_ClearLog()
  1.1261 +	{
  1.1262 +	// Store the name of this test case
  1.1263 +	SetTestStepName(_L("step_028_Sync_ClearLog"));
  1.1264 +	}
  1.1265 +
  1.1266 +
  1.1267 +
  1.1268 +
  1.1269 +CFloggerTest028_Sync_ClearLog::~CFloggerTest028_Sync_ClearLog()
  1.1270 +	{
  1.1271 +	}
  1.1272 +
  1.1273 +
  1.1274 +
  1.1275 +
  1.1276 +TVerdict CFloggerTest028_Sync_ClearLog::doTestStepL( )
  1.1277 +	{
  1.1278 +	if ( executeStepL() == KErrNone  )
  1.1279 +		SetTestStepResult(EPass);
  1.1280 +
  1.1281 +	else
  1.1282 +		SetTestStepResult(EFail);
  1.1283 +
  1.1284 +	
  1.1285 +	return TestStepResult();
  1.1286 +	}
  1.1287 +
  1.1288 +
  1.1289 +TInt CFloggerTest028_Sync_ClearLog::executeStepL(TBool)
  1.1290 +	{
  1.1291 +	return KErrGeneral;
  1.1292 +	}
  1.1293 +
  1.1294 +TInt CFloggerTest028_Sync_ClearLog::executeStepL()
  1.1295 +	{
  1.1296 +	TInt ret;
  1.1297 +	
  1.1298 +	// clear the old log messages
  1.1299 +	RFileLogger flogger;
  1.1300 +	ret = flogger.Connect();
  1.1301 +	
  1.1302 +	if ( ret == KErrNone )
  1.1303 +		{
  1.1304 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
  1.1305 +		flogger.ClearLog();
  1.1306 +		flogger.Close();
  1.1307 +		
  1.1308 +		TRAPD(r, ret = DoTestCheckWriteL());
  1.1309 +		if (r != KErrNone)
  1.1310 +			ret = r;
  1.1311 +		}
  1.1312 +		
  1.1313 +	
  1.1314 +	return ret;		
  1.1315 +
  1.1316 +	}
  1.1317 +
  1.1318 +
  1.1319 +TInt CFloggerTest028_Sync_ClearLog::DoTestCheckWriteL()
  1.1320 +	{
  1.1321 +	RFile logFile;
  1.1322 +	HBufC8* hBuffer;
  1.1323 +	TInt listfilesize,returnCode;
  1.1324 +	RFs fileSystem; //For file operation create a file system
  1.1325 +	TBuf8<KTestMessageSize> testData; //To hold the test descriptor
  1.1326 +
  1.1327 +	User::LeaveIfError(fileSystem.Connect());
  1.1328 +	
  1.1329 +	//Open the file in the read mode
  1.1330 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
  1.1331 +
  1.1332 +	CleanupClosePushL(logFile);
  1.1333 +
  1.1334 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
  1.1335 +	
  1.1336 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
  1.1337 +	CleanupStack::PushL(hBuffer);
  1.1338 +
  1.1339 +	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
  1.1340 +
  1.1341 +	// Read from position 0: start of file
  1.1342 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
  1.1343 +	
  1.1344 +	testData.Copy(KTestMessage); //Copy the test descriptor
  1.1345 +	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
  1.1346 +											//from the file
  1.1347 +
  1.1348 +	CleanupStack::PopAndDestroy(hBuffer);
  1.1349 +	CleanupStack::PopAndDestroy();	//logFile
  1.1350 +	if (returnCode == KErrNotFound)
  1.1351 +		return KErrNone;
  1.1352 +	else
  1.1353 +		return KErrUnknown;
  1.1354 +	}
  1.1355 +	
  1.1356 +	
  1.1357 +	
  1.1358 +	
  1.1359 +/**
  1.1360 +* 028_Sync_Binary - test sync with write binary
  1.1361 +* doTestStep returns whether test case passed or failed.
  1.1362 +*/ 
  1.1363 +
  1.1364 +CFloggerTest028_Sync_Binary::CFloggerTest028_Sync_Binary()
  1.1365 +	{
  1.1366 +	// Store the name of this test case
  1.1367 +	SetTestStepName(_L("step_028_Sync_Binary"));
  1.1368 +	}
  1.1369 +
  1.1370 +
  1.1371 +
  1.1372 +
  1.1373 +CFloggerTest028_Sync_Binary::~CFloggerTest028_Sync_Binary()
  1.1374 +	{
  1.1375 +	}
  1.1376 +
  1.1377 +
  1.1378 +
  1.1379 +
  1.1380 +TVerdict CFloggerTest028_Sync_Binary::doTestStepL( )
  1.1381 +	{
  1.1382 +	if ( executeStepL() == KErrNone  )
  1.1383 +		SetTestStepResult(EPass);
  1.1384 +
  1.1385 +	else
  1.1386 +		SetTestStepResult(EFail);
  1.1387 +
  1.1388 +	
  1.1389 +	return TestStepResult();
  1.1390 +	}
  1.1391 +
  1.1392 +
  1.1393 +TInt CFloggerTest028_Sync_Binary::executeStepL(TBool)
  1.1394 +	{
  1.1395 +	return KErrGeneral;
  1.1396 +	}	
  1.1397 +
  1.1398 +TInt CFloggerTest028_Sync_Binary::executeStepL()
  1.1399 +	{
  1.1400 +	TInt ret;
  1.1401 +	
  1.1402 +	// clear the old log messages
  1.1403 +	ret = flogger.Connect();
  1.1404 +	
  1.1405 +	if ( ret == KErrNone )
  1.1406 +		{
  1.1407 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
  1.1408 +		flogger.ClearLog();
  1.1409 +		
  1.1410 +		flogger.WriteBinary(KTestMessage8);
  1.1411 +		
  1.1412 +		flogger.Close();
  1.1413 +		
  1.1414 +		TRAPD(r, ret = DoTestCheckWriteL());
  1.1415 +		if (r != KErrNone)
  1.1416 +			ret = r;
  1.1417 +		}
  1.1418 +		
  1.1419 +	
  1.1420 +	return ret;		
  1.1421 +
  1.1422 +	}
  1.1423 +
  1.1424 +
  1.1425 +TInt CFloggerTest028_Sync_Binary::DoTestCheckWriteL()
  1.1426 +	{
  1.1427 +	RFile logFile;
  1.1428 +	HBufC8* hBuffer;
  1.1429 +	TInt listfilesize,returnCode;
  1.1430 +	RFs fileSystem; //For file operation create a file system
  1.1431 +	TInt numSuccessful = 0;
  1.1432 +
  1.1433 +	User::LeaveIfError(fileSystem.Connect());
  1.1434 +	
  1.1435 +	//Open the file in the read mode
  1.1436 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
  1.1437 +
  1.1438 +	CleanupClosePushL(logFile);
  1.1439 +
  1.1440 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
  1.1441 +	
  1.1442 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
  1.1443 +	CleanupStack::PushL(hBuffer);
  1.1444 +
  1.1445 +	TPtr8 ptrString = hBuffer->Des();  ; //To access the buffer
  1.1446 +
  1.1447 +	// Read from position 0: start of file
  1.1448 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
  1.1449 +	
  1.1450 +	returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read
  1.1451 +											//from the file
  1.1452 +	if (returnCode > 0)
  1.1453 +		{
  1.1454 +		numSuccessful++;
  1.1455 +		}
  1.1456 +
  1.1457 +	returnCode = ptrString.Find(KStdSubsysTag8); 
  1.1458 +	if (returnCode > 0)
  1.1459 +		{
  1.1460 +		numSuccessful++;
  1.1461 +		}
  1.1462 +
  1.1463 +	returnCode = ptrString.Find(KStdCompTag8); 
  1.1464 +	if (returnCode > 0)
  1.1465 +		{
  1.1466 +		numSuccessful++;
  1.1467 +		}
  1.1468 +		
  1.1469 +
  1.1470 +
  1.1471 +	CleanupStack::PopAndDestroy(hBuffer);
  1.1472 +	CleanupStack::PopAndDestroy();	//logFile
  1.1473 +	if (numSuccessful ==3)
  1.1474 +		return KErrNone;
  1.1475 +	else
  1.1476 +		return KErrUnknown;
  1.1477 +	}
  1.1478 +	
  1.1479 +	
  1.1480 +	
  1.1481 +/**
  1.1482 +* 028_Sync_ConMultiple - test connect and multiple writes
  1.1483 +* doTestStep returns whether test case passed or failed.
  1.1484 +*/ 
  1.1485 +
  1.1486 +CFloggerTest028_Sync_ConMultiple::CFloggerTest028_Sync_ConMultiple()
  1.1487 +	{
  1.1488 +	// Store the name of this test case
  1.1489 +	SetTestStepName(_L("step_028_Sync_ConMultiple"));
  1.1490 +	}
  1.1491 +
  1.1492 +
  1.1493 +
  1.1494 +
  1.1495 +CFloggerTest028_Sync_ConMultiple::~CFloggerTest028_Sync_ConMultiple()
  1.1496 +	{
  1.1497 +	}
  1.1498 +
  1.1499 +
  1.1500 +
  1.1501 +
  1.1502 +TVerdict CFloggerTest028_Sync_ConMultiple::doTestStepL( )
  1.1503 +	{
  1.1504 +	if ( executeStepL() == KErrNone  )
  1.1505 +		SetTestStepResult(EPass);
  1.1506 +
  1.1507 +	else
  1.1508 +		SetTestStepResult(EFail);
  1.1509 +
  1.1510 +	
  1.1511 +	return TestStepResult();
  1.1512 +	}
  1.1513 +
  1.1514 +TInt CFloggerTest028_Sync_ConMultiple::executeStepL(TBool)
  1.1515 +	{
  1.1516 +	return KErrGeneral;
  1.1517 +	}
  1.1518 +
  1.1519 +
  1.1520 +TInt CFloggerTest028_Sync_ConMultiple::executeStepL()
  1.1521 +	{
  1.1522 +	TInt ret;
  1.1523 +	
  1.1524 +	// clear the old log messages
  1.1525 +	ret = flogger.Connect();
  1.1526 +	
  1.1527 +	if ( ret == KErrNone )
  1.1528 +		{
  1.1529 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
  1.1530 +		flogger.ClearLog();
  1.1531 +		
  1.1532 +		flogger.Write(KTestMessage);
  1.1533 +		flogger.WriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
  1.1534 +		flogger.Write(KTestTooLongMessage16);
  1.1535 +		flogger.WriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
  1.1536 +		DoTestWriteFormat(KTestMessageOneParam8,KTestMessageOneParamValue);
  1.1537 +		
  1.1538 +		TPtrC8 dataSeg;
  1.1539 +		dataSeg.Set(K1KilobyteOfData,K1KilobyteOfDataSize);
  1.1540 +		flogger.WriteBinary(dataSeg);
  1.1541 +		
  1.1542 +		flogger.Close();
  1.1543 +		
  1.1544 +		TRAPD(r, ret = DoTestCheckWriteL());
  1.1545 +		if (r != KErrNone)
  1.1546 +			ret = r;
  1.1547 +		}
  1.1548 +		
  1.1549 +	
  1.1550 +	return ret;		
  1.1551 +
  1.1552 +	}
  1.1553 +
  1.1554 +void CFloggerTest028_Sync_ConMultiple::DoTestWriteFormat(TRefByValue<const TDesC8> aFmt,...)
  1.1555 +	{
  1.1556 +	VA_LIST list;
  1.1557 +	VA_START(list,aFmt);
  1.1558 +	flogger.WriteFormat(aFmt,list);
  1.1559 +	}
  1.1560 +
  1.1561 +TInt CFloggerTest028_Sync_ConMultiple::DoTestCheckWriteL()
  1.1562 +	{
  1.1563 +	RFile logFile;
  1.1564 +	HBufC8* hBuffer;
  1.1565 +	TInt listfilesize,returnCode;
  1.1566 +	RFs fileSystem; //For file operation create a file system
  1.1567 +	TInt numSuccessful = 0;
  1.1568 +
  1.1569 +	User::LeaveIfError(fileSystem.Connect());
  1.1570 +	
  1.1571 +	//Open the file in the read mode
  1.1572 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
  1.1573 +
  1.1574 +	CleanupClosePushL(logFile);
  1.1575 +
  1.1576 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
  1.1577 +	
  1.1578 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
  1.1579 +	CleanupStack::PushL(hBuffer);
  1.1580 +
  1.1581 +	TPtr8 ptrString = hBuffer->Des();  //To access the buffer
  1.1582 +
  1.1583 +	// Read from position 0: start of file
  1.1584 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
  1.1585 +	
  1.1586 +	returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read
  1.1587 +											//from the file
  1.1588 +	if (returnCode > 0)
  1.1589 +		{
  1.1590 +		numSuccessful++;
  1.1591 +		}
  1.1592 +
  1.1593 +
  1.1594 +	returnCode = ptrString.Find(KTestMessageOneParamExpected); 
  1.1595 +	if (returnCode > 0)
  1.1596 +		{
  1.1597 +		numSuccessful++;
  1.1598 +		}
  1.1599 +
  1.1600 +	TPtrC8 ptrStringOffsetForSearching = ptrString.Right((ptrString.Length()-returnCode)-KTestMessageOneParamExpected().Length());
  1.1601 +
  1.1602 +	returnCode = ptrStringOffsetForSearching.Find(KTestMessageOneParamExpected); //find the next occurance
  1.1603 +	if (returnCode > 0)
  1.1604 +		{
  1.1605 +		numSuccessful++;
  1.1606 +		}
  1.1607 +
  1.1608 +	returnCode = ptrString.Find(KTestTooLongExpectedMessage); 
  1.1609 +	if (returnCode > 0)
  1.1610 +		{
  1.1611 +		numSuccessful++;
  1.1612 +		}
  1.1613 +		
  1.1614 +	returnCode = ptrString.Find(KTestTooLongMessageOneParamExpected); 
  1.1615 +	if (returnCode > 0)
  1.1616 +		{
  1.1617 +		numSuccessful++;
  1.1618 +		}
  1.1619 +
  1.1620 +	// we don't check that all the binary data is there - just that the file is nice and long		
  1.1621 +	if ( listfilesize > K1KilobyteOfDataSize)
  1.1622 +		{
  1.1623 +		numSuccessful++;
  1.1624 +		}
  1.1625 +
  1.1626 +
  1.1627 +
  1.1628 +	CleanupStack::PopAndDestroy(hBuffer);
  1.1629 +	CleanupStack::PopAndDestroy();	//logFile
  1.1630 +	if ( numSuccessful == 6 )
  1.1631 +		return KErrNone;
  1.1632 +	else
  1.1633 +		return KErrUnknown;
  1.1634 +	}
  1.1635 +	
  1.1636 +	
  1.1637 +	
  1.1638 +	
  1.1639 +	
  1.1640 +	
  1.1641 +/**
  1.1642 +* 028_Sync_Static_Multiple - test static multiple writes
  1.1643 +* doTestStep returns whether test case passed or failed.
  1.1644 +*/ 
  1.1645 +
  1.1646 +CFloggerTest028_Sync_Static_Multiple::CFloggerTest028_Sync_Static_Multiple()
  1.1647 +	{
  1.1648 +	// Store the name of this test case
  1.1649 +	SetTestStepName(_L("step_028_Sync_Static_Multiple"));
  1.1650 +	}
  1.1651 +
  1.1652 +
  1.1653 +
  1.1654 +
  1.1655 +CFloggerTest028_Sync_Static_Multiple::~CFloggerTest028_Sync_Static_Multiple()
  1.1656 +	{
  1.1657 +	}
  1.1658 +
  1.1659 +
  1.1660 +
  1.1661 +
  1.1662 +TVerdict CFloggerTest028_Sync_Static_Multiple::doTestStepL( )
  1.1663 +	{
  1.1664 +	if ( executeStepL() == KErrNone  )
  1.1665 +		SetTestStepResult(EPass);
  1.1666 +
  1.1667 +	else
  1.1668 +		SetTestStepResult(EFail);
  1.1669 +
  1.1670 +	
  1.1671 +	return TestStepResult();
  1.1672 +	}
  1.1673 +
  1.1674 +TInt CFloggerTest028_Sync_Static_Multiple::executeStepL(TBool)
  1.1675 +	{
  1.1676 +	return KErrGeneral;
  1.1677 +	}
  1.1678 +
  1.1679 +
  1.1680 +TInt CFloggerTest028_Sync_Static_Multiple::executeStepL()
  1.1681 +	{
  1.1682 +	TInt ret;
  1.1683 +	
  1.1684 +	// clear the old log messages
  1.1685 +	RFileLogger flogger;
  1.1686 +	ret = flogger.Connect();
  1.1687 +	
  1.1688 +	if ( ret == KErrNone )
  1.1689 +		{
  1.1690 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
  1.1691 +		flogger.ClearLog();
  1.1692 +		flogger.Close();
  1.1693 +		
  1.1694 +		RFileLogger::Write(KStdSubsysTag8, KStdCompTag8,KTestMessage);
  1.1695 +		RFileLogger::WriteFormat(KStdSubsysTag8, KStdCompTag8,KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
  1.1696 +		DoTestWriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
  1.1697 +		DoTestWriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
  1.1698 +		
  1.1699 +		RFileLogger::HexDump(KStdSubsysTag8, KStdCompTag8,KTestMessage8);
  1.1700 +		
  1.1701 +		TRAPD(r, ret = DoTestCheckWriteL());
  1.1702 +		if (r != KErrNone)
  1.1703 +			ret = r;
  1.1704 +		}
  1.1705 +		
  1.1706 +	
  1.1707 +	return ret;		
  1.1708 +
  1.1709 +	}
  1.1710 +
  1.1711 +void CFloggerTest028_Sync_Static_Multiple::DoTestWriteFormat(TRefByValue<const TDesC16> aFmt,...)
  1.1712 +	{
  1.1713 +	VA_LIST list;
  1.1714 +	VA_START(list,aFmt);
  1.1715 +	RFileLogger::WriteFormat(KStdSubsysTag8, KStdCompTag8,aFmt,list);
  1.1716 +	}
  1.1717 +
  1.1718 +
  1.1719 +
  1.1720 +TInt CFloggerTest028_Sync_Static_Multiple::DoTestCheckWriteL()
  1.1721 +	{
  1.1722 +	RFile logFile;
  1.1723 +	HBufC8* hBuffer;
  1.1724 +	TInt listfilesize,returnCode;
  1.1725 +	RFs fileSystem; //For file operation create a file system
  1.1726 +	TInt numSuccessful = 0;
  1.1727 +
  1.1728 +	User::LeaveIfError(fileSystem.Connect());
  1.1729 +	
  1.1730 +	//Open the file in the read mode
  1.1731 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
  1.1732 +
  1.1733 +	CleanupClosePushL(logFile);
  1.1734 +
  1.1735 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
  1.1736 +	
  1.1737 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
  1.1738 +	CleanupStack::PushL(hBuffer);
  1.1739 +
  1.1740 +	TPtr8 ptrString = hBuffer->Des();  //To access the buffer
  1.1741 +
  1.1742 +	// Read from position 0: start of file
  1.1743 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
  1.1744 +	
  1.1745 +	returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read
  1.1746 +											//from the file
  1.1747 +	if (returnCode > 0)
  1.1748 +		{
  1.1749 +		numSuccessful++;
  1.1750 +		}
  1.1751 +
  1.1752 +	returnCode = ptrString.Find(KTestTooLongMessageOneParamExpected); 
  1.1753 +	if (returnCode > 0)
  1.1754 +		{
  1.1755 +		numSuccessful++;
  1.1756 +		}
  1.1757 +
  1.1758 +	// search for the occurance that the VA_LIST put in
  1.1759 +	// when testing serial, the length will be negative, so skip
  1.1760 +	TInt len;
  1.1761 +	len = (ptrString.Length()-returnCode)-KTestTooLongMessageOneParamExpected().Length();
  1.1762 +	if (len > 0)
  1.1763 +		{
  1.1764 +		TPtrC8 ptrStringOffsetForSearching = ptrString.Right(len);
  1.1765 +		
  1.1766 +		returnCode = ptrStringOffsetForSearching.Find(KTestTooLongMessageOneParamExpected); //find the next occurance
  1.1767 +		if (returnCode > 0)
  1.1768 +			{
  1.1769 +			numSuccessful++;
  1.1770 +			}
  1.1771 +		}
  1.1772 +
  1.1773 +
  1.1774 +	returnCode = ptrString.Find(KTestMessageOneParamExpected); 
  1.1775 +	if (returnCode > 0)
  1.1776 +		{
  1.1777 +		numSuccessful++;
  1.1778 +		}
  1.1779 +
  1.1780 +	returnCode = ptrString.Find(KTestMessageAsHex8); 
  1.1781 +	if (returnCode > 0)
  1.1782 +		{
  1.1783 +		numSuccessful++;
  1.1784 +		}
  1.1785 +
  1.1786 +	
  1.1787 +	CleanupStack::PopAndDestroy(hBuffer);
  1.1788 +	CleanupStack::PopAndDestroy();	//logFile
  1.1789 +	if ( numSuccessful == 5 )
  1.1790 +		return KErrNone;
  1.1791 +	else
  1.1792 +		return KErrUnknown;
  1.1793 +	}
  1.1794 +	
  1.1795 +	
  1.1796 +	
  1.1797 +/**
  1.1798 +* 028_Sync_ConMultiple2 - test connect and multiple2 writes
  1.1799 +* doTestStep returns whether test case passed or failed.
  1.1800 +*/ 
  1.1801 +
  1.1802 +CFloggerTest028_Sync_ConMultiple2::CFloggerTest028_Sync_ConMultiple2()
  1.1803 +	{
  1.1804 +	// Store the name of this test case
  1.1805 +	SetTestStepName(_L("step_028_Sync_ConMultiple2"));
  1.1806 +	}
  1.1807 +
  1.1808 +
  1.1809 +
  1.1810 +
  1.1811 +CFloggerTest028_Sync_ConMultiple2::~CFloggerTest028_Sync_ConMultiple2()
  1.1812 +	{
  1.1813 +	}
  1.1814 +
  1.1815 +
  1.1816 +
  1.1817 +
  1.1818 +TVerdict CFloggerTest028_Sync_ConMultiple2::doTestStepL( )
  1.1819 +	{
  1.1820 +	if ( executeStepL() == KErrNone  )
  1.1821 +		SetTestStepResult(EPass);
  1.1822 +
  1.1823 +	else
  1.1824 +		SetTestStepResult(EFail);
  1.1825 +
  1.1826 +	
  1.1827 +	return TestStepResult();
  1.1828 +	}
  1.1829 +
  1.1830 +TInt CFloggerTest028_Sync_ConMultiple2::executeStepL(TBool)
  1.1831 +	{
  1.1832 +	return KErrGeneral;
  1.1833 +	}
  1.1834 +
  1.1835 +
  1.1836 +TInt CFloggerTest028_Sync_ConMultiple2::executeStepL()
  1.1837 +	{
  1.1838 +	TInt ret;
  1.1839 +	
  1.1840 +	// clear the old log messages
  1.1841 +	ret = flogger.Connect();
  1.1842 +	
  1.1843 +	if ( ret == KErrNone )
  1.1844 +		{
  1.1845 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
  1.1846 +		flogger.ClearLog();
  1.1847 +		
  1.1848 +		for (TInt loop = 1; loop <= KMultipleWriteStressTimes; loop++)
  1.1849 +			{
  1.1850 +			flogger.Write(KTestMessage);
  1.1851 +			flogger.WriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
  1.1852 +			flogger.Write(KTestTooLongMessage16);
  1.1853 +			flogger.WriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
  1.1854 +			DoTestWriteFormat(KTestTooLongMessageOneParam8,KTestTooLongMessageOneParamValue);
  1.1855 +			
  1.1856 +			TPtrC8 dataSeg;
  1.1857 +			dataSeg.Set(K1KilobyteOfData,K1KilobyteOfDataSize);
  1.1858 +			flogger.WriteBinary(dataSeg);
  1.1859 +			}
  1.1860 +		flogger.Write(KTestEndMessage8);
  1.1861 +		
  1.1862 +		flogger.Close();
  1.1863 +		
  1.1864 +		TRAPD(r, ret = DoTestCheckWriteL());
  1.1865 +		if (r != KErrNone)
  1.1866 +			ret = r;
  1.1867 +		}
  1.1868 +		
  1.1869 +	
  1.1870 +	return ret;		
  1.1871 +
  1.1872 +	}
  1.1873 +
  1.1874 +void CFloggerTest028_Sync_ConMultiple2::DoTestWriteFormat(TRefByValue<const TDesC8> aFmt,...)
  1.1875 +	{
  1.1876 +	VA_LIST list;
  1.1877 +	VA_START(list,aFmt);
  1.1878 +	flogger.WriteFormat(aFmt,list);
  1.1879 +	}
  1.1880 +
  1.1881 +TInt CFloggerTest028_Sync_ConMultiple2::DoTestCheckWriteL()
  1.1882 +	{
  1.1883 +	RFile logFile;
  1.1884 +	HBufC8* hBuffer;
  1.1885 +	TInt listfilesize,returnCode;
  1.1886 +	RFs fileSystem; //For file operation create a file system
  1.1887 +	TInt numSuccessful = 0;
  1.1888 +	TInt loop = 0;
  1.1889 +
  1.1890 +	User::LeaveIfError(fileSystem.Connect());
  1.1891 +	
  1.1892 +	//Open the file in the read mode
  1.1893 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
  1.1894 +
  1.1895 +	CleanupClosePushL(logFile);
  1.1896 +
  1.1897 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
  1.1898 +	
  1.1899 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer. This is about 176K in size
  1.1900 +	CleanupStack::PushL(hBuffer);
  1.1901 +
  1.1902 +	TPtr8 ptrString = hBuffer->Des();  //To access the buffer
  1.1903 +
  1.1904 +	// Read from position 0: start of file
  1.1905 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
  1.1906 +	
  1.1907 +	// the test case writes 6 elements 100 times, but we only check these things:
  1.1908 +	// 1. that the test message with one parameter is written 100 times
  1.1909 +	// 2. that the long message is written 100 times
  1.1910 +	// 3. that the end of test message has been written
  1.1911 +	// 4. that the file is suitably big enough to be expected to contain the
  1.1912 +	//    1K data segment 100 times in it.
  1.1913 +	
  1.1914 +	TPtrC8 ptrStringOffsetForSearching;
  1.1915 +	returnCode = ptrString.Find(KTestMessageOneParamExpected);
  1.1916 +
  1.1917 +	if (returnCode > 0)
  1.1918 +		{
  1.1919 +		numSuccessful++;
  1.1920 +		}
  1.1921 +		
  1.1922 +	TInt newLength;
  1.1923 +	ptrStringOffsetForSearching.Set(ptrString.Right((ptrString.Length()-returnCode)-KTestMessageOneParamExpected().Length()));
  1.1924 +	for (loop=0; loop < KMultipleWriteStressTimes; loop++)
  1.1925 +		{
  1.1926 +		returnCode = ptrStringOffsetForSearching.Find(KTestMessageOneParamExpected); //find the next occurance
  1.1927 +		if (returnCode > 0)
  1.1928 +			{
  1.1929 +			numSuccessful++;
  1.1930 +			}
  1.1931 +			
  1.1932 +		newLength = ptrStringOffsetForSearching.Length() - returnCode - KTestMessageOneParamExpected().Length();
  1.1933 +		if (newLength < 0)
  1.1934 +			{
  1.1935 +			User::Leave(KErrUnknown);
  1.1936 +			}
  1.1937 +		ptrStringOffsetForSearching.Set(ptrStringOffsetForSearching.Right(newLength));
  1.1938 +		
  1.1939 +		}
  1.1940 +
  1.1941 +	returnCode = ptrString.Find(KTestTooLongExpectedMessage); 
  1.1942 +	
  1.1943 +	if (returnCode > 0)
  1.1944 +		{
  1.1945 +		numSuccessful++;
  1.1946 +		}
  1.1947 +		
  1.1948 +	ptrStringOffsetForSearching.Set(ptrString.Right((ptrString.Length()-returnCode)-KTestTooLongExpectedMessage().Length()));
  1.1949 +
  1.1950 +	for (loop=0; loop < KMultipleWriteStressTimes; loop++)
  1.1951 +		{
  1.1952 +
  1.1953 +		returnCode = ptrStringOffsetForSearching.Find(KTestTooLongExpectedMessage); //find the next occurance
  1.1954 +		if (returnCode > 0)
  1.1955 +			{
  1.1956 +			numSuccessful++;
  1.1957 +			}
  1.1958 +		newLength = ptrStringOffsetForSearching.Length() - returnCode - KTestTooLongExpectedMessage().Length();
  1.1959 +		if (newLength <0)
  1.1960 +			{
  1.1961 +			User::Leave(KErrUnknown);
  1.1962 +			}
  1.1963 +		ptrStringOffsetForSearching.Set(ptrStringOffsetForSearching.Right(newLength));
  1.1964 +			
  1.1965 +		}
  1.1966 +
  1.1967 +
  1.1968 +	returnCode = ptrString.Find(KTestEndMessage8); 
  1.1969 +	if (returnCode > 0)
  1.1970 +		{
  1.1971 +		numSuccessful++;
  1.1972 +		}
  1.1973 +		
  1.1974 +
  1.1975 +	// we don't check that all the binary data is there - just that the file is nice and long		
  1.1976 +	if ( listfilesize > (K1KilobyteOfDataSize * KMultipleWriteStressTimes))
  1.1977 +		{
  1.1978 +		numSuccessful++;
  1.1979 +		}
  1.1980 +	
  1.1981 +
  1.1982 +
  1.1983 +	CleanupStack::PopAndDestroy(hBuffer);
  1.1984 +	CleanupStack::PopAndDestroy();	//logFile
  1.1985 +	if ( numSuccessful == 202 )
  1.1986 +		return KErrNone;
  1.1987 +	else
  1.1988 +		return KErrUnknown;
  1.1989 +	}
  1.1990 +	
  1.1991 +	
  1.1992 +	
  1.1993 +	
  1.1994 +	
  1.1995 +	
  1.1996 +/**
  1.1997 +* 028_Sync_Static_Multiple2 - test static multiple2 writes
  1.1998 +* doTestStep returns whether test case passed or failed.
  1.1999 +*/ 
  1.2000 +
  1.2001 +CFloggerTest028_Sync_Static_Multiple2::CFloggerTest028_Sync_Static_Multiple2()
  1.2002 +	{
  1.2003 +	// Store the name of this test case
  1.2004 +	SetTestStepName(_L("step_028_Sync_Static_Multiple2"));
  1.2005 +	}
  1.2006 +
  1.2007 +
  1.2008 +
  1.2009 +
  1.2010 +CFloggerTest028_Sync_Static_Multiple2::~CFloggerTest028_Sync_Static_Multiple2()
  1.2011 +	{
  1.2012 +	}
  1.2013 +
  1.2014 +
  1.2015 +
  1.2016 +
  1.2017 +TVerdict CFloggerTest028_Sync_Static_Multiple2::doTestStepL( )
  1.2018 +	{
  1.2019 +	if ( executeStepL() == KErrNone  )
  1.2020 +		SetTestStepResult(EPass);
  1.2021 +
  1.2022 +	else
  1.2023 +		SetTestStepResult(EFail);
  1.2024 +
  1.2025 +	
  1.2026 +	return TestStepResult();
  1.2027 +	}
  1.2028 +
  1.2029 +
  1.2030 +TInt CFloggerTest028_Sync_Static_Multiple2::executeStepL(TBool)
  1.2031 +	{
  1.2032 +	return KErrGeneral;
  1.2033 +	}
  1.2034 +
  1.2035 +TInt CFloggerTest028_Sync_Static_Multiple2::executeStepL()
  1.2036 +	{
  1.2037 +	TInt ret;
  1.2038 +	
  1.2039 +	// clear the old log messages
  1.2040 +	RFileLogger flogger;
  1.2041 +	ret = flogger.Connect();
  1.2042 +	
  1.2043 +	if ( ret == KErrNone )
  1.2044 +		{
  1.2045 +		flogger.SetLogTags(KStdSubsysTag8, KStdCompTag8);
  1.2046 +		flogger.ClearLog();
  1.2047 +		flogger.Close();
  1.2048 +		
  1.2049 +		for (TInt loop = 1; loop <= KMultipleWriteStressTimes; loop++)
  1.2050 +			{		
  1.2051 +			RFileLogger::Write(KStdSubsysTag8, KStdCompTag8,KTestMessage);
  1.2052 +			RFileLogger::Write(KStdSubsysTag8, KStdCompTag8,KTestTooLongMessage16);
  1.2053 +			DoTestWriteFormat(KTestMessageOneParam16,KTestMessageOneParamValue);
  1.2054 +			DoTestWriteFormat(KTestTooLongMessageOneParam16,KTestTooLongMessageOneParamValue);
  1.2055 +			
  1.2056 +			RFileLogger::HexDump(KStdSubsysTag8, KStdCompTag8,KTestMessage8);
  1.2057 +			}
  1.2058 +		RFileLogger::Write(KStdSubsysTag8, KStdCompTag8,KTestEndMessage8);
  1.2059 +		
  1.2060 +		TRAPD(r, ret = DoTestCheckWriteL());
  1.2061 +		if (r != KErrNone)
  1.2062 +			ret = r;
  1.2063 +		}
  1.2064 +		
  1.2065 +	
  1.2066 +	return ret;		
  1.2067 +
  1.2068 +	}
  1.2069 +
  1.2070 +void CFloggerTest028_Sync_Static_Multiple2::DoTestWriteFormat(TRefByValue<const TDesC16> aFmt,...)
  1.2071 +	{
  1.2072 +	VA_LIST list;
  1.2073 +	VA_START(list,aFmt);
  1.2074 +	RFileLogger::WriteFormat(KStdSubsysTag8, KStdCompTag8,aFmt,list);
  1.2075 +	}
  1.2076 +
  1.2077 +
  1.2078 +
  1.2079 +TInt CFloggerTest028_Sync_Static_Multiple2::DoTestCheckWriteL()
  1.2080 +	{
  1.2081 +	RFile logFile;
  1.2082 +	HBufC8* hBuffer;
  1.2083 +	TInt listfilesize,returnCode;
  1.2084 +	RFs fileSystem; //For file operation create a file system
  1.2085 +	TInt numSuccessful = 0;
  1.2086 +
  1.2087 +	User::LeaveIfError(fileSystem.Connect());
  1.2088 +	
  1.2089 +	//Open the file in the read mode
  1.2090 +	User::LeaveIfError(logFile.Open(fileSystem,KFloggerOutputFile,EFileRead));
  1.2091 +
  1.2092 +	CleanupClosePushL(logFile);
  1.2093 +
  1.2094 +	User::LeaveIfError(logFile.Size(listfilesize)); //Size of the file
  1.2095 +	
  1.2096 +	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
  1.2097 +	CleanupStack::PushL(hBuffer);
  1.2098 +
  1.2099 +	TPtr8 ptrString = hBuffer->Des();  //To access the buffer
  1.2100 +
  1.2101 +	// Read from position 0: start of file
  1.2102 +	User::LeaveIfError(returnCode = logFile.Read(ptrString));
  1.2103 +	
  1.2104 +	
  1.2105 +	// the test case writes 5 elements 100 times, but we only check these things:
  1.2106 +	// 1. that the long test message with one parameter is written 100 times
  1.2107 +	// 2. that the test message with one param is written 100 times
  1.2108 +	// 3. that the end of test message has been written
  1.2109 +	
  1.2110 +	TPtrC8 ptrStringOffsetForSearching;
  1.2111 +	returnCode = ptrString.Find(KTestMessageOneParamExpected);
  1.2112 +
  1.2113 +	if (returnCode > 0)
  1.2114 +		{
  1.2115 +		numSuccessful++;
  1.2116 +		}
  1.2117 +		
  1.2118 +	TInt newLength;   // allow length to be watched during debugging
  1.2119 +	TInt loop;
  1.2120 +	
  1.2121 +	ptrStringOffsetForSearching.Set(ptrString.Right((ptrString.Length()-returnCode)-KTestMessageOneParamExpected().Length()));
  1.2122 +	for (loop=0; loop < KMultipleWriteStressTimes; loop++)
  1.2123 +		{
  1.2124 +		returnCode = ptrStringOffsetForSearching.Find(KTestMessageOneParamExpected); //find the next occurance
  1.2125 +		if (returnCode > 0)
  1.2126 +			{
  1.2127 +			numSuccessful++;
  1.2128 +			}
  1.2129 +			
  1.2130 +		newLength = ptrStringOffsetForSearching.Length() - returnCode - KTestMessageOneParamExpected().Length();
  1.2131 +	 	if (newLength < 0)
  1.2132 +	 		{
  1.2133 +	 		User::Leave(KErrUnknown);
  1.2134 +	 		}
  1.2135 +
  1.2136 +		ptrStringOffsetForSearching.Set(ptrStringOffsetForSearching.Right(newLength));
  1.2137 +		
  1.2138 +		}
  1.2139 +
  1.2140 +
  1.2141 +	returnCode = ptrString.Find(KTestTooLongMessageOneParamExpected);
  1.2142 +
  1.2143 +	if (returnCode > 0)
  1.2144 +		{
  1.2145 +		numSuccessful++;
  1.2146 +		}
  1.2147 +		
  1.2148 +	newLength = ptrString.Length()-returnCode-KTestTooLongMessageOneParamExpected().Length();
  1.2149 +	ptrStringOffsetForSearching.Set(ptrString.Right(newLength));
  1.2150 +	for (loop=0; loop < KMultipleWriteStressTimes; loop++)
  1.2151 +		{
  1.2152 +		returnCode = ptrStringOffsetForSearching.Find(KTestTooLongMessageOneParamExpected); //find the next occurance
  1.2153 +		if (returnCode > 0)
  1.2154 +			{
  1.2155 +			numSuccessful++;
  1.2156 +			}
  1.2157 +			
  1.2158 +		if (loop < (KMultipleWriteStressTimes - 1))
  1.2159 +			{
  1.2160 +			newLength = ptrStringOffsetForSearching.Length() - returnCode - KTestTooLongMessageOneParamExpected().Length();
  1.2161 +	 		if (newLength < 0)
  1.2162 +	 			{
  1.2163 +	 			User::Leave(KErrUnknown);
  1.2164 +	 			}
  1.2165 +			ptrStringOffsetForSearching.Set(ptrStringOffsetForSearching.Right(newLength));
  1.2166 +			}
  1.2167 +		
  1.2168 +		}
  1.2169 +
  1.2170 +	returnCode = ptrString.Find(KTestEndMessage8); 
  1.2171 +	if (returnCode > 0)
  1.2172 +		{
  1.2173 +		numSuccessful++;
  1.2174 +		}
  1.2175 +
  1.2176 +	
  1.2177 +	CleanupStack::PopAndDestroy(hBuffer);
  1.2178 +	CleanupStack::PopAndDestroy();	//logFile
  1.2179 +	if ( numSuccessful == 201 )
  1.2180 +		return KErrNone;
  1.2181 +	else
  1.2182 +		return KErrUnknown;
  1.2183 +	}