os/persistentdata/traceservices/commsdebugutility/TE_commsdebugutility/src/step_027_xx.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/traceservices/commsdebugutility/TE_commsdebugutility/src/step_027_xx.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1674 @@
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 "step_027_xx.h"
1.21 +
1.22 +#include <comms-infras/commsdebugutility.h>
1.23 +
1.24 +
1.25 +/**
1.26 +* Function Name : CFloggerTest027_01
1.27 +* Input parameters : None
1.28 +* Output parameters : None
1.29 +* Description : This is the constructor
1.30 +*/
1.31 +
1.32 +
1.33 +CFloggerTest027_01::CFloggerTest027_01()
1.34 + {
1.35 + // Store the name of this test case
1.36 + SetTestStepName(_L("step_027_01"));
1.37 + }
1.38 +
1.39 +
1.40 +/**
1.41 +* Function Name :~ CFloggerTest027_01
1.42 +* Input parameters : None
1.43 +* Output parameters : None
1.44 +* Description : This is the Destructor
1.45 +*/
1.46 +
1.47 +
1.48 +CFloggerTest027_01::~CFloggerTest027_01()
1.49 + {
1.50 + }
1.51 +
1.52 +
1.53 +/**
1.54 +* Function Name : doTestStepL
1.55 +* Input parameters : None
1.56 +* Output parameters : TVerdict
1.57 +* Description : This function returns whether the test case 027_01 has
1.58 +* passed or failed
1.59 +
1.60 +*/
1.61 +
1.62 +
1.63 +TVerdict CFloggerTest027_01::doTestStepL( )
1.64 + {
1.65 + if ( executeStepL() == KErrNone )
1.66 + SetTestStepResult(EPass);
1.67 +
1.68 + else
1.69 + SetTestStepResult(EFail);
1.70 +
1.71 +
1.72 +
1.73 + return TestStepResult();
1.74 + }
1.75 +
1.76 +
1.77 +/**
1.78 +* Function Name : executeStepL
1.79 +* Input parameters : None
1.80 +* Output parameters : TInt
1.81 +* Description : This function calls the Connect twice
1.82 +
1.83 +*/
1.84 +
1.85 +
1.86 +TInt CFloggerTest027_01::executeStepL(TBool)
1.87 + {
1.88 + return KErrGeneral;
1.89 + }
1.90 +/**
1.91 +* Function Name : executeStepL
1.92 +* Input parameters : None
1.93 +* Output parameters : TInt
1.94 +* Description : This function calls the Connect twice
1.95 +
1.96 +*/
1.97 +
1.98 +
1.99 +TInt CFloggerTest027_01::executeStepL()
1.100 + {
1.101 + TInt numSuccess = 0;
1.102 + TInt ret;
1.103 + RFileLogger flogger;
1.104 + ret = flogger.Connect();
1.105 +
1.106 + if (ret == KErrNone)
1.107 + {
1.108 + numSuccess++;
1.109 + }
1.110 +
1.111 + //Call Connect() twice this will cause 2nd one ot return KErrorAlreadyExists and nothing to happen.
1.112 + ret = flogger.Connect();
1.113 +
1.114 + if (ret == KErrAlreadyExists)
1.115 + {
1.116 + numSuccess++;
1.117 + }
1.118 +
1.119 +
1.120 + if (numSuccess == 2)
1.121 + {
1.122 + return KErrNone;
1.123 + }
1.124 +
1.125 + return KErrBadHandle;
1.126 + }
1.127 +
1.128 +
1.129 +
1.130 +
1.131 +/**
1.132 +* Function Name : CFloggerTest027_02
1.133 +* Input parameters : None
1.134 +* Output parameters : None
1.135 +* Description : This is the constructor
1.136 +*/
1.137 +
1.138 +
1.139 +CFloggerTest027_02::CFloggerTest027_02()
1.140 + {
1.141 + // Store the name of this test case
1.142 + SetTestStepName(_L("step_027_02"));
1.143 + }
1.144 +
1.145 +
1.146 +/**
1.147 +* Function Name :~ CFloggerTest027_02
1.148 +* Input parameters : None
1.149 +* Output parameters : None
1.150 +* Description : This is the Destructor
1.151 +*/
1.152 +
1.153 +
1.154 +CFloggerTest027_02::~CFloggerTest027_02()
1.155 + {
1.156 + }
1.157 +
1.158 +
1.159 +/**
1.160 +* Function Name : doTestStepL
1.161 +* Input parameters : None
1.162 +* Output parameters : TVerdict
1.163 +* Description : This function returns whether the test case 027_02 has
1.164 +* passed or failed
1.165 +
1.166 +*/
1.167 +
1.168 +
1.169 +TVerdict CFloggerTest027_02::doTestStepL( )
1.170 + {
1.171 +
1.172 + INFO_PRINTF1(_L("Step 027.02 called "));
1.173 + TRAPD(res ,executeStepL());
1.174 + if (res == KErrNone )
1.175 + SetTestStepResult(EPass);
1.176 +
1.177 + else
1.178 + SetTestStepResult(EFail);
1.179 +
1.180 + INFO_PRINTF1(_L("leaving Step 027.02 "));
1.181 + User::After(KTimeForDisplay);
1.182 +
1.183 +
1.184 + return TestStepResult();
1.185 + }
1.186 +
1.187 +/**
1.188 +* Function Name : executeStepL
1.189 +* Input parameters : None
1.190 +* Output parameters : TInt
1.191 +* Description : This function leaves without calling CleanupStack::PopAndDestroy()
1.192 +
1.193 +*/
1.194 +
1.195 +
1.196 +TInt CFloggerTest027_02::executeStepL(TBool)
1.197 + {
1.198 + return KErrGeneral;
1.199 + }
1.200 +
1.201 +/**
1.202 +* Function Name : executeStepL
1.203 +* Input parameters : None
1.204 +* Output parameters : TInt
1.205 +* Description : This function leaves without calling CleanupStack::PopAndDestroy()
1.206 +
1.207 +*/
1.208 +
1.209 +
1.210 +TInt CFloggerTest027_02::executeStepL()
1.211 + {
1.212 + TInt r = KErrNone;
1.213 + TPtrC8 ptrSubSystem;
1.214 + TPtrC8 ptrComponent;
1.215 + ptrSubSystem.Set(_L8("SubSystem"));
1.216 + ptrComponent.Set(_L8("Component"));
1.217 + __FLOG_DECLARATION_MEMBER;
1.218 + __FLOG_OPENC(ptrSubSystem, ptrComponent);
1.219 + User::Leave(r);
1.220 + return KErrNone;
1.221 + }
1.222 +
1.223 +
1.224 +
1.225 +/**
1.226 +* Function Name : CFloggerTest027_03
1.227 +* Input parameters : None
1.228 +* Output parameters : None
1.229 +* Description : This is the constructor
1.230 +*/
1.231 +
1.232 +
1.233 +CFloggerTest027_03::CFloggerTest027_03()
1.234 + {
1.235 + // Store the name of this test case
1.236 + SetTestStepName(_L("step_027_03"));
1.237 + }
1.238 +
1.239 +
1.240 +/**
1.241 +* Function Name :~ CFloggerTest027_03
1.242 +* Input parameters : None
1.243 +* Output parameters : None
1.244 +* Description : This is the Destructor
1.245 +*/
1.246 +
1.247 +
1.248 +CFloggerTest027_03::~CFloggerTest027_03()
1.249 + {
1.250 + }
1.251 +
1.252 +
1.253 +/**
1.254 +* Function Name : doTestStepL
1.255 +* Input parameters : None
1.256 +* Output parameters : TVerdict
1.257 +* Description : This function returns whether the test case 027_03 has
1.258 +* passed or failed
1.259 +
1.260 +*/
1.261 +
1.262 +
1.263 +TVerdict CFloggerTest027_03::doTestStepL( )
1.264 + {
1.265 + INFO_PRINTF1(_L("Step 027.03 called "));
1.266 + TRAPD(ret, executeStepL());
1.267 + if (ret == KErrNone )
1.268 + SetTestStepResult(EPass);
1.269 +
1.270 + else
1.271 + SetTestStepResult(EFail);
1.272 +
1.273 + INFO_PRINTF1(_L("leaving Step 027.02 "));
1.274 + User::After(KTimeForDisplay);
1.275 +
1.276 +
1.277 + return TestStepResult();
1.278 + }
1.279 +
1.280 +
1.281 +/**
1.282 +* Function Name : executeStepL
1.283 +* Input parameters : None
1.284 +* Output parameters : TInt
1.285 +* Description : This function calls CleanupStack::PopAndDestroy() to check whether the flogger is pushed to the stack
1.286 +
1.287 +*/
1.288 +
1.289 +
1.290 +TInt CFloggerTest027_03::executeStepL()
1.291 + {
1.292 + TPtrC8 ptrSubSystem;
1.293 + TPtrC8 ptrComponent;
1.294 + ptrSubSystem.Set(_L8("SubSystem"));
1.295 + ptrComponent.Set(_L8("Component"));
1.296 + __FLOG_DECLARATION_MEMBER;
1.297 + __FLOG_OPENC(ptrSubSystem, ptrComponent);
1.298 + CleanupStack::PopAndDestroy();
1.299 + return KErrNone;
1.300 + }
1.301 +
1.302 +/**
1.303 +* Function Name : executeStepL
1.304 +* Input parameters : None
1.305 +* Output parameters : TInt
1.306 +* Description : This function calls CleanupStack::PopAndDestroy() to check whether the flogger is pushed to the stack
1.307 +
1.308 +*/
1.309 +
1.310 +
1.311 +TInt CFloggerTest027_03::executeStepL(TBool)
1.312 + {
1.313 + return KErrGeneral;
1.314 + }
1.315 +
1.316 +/**
1.317 +* Function Name : CFloggerTest027_04
1.318 +* Input parameters : None
1.319 +* Output parameters : None
1.320 +* Description : This is the constructor
1.321 +*/
1.322 +
1.323 +
1.324 +CFloggerTest027_04::CFloggerTest027_04()
1.325 + {
1.326 + // Store the name of this test case
1.327 + SetTestStepName(_L("step_027_04"));
1.328 + }
1.329 +
1.330 +
1.331 +/**
1.332 +* Function Name :~ CFloggerTest027_04
1.333 +* Input parameters : None
1.334 +* Output parameters : None
1.335 +* Description : This is the Destructor
1.336 +*/
1.337 +
1.338 +
1.339 +CFloggerTest027_04::~CFloggerTest027_04()
1.340 + {
1.341 + }
1.342 +
1.343 +
1.344 +/**
1.345 +* Function Name : doTestStepL
1.346 +* Input parameters : None
1.347 +* Output parameters : TVerdict
1.348 +* Description : This function returns whether the test case 027_04 has
1.349 +* passed or failed
1.350 +
1.351 +*/
1.352 +
1.353 +
1.354 +TVerdict CFloggerTest027_04::doTestStepL( )
1.355 + {
1.356 + INFO_PRINTF1(_L("Step 027.04 called "));
1.357 + if ( executeStepL() == KErrNone )
1.358 + SetTestStepResult(EPass);
1.359 +
1.360 + else
1.361 + SetTestStepResult(EFail);
1.362 +
1.363 +
1.364 + return TestStepResult();
1.365 + }
1.366 +
1.367 +
1.368 +/**
1.369 +* Function Name : executeStepL
1.370 +* Input parameters : None
1.371 +* Output parameters : TInt
1.372 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.373 +
1.374 +*/
1.375 +
1.376 +
1.377 +TInt CFloggerTest027_04::executeStepL(TBool)
1.378 + {
1.379 + return KErrGeneral;
1.380 + }
1.381 +/**
1.382 +* Function Name : executeStepL
1.383 +* Input parameters : None
1.384 +* Output parameters : TInt
1.385 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.386 +
1.387 +*/
1.388 +
1.389 +
1.390 +TInt CFloggerTest027_04::executeStepL()
1.391 + {
1.392 + TInt ret = KErrNone;
1.393 + ret = DoTestWrite();
1.394 + if ( ret == KErrNone)
1.395 + {
1.396 + TRAPD(r, ret = DoTestCheckWriteL());
1.397 + if ( r != KErrNone)
1.398 + ret = r;
1.399 + }
1.400 + return ret;
1.401 + }
1.402 +
1.403 +
1.404 +TInt CFloggerTest027_04::DoTestWrite()
1.405 + {
1.406 + _LIT8(KTestMessage,"TC 27_04: The is Test for macros");
1.407 + TPtrC8 ptrSubSystem;
1.408 + TPtrC8 ptrComponent;
1.409 + ptrSubSystem.Set(_L8("SubSystem"));
1.410 + ptrComponent.Set(_L8("Component"));
1.411 + __FLOG_DECLARATION_MEMBER;
1.412 + __FLOG_OPEN(ptrSubSystem, ptrComponent);
1.413 + __FLOG_CLEAR;
1.414 + __FLOG_0(KTestMessage);
1.415 + __FLOG_CLOSE;
1.416 + return KErrNone;
1.417 + }
1.418 +
1.419 +
1.420 +/**
1.421 +* Function Name : DoTestCheckWriteL
1.422 +* Input parameters : None
1.423 +* Output parameters : TInt
1.424 +* Description : This function checks whether test data was written
1.425 + in to the log file or not.
1.426 +
1.427 +*/
1.428 +
1.429 +
1.430 +TInt CFloggerTest027_04::DoTestCheckWriteL()
1.431 + {
1.432 + User::After(KTimeToLog);
1.433 + RFile theFile;
1.434 + HBufC8 * hBuffer;
1.435 + TInt listfilesize;
1.436 + TInt returnCode;
1.437 + RFs fileSystem; //For file operation create a file system
1.438 + _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
1.439 +
1.440 + _LIT8(KTestMessage,"TC 27_04: The is Test for macros");
1.441 +
1.442 + User::LeaveIfError(fileSystem.Connect());
1.443 +
1.444 + //Open the file in the read mode
1.445 + User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
1.446 +
1.447 + CleanupClosePushL(theFile);
1.448 +
1.449 + User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
1.450 + hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1.451 + CleanupStack::PushL(hBuffer);
1.452 + TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
1.453 +
1.454 + // Read from position 0: start of file
1.455 + returnCode = theFile.Read(ptrString);
1.456 +
1.457 + returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
1.458 + //from the file
1.459 + CleanupStack::PopAndDestroy(hBuffer);
1.460 + CleanupStack::PopAndDestroy(); // For theFile object
1.461 + if (returnCode > 0)
1.462 + return KErrNone;
1.463 + else
1.464 + return KErrGeneral;
1.465 + }
1.466 +
1.467 +
1.468 +
1.469 +/**
1.470 +* Function Name : CFloggerTest027_05
1.471 +* Input parameters : None
1.472 +* Output parameters : None
1.473 +* Description : This is the constructor
1.474 +*/
1.475 +
1.476 +
1.477 +CFloggerTest027_05::CFloggerTest027_05()
1.478 + {
1.479 + // Store the name of this test case
1.480 + SetTestStepName(_L("step_027_05"));
1.481 + }
1.482 +
1.483 +
1.484 +/**
1.485 +* Function Name :~ CFloggerTest027_05
1.486 +* Input parameters : None
1.487 +* Output parameters : None
1.488 +* Description : This is the Destructor
1.489 +*/
1.490 +
1.491 +
1.492 +CFloggerTest027_05::~CFloggerTest027_05()
1.493 + {
1.494 + }
1.495 +
1.496 +
1.497 +/**
1.498 +* Function Name : doTestStepL
1.499 +* Input parameters : None
1.500 +* Output parameters : TVerdict
1.501 +* Description : This function returns whether the test case 027_05 has
1.502 +* passed or failed
1.503 +
1.504 +*/
1.505 +
1.506 +
1.507 +TVerdict CFloggerTest027_05::doTestStepL( )
1.508 + {
1.509 + INFO_PRINTF1(_L("Step 027.05 called "));
1.510 + if ( executeStepL() == KErrNone )
1.511 + SetTestStepResult(EPass);
1.512 +
1.513 + else
1.514 + SetTestStepResult(EFail);
1.515 +
1.516 +
1.517 + return TestStepResult();
1.518 + }
1.519 +/**
1.520 +* Function Name : executeStepL
1.521 +* Input parameters : None
1.522 +* Output parameters : TInt
1.523 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.524 +
1.525 +*/
1.526 +
1.527 +
1.528 +TInt CFloggerTest027_05::executeStepL(TBool)
1.529 + {
1.530 + return KErrGeneral;
1.531 + }
1.532 +
1.533 +/**
1.534 +* Function Name : executeStepL
1.535 +* Input parameters : None
1.536 +* Output parameters : TInt
1.537 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.538 +
1.539 +*/
1.540 +
1.541 +
1.542 +TInt CFloggerTest027_05::executeStepL()
1.543 + {
1.544 + TInt ret = KErrNone;
1.545 + ret = DoTestWrite();
1.546 + if ( ret == KErrNone)
1.547 + {
1.548 + TRAPD(r, ret = DoTestCheckWriteL());
1.549 + if ( r != KErrNone)
1.550 + ret = r;
1.551 + }
1.552 + return ret;
1.553 + }
1.554 +
1.555 +
1.556 +TInt CFloggerTest027_05::DoTestWrite()
1.557 + {
1.558 + _LIT8(KTestMessageOne,"TC 27_05: The value of test integer variable :%d");
1.559 + TPtrC8 ptrSubSystem;
1.560 + TPtrC8 ptrComponent;
1.561 + ptrSubSystem.Set(_L8("SubSystem"));
1.562 + ptrComponent.Set(_L8("Component"));
1.563 + __FLOG_DECLARATION_MEMBER;
1.564 + __FLOG_OPEN(ptrSubSystem, ptrComponent);
1.565 + __FLOG_CLEAR;
1.566 + __FLOG_1(KTestMessageOne, 100);
1.567 + __FLOG_CLOSE;
1.568 + return KErrNone;
1.569 + }
1.570 +
1.571 +
1.572 +/**
1.573 +* Function Name : DoTestCheckWriteL
1.574 +* Input parameters : None
1.575 +* Output parameters : TInt
1.576 +* Description : This function checks whether test data was written
1.577 + in to the log file or not.
1.578 +
1.579 +*/
1.580 +
1.581 +
1.582 +TInt CFloggerTest027_05::DoTestCheckWriteL()
1.583 + {
1.584 + User::After(KTimeToLog);
1.585 + RFile theFile;
1.586 + HBufC8 * hBuffer;
1.587 + TInt listfilesize;
1.588 + TInt returnCode;
1.589 + RFs fileSystem; //For file operation create a file system
1.590 + _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
1.591 +
1.592 + TBuf8<256> testData; //To hold the test descriptor
1.593 +
1.594 + _LIT8(KTestMessageOne,"TC 27_05: The value of test integer variable :%d");
1.595 + testData.Format(KTestMessageOne,100);
1.596 +
1.597 + User::LeaveIfError(fileSystem.Connect());
1.598 +
1.599 + //Open the file in the read mode
1.600 + User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
1.601 +
1.602 + CleanupClosePushL(theFile);
1.603 +
1.604 + User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
1.605 + hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1.606 + CleanupStack::PushL(hBuffer);
1.607 + TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
1.608 +
1.609 + // Read from position 0: start of file
1.610 + returnCode = theFile.Read(ptrString);
1.611 + if (returnCode == KErrNone)
1.612 + returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
1.613 + //from the file
1.614 +
1.615 + CleanupStack::PopAndDestroy(hBuffer);
1.616 + CleanupStack::PopAndDestroy(); // For theFile object
1.617 + if (returnCode > 0)
1.618 + return KErrNone;
1.619 + else
1.620 + return KErrGeneral;
1.621 + }
1.622 +
1.623 +
1.624 +
1.625 +/**
1.626 +* Function Name : CFloggerTest027_06
1.627 +* Input parameters : None
1.628 +* Output parameters : None
1.629 +* Description : This is the constructor
1.630 +*/
1.631 +
1.632 +
1.633 +CFloggerTest027_06::CFloggerTest027_06()
1.634 + {
1.635 + // Store the name of this test case
1.636 + SetTestStepName(_L("step_027_06"));
1.637 + }
1.638 +
1.639 +
1.640 +/**
1.641 +* Function Name :~ CFloggerTest027_06
1.642 +* Input parameters : None
1.643 +* Output parameters : None
1.644 +* Description : This is the Destructor
1.645 +*/
1.646 +
1.647 +
1.648 +CFloggerTest027_06::~CFloggerTest027_06()
1.649 + {
1.650 + }
1.651 +
1.652 +
1.653 +/**
1.654 +* Function Name : doTestStepL
1.655 +* Input parameters : None
1.656 +* Output parameters : TVerdict
1.657 +* Description : This function returns whether the test case 027_06 has
1.658 +* passed or failed
1.659 +
1.660 +*/
1.661 +
1.662 +
1.663 +TVerdict CFloggerTest027_06::doTestStepL( )
1.664 + {
1.665 + INFO_PRINTF1(_L("Step 027.06 called "));
1.666 + if ( executeStepL() == KErrNone )
1.667 + SetTestStepResult(EPass);
1.668 +
1.669 + else
1.670 + SetTestStepResult(EFail);
1.671 +
1.672 +
1.673 + return TestStepResult();
1.674 + }
1.675 +
1.676 +
1.677 +/**
1.678 +* Function Name : executeStepL
1.679 +* Input parameters : None
1.680 +* Output parameters : TInt
1.681 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.682 +
1.683 +*/
1.684 +
1.685 +
1.686 +TInt CFloggerTest027_06::executeStepL()
1.687 + {
1.688 + TInt ret = KErrNone;
1.689 + ret = DoTestWrite();
1.690 + if ( ret == KErrNone)
1.691 + {
1.692 + TRAPD(r, ret = DoTestCheckWriteL());
1.693 + if ( r != KErrNone)
1.694 + ret = r;
1.695 + }
1.696 + return ret;
1.697 + }
1.698 +
1.699 +/**
1.700 +* Function Name : executeStepL
1.701 +* Input parameters : None
1.702 +* Output parameters : TInt
1.703 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.704 +
1.705 +*/
1.706 +
1.707 +
1.708 +TInt CFloggerTest027_06::executeStepL(TBool)
1.709 + {
1.710 + return KErrGeneral;
1.711 + }
1.712 +
1.713 +TInt CFloggerTest027_06::DoTestWrite()
1.714 + {
1.715 + TPtrC8 ptrSubSystem;
1.716 + TPtrC8 ptrComponent;
1.717 + ptrSubSystem.Set(_L8("SubSystem"));
1.718 + ptrComponent.Set(_L8("Component"));
1.719 + _LIT8(descTxt,"TC 27_6:Test Msg");
1.720 +
1.721 + __FLOG_DECLARATION_MEMBER;
1.722 + __FLOG_OPEN(ptrSubSystem, ptrComponent);
1.723 + __FLOG_CLEAR;
1.724 + __FLOG_HEXDUMP ( (descTxt) );
1.725 + __FLOG_CLOSE;
1.726 + return KErrNone;
1.727 + }
1.728 +
1.729 +
1.730 +/**
1.731 +* Function Name : DoTestCheckWriteL
1.732 +* Input parameters : None
1.733 +* Output parameters : TInt
1.734 +* Description : This function checks whether test data was written
1.735 + in to the log file or not.
1.736 +
1.737 +*/
1.738 +
1.739 +
1.740 +TInt CFloggerTest027_06::DoTestCheckWriteL()
1.741 + {
1.742 + User::After(KTimeToLog);
1.743 + RFile theFile;
1.744 + HBufC8 * hBuffer;
1.745 + TInt listfilesize;
1.746 + TInt returnCode;
1.747 + RFs fileSystem; //For file operation create a file system
1.748 + _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
1.749 +
1.750 + _LIT8(KBodyTxt,"TC 27_6:Test Msg");// Test body descriptor
1.751 +
1.752 + User::LeaveIfError(fileSystem.Connect());
1.753 +
1.754 + //Open the file in the read mode
1.755 + User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
1.756 +
1.757 + CleanupClosePushL(theFile);
1.758 +
1.759 + User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
1.760 + hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1.761 + CleanupStack::PushL(hBuffer);
1.762 + TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
1.763 +
1.764 + // Read from position 0: start of file
1.765 + returnCode = theFile.Read(ptrString);
1.766 + if (returnCode == KErrNone)
1.767 + returnCode = ptrString.Find(KBodyTxt);
1.768 +
1.769 + CleanupStack::PopAndDestroy(hBuffer);
1.770 + CleanupStack::PopAndDestroy(); //theFile
1.771 + if (returnCode > 0)
1.772 + return KErrNone;
1.773 + else
1.774 + return KErrGeneral;
1.775 + }
1.776 +
1.777 +
1.778 +
1.779 +/**
1.780 +* Function Name : CFloggerTest027_07
1.781 +* Input parameters : None
1.782 +* Output parameters : None
1.783 +* Description : This is the constructor
1.784 +*/
1.785 +
1.786 +
1.787 +CFloggerTest027_07::CFloggerTest027_07()
1.788 + {
1.789 + // Store the name of this test case
1.790 + SetTestStepName(_L("step_027_07"));
1.791 + }
1.792 +
1.793 +
1.794 +/**
1.795 +* Function Name :~ CFloggerTest027_07
1.796 +* Input parameters : None
1.797 +* Output parameters : None
1.798 +* Description : This is the Destructor
1.799 +*/
1.800 +
1.801 +
1.802 +CFloggerTest027_07::~CFloggerTest027_07()
1.803 + {
1.804 + }
1.805 +
1.806 +
1.807 +/**
1.808 +* Function Name : doTestStepL
1.809 +* Input parameters : None
1.810 +* Output parameters : TVerdict
1.811 +* Description : This function returns whether the test case 027_07 has
1.812 +* passed or failed
1.813 +
1.814 +*/
1.815 +
1.816 +
1.817 +TVerdict CFloggerTest027_07::doTestStepL( )
1.818 + {
1.819 + INFO_PRINTF1(_L("Step 027.07 called "));
1.820 + if ( executeStepL() == KErrNone )
1.821 + SetTestStepResult(EPass);
1.822 +
1.823 + else
1.824 + SetTestStepResult(EFail);
1.825 +
1.826 +
1.827 + return TestStepResult();
1.828 + }
1.829 +
1.830 +
1.831 +/**
1.832 +* Function Name : executeStepL
1.833 +* Input parameters : None
1.834 +* Output parameters : TInt
1.835 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.836 +
1.837 +*/
1.838 +
1.839 +
1.840 +TInt CFloggerTest027_07::executeStepL()
1.841 + {
1.842 + TInt ret = KErrNone;
1.843 + ret = DoTestWrite();
1.844 + if ( ret == KErrNone)
1.845 + {
1.846 + TRAPD(r, ret = DoTestCheckWriteL());
1.847 + if ( r != KErrNone)
1.848 + ret = r;
1.849 + }
1.850 + return ret;
1.851 + }
1.852 +/**
1.853 +* Function Name : executeStepL
1.854 +* Input parameters : None
1.855 +* Output parameters : TInt
1.856 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.857 +
1.858 +*/
1.859 +
1.860 +
1.861 +TInt CFloggerTest027_07::executeStepL(TBool)
1.862 + {
1.863 + return KErrGeneral;
1.864 + }
1.865 +
1.866 +TInt CFloggerTest027_07::DoTestWrite()
1.867 + {
1.868 + TPtrC8 ptrSubSystem;
1.869 + TPtrC8 ptrComponent;
1.870 + ptrSubSystem.Set(_L8("SubSystem"));
1.871 + ptrComponent.Set(_L8("Component"));
1.872 + __FLOG_DECLARATION_MEMBER;
1.873 + __FLOG_OPEN(ptrSubSystem, ptrComponent);
1.874 + __FLOG_CLEAR;
1.875 + _LIT8(KTestMessage ,"TC no 27.7: This is test message");
1.876 + __FLOG_BINARY(KTestMessage); //Write 8 bit test descriptor
1.877 + __FLOG_CLOSE;
1.878 + return KErrNone;
1.879 + }
1.880 +
1.881 +
1.882 +/**
1.883 +* Function Name : DoTestCheckWriteL
1.884 +* Input parameters : None
1.885 +* Output parameters : TInt
1.886 +* Description : This function checks whether test data was written
1.887 + in to the log file or not.
1.888 +
1.889 +*/
1.890 +
1.891 +
1.892 +TInt CFloggerTest027_07::DoTestCheckWriteL()
1.893 + {
1.894 + User::After(KTimeToLog);
1.895 + RFile theFile;
1.896 + HBufC8 * hBuffer;
1.897 + TInt listfilesize;
1.898 + TInt returnCode;
1.899 + RFs fileSystem; //For file operation create a file system
1.900 + _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
1.901 +
1.902 + _LIT8(KTestMessage ,"TC no 27.7: This is test message");
1.903 +
1.904 + User::LeaveIfError(fileSystem.Connect());
1.905 +
1.906 + //Open the file in the read mode
1.907 + User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
1.908 +
1.909 + CleanupClosePushL(theFile);
1.910 +
1.911 + User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
1.912 + hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1.913 + CleanupStack::PushL(hBuffer);
1.914 + TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
1.915 +
1.916 + // Read from position 0: start of file
1.917 + returnCode = theFile.Read(ptrString);
1.918 +
1.919 + returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
1.920 + //from the file
1.921 +
1.922 + CleanupStack::PopAndDestroy(hBuffer);
1.923 + CleanupStack::PopAndDestroy(); // For theFile object
1.924 + if (returnCode > 0)
1.925 + return KErrNone;
1.926 + else
1.927 + return KErrGeneral;
1.928 + }
1.929 +
1.930 +
1.931 +
1.932 +
1.933 +/**
1.934 +* Function Name : CFloggerTest027_08
1.935 +* Input parameters : None
1.936 +* Output parameters : None
1.937 +* Description : This is the constructor
1.938 +*/
1.939 +
1.940 +
1.941 +CFloggerTest027_08::CFloggerTest027_08()
1.942 + {
1.943 + // Store the name of this test case
1.944 + SetTestStepName(_L("step_027_08"));
1.945 + }
1.946 +
1.947 +
1.948 +/**
1.949 +* Function Name :~ CFloggerTest027_08
1.950 +* Input parameters : None
1.951 +* Output parameters : None
1.952 +* Description : This is the Destructor
1.953 +*/
1.954 +
1.955 +
1.956 +CFloggerTest027_08::~CFloggerTest027_08()
1.957 + {
1.958 + }
1.959 +
1.960 +
1.961 +/**
1.962 +* Function Name : doTestStepL
1.963 +* Input parameters : None
1.964 +* Output parameters : TVerdict
1.965 +* Description : This function returns whether the test case 027_07 has
1.966 +* passed or failed
1.967 +
1.968 +*/
1.969 +
1.970 +
1.971 +TVerdict CFloggerTest027_08::doTestStepL( )
1.972 + {
1.973 + INFO_PRINTF1(_L("Step 027.08 called "));
1.974 + if ( executeStepL() == KErrNone )
1.975 + SetTestStepResult(EPass);
1.976 +
1.977 + else
1.978 + SetTestStepResult(EFail);
1.979 +
1.980 +
1.981 + return TestStepResult();
1.982 + }
1.983 +
1.984 +/**
1.985 +* Function Name : executeStepL
1.986 +* Input parameters : None
1.987 +* Output parameters : TInt
1.988 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.989 +*/
1.990 +
1.991 +
1.992 +TInt CFloggerTest027_08::executeStepL(TBool)
1.993 + {
1.994 + return KErrGeneral;
1.995 + }
1.996 +
1.997 +/**
1.998 +* Function Name : executeStepL
1.999 +* Input parameters : None
1.1000 +* Output parameters : TInt
1.1001 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.1002 +*/
1.1003 +
1.1004 +
1.1005 +TInt CFloggerTest027_08::executeStepL()
1.1006 + {
1.1007 + TInt ret = KErrNone;
1.1008 + ret = DoTestWrite();
1.1009 + if ( ret == KErrNone)
1.1010 + {
1.1011 + TRAPD(r, ret = DoTestCheckWriteL());
1.1012 + if ( r != KErrNone)
1.1013 + ret = r;
1.1014 + }
1.1015 + return ret;
1.1016 + }
1.1017 +
1.1018 +
1.1019 +TInt CFloggerTest027_08::DoTestWrite()
1.1020 + {
1.1021 + _LIT8(ptrSubSystem,"SubSystem");
1.1022 + _LIT8(ptrComponent,"Component");
1.1023 + _LIT8(KTestMessage ,"TC no 27.8: This is test message");
1.1024 + __FLOG_STATIC0(ptrSubSystem, ptrComponent, KTestMessage);
1.1025 + return KErrNone;
1.1026 + }
1.1027 +
1.1028 +
1.1029 +/**
1.1030 +* Function Name : DoTestCheckWriteL
1.1031 +* Input parameters : None
1.1032 +* Output parameters : TInt
1.1033 +* Description : This function checks whether test data was written
1.1034 + in to the log file or not.
1.1035 +
1.1036 +*/
1.1037 +
1.1038 +
1.1039 +TInt CFloggerTest027_08::DoTestCheckWriteL()
1.1040 + {
1.1041 + User::After(KTimeToLog);
1.1042 + RFile theFile;
1.1043 + HBufC8 * hBuffer;
1.1044 + TInt listfilesize;
1.1045 + TInt returnCode;
1.1046 + RFs fileSystem; //For file operation create a file system
1.1047 + _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
1.1048 +
1.1049 + _LIT8(KTestMessage ,"TC no 27.8: This is test message");
1.1050 +
1.1051 + User::LeaveIfError(fileSystem.Connect());
1.1052 +
1.1053 + //Open the file in the read mode
1.1054 + User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
1.1055 +
1.1056 + CleanupClosePushL(theFile);
1.1057 +
1.1058 + User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
1.1059 + hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1.1060 + CleanupStack::PushL(hBuffer);
1.1061 + TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
1.1062 +
1.1063 + // Read from position 0: start of file
1.1064 + returnCode = theFile.Read(ptrString);
1.1065 +
1.1066 + returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
1.1067 + //from the file
1.1068 +
1.1069 + CleanupStack::PopAndDestroy(hBuffer);
1.1070 + CleanupStack::PopAndDestroy(); // For theFile object
1.1071 + if (returnCode > 0)
1.1072 + return KErrNone;
1.1073 + else
1.1074 + return KErrGeneral;
1.1075 + }
1.1076 +
1.1077 +
1.1078 +
1.1079 +
1.1080 +/**
1.1081 +* Function Name : CFloggerTest027_09
1.1082 +* Input parameters : None
1.1083 +* Output parameters : None
1.1084 +* Description : This is the constructor
1.1085 +*/
1.1086 +
1.1087 +
1.1088 +CFloggerTest027_09::CFloggerTest027_09()
1.1089 + {
1.1090 + // Store the name of this test case
1.1091 + SetTestStepName(_L("step_027_09"));
1.1092 + }
1.1093 +
1.1094 +
1.1095 +/**
1.1096 +* Function Name :~ CFloggerTest027_09
1.1097 +* Input parameters : None
1.1098 +* Output parameters : None
1.1099 +* Description : This is the Destructor
1.1100 +*/
1.1101 +
1.1102 +
1.1103 +CFloggerTest027_09::~CFloggerTest027_09()
1.1104 + {
1.1105 + }
1.1106 +
1.1107 +
1.1108 +/**
1.1109 +* Function Name : doTestStepL
1.1110 +* Input parameters : None
1.1111 +* Output parameters : TVerdict
1.1112 +* Description : This function returns whether the test case 027_09 has
1.1113 +* passed or failed
1.1114 +
1.1115 +*/
1.1116 +
1.1117 +
1.1118 +TVerdict CFloggerTest027_09::doTestStepL( )
1.1119 + {
1.1120 + INFO_PRINTF1(_L("Step 027.09 called "));
1.1121 + if ( executeStepL() == KErrNone )
1.1122 + SetTestStepResult(EPass);
1.1123 +
1.1124 + else
1.1125 + SetTestStepResult(EFail);
1.1126 +
1.1127 +
1.1128 + return TestStepResult();
1.1129 + }
1.1130 +/**
1.1131 +* Function Name : executeStepL
1.1132 +* Input parameters : None
1.1133 +* Output parameters : TInt
1.1134 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.1135 +
1.1136 +*/
1.1137 +
1.1138 +
1.1139 +TInt CFloggerTest027_09::executeStepL(TBool)
1.1140 + {
1.1141 + return KErrGeneral;
1.1142 + }
1.1143 +
1.1144 +/**
1.1145 +* Function Name : executeStepL
1.1146 +* Input parameters : None
1.1147 +* Output parameters : TInt
1.1148 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.1149 +
1.1150 +*/
1.1151 +
1.1152 +
1.1153 +TInt CFloggerTest027_09::executeStepL()
1.1154 + {
1.1155 + TInt ret = KErrNone;
1.1156 + ret = DoTestWrite();
1.1157 + if ( ret == KErrNone)
1.1158 + {
1.1159 + TRAPD(r, ret = DoTestCheckWriteL());
1.1160 + if ( r != KErrNone)
1.1161 + ret = r;
1.1162 + }
1.1163 + return ret;
1.1164 + }
1.1165 +
1.1166 +
1.1167 +TInt CFloggerTest027_09::DoTestWrite()
1.1168 + {
1.1169 + _LIT8(ptrSubSystem,"SubSystem");
1.1170 + _LIT8(ptrComponent,"Component");
1.1171 + _LIT8(KTestMessageOne,"TEST 27.09: The value of test integer variable :%d");
1.1172 + __FLOG_STATIC1(ptrSubSystem, ptrComponent, KTestMessageOne, 100);
1.1173 + return KErrNone;
1.1174 + }
1.1175 +
1.1176 +
1.1177 +/**
1.1178 +* Function Name : DoTestCheckWriteL
1.1179 +* Input parameters : None
1.1180 +* Output parameters : TInt
1.1181 +* Description : This function checks whether test data was written
1.1182 + in to the log file or not.
1.1183 +
1.1184 +*/
1.1185 +
1.1186 +
1.1187 +TInt CFloggerTest027_09::DoTestCheckWriteL()
1.1188 + {
1.1189 + User::After(KTimeToLog);
1.1190 + RFile theFile;
1.1191 + HBufC8 * hBuffer;
1.1192 + TInt listfilesize;
1.1193 + TInt returnCode;
1.1194 + RFs fileSystem; //For file operation create a file system
1.1195 + _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
1.1196 +
1.1197 + TBuf8<256> testData; //To hold the test descriptor
1.1198 +
1.1199 + _LIT8(KTestMessageOne,"TEST 27.09: The value of test integer variable :%d");
1.1200 + testData.Format(KTestMessageOne,100);
1.1201 +
1.1202 + User::LeaveIfError(fileSystem.Connect());
1.1203 +
1.1204 + //Open the file in the read mode
1.1205 + User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
1.1206 +
1.1207 + CleanupClosePushL(theFile);
1.1208 +
1.1209 + User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
1.1210 + hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1.1211 + CleanupStack::PushL(hBuffer);
1.1212 + TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
1.1213 +
1.1214 + // Read from position 0: start of file
1.1215 + returnCode = theFile.Read(ptrString);
1.1216 +
1.1217 + returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
1.1218 + //from the file
1.1219 +
1.1220 + CleanupStack::PopAndDestroy(hBuffer);
1.1221 + CleanupStack::PopAndDestroy(); // For theFile object
1.1222 + if (returnCode > 0)
1.1223 + return KErrNone;
1.1224 + else
1.1225 + return KErrGeneral;
1.1226 + }
1.1227 +
1.1228 +
1.1229 +
1.1230 +
1.1231 +/**
1.1232 +* Function Name : CFloggerTest027_10
1.1233 +* Input parameters : None
1.1234 +* Output parameters : None
1.1235 +* Description : This is the constructor
1.1236 +*/
1.1237 +
1.1238 +
1.1239 +CFloggerTest027_10::CFloggerTest027_10()
1.1240 + {
1.1241 + // Store the name of this test case
1.1242 + SetTestStepName(_L("step_027_10"));
1.1243 + }
1.1244 +
1.1245 +
1.1246 +/**
1.1247 +* Function Name :~ CFloggerTest027_10
1.1248 +* Input parameters : None
1.1249 +* Output parameters : None
1.1250 +* Description : This is the Destructor
1.1251 +*/
1.1252 +
1.1253 +
1.1254 +CFloggerTest027_10::~CFloggerTest027_10()
1.1255 + {
1.1256 + }
1.1257 +
1.1258 +
1.1259 +/**
1.1260 +* Function Name : doTestStepL
1.1261 +* Input parameters : None
1.1262 +* Output parameters : TVerdict
1.1263 +* Description : This function returns whether the test case 027_10 has
1.1264 +* passed or failed
1.1265 +
1.1266 +*/
1.1267 +
1.1268 +
1.1269 +TVerdict CFloggerTest027_10::doTestStepL( )
1.1270 + {
1.1271 + INFO_PRINTF1(_L("Step 027.10 called "));
1.1272 + if ( executeStepL() == KErrNone )
1.1273 + SetTestStepResult(EPass);
1.1274 +
1.1275 + else
1.1276 + SetTestStepResult(EFail);
1.1277 +
1.1278 +
1.1279 + return TestStepResult();
1.1280 + }
1.1281 +
1.1282 +/**
1.1283 +* Function Name : executeStepL
1.1284 +* Input parameters : None
1.1285 +* Output parameters : TInt
1.1286 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.1287 +
1.1288 +*/
1.1289 +
1.1290 +
1.1291 +TInt CFloggerTest027_10::executeStepL(TBool)
1.1292 + {
1.1293 + return KErrGeneral;
1.1294 + }
1.1295 +/**
1.1296 +* Function Name : executeStepL
1.1297 +* Input parameters : None
1.1298 +* Output parameters : TInt
1.1299 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.1300 +
1.1301 +*/
1.1302 +
1.1303 +
1.1304 +TInt CFloggerTest027_10::executeStepL()
1.1305 + {
1.1306 + TInt ret = KErrNone;
1.1307 + ret = DoTestWrite();
1.1308 + if ( ret == KErrNone)
1.1309 + {
1.1310 + TRAPD(r, ret = DoTestCheckWriteL());
1.1311 + if ( r != KErrNone)
1.1312 + ret = r;
1.1313 + }
1.1314 + return ret;
1.1315 + }
1.1316 +
1.1317 +
1.1318 +TInt CFloggerTest027_10::DoTestWrite()
1.1319 + {
1.1320 + _LIT8(ptrSubSystem,"SubSystem");
1.1321 + _LIT8(ptrComponent,"Component");
1.1322 + _LIT8(KTestMessage ,"TC no 27.10: This is test message");
1.1323 + __FLOG_STATIC(ptrSubSystem, ptrComponent, KTestMessage);
1.1324 + return KErrNone;
1.1325 + }
1.1326 +
1.1327 +
1.1328 +/**
1.1329 +* Function Name : DoTestCheckWriteL
1.1330 +* Input parameters : None
1.1331 +* Output parameters : TInt
1.1332 +* Description : This function checks whether test data was written
1.1333 + in to the log file or not..
1.1334 +
1.1335 +*/
1.1336 +
1.1337 +
1.1338 +TInt CFloggerTest027_10::DoTestCheckWriteL()
1.1339 + {
1.1340 + User::After(KTimeToLog);
1.1341 + RFile theFile;
1.1342 + HBufC8 * hBuffer;
1.1343 + TInt listfilesize;
1.1344 + TInt returnCode;
1.1345 + RFs fileSystem; //For file operation create a file system
1.1346 + _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
1.1347 + _LIT8(KTestMessage ,"TC no 27.10: This is test message");
1.1348 +
1.1349 + User::LeaveIfError(fileSystem.Connect());
1.1350 +
1.1351 + //Open the file in the read mode
1.1352 + User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
1.1353 +
1.1354 + CleanupClosePushL(theFile);
1.1355 +
1.1356 + User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
1.1357 + hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1.1358 + CleanupStack::PushL(hBuffer);
1.1359 + TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
1.1360 +
1.1361 + // Read from position 0: start of file
1.1362 + returnCode = theFile.Read(ptrString);
1.1363 +
1.1364 + returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
1.1365 + //from the file
1.1366 +
1.1367 + CleanupStack::PopAndDestroy(hBuffer);
1.1368 + CleanupStack::PopAndDestroy(); // For theFile object
1.1369 + if (returnCode > 0)
1.1370 + return KErrNone;
1.1371 + else
1.1372 + return KErrGeneral;
1.1373 + }
1.1374 +
1.1375 +
1.1376 +
1.1377 +
1.1378 +/**
1.1379 +* Function Name : CFloggerTest027_11
1.1380 +* Input parameters : None
1.1381 +* Output parameters : None
1.1382 +* Description : This is the constructor
1.1383 +*/
1.1384 +
1.1385 +
1.1386 +CFloggerTest027_11::CFloggerTest027_11()
1.1387 + {
1.1388 + // Store the name of this test case
1.1389 + SetTestStepName(_L("step_027_11"));
1.1390 + }
1.1391 +
1.1392 +
1.1393 +/**
1.1394 +* Function Name :~ CFloggerTest027_11
1.1395 +* Input parameters : None
1.1396 +* Output parameters : None
1.1397 +* Description : This is the Destructor
1.1398 +*/
1.1399 +
1.1400 +
1.1401 +CFloggerTest027_11::~CFloggerTest027_11()
1.1402 + {
1.1403 + }
1.1404 +
1.1405 +
1.1406 +/**
1.1407 +* Function Name : doTestStepL
1.1408 +* Input parameters : None
1.1409 +* Output parameters : TVerdict
1.1410 +* Description : This function returns whether the test case 027_11 has
1.1411 +* passed or failed
1.1412 +
1.1413 +*/
1.1414 +
1.1415 +
1.1416 +TVerdict CFloggerTest027_11::doTestStepL( )
1.1417 + {
1.1418 + INFO_PRINTF1(_L("Step 027.11 called "));
1.1419 + if ( executeStepL() == KErrNone )
1.1420 + SetTestStepResult(EPass);
1.1421 +
1.1422 + else
1.1423 + SetTestStepResult(EFail);
1.1424 +
1.1425 +
1.1426 + return TestStepResult();
1.1427 + }
1.1428 +
1.1429 +/**
1.1430 +* Function Name : executeStepL
1.1431 +* Input parameters : None
1.1432 +* Output parameters : TInt
1.1433 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.1434 +
1.1435 +*/
1.1436 +
1.1437 +
1.1438 +TInt CFloggerTest027_11::executeStepL(TBool)
1.1439 + {
1.1440 + return KErrGeneral;
1.1441 + }
1.1442 +
1.1443 +/**
1.1444 +* Function Name : executeStepL
1.1445 +* Input parameters : None
1.1446 +* Output parameters : TInt
1.1447 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.1448 +
1.1449 +*/
1.1450 +
1.1451 +
1.1452 +TInt CFloggerTest027_11::executeStepL()
1.1453 + {
1.1454 + TInt ret = KErrNone;
1.1455 + ret = DoTestWrite();
1.1456 + if ( ret == KErrNone)
1.1457 + {
1.1458 + TRAPD(r, ret = DoTestCheckWriteL());
1.1459 + if ( r != KErrNone)
1.1460 + ret = r;
1.1461 + }
1.1462 + return ret;
1.1463 + }
1.1464 +
1.1465 +
1.1466 +TInt CFloggerTest027_11::DoTestWrite()
1.1467 + {
1.1468 + TPtrC8 ptrSubSystem;
1.1469 + TPtrC8 ptrComponent;
1.1470 + ptrSubSystem.Set(_L8("SubSystem"));
1.1471 + ptrComponent.Set(_L8("Component"));
1.1472 + _LIT8(descTxt,"T 27_11:Test Msg"); //Test body descriptor
1.1473 + __FLOG_STATIC_HEXDUMP((ptrSubSystem, ptrComponent, descTxt));
1.1474 + return KErrNone;
1.1475 + }
1.1476 +
1.1477 +
1.1478 +/**
1.1479 +* Function Name : DoTestCheckWriteL
1.1480 +* Input parameters : None
1.1481 +* Output parameters : TInt
1.1482 +* Description : This function checks whether test data was written
1.1483 + in to the log file or not.
1.1484 +
1.1485 +*/
1.1486 +
1.1487 +
1.1488 +TInt CFloggerTest027_11::DoTestCheckWriteL()
1.1489 + {
1.1490 + User::After(KTimeToLog);
1.1491 + RFile theFile;
1.1492 + HBufC8 * hBuffer;
1.1493 + TInt listfilesize;
1.1494 + TInt returnCode;
1.1495 + RFs fileSystem; //For file operation create a file system
1.1496 + _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
1.1497 + _LIT8(KTestMessage ,"T 27_11:Test Msg");
1.1498 +
1.1499 + User::LeaveIfError(fileSystem.Connect());
1.1500 +
1.1501 + //Open the file in the read mode
1.1502 + User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
1.1503 +
1.1504 + CleanupClosePushL(theFile);
1.1505 +
1.1506 + User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
1.1507 + hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1.1508 + CleanupStack::PushL(hBuffer);
1.1509 + TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
1.1510 +
1.1511 + // Read from position 0: start of file
1.1512 + returnCode = theFile.Read(ptrString);
1.1513 +
1.1514 + returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
1.1515 + //from the file
1.1516 +
1.1517 + CleanupStack::PopAndDestroy(hBuffer);
1.1518 + CleanupStack::PopAndDestroy(); // For theFile object
1.1519 + if (returnCode > 0)
1.1520 + return KErrNone;
1.1521 + else
1.1522 + return KErrGeneral;
1.1523 + }
1.1524 +
1.1525 +
1.1526 +
1.1527 +
1.1528 +/**
1.1529 +* Function Name : CFloggerTest027_12
1.1530 +* Input parameters : None
1.1531 +* Output parameters : None
1.1532 +* Description : This is the constructor
1.1533 +*/
1.1534 +
1.1535 +
1.1536 +CFloggerTest027_12::CFloggerTest027_12()
1.1537 + {
1.1538 + // Store the name of this test case
1.1539 + SetTestStepName(_L("step_027_12"));
1.1540 + }
1.1541 +
1.1542 +
1.1543 +/**
1.1544 +* Function Name :~ CFloggerTest027_12
1.1545 +* Input parameters : None
1.1546 +* Output parameters : None
1.1547 +* Description : This is the Destructor
1.1548 +*/
1.1549 +
1.1550 +
1.1551 +CFloggerTest027_12::~CFloggerTest027_12()
1.1552 + {
1.1553 + }
1.1554 +
1.1555 +
1.1556 +/**
1.1557 +* Function Name : doTestStepL
1.1558 +* Input parameters : None
1.1559 +* Output parameters : TVerdict
1.1560 +* Description : This function returns whether the test case 027_12 has
1.1561 +* passed or failed
1.1562 +
1.1563 +*/
1.1564 +
1.1565 +
1.1566 +TVerdict CFloggerTest027_12::doTestStepL( )
1.1567 + {
1.1568 + INFO_PRINTF1(_L("Step 027.12 called "));
1.1569 + if ( executeStepL() == KErrNone )
1.1570 + SetTestStepResult(EPass);
1.1571 +
1.1572 + else
1.1573 + SetTestStepResult(EFail);
1.1574 +
1.1575 +
1.1576 + return TestStepResult();
1.1577 + }
1.1578 +
1.1579 +/**
1.1580 +* Function Name : executeStepL
1.1581 +* Input parameters : None
1.1582 +* Output parameters : TInt
1.1583 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.1584 +*/
1.1585 +
1.1586 +
1.1587 +TInt CFloggerTest027_12::executeStepL(TBool)
1.1588 + {
1.1589 + return KErrGeneral;
1.1590 + }
1.1591 +
1.1592 +/**
1.1593 +* Function Name : executeStepL
1.1594 +* Input parameters : None
1.1595 +* Output parameters : TInt
1.1596 +* Description : This function calls the flogger write and checks whether the log message is written in to the log file
1.1597 +*/
1.1598 +
1.1599 +
1.1600 +TInt CFloggerTest027_12::executeStepL()
1.1601 + {
1.1602 + TInt ret = KErrNone;
1.1603 + ret = DoTestWrite();
1.1604 + if ( ret == KErrNone)
1.1605 + {
1.1606 + TRAPD(r, ret = DoTestCheckWriteL());
1.1607 + if ( r != KErrNone)
1.1608 + ret = r;
1.1609 + }
1.1610 + return ret;
1.1611 + }
1.1612 +
1.1613 +
1.1614 +TInt CFloggerTest027_12::DoTestWrite()
1.1615 + {
1.1616 + TPtrC8 ptrSubSystem;
1.1617 + TPtrC8 ptrComponent;
1.1618 + ptrSubSystem.Set(_L8("SubSystem"));
1.1619 + ptrComponent.Set(_L8("Component"));
1.1620 + _LIT16(KTestMessageTwo,"TEST 27.12: The value of first test integer variable :%d The value of second test integer variable : %d");
1.1621 + __FLOG_STATIC2(ptrSubSystem, ptrComponent, KTestMessageTwo, 100, 200);
1.1622 + return KErrNone;
1.1623 + }
1.1624 +
1.1625 +
1.1626 +/**
1.1627 +* Function Name : DoTestCheckWriteL
1.1628 +* Input parameters : None
1.1629 +* Output parameters : TInt
1.1630 +* Description : This function checks whether test data was written
1.1631 + in to the log file or not.
1.1632 +
1.1633 +*/
1.1634 +
1.1635 +
1.1636 +TInt CFloggerTest027_12::DoTestCheckWriteL()
1.1637 + {
1.1638 + User::After(KTimeToLog);
1.1639 + RFile theFile;
1.1640 + HBufC8 * hBuffer;
1.1641 + TInt listfilesize;
1.1642 + TInt returnCode;
1.1643 + RFs fileSystem; //For file operation create a file system
1.1644 + _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
1.1645 +
1.1646 + TBuf8<256> testData; //To hold the test descriptor
1.1647 +
1.1648 + _LIT8(KTestMessageTwo,"TEST 27.12: The value of first test integer variable :%d The value of second test integer variable : %d");
1.1649 + testData.Format(KTestMessageTwo,100, 200);
1.1650 +
1.1651 + User::LeaveIfError(fileSystem.Connect());
1.1652 +
1.1653 + //Open the file in the read mode
1.1654 + User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
1.1655 +
1.1656 + CleanupClosePushL(theFile);
1.1657 +
1.1658 + User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
1.1659 + hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
1.1660 + CleanupStack::PushL(hBuffer);
1.1661 + TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
1.1662 +
1.1663 + // Read from position 0: start of file
1.1664 + returnCode = theFile.Read(ptrString);
1.1665 +
1.1666 + returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
1.1667 + //from the file
1.1668 +
1.1669 + CleanupStack::PopAndDestroy(hBuffer);
1.1670 + CleanupStack::PopAndDestroy(); // For theFile object
1.1671 + if (returnCode > 0)
1.1672 + return KErrNone;
1.1673 + else
1.1674 + return KErrGeneral;
1.1675 + }
1.1676 +
1.1677 +