traceservices/commsdebugutility/TE_commsdebugutility/src/step_027_xx.cpp
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     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 "step_027_xx.h"
       
    18 
       
    19 #include <comms-infras/commsdebugutility.h>
       
    20 
       
    21 
       
    22 /**
       
    23 * Function  Name : CFloggerTest027_01
       
    24 * Input parameters : None
       
    25 * Output parameters : None
       
    26 * Description : This is the constructor
       
    27 */
       
    28 
       
    29 
       
    30 CFloggerTest027_01::CFloggerTest027_01()
       
    31 	{
       
    32 	// Store the name of this test case
       
    33 	SetTestStepName(_L("step_027_01"));
       
    34 	}
       
    35 
       
    36 
       
    37 /**
       
    38 * Function  Name :~ CFloggerTest027_01
       
    39 * Input parameters : None
       
    40 * Output parameters : None
       
    41 * Description : This is the Destructor
       
    42 */ 
       
    43 
       
    44 
       
    45 CFloggerTest027_01::~CFloggerTest027_01()
       
    46 	{
       
    47 	}
       
    48 
       
    49 
       
    50 /**
       
    51 * Function  Name	: doTestStepL
       
    52 * Input parameters	: None
       
    53 * Output parameters : TVerdict 
       
    54 * Description		: This function returns whether the test case 027_01 has 
       
    55 * 					  passed or failed
       
    56 
       
    57 */
       
    58 
       
    59 
       
    60 TVerdict CFloggerTest027_01::doTestStepL( )
       
    61 	{
       
    62 	if ( executeStepL() == KErrNone  )
       
    63 		SetTestStepResult(EPass);
       
    64 
       
    65 	else
       
    66 		SetTestStepResult(EFail);
       
    67 
       
    68 
       
    69 	
       
    70 	return TestStepResult();
       
    71 	}
       
    72 
       
    73 
       
    74 /**
       
    75 * Function  Name		: executeStepL
       
    76 * Input parameters		: None
       
    77 * Output parameters		: TInt 
       
    78 * Description 			: This function calls the Connect twice
       
    79 
       
    80 */
       
    81 
       
    82 
       
    83 TInt CFloggerTest027_01::executeStepL(TBool)
       
    84 	{
       
    85 	return KErrGeneral;
       
    86 	}
       
    87 /**
       
    88 * Function  Name		: executeStepL
       
    89 * Input parameters		: None
       
    90 * Output parameters		: TInt 
       
    91 * Description 			: This function calls the Connect twice
       
    92 
       
    93 */
       
    94 
       
    95 
       
    96 TInt CFloggerTest027_01::executeStepL()
       
    97 	{
       
    98 	TInt numSuccess = 0;
       
    99 	TInt ret;
       
   100 	RFileLogger flogger;
       
   101 	ret = flogger.Connect();
       
   102 
       
   103 	if (ret == KErrNone)
       
   104 		{
       
   105 		numSuccess++;
       
   106 		}
       
   107 
       
   108 	//Call Connect() twice this will cause 2nd one ot return KErrorAlreadyExists and nothing to happen.
       
   109 	ret = flogger.Connect();
       
   110 
       
   111 	if (ret == KErrAlreadyExists)
       
   112 		{
       
   113 		numSuccess++;
       
   114 		}
       
   115 
       
   116 
       
   117 	if (numSuccess == 2)
       
   118 		{
       
   119 		return KErrNone;
       
   120 		}
       
   121 	
       
   122 	return KErrBadHandle;
       
   123 	}
       
   124 
       
   125 
       
   126 
       
   127 
       
   128 /**
       
   129 * Function  Name : CFloggerTest027_02
       
   130 * Input parameters : None
       
   131 * Output parameters : None
       
   132 * Description : This is the constructor
       
   133 */
       
   134 
       
   135 
       
   136 CFloggerTest027_02::CFloggerTest027_02()
       
   137 	{
       
   138 	// Store the name of this test case
       
   139 	SetTestStepName(_L("step_027_02"));
       
   140 	}
       
   141 
       
   142 
       
   143 /**
       
   144 * Function  Name :~ CFloggerTest027_02
       
   145 * Input parameters : None
       
   146 * Output parameters : None
       
   147 * Description : This is the Destructor
       
   148 */ 
       
   149 
       
   150 
       
   151 CFloggerTest027_02::~CFloggerTest027_02()
       
   152 	{
       
   153 	}
       
   154 
       
   155 
       
   156 /**
       
   157 * Function  Name	: doTestStepL
       
   158 * Input parameters	: None
       
   159 * Output parameters : TVerdict 
       
   160 * Description		: This function returns whether the test case 027_02 has 
       
   161 * 					  passed or failed
       
   162 
       
   163 */
       
   164 
       
   165 
       
   166 TVerdict CFloggerTest027_02::doTestStepL( )
       
   167 	{
       
   168 	
       
   169 	INFO_PRINTF1(_L("Step 027.02 called "));
       
   170 	TRAPD(res ,executeStepL());
       
   171 	if (res == KErrNone )
       
   172 		SetTestStepResult(EPass);
       
   173 
       
   174 	else
       
   175 		SetTestStepResult(EFail);
       
   176 
       
   177 	INFO_PRINTF1(_L("leaving Step 027.02 "));
       
   178 	User::After(KTimeForDisplay);
       
   179 
       
   180 	
       
   181 	return TestStepResult();
       
   182 	}
       
   183 
       
   184 /**
       
   185 * Function  Name		: executeStepL
       
   186 * Input parameters		: None
       
   187 * Output parameters		: TInt 
       
   188 * Description 			: This function leaves without calling CleanupStack::PopAndDestroy()
       
   189 
       
   190 */
       
   191 
       
   192 
       
   193 TInt CFloggerTest027_02::executeStepL(TBool)
       
   194 	{
       
   195 	return KErrGeneral;
       
   196 	}
       
   197 
       
   198 /**
       
   199 * Function  Name		: executeStepL
       
   200 * Input parameters		: None
       
   201 * Output parameters		: TInt 
       
   202 * Description 			: This function leaves without calling CleanupStack::PopAndDestroy()
       
   203 
       
   204 */
       
   205 
       
   206 
       
   207 TInt CFloggerTest027_02::executeStepL()
       
   208 	{
       
   209 	TInt r = KErrNone;
       
   210 	TPtrC8 ptrSubSystem;
       
   211 	TPtrC8 ptrComponent;
       
   212 	ptrSubSystem.Set(_L8("SubSystem"));
       
   213 	ptrComponent.Set(_L8("Component"));
       
   214 	__FLOG_DECLARATION_MEMBER;
       
   215 	__FLOG_OPENC(ptrSubSystem, ptrComponent);
       
   216 	User::Leave(r);	
       
   217 	return KErrNone;
       
   218 	}
       
   219 
       
   220 
       
   221 
       
   222 /**
       
   223 * Function  Name : CFloggerTest027_03
       
   224 * Input parameters : None
       
   225 * Output parameters : None
       
   226 * Description : This is the constructor
       
   227 */
       
   228 
       
   229 
       
   230 CFloggerTest027_03::CFloggerTest027_03()
       
   231 	{
       
   232 	// Store the name of this test case
       
   233 	SetTestStepName(_L("step_027_03"));
       
   234 	}
       
   235 
       
   236 
       
   237 /**
       
   238 * Function  Name :~ CFloggerTest027_03
       
   239 * Input parameters : None
       
   240 * Output parameters : None
       
   241 * Description : This is the Destructor
       
   242 */ 
       
   243 
       
   244 
       
   245 CFloggerTest027_03::~CFloggerTest027_03()
       
   246 	{
       
   247 	}
       
   248 
       
   249 
       
   250 /**
       
   251 * Function  Name	: doTestStepL
       
   252 * Input parameters	: None
       
   253 * Output parameters : TVerdict 
       
   254 * Description		: This function returns whether the test case 027_03 has 
       
   255 * 					  passed or failed
       
   256 
       
   257 */
       
   258 
       
   259 
       
   260 TVerdict CFloggerTest027_03::doTestStepL( )
       
   261 	{
       
   262 	INFO_PRINTF1(_L("Step 027.03 called "));
       
   263 	TRAPD(ret, executeStepL());
       
   264 	if (ret == KErrNone  )
       
   265 		SetTestStepResult(EPass);
       
   266 
       
   267 	else
       
   268 		SetTestStepResult(EFail);
       
   269 
       
   270 	INFO_PRINTF1(_L("leaving Step 027.02 "));
       
   271 	User::After(KTimeForDisplay);
       
   272 
       
   273 	
       
   274 	return TestStepResult();
       
   275 	}
       
   276 
       
   277 
       
   278 /**
       
   279 * Function  Name		: executeStepL
       
   280 * Input parameters		: None
       
   281 * Output parameters		: TInt 
       
   282 * Description 			: This function calls CleanupStack::PopAndDestroy() to check whether the flogger is pushed to the stack
       
   283 
       
   284 */
       
   285 
       
   286 
       
   287 TInt CFloggerTest027_03::executeStepL()
       
   288 	{
       
   289 	TPtrC8 ptrSubSystem;
       
   290 	TPtrC8 ptrComponent;
       
   291 	ptrSubSystem.Set(_L8("SubSystem"));
       
   292 	ptrComponent.Set(_L8("Component"));
       
   293 	__FLOG_DECLARATION_MEMBER;
       
   294 	__FLOG_OPENC(ptrSubSystem, ptrComponent);
       
   295 	CleanupStack::PopAndDestroy();
       
   296 	return KErrNone;
       
   297 	}
       
   298 
       
   299 /**
       
   300 * Function  Name		: executeStepL
       
   301 * Input parameters		: None
       
   302 * Output parameters		: TInt 
       
   303 * Description 			: This function calls CleanupStack::PopAndDestroy() to check whether the flogger is pushed to the stack
       
   304 
       
   305 */
       
   306 
       
   307 
       
   308 TInt CFloggerTest027_03::executeStepL(TBool)
       
   309 	{
       
   310 	return KErrGeneral;
       
   311 	}
       
   312 
       
   313 /**
       
   314 * Function  Name : CFloggerTest027_04
       
   315 * Input parameters : None
       
   316 * Output parameters : None
       
   317 * Description : This is the constructor
       
   318 */
       
   319 
       
   320 
       
   321 CFloggerTest027_04::CFloggerTest027_04()
       
   322 	{
       
   323 	// Store the name of this test case
       
   324 	SetTestStepName(_L("step_027_04"));
       
   325 	}
       
   326 
       
   327 
       
   328 /**
       
   329 * Function  Name :~ CFloggerTest027_04
       
   330 * Input parameters : None
       
   331 * Output parameters : None
       
   332 * Description : This is the Destructor
       
   333 */ 
       
   334 
       
   335 
       
   336 CFloggerTest027_04::~CFloggerTest027_04()
       
   337 	{
       
   338 	}
       
   339 
       
   340 
       
   341 /**
       
   342 * Function  Name	: doTestStepL
       
   343 * Input parameters	: None
       
   344 * Output parameters : TVerdict 
       
   345 * Description		: This function returns whether the test case 027_04 has 
       
   346 * 					  passed or failed
       
   347 
       
   348 */
       
   349 
       
   350 
       
   351 TVerdict CFloggerTest027_04::doTestStepL( )
       
   352 	{
       
   353 	INFO_PRINTF1(_L("Step 027.04 called "));
       
   354 	if ( executeStepL() == KErrNone )
       
   355 		SetTestStepResult(EPass);
       
   356 
       
   357 	else
       
   358 		SetTestStepResult(EFail);
       
   359 
       
   360 
       
   361 	return TestStepResult();
       
   362 	}
       
   363 
       
   364 
       
   365 /**
       
   366 * Function  Name		: executeStepL
       
   367 * Input parameters		: None
       
   368 * Output parameters		: TInt 
       
   369 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
   370 
       
   371 */
       
   372 
       
   373 
       
   374 TInt CFloggerTest027_04::executeStepL(TBool)
       
   375 	{
       
   376 	return KErrGeneral;
       
   377 	}
       
   378 /**
       
   379 * Function  Name		: executeStepL
       
   380 * Input parameters		: None
       
   381 * Output parameters		: TInt 
       
   382 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
   383 
       
   384 */
       
   385 
       
   386 
       
   387 TInt CFloggerTest027_04::executeStepL()
       
   388 	{
       
   389 	TInt ret = KErrNone;
       
   390 	ret = DoTestWrite();
       
   391 	if ( ret == KErrNone)
       
   392 		{
       
   393 		TRAPD(r, ret = DoTestCheckWriteL());
       
   394 		if ( r != KErrNone)
       
   395 			ret = r;
       
   396 		}
       
   397 	return ret;
       
   398 	}
       
   399 
       
   400 
       
   401 TInt CFloggerTest027_04::DoTestWrite()
       
   402 	{
       
   403 	_LIT8(KTestMessage,"TC 27_04: The is Test for macros");
       
   404 	TPtrC8 ptrSubSystem;
       
   405 	TPtrC8 ptrComponent;
       
   406 	ptrSubSystem.Set(_L8("SubSystem"));
       
   407 	ptrComponent.Set(_L8("Component"));
       
   408 	__FLOG_DECLARATION_MEMBER;
       
   409 	__FLOG_OPEN(ptrSubSystem, ptrComponent);
       
   410 	__FLOG_CLEAR;
       
   411 	__FLOG_0(KTestMessage);
       
   412 	__FLOG_CLOSE;
       
   413 	return KErrNone; 
       
   414 	}
       
   415 
       
   416 
       
   417 /**
       
   418 * Function  Name		: DoTestCheckWriteL
       
   419 * Input parameters		: None
       
   420 * Output parameters		: TInt 
       
   421 * Description 			: This function checks whether test data was written
       
   422 						  in to the log file or not.
       
   423 					  
       
   424 */
       
   425 
       
   426 
       
   427 TInt CFloggerTest027_04::DoTestCheckWriteL()
       
   428 	{
       
   429 	User::After(KTimeToLog);
       
   430 	RFile theFile;
       
   431 	HBufC8 * hBuffer;
       
   432 	TInt listfilesize;
       
   433 	TInt returnCode;
       
   434 	RFs fileSystem; //For file operation create a file system	
       
   435 	_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
       
   436 
       
   437 	_LIT8(KTestMessage,"TC 27_04: The is Test for macros");
       
   438 	
       
   439 	User::LeaveIfError(fileSystem.Connect());
       
   440 	
       
   441 	//Open the file in the read mode
       
   442 	User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead)); 
       
   443 
       
   444 	CleanupClosePushL(theFile);	
       
   445 	
       
   446 	User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
       
   447 	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
       
   448 	CleanupStack::PushL(hBuffer);
       
   449 	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer
       
   450 
       
   451 	// Read from position 0: start of file
       
   452 	returnCode = theFile.Read(ptrString);
       
   453 	
       
   454 	returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
       
   455 									//from the file
       
   456 	CleanupStack::PopAndDestroy(hBuffer);
       
   457 	CleanupStack::PopAndDestroy(); // For theFile object
       
   458 	if (returnCode > 0)
       
   459 		return KErrNone;
       
   460 	else 
       
   461 		return KErrGeneral;
       
   462 	}
       
   463 
       
   464 
       
   465 
       
   466 /**
       
   467 * Function  Name : CFloggerTest027_05
       
   468 * Input parameters : None
       
   469 * Output parameters : None
       
   470 * Description : This is the constructor
       
   471 */
       
   472 
       
   473 
       
   474 CFloggerTest027_05::CFloggerTest027_05()
       
   475 	{
       
   476 	// Store the name of this test case
       
   477 	SetTestStepName(_L("step_027_05"));
       
   478 	}
       
   479 
       
   480 
       
   481 /**
       
   482 * Function  Name :~ CFloggerTest027_05
       
   483 * Input parameters : None
       
   484 * Output parameters : None
       
   485 * Description : This is the Destructor
       
   486 */ 
       
   487 
       
   488 
       
   489 CFloggerTest027_05::~CFloggerTest027_05()
       
   490 	{
       
   491 	}
       
   492 
       
   493 
       
   494 /**
       
   495 * Function  Name	: doTestStepL
       
   496 * Input parameters	: None
       
   497 * Output parameters : TVerdict 
       
   498 * Description		: This function returns whether the test case 027_05 has 
       
   499 * 					  passed or failed
       
   500 
       
   501 */
       
   502 
       
   503 
       
   504 TVerdict CFloggerTest027_05::doTestStepL( )
       
   505 	{
       
   506 	INFO_PRINTF1(_L("Step 027.05 called "));
       
   507 	if ( executeStepL() == KErrNone )
       
   508 		SetTestStepResult(EPass);
       
   509 
       
   510 	else
       
   511 		SetTestStepResult(EFail);
       
   512 
       
   513 	
       
   514 	return TestStepResult();
       
   515 	}
       
   516 /**
       
   517 * Function  Name		: executeStepL
       
   518 * Input parameters		: None
       
   519 * Output parameters		: TInt 
       
   520 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
   521 
       
   522 */
       
   523 
       
   524 
       
   525 TInt CFloggerTest027_05::executeStepL(TBool)
       
   526 	{
       
   527 	return KErrGeneral;
       
   528 	}
       
   529 
       
   530 /**
       
   531 * Function  Name		: executeStepL
       
   532 * Input parameters		: None
       
   533 * Output parameters		: TInt 
       
   534 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
   535 
       
   536 */
       
   537 
       
   538 
       
   539 TInt CFloggerTest027_05::executeStepL()
       
   540 	{
       
   541 	TInt ret = KErrNone;
       
   542 	ret = DoTestWrite();
       
   543 	if ( ret == KErrNone)
       
   544 		{
       
   545 		TRAPD(r, ret = DoTestCheckWriteL());
       
   546 		if ( r != KErrNone)
       
   547 			ret = r;
       
   548 		}
       
   549 	return ret;
       
   550 	}
       
   551 
       
   552 
       
   553 TInt CFloggerTest027_05::DoTestWrite()
       
   554 	{
       
   555 	_LIT8(KTestMessageOne,"TC 27_05: The value of test integer variable :%d");
       
   556 	TPtrC8 ptrSubSystem;
       
   557 	TPtrC8 ptrComponent;
       
   558 	ptrSubSystem.Set(_L8("SubSystem"));
       
   559 	ptrComponent.Set(_L8("Component"));
       
   560 	__FLOG_DECLARATION_MEMBER;
       
   561 	__FLOG_OPEN(ptrSubSystem, ptrComponent);
       
   562 	__FLOG_CLEAR;
       
   563 	__FLOG_1(KTestMessageOne, 100);
       
   564 	__FLOG_CLOSE;
       
   565 	return KErrNone; 
       
   566 	}
       
   567 
       
   568 
       
   569 /**
       
   570 * Function  Name		: DoTestCheckWriteL
       
   571 * Input parameters		: None
       
   572 * Output parameters		: TInt 
       
   573 * Description 			: This function checks whether test data was written
       
   574 						  in to the log file or not.
       
   575 					  
       
   576 */
       
   577 
       
   578 
       
   579 TInt CFloggerTest027_05::DoTestCheckWriteL()
       
   580 	{
       
   581 	User::After(KTimeToLog);
       
   582 	RFile theFile;
       
   583 	HBufC8 * hBuffer;
       
   584 	TInt listfilesize;
       
   585 	TInt returnCode;
       
   586 	RFs fileSystem; //For file operation create a file system	
       
   587 	_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
       
   588 
       
   589 	TBuf8<256> testData; //To hold the test descriptor
       
   590 
       
   591 	_LIT8(KTestMessageOne,"TC 27_05: The value of test integer variable :%d");
       
   592 	testData.Format(KTestMessageOne,100);
       
   593 	
       
   594 	User::LeaveIfError(fileSystem.Connect());
       
   595 	
       
   596 	//Open the file in the read mode
       
   597 	User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead)); 
       
   598 
       
   599 	CleanupClosePushL(theFile);	
       
   600 	
       
   601 	User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
       
   602 	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
       
   603 	CleanupStack::PushL(hBuffer);
       
   604 	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer
       
   605 
       
   606 	// Read from position 0: start of file
       
   607 	returnCode = theFile.Read(ptrString);
       
   608 	if (returnCode == KErrNone) 
       
   609 	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
       
   610 											//from the file
       
   611 
       
   612 	CleanupStack::PopAndDestroy(hBuffer);
       
   613 	CleanupStack::PopAndDestroy(); // For theFile object
       
   614 	if (returnCode > 0)
       
   615 		return KErrNone;
       
   616 	else 
       
   617 		return KErrGeneral;
       
   618 	}
       
   619 
       
   620 
       
   621 
       
   622 /**
       
   623 * Function  Name : CFloggerTest027_06
       
   624 * Input parameters : None
       
   625 * Output parameters : None
       
   626 * Description : This is the constructor
       
   627 */
       
   628 
       
   629 
       
   630 CFloggerTest027_06::CFloggerTest027_06()
       
   631 	{
       
   632 	// Store the name of this test case
       
   633 	SetTestStepName(_L("step_027_06"));
       
   634 	}
       
   635 
       
   636 
       
   637 /**
       
   638 * Function  Name :~ CFloggerTest027_06
       
   639 * Input parameters : None
       
   640 * Output parameters : None
       
   641 * Description : This is the Destructor
       
   642 */ 
       
   643 
       
   644 
       
   645 CFloggerTest027_06::~CFloggerTest027_06()
       
   646 	{
       
   647 	}
       
   648 
       
   649 
       
   650 /**
       
   651 * Function  Name	: doTestStepL
       
   652 * Input parameters	: None
       
   653 * Output parameters : TVerdict 
       
   654 * Description		: This function returns whether the test case 027_06 has 
       
   655 * 					  passed or failed
       
   656 
       
   657 */
       
   658 
       
   659 
       
   660 TVerdict CFloggerTest027_06::doTestStepL( )
       
   661 	{
       
   662 	INFO_PRINTF1(_L("Step 027.06 called "));
       
   663 	if ( executeStepL() == KErrNone )
       
   664 		SetTestStepResult(EPass);
       
   665 
       
   666 	else
       
   667 		SetTestStepResult(EFail);
       
   668 
       
   669 	
       
   670 	return TestStepResult();
       
   671 	}
       
   672 
       
   673 
       
   674 /**
       
   675 * Function  Name		: executeStepL
       
   676 * Input parameters		: None
       
   677 * Output parameters		: TInt 
       
   678 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
   679 
       
   680 */
       
   681 
       
   682 
       
   683 TInt CFloggerTest027_06::executeStepL()
       
   684 	{
       
   685 	TInt ret = KErrNone;
       
   686 	ret = DoTestWrite();
       
   687 	if ( ret == KErrNone)
       
   688 		{
       
   689 		TRAPD(r, ret = DoTestCheckWriteL());
       
   690 		if ( r != KErrNone)
       
   691 			ret = r;
       
   692 		}
       
   693 	return ret;
       
   694 	}
       
   695 
       
   696 /**
       
   697 * Function  Name		: executeStepL
       
   698 * Input parameters		: None
       
   699 * Output parameters		: TInt 
       
   700 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
   701 
       
   702 */
       
   703 
       
   704 
       
   705 TInt CFloggerTest027_06::executeStepL(TBool)
       
   706 	{
       
   707 	return KErrGeneral;
       
   708 	}
       
   709 
       
   710 TInt CFloggerTest027_06::DoTestWrite()
       
   711 	{
       
   712 	TPtrC8 ptrSubSystem;
       
   713 	TPtrC8 ptrComponent;
       
   714 	ptrSubSystem.Set(_L8("SubSystem"));
       
   715 	ptrComponent.Set(_L8("Component"));
       
   716 	_LIT8(descTxt,"TC 27_6:Test Msg");
       
   717 
       
   718 	__FLOG_DECLARATION_MEMBER;
       
   719 	__FLOG_OPEN(ptrSubSystem, ptrComponent);
       
   720 	__FLOG_CLEAR;
       
   721 	__FLOG_HEXDUMP ( (descTxt) );
       
   722 	__FLOG_CLOSE;
       
   723 	return KErrNone; 
       
   724 	}
       
   725 
       
   726 
       
   727 /**
       
   728 * Function  Name		: DoTestCheckWriteL
       
   729 * Input parameters		: None
       
   730 * Output parameters		: TInt 
       
   731 * Description 			: This function checks whether test data was written
       
   732 						  in to the log file or not.
       
   733 					  
       
   734 */
       
   735 
       
   736 
       
   737 TInt CFloggerTest027_06::DoTestCheckWriteL()
       
   738 	{
       
   739 	User::After(KTimeToLog);
       
   740 	RFile theFile;
       
   741 	HBufC8 * hBuffer;
       
   742 	TInt listfilesize;
       
   743 	TInt returnCode;
       
   744 	RFs fileSystem; //For file operation create a file system	
       
   745 	_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
       
   746 		
       
   747 	_LIT8(KBodyTxt,"TC 27_6:Test Msg");//  Test body descriptor 
       
   748 
       
   749 	User::LeaveIfError(fileSystem.Connect());
       
   750 	
       
   751 	//Open the file in the read mode
       
   752 	User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead)); 
       
   753 
       
   754 	CleanupClosePushL(theFile);
       
   755 	
       
   756 	User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
       
   757 	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
       
   758 	CleanupStack::PushL(hBuffer);
       
   759 	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer
       
   760 
       
   761 	// Read from position 0: start of file
       
   762 	returnCode = theFile.Read(ptrString);
       
   763 	if (returnCode == KErrNone) 
       
   764 		returnCode = ptrString.Find(KBodyTxt);
       
   765 			
       
   766 	CleanupStack::PopAndDestroy(hBuffer);
       
   767 	CleanupStack::PopAndDestroy();	//theFile
       
   768 	if (returnCode > 0)
       
   769 		return KErrNone;
       
   770 	else 
       
   771 		return KErrGeneral;
       
   772 	}
       
   773 
       
   774 
       
   775 
       
   776 /**
       
   777 * Function  Name : CFloggerTest027_07
       
   778 * Input parameters : None
       
   779 * Output parameters : None
       
   780 * Description : This is the constructor
       
   781 */
       
   782 
       
   783 
       
   784 CFloggerTest027_07::CFloggerTest027_07()
       
   785 	{
       
   786 	// Store the name of this test case
       
   787 	SetTestStepName(_L("step_027_07"));
       
   788 	}
       
   789 
       
   790 
       
   791 /**
       
   792 * Function  Name :~ CFloggerTest027_07
       
   793 * Input parameters : None
       
   794 * Output parameters : None
       
   795 * Description : This is the Destructor
       
   796 */ 
       
   797 
       
   798 
       
   799 CFloggerTest027_07::~CFloggerTest027_07()
       
   800 	{
       
   801 	}
       
   802 
       
   803 
       
   804 /**
       
   805 * Function  Name	: doTestStepL
       
   806 * Input parameters	: None
       
   807 * Output parameters : TVerdict 
       
   808 * Description		: This function returns whether the test case 027_07 has 
       
   809 * 					  passed or failed
       
   810 
       
   811 */
       
   812 
       
   813 
       
   814 TVerdict CFloggerTest027_07::doTestStepL( )
       
   815 	{
       
   816 	INFO_PRINTF1(_L("Step 027.07 called "));
       
   817 	if ( executeStepL() == KErrNone )
       
   818 		SetTestStepResult(EPass);
       
   819 
       
   820 	else
       
   821 		SetTestStepResult(EFail);
       
   822 
       
   823 	
       
   824 	return TestStepResult();
       
   825 	}
       
   826 
       
   827 
       
   828 /**
       
   829 * Function  Name		: executeStepL
       
   830 * Input parameters		: None
       
   831 * Output parameters		: TInt 
       
   832 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
   833 
       
   834 */
       
   835 
       
   836 
       
   837 TInt CFloggerTest027_07::executeStepL()
       
   838 	{
       
   839 	TInt ret = KErrNone;
       
   840 	ret = DoTestWrite();
       
   841 	if ( ret == KErrNone)
       
   842 		{
       
   843 		TRAPD(r, ret = DoTestCheckWriteL());
       
   844 		if ( r != KErrNone)
       
   845 			ret = r;
       
   846 		}
       
   847 	return ret;
       
   848 	}
       
   849 /**
       
   850 * Function  Name		: executeStepL
       
   851 * Input parameters		: None
       
   852 * Output parameters		: TInt 
       
   853 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
   854 
       
   855 */
       
   856 
       
   857 
       
   858 TInt CFloggerTest027_07::executeStepL(TBool)
       
   859 	{
       
   860 	return KErrGeneral;
       
   861 	}
       
   862 
       
   863 TInt CFloggerTest027_07::DoTestWrite()
       
   864 	{
       
   865 	TPtrC8 ptrSubSystem;
       
   866 	TPtrC8 ptrComponent;
       
   867 	ptrSubSystem.Set(_L8("SubSystem"));
       
   868 	ptrComponent.Set(_L8("Component"));
       
   869 	__FLOG_DECLARATION_MEMBER;
       
   870 	__FLOG_OPEN(ptrSubSystem, ptrComponent);
       
   871 	__FLOG_CLEAR;
       
   872 	_LIT8(KTestMessage ,"TC no 27.7: This is test message");
       
   873 	__FLOG_BINARY(KTestMessage);  //Write 8 bit test descriptor
       
   874 	__FLOG_CLOSE;
       
   875 	return KErrNone; 
       
   876 	}
       
   877 
       
   878 
       
   879 /**
       
   880 * Function  Name		: DoTestCheckWriteL
       
   881 * Input parameters		: None
       
   882 * Output parameters		: TInt 
       
   883 * Description 			: This function checks whether test data was written
       
   884 						  in to the log file or not.
       
   885 					  
       
   886 */
       
   887 
       
   888 
       
   889 TInt CFloggerTest027_07::DoTestCheckWriteL()
       
   890 	{
       
   891 	User::After(KTimeToLog);
       
   892 	RFile theFile;
       
   893 	HBufC8 * hBuffer;
       
   894 	TInt listfilesize;
       
   895 	TInt returnCode;
       
   896 	RFs fileSystem; //For file operation create a file system	
       
   897 	_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
       
   898 
       
   899 	_LIT8(KTestMessage ,"TC no 27.7: This is test message");
       
   900 	
       
   901 	User::LeaveIfError(fileSystem.Connect());
       
   902 	
       
   903 	//Open the file in the read mode
       
   904 	User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead)); 
       
   905 
       
   906 	CleanupClosePushL(theFile);	
       
   907 	
       
   908 	User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
       
   909 	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
       
   910 	CleanupStack::PushL(hBuffer);
       
   911 	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer
       
   912 
       
   913 	// Read from position 0: start of file
       
   914 	returnCode = theFile.Read(ptrString);
       
   915 	
       
   916 	returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
       
   917 												//from the file
       
   918 
       
   919 	CleanupStack::PopAndDestroy(hBuffer);
       
   920 	CleanupStack::PopAndDestroy(); // For theFile object
       
   921 	if (returnCode > 0)
       
   922 		return KErrNone;
       
   923 	else 
       
   924 		return KErrGeneral;
       
   925 	}
       
   926 
       
   927 
       
   928 
       
   929 
       
   930 /**
       
   931 * Function  Name : CFloggerTest027_08
       
   932 * Input parameters : None
       
   933 * Output parameters : None
       
   934 * Description : This is the constructor
       
   935 */
       
   936 
       
   937 
       
   938 CFloggerTest027_08::CFloggerTest027_08()
       
   939 	{
       
   940 	// Store the name of this test case
       
   941 	SetTestStepName(_L("step_027_08"));
       
   942 	}
       
   943 
       
   944 
       
   945 /**
       
   946 * Function  Name :~ CFloggerTest027_08
       
   947 * Input parameters : None
       
   948 * Output parameters : None
       
   949 * Description : This is the Destructor
       
   950 */ 
       
   951 
       
   952 
       
   953 CFloggerTest027_08::~CFloggerTest027_08()
       
   954 	{
       
   955 	}
       
   956 
       
   957 
       
   958 /**
       
   959 * Function  Name	: doTestStepL
       
   960 * Input parameters	: None
       
   961 * Output parameters : TVerdict 
       
   962 * Description		: This function returns whether the test case 027_07 has 
       
   963 * 					  passed or failed
       
   964 
       
   965 */
       
   966 
       
   967 
       
   968 TVerdict CFloggerTest027_08::doTestStepL( )
       
   969 	{
       
   970 	INFO_PRINTF1(_L("Step 027.08 called "));
       
   971 	if ( executeStepL() == KErrNone )
       
   972 		SetTestStepResult(EPass);
       
   973 
       
   974 	else
       
   975 		SetTestStepResult(EFail);
       
   976 
       
   977 	
       
   978 	return TestStepResult();
       
   979 	}
       
   980 
       
   981 /**
       
   982 * Function  Name		: executeStepL
       
   983 * Input parameters		: None
       
   984 * Output parameters		: TInt 
       
   985 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
   986 */
       
   987 
       
   988 
       
   989 TInt CFloggerTest027_08::executeStepL(TBool)
       
   990 	{
       
   991 	return KErrGeneral;
       
   992 	}
       
   993 
       
   994 /**
       
   995 * Function  Name		: executeStepL
       
   996 * Input parameters		: None
       
   997 * Output parameters		: TInt 
       
   998 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
   999 */
       
  1000 
       
  1001 
       
  1002 TInt CFloggerTest027_08::executeStepL()
       
  1003 	{
       
  1004 	TInt ret = KErrNone;
       
  1005 	ret = DoTestWrite();
       
  1006 	if ( ret == KErrNone)
       
  1007 		{
       
  1008 		TRAPD(r, ret = DoTestCheckWriteL());
       
  1009 		if ( r != KErrNone)
       
  1010 			ret = r;
       
  1011 		}
       
  1012 	return ret;
       
  1013 	}
       
  1014 
       
  1015 
       
  1016 TInt CFloggerTest027_08::DoTestWrite()
       
  1017 	{
       
  1018 	_LIT8(ptrSubSystem,"SubSystem");
       
  1019 	_LIT8(ptrComponent,"Component");
       
  1020 	_LIT8(KTestMessage ,"TC no 27.8: This is test message");
       
  1021 	__FLOG_STATIC0(ptrSubSystem, ptrComponent, KTestMessage);
       
  1022 	return KErrNone; 
       
  1023 	}
       
  1024 
       
  1025 
       
  1026 /**
       
  1027 * Function  Name		: DoTestCheckWriteL
       
  1028 * Input parameters		: None
       
  1029 * Output parameters		: TInt 
       
  1030 * Description 			: This function checks whether test data was written
       
  1031 						  in to the log file or not.
       
  1032 					  
       
  1033 */
       
  1034 
       
  1035 
       
  1036 TInt CFloggerTest027_08::DoTestCheckWriteL()
       
  1037 	{
       
  1038 	User::After(KTimeToLog);
       
  1039 	RFile theFile;
       
  1040 	HBufC8 * hBuffer;
       
  1041 	TInt listfilesize;
       
  1042 	TInt returnCode;
       
  1043 	RFs fileSystem; //For file operation create a file system	
       
  1044 	_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
       
  1045 
       
  1046 	_LIT8(KTestMessage ,"TC no 27.8: This is test message");
       
  1047 	
       
  1048 	User::LeaveIfError(fileSystem.Connect());
       
  1049 	
       
  1050 	//Open the file in the read mode
       
  1051 	User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead)); 
       
  1052 
       
  1053 	CleanupClosePushL(theFile);	
       
  1054 	
       
  1055 	User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
       
  1056 	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
       
  1057 	CleanupStack::PushL(hBuffer);
       
  1058 	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer
       
  1059 
       
  1060 	// Read from position 0: start of file
       
  1061 	returnCode = theFile.Read(ptrString);
       
  1062 	
       
  1063 	returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
       
  1064 												//from the file
       
  1065 
       
  1066 	CleanupStack::PopAndDestroy(hBuffer);
       
  1067 	CleanupStack::PopAndDestroy(); // For theFile object
       
  1068 	if (returnCode > 0)
       
  1069 		return KErrNone;
       
  1070 	else 
       
  1071 		return KErrGeneral;
       
  1072 	}
       
  1073 
       
  1074 
       
  1075 
       
  1076 
       
  1077 /**
       
  1078 * Function  Name : CFloggerTest027_09
       
  1079 * Input parameters : None
       
  1080 * Output parameters : None
       
  1081 * Description : This is the constructor
       
  1082 */
       
  1083 
       
  1084 
       
  1085 CFloggerTest027_09::CFloggerTest027_09()
       
  1086 	{
       
  1087 	// Store the name of this test case
       
  1088 	SetTestStepName(_L("step_027_09"));
       
  1089 	}
       
  1090 
       
  1091 
       
  1092 /**
       
  1093 * Function  Name :~ CFloggerTest027_09
       
  1094 * Input parameters : None
       
  1095 * Output parameters : None
       
  1096 * Description : This is the Destructor
       
  1097 */ 
       
  1098 
       
  1099 
       
  1100 CFloggerTest027_09::~CFloggerTest027_09()
       
  1101 	{
       
  1102 	}
       
  1103 
       
  1104 
       
  1105 /**
       
  1106 * Function  Name	: doTestStepL
       
  1107 * Input parameters	: None
       
  1108 * Output parameters : TVerdict 
       
  1109 * Description		: This function returns whether the test case 027_09 has 
       
  1110 * 					  passed or failed
       
  1111 
       
  1112 */
       
  1113 
       
  1114 
       
  1115 TVerdict CFloggerTest027_09::doTestStepL( )
       
  1116 	{
       
  1117 	INFO_PRINTF1(_L("Step 027.09 called "));
       
  1118 	if ( executeStepL() == KErrNone )
       
  1119 		SetTestStepResult(EPass);
       
  1120 
       
  1121 	else
       
  1122 		SetTestStepResult(EFail);
       
  1123 
       
  1124 	
       
  1125 	return TestStepResult();
       
  1126 	}
       
  1127 /**
       
  1128 * Function  Name		: executeStepL
       
  1129 * Input parameters		: None
       
  1130 * Output parameters		: TInt 
       
  1131 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
  1132 
       
  1133 */
       
  1134 
       
  1135 
       
  1136 TInt CFloggerTest027_09::executeStepL(TBool)
       
  1137 	{
       
  1138 	return KErrGeneral;
       
  1139 	}
       
  1140 
       
  1141 /**
       
  1142 * Function  Name		: executeStepL
       
  1143 * Input parameters		: None
       
  1144 * Output parameters		: TInt 
       
  1145 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
  1146 
       
  1147 */
       
  1148 
       
  1149 
       
  1150 TInt CFloggerTest027_09::executeStepL()
       
  1151 	{
       
  1152 	TInt ret = KErrNone;
       
  1153 	ret = DoTestWrite();
       
  1154 	if ( ret == KErrNone)
       
  1155 		{
       
  1156 		TRAPD(r, ret = DoTestCheckWriteL());
       
  1157 		if ( r != KErrNone)
       
  1158 			ret = r;
       
  1159 		}
       
  1160 	return ret;
       
  1161 	}
       
  1162 
       
  1163 
       
  1164 TInt CFloggerTest027_09::DoTestWrite()
       
  1165 	{
       
  1166 	_LIT8(ptrSubSystem,"SubSystem");
       
  1167 	_LIT8(ptrComponent,"Component");
       
  1168 	_LIT8(KTestMessageOne,"TEST 27.09: The value of test integer variable :%d");
       
  1169 	__FLOG_STATIC1(ptrSubSystem, ptrComponent, KTestMessageOne, 100);
       
  1170 	return KErrNone; 
       
  1171 	}
       
  1172 
       
  1173 
       
  1174 /**
       
  1175 * Function  Name		: DoTestCheckWriteL
       
  1176 * Input parameters		: None
       
  1177 * Output parameters		: TInt 
       
  1178 * Description 			: This function checks whether test data was written
       
  1179 						  in to the log file or not.
       
  1180 					  
       
  1181 */
       
  1182 
       
  1183 
       
  1184 TInt CFloggerTest027_09::DoTestCheckWriteL()
       
  1185 	{
       
  1186 	User::After(KTimeToLog);
       
  1187 	RFile theFile;
       
  1188 	HBufC8 * hBuffer;
       
  1189 	TInt listfilesize;
       
  1190 	TInt returnCode;
       
  1191 	RFs fileSystem; //For file operation create a file system	
       
  1192 	_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
       
  1193 
       
  1194 	TBuf8<256> testData; //To hold the test descriptor
       
  1195 
       
  1196 	_LIT8(KTestMessageOne,"TEST 27.09: The value of test integer variable :%d");
       
  1197 	testData.Format(KTestMessageOne,100);
       
  1198 	
       
  1199 	User::LeaveIfError(fileSystem.Connect());
       
  1200 	
       
  1201 	//Open the file in the read mode
       
  1202 	User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead)); 
       
  1203 
       
  1204 	CleanupClosePushL(theFile);	
       
  1205 	
       
  1206 	User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
       
  1207 	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
       
  1208 	CleanupStack::PushL(hBuffer);
       
  1209 	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer
       
  1210 
       
  1211 	// Read from position 0: start of file
       
  1212 	returnCode = theFile.Read(ptrString);
       
  1213 	
       
  1214 	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
       
  1215 												//from the file
       
  1216 
       
  1217 	CleanupStack::PopAndDestroy(hBuffer);
       
  1218 	CleanupStack::PopAndDestroy(); // For theFile object
       
  1219 	if (returnCode > 0)
       
  1220 		return KErrNone;
       
  1221 	else 
       
  1222 		return KErrGeneral;
       
  1223 	}
       
  1224 
       
  1225 
       
  1226 
       
  1227 
       
  1228 /**
       
  1229 * Function  Name : CFloggerTest027_10
       
  1230 * Input parameters : None
       
  1231 * Output parameters : None
       
  1232 * Description : This is the constructor
       
  1233 */
       
  1234 
       
  1235 
       
  1236 CFloggerTest027_10::CFloggerTest027_10()
       
  1237 	{
       
  1238 	// Store the name of this test case
       
  1239 	SetTestStepName(_L("step_027_10"));
       
  1240 	}
       
  1241 
       
  1242 
       
  1243 /**
       
  1244 * Function  Name :~ CFloggerTest027_10
       
  1245 * Input parameters : None
       
  1246 * Output parameters : None
       
  1247 * Description : This is the Destructor
       
  1248 */ 
       
  1249 
       
  1250 
       
  1251 CFloggerTest027_10::~CFloggerTest027_10()
       
  1252 	{
       
  1253 	}
       
  1254 
       
  1255 
       
  1256 /**
       
  1257 * Function  Name	: doTestStepL
       
  1258 * Input parameters	: None
       
  1259 * Output parameters : TVerdict 
       
  1260 * Description		: This function returns whether the test case 027_10 has 
       
  1261 * 					  passed or failed
       
  1262 
       
  1263 */
       
  1264 
       
  1265 
       
  1266 TVerdict CFloggerTest027_10::doTestStepL( )
       
  1267 	{
       
  1268 	INFO_PRINTF1(_L("Step 027.10 called "));
       
  1269 	if ( executeStepL() == KErrNone )
       
  1270 		SetTestStepResult(EPass);
       
  1271 
       
  1272 	else
       
  1273 		SetTestStepResult(EFail);
       
  1274 
       
  1275 	
       
  1276 	return TestStepResult();
       
  1277 	}
       
  1278 
       
  1279 /**
       
  1280 * Function  Name		: executeStepL
       
  1281 * Input parameters		: None
       
  1282 * Output parameters		: TInt 
       
  1283 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
  1284 
       
  1285 */
       
  1286 
       
  1287 
       
  1288 TInt CFloggerTest027_10::executeStepL(TBool)
       
  1289 	{
       
  1290 	return KErrGeneral;
       
  1291 	}
       
  1292 /**
       
  1293 * Function  Name		: executeStepL
       
  1294 * Input parameters		: None
       
  1295 * Output parameters		: TInt 
       
  1296 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
  1297 
       
  1298 */
       
  1299 
       
  1300 
       
  1301 TInt CFloggerTest027_10::executeStepL()
       
  1302 	{
       
  1303 	TInt ret = KErrNone;
       
  1304 	ret = DoTestWrite();
       
  1305 	if ( ret == KErrNone)
       
  1306 		{
       
  1307 		TRAPD(r, ret = DoTestCheckWriteL());
       
  1308 		if ( r != KErrNone)
       
  1309 			ret = r;
       
  1310 		}
       
  1311 	return ret;
       
  1312 	}
       
  1313 
       
  1314 
       
  1315 TInt CFloggerTest027_10::DoTestWrite()
       
  1316 	{
       
  1317 	_LIT8(ptrSubSystem,"SubSystem");
       
  1318 	_LIT8(ptrComponent,"Component");
       
  1319 	_LIT8(KTestMessage ,"TC no 27.10: This is test message");
       
  1320 	__FLOG_STATIC(ptrSubSystem, ptrComponent, KTestMessage);
       
  1321 	return KErrNone; 
       
  1322 	}
       
  1323 
       
  1324 
       
  1325 /**
       
  1326 * Function  Name		: DoTestCheckWriteL
       
  1327 * Input parameters		: None
       
  1328 * Output parameters		: TInt 
       
  1329 * Description 			: This function checks whether test data was written
       
  1330 						  in to the log file or not..
       
  1331 					  
       
  1332 */
       
  1333 
       
  1334 
       
  1335 TInt CFloggerTest027_10::DoTestCheckWriteL()
       
  1336 	{
       
  1337 	User::After(KTimeToLog);
       
  1338 	RFile theFile;
       
  1339 	HBufC8 * hBuffer;
       
  1340 	TInt listfilesize;
       
  1341 	TInt returnCode;
       
  1342 	RFs fileSystem; //For file operation create a file system	
       
  1343 	_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
       
  1344 	_LIT8(KTestMessage ,"TC no 27.10: This is test message");
       
  1345 	
       
  1346 	User::LeaveIfError(fileSystem.Connect());
       
  1347 	
       
  1348 	//Open the file in the read mode
       
  1349 	User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead)); 
       
  1350 
       
  1351 	CleanupClosePushL(theFile);	
       
  1352 	
       
  1353 	User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
       
  1354 	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
       
  1355 	CleanupStack::PushL(hBuffer);
       
  1356 	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer
       
  1357 
       
  1358 	// Read from position 0: start of file
       
  1359 	returnCode = theFile.Read(ptrString);
       
  1360 	
       
  1361 	returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
       
  1362 												//from the file
       
  1363 
       
  1364 	CleanupStack::PopAndDestroy(hBuffer);
       
  1365 	CleanupStack::PopAndDestroy(); // For theFile object
       
  1366 	if (returnCode > 0)
       
  1367 		return KErrNone;
       
  1368 	else 
       
  1369 		return KErrGeneral;
       
  1370 	}
       
  1371 
       
  1372 
       
  1373 
       
  1374 
       
  1375 /**
       
  1376 * Function  Name : CFloggerTest027_11
       
  1377 * Input parameters : None
       
  1378 * Output parameters : None
       
  1379 * Description : This is the constructor
       
  1380 */
       
  1381 
       
  1382 
       
  1383 CFloggerTest027_11::CFloggerTest027_11()
       
  1384 	{
       
  1385 	// Store the name of this test case
       
  1386 	SetTestStepName(_L("step_027_11"));
       
  1387 	}
       
  1388 
       
  1389 
       
  1390 /**
       
  1391 * Function  Name :~ CFloggerTest027_11
       
  1392 * Input parameters : None
       
  1393 * Output parameters : None
       
  1394 * Description : This is the Destructor
       
  1395 */ 
       
  1396 
       
  1397 
       
  1398 CFloggerTest027_11::~CFloggerTest027_11()
       
  1399 	{
       
  1400 	}
       
  1401 
       
  1402 
       
  1403 /**
       
  1404 * Function  Name	: doTestStepL
       
  1405 * Input parameters	: None
       
  1406 * Output parameters : TVerdict 
       
  1407 * Description		: This function returns whether the test case 027_11 has 
       
  1408 * 					  passed or failed
       
  1409 
       
  1410 */
       
  1411 
       
  1412 
       
  1413 TVerdict CFloggerTest027_11::doTestStepL( )
       
  1414 	{
       
  1415 	INFO_PRINTF1(_L("Step 027.11 called "));
       
  1416 	if ( executeStepL() == KErrNone )
       
  1417 		SetTestStepResult(EPass);
       
  1418 
       
  1419 	else
       
  1420 		SetTestStepResult(EFail);
       
  1421 
       
  1422 	
       
  1423 	return TestStepResult();
       
  1424 	}
       
  1425 
       
  1426 /**
       
  1427 * Function  Name		: executeStepL
       
  1428 * Input parameters		: None
       
  1429 * Output parameters		: TInt 
       
  1430 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
  1431 
       
  1432 */
       
  1433 
       
  1434 
       
  1435 TInt CFloggerTest027_11::executeStepL(TBool)
       
  1436 	{
       
  1437 	return KErrGeneral;
       
  1438 	}
       
  1439 
       
  1440 /**
       
  1441 * Function  Name		: executeStepL
       
  1442 * Input parameters		: None
       
  1443 * Output parameters		: TInt 
       
  1444 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
  1445 
       
  1446 */
       
  1447 
       
  1448 
       
  1449 TInt CFloggerTest027_11::executeStepL()
       
  1450 	{
       
  1451 	TInt ret = KErrNone;
       
  1452 	ret = DoTestWrite();
       
  1453 	if ( ret == KErrNone)
       
  1454 		{
       
  1455 		TRAPD(r, ret = DoTestCheckWriteL());
       
  1456 		if ( r != KErrNone)
       
  1457 			ret = r;
       
  1458 		}
       
  1459 	return ret;
       
  1460 	}
       
  1461 
       
  1462 
       
  1463 TInt CFloggerTest027_11::DoTestWrite()
       
  1464 	{
       
  1465 	TPtrC8 ptrSubSystem;
       
  1466 	TPtrC8 ptrComponent;
       
  1467 	ptrSubSystem.Set(_L8("SubSystem"));
       
  1468 	ptrComponent.Set(_L8("Component"));
       
  1469 	_LIT8(descTxt,"T 27_11:Test Msg"); //Test body descriptor
       
  1470 	__FLOG_STATIC_HEXDUMP((ptrSubSystem, ptrComponent, descTxt));
       
  1471 	return KErrNone;
       
  1472 	}
       
  1473 
       
  1474 
       
  1475 /**
       
  1476 * Function  Name		: DoTestCheckWriteL
       
  1477 * Input parameters		: None
       
  1478 * Output parameters		: TInt 
       
  1479 * Description 			: This function checks whether test data was written
       
  1480 						  in to the log file or not.
       
  1481 					  
       
  1482 */
       
  1483 
       
  1484 
       
  1485 TInt CFloggerTest027_11::DoTestCheckWriteL()
       
  1486 	{
       
  1487 	User::After(KTimeToLog);
       
  1488 	RFile theFile;
       
  1489 	HBufC8 * hBuffer;
       
  1490 	TInt listfilesize;
       
  1491 	TInt returnCode;
       
  1492 	RFs fileSystem; //For file operation create a file system	
       
  1493 	_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
       
  1494 	_LIT8(KTestMessage ,"T 27_11:Test Msg");
       
  1495 	
       
  1496 	User::LeaveIfError(fileSystem.Connect());
       
  1497 	
       
  1498 	//Open the file in the read mode
       
  1499 	User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead)); 
       
  1500 
       
  1501 	CleanupClosePushL(theFile);	
       
  1502 	
       
  1503 	User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
       
  1504 	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
       
  1505 	CleanupStack::PushL(hBuffer);
       
  1506 	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer
       
  1507 
       
  1508 	// Read from position 0: start of file
       
  1509 	returnCode = theFile.Read(ptrString);
       
  1510 	
       
  1511 	returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
       
  1512 												//from the file
       
  1513 
       
  1514 	CleanupStack::PopAndDestroy(hBuffer);
       
  1515 	CleanupStack::PopAndDestroy(); // For theFile object
       
  1516 	if (returnCode > 0)
       
  1517 		return KErrNone;
       
  1518 	else 
       
  1519 		return KErrGeneral;
       
  1520 	}
       
  1521 
       
  1522 
       
  1523 
       
  1524 
       
  1525 /**
       
  1526 * Function  Name : CFloggerTest027_12
       
  1527 * Input parameters : None
       
  1528 * Output parameters : None
       
  1529 * Description : This is the constructor
       
  1530 */
       
  1531 
       
  1532 
       
  1533 CFloggerTest027_12::CFloggerTest027_12()
       
  1534 	{
       
  1535 	// Store the name of this test case
       
  1536 	SetTestStepName(_L("step_027_12"));
       
  1537 	}
       
  1538 
       
  1539 
       
  1540 /**
       
  1541 * Function  Name :~ CFloggerTest027_12
       
  1542 * Input parameters : None
       
  1543 * Output parameters : None
       
  1544 * Description : This is the Destructor
       
  1545 */ 
       
  1546 
       
  1547 
       
  1548 CFloggerTest027_12::~CFloggerTest027_12()
       
  1549 	{
       
  1550 	}
       
  1551 
       
  1552 
       
  1553 /**
       
  1554 * Function  Name	: doTestStepL
       
  1555 * Input parameters	: None
       
  1556 * Output parameters : TVerdict 
       
  1557 * Description		: This function returns whether the test case 027_12 has 
       
  1558 * 					  passed or failed
       
  1559 
       
  1560 */
       
  1561 
       
  1562 
       
  1563 TVerdict CFloggerTest027_12::doTestStepL( )
       
  1564 	{
       
  1565 	INFO_PRINTF1(_L("Step 027.12 called "));
       
  1566 	if ( executeStepL() == KErrNone )
       
  1567 		SetTestStepResult(EPass);
       
  1568 
       
  1569 	else
       
  1570 		SetTestStepResult(EFail);
       
  1571 
       
  1572 	
       
  1573 	return TestStepResult();
       
  1574 	}
       
  1575 
       
  1576 /**
       
  1577 * Function  Name		: executeStepL
       
  1578 * Input parameters		: None
       
  1579 * Output parameters		: TInt 
       
  1580 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
  1581 */
       
  1582 
       
  1583 
       
  1584 TInt CFloggerTest027_12::executeStepL(TBool)
       
  1585 	{
       
  1586 	return KErrGeneral;
       
  1587 	}
       
  1588 
       
  1589 /**
       
  1590 * Function  Name		: executeStepL
       
  1591 * Input parameters		: None
       
  1592 * Output parameters		: TInt 
       
  1593 * Description 			: This function calls the flogger write and checks whether the log message is written in to the log file
       
  1594 */
       
  1595 
       
  1596 
       
  1597 TInt CFloggerTest027_12::executeStepL()
       
  1598 	{
       
  1599 	TInt ret = KErrNone;
       
  1600 	ret = DoTestWrite();
       
  1601 	if ( ret == KErrNone)
       
  1602 		{
       
  1603 		TRAPD(r, ret = DoTestCheckWriteL());
       
  1604 		if ( r != KErrNone)
       
  1605 			ret = r;
       
  1606 		}
       
  1607 	return ret;
       
  1608 	}
       
  1609 
       
  1610 
       
  1611 TInt CFloggerTest027_12::DoTestWrite()
       
  1612 	{
       
  1613 	TPtrC8 ptrSubSystem;
       
  1614 	TPtrC8 ptrComponent;
       
  1615 	ptrSubSystem.Set(_L8("SubSystem"));
       
  1616 	ptrComponent.Set(_L8("Component"));
       
  1617 	_LIT16(KTestMessageTwo,"TEST 27.12: The value of first test integer variable :%d The value of second test integer variable : %d");
       
  1618 	__FLOG_STATIC2(ptrSubSystem, ptrComponent, KTestMessageTwo, 100, 200);
       
  1619 	return KErrNone;
       
  1620 	}
       
  1621 
       
  1622 
       
  1623 /**
       
  1624 * Function  Name		: DoTestCheckWriteL
       
  1625 * Input parameters		: None
       
  1626 * Output parameters		: TInt 
       
  1627 * Description 			: This function checks whether test data was written
       
  1628 						  in to the log file or not.
       
  1629 					  
       
  1630 */
       
  1631 
       
  1632 
       
  1633 TInt CFloggerTest027_12::DoTestCheckWriteL()
       
  1634 	{
       
  1635 	User::After(KTimeToLog);
       
  1636 	RFile theFile;
       
  1637 	HBufC8 * hBuffer;
       
  1638 	TInt listfilesize;
       
  1639 	TInt returnCode;
       
  1640 	RFs fileSystem; //For file operation create a file system	
       
  1641 	_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
       
  1642 
       
  1643 	TBuf8<256> testData; //To hold the test descriptor
       
  1644 
       
  1645 	_LIT8(KTestMessageTwo,"TEST 27.12: The value of first test integer variable :%d The value of second test integer variable : %d");
       
  1646 	testData.Format(KTestMessageTwo,100, 200);
       
  1647 
       
  1648 	User::LeaveIfError(fileSystem.Connect());
       
  1649 	
       
  1650 	//Open the file in the read mode
       
  1651 	User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead)); 
       
  1652 
       
  1653 	CleanupClosePushL(theFile);	
       
  1654 	
       
  1655 	User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
       
  1656 	hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
       
  1657 	CleanupStack::PushL(hBuffer);
       
  1658 	TPtr8 ptrString = hBuffer->Des();  ; //To hold the buffer
       
  1659 
       
  1660 	// Read from position 0: start of file
       
  1661 	returnCode = theFile.Read(ptrString);
       
  1662 	
       
  1663 	returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
       
  1664 												//from the file
       
  1665 
       
  1666 	CleanupStack::PopAndDestroy(hBuffer);
       
  1667 	CleanupStack::PopAndDestroy(); // For theFile object
       
  1668 	if (returnCode > 0)
       
  1669 		return KErrNone;
       
  1670 	else 
       
  1671 		return KErrGeneral;
       
  1672 	}
       
  1673 
       
  1674