os/persistentdata/traceservices/commsdebugutility/TE_commsdebugutility/src/step_027_xx.cpp
Update contrib.
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // See the test specification for details of what these test cases do.
16 #include "teststepcomsdbg.h"
17 #include "step_027_xx.h"
19 #include <comms-infras/commsdebugutility.h>
23 * Function Name : CFloggerTest027_01
24 * Input parameters : None
25 * Output parameters : None
26 * Description : This is the constructor
30 CFloggerTest027_01::CFloggerTest027_01()
32 // Store the name of this test case
33 SetTestStepName(_L("step_027_01"));
38 * Function Name :~ CFloggerTest027_01
39 * Input parameters : None
40 * Output parameters : None
41 * Description : This is the Destructor
45 CFloggerTest027_01::~CFloggerTest027_01()
51 * Function Name : doTestStepL
52 * Input parameters : None
53 * Output parameters : TVerdict
54 * Description : This function returns whether the test case 027_01 has
60 TVerdict CFloggerTest027_01::doTestStepL( )
62 if ( executeStepL() == KErrNone )
63 SetTestStepResult(EPass);
66 SetTestStepResult(EFail);
70 return TestStepResult();
75 * Function Name : executeStepL
76 * Input parameters : None
77 * Output parameters : TInt
78 * Description : This function calls the Connect twice
83 TInt CFloggerTest027_01::executeStepL(TBool)
88 * Function Name : executeStepL
89 * Input parameters : None
90 * Output parameters : TInt
91 * Description : This function calls the Connect twice
96 TInt CFloggerTest027_01::executeStepL()
101 ret = flogger.Connect();
108 //Call Connect() twice this will cause 2nd one ot return KErrorAlreadyExists and nothing to happen.
109 ret = flogger.Connect();
111 if (ret == KErrAlreadyExists)
122 return KErrBadHandle;
129 * Function Name : CFloggerTest027_02
130 * Input parameters : None
131 * Output parameters : None
132 * Description : This is the constructor
136 CFloggerTest027_02::CFloggerTest027_02()
138 // Store the name of this test case
139 SetTestStepName(_L("step_027_02"));
144 * Function Name :~ CFloggerTest027_02
145 * Input parameters : None
146 * Output parameters : None
147 * Description : This is the Destructor
151 CFloggerTest027_02::~CFloggerTest027_02()
157 * Function Name : doTestStepL
158 * Input parameters : None
159 * Output parameters : TVerdict
160 * Description : This function returns whether the test case 027_02 has
166 TVerdict CFloggerTest027_02::doTestStepL( )
169 INFO_PRINTF1(_L("Step 027.02 called "));
170 TRAPD(res ,executeStepL());
171 if (res == KErrNone )
172 SetTestStepResult(EPass);
175 SetTestStepResult(EFail);
177 INFO_PRINTF1(_L("leaving Step 027.02 "));
178 User::After(KTimeForDisplay);
181 return TestStepResult();
185 * Function Name : executeStepL
186 * Input parameters : None
187 * Output parameters : TInt
188 * Description : This function leaves without calling CleanupStack::PopAndDestroy()
193 TInt CFloggerTest027_02::executeStepL(TBool)
199 * Function Name : executeStepL
200 * Input parameters : None
201 * Output parameters : TInt
202 * Description : This function leaves without calling CleanupStack::PopAndDestroy()
207 TInt CFloggerTest027_02::executeStepL()
212 ptrSubSystem.Set(_L8("SubSystem"));
213 ptrComponent.Set(_L8("Component"));
214 __FLOG_DECLARATION_MEMBER;
215 __FLOG_OPENC(ptrSubSystem, ptrComponent);
223 * Function Name : CFloggerTest027_03
224 * Input parameters : None
225 * Output parameters : None
226 * Description : This is the constructor
230 CFloggerTest027_03::CFloggerTest027_03()
232 // Store the name of this test case
233 SetTestStepName(_L("step_027_03"));
238 * Function Name :~ CFloggerTest027_03
239 * Input parameters : None
240 * Output parameters : None
241 * Description : This is the Destructor
245 CFloggerTest027_03::~CFloggerTest027_03()
251 * Function Name : doTestStepL
252 * Input parameters : None
253 * Output parameters : TVerdict
254 * Description : This function returns whether the test case 027_03 has
260 TVerdict CFloggerTest027_03::doTestStepL( )
262 INFO_PRINTF1(_L("Step 027.03 called "));
263 TRAPD(ret, executeStepL());
264 if (ret == KErrNone )
265 SetTestStepResult(EPass);
268 SetTestStepResult(EFail);
270 INFO_PRINTF1(_L("leaving Step 027.02 "));
271 User::After(KTimeForDisplay);
274 return TestStepResult();
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
287 TInt CFloggerTest027_03::executeStepL()
291 ptrSubSystem.Set(_L8("SubSystem"));
292 ptrComponent.Set(_L8("Component"));
293 __FLOG_DECLARATION_MEMBER;
294 __FLOG_OPENC(ptrSubSystem, ptrComponent);
295 CleanupStack::PopAndDestroy();
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
308 TInt CFloggerTest027_03::executeStepL(TBool)
314 * Function Name : CFloggerTest027_04
315 * Input parameters : None
316 * Output parameters : None
317 * Description : This is the constructor
321 CFloggerTest027_04::CFloggerTest027_04()
323 // Store the name of this test case
324 SetTestStepName(_L("step_027_04"));
329 * Function Name :~ CFloggerTest027_04
330 * Input parameters : None
331 * Output parameters : None
332 * Description : This is the Destructor
336 CFloggerTest027_04::~CFloggerTest027_04()
342 * Function Name : doTestStepL
343 * Input parameters : None
344 * Output parameters : TVerdict
345 * Description : This function returns whether the test case 027_04 has
351 TVerdict CFloggerTest027_04::doTestStepL( )
353 INFO_PRINTF1(_L("Step 027.04 called "));
354 if ( executeStepL() == KErrNone )
355 SetTestStepResult(EPass);
358 SetTestStepResult(EFail);
361 return TestStepResult();
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
374 TInt CFloggerTest027_04::executeStepL(TBool)
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
387 TInt CFloggerTest027_04::executeStepL()
391 if ( ret == KErrNone)
393 TRAPD(r, ret = DoTestCheckWriteL());
401 TInt CFloggerTest027_04::DoTestWrite()
403 _LIT8(KTestMessage,"TC 27_04: The is Test for macros");
406 ptrSubSystem.Set(_L8("SubSystem"));
407 ptrComponent.Set(_L8("Component"));
408 __FLOG_DECLARATION_MEMBER;
409 __FLOG_OPEN(ptrSubSystem, ptrComponent);
411 __FLOG_0(KTestMessage);
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.
427 TInt CFloggerTest027_04::DoTestCheckWriteL()
429 User::After(KTimeToLog);
434 RFs fileSystem; //For file operation create a file system
435 _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
437 _LIT8(KTestMessage,"TC 27_04: The is Test for macros");
439 User::LeaveIfError(fileSystem.Connect());
441 //Open the file in the read mode
442 User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
444 CleanupClosePushL(theFile);
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
451 // Read from position 0: start of file
452 returnCode = theFile.Read(ptrString);
454 returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
456 CleanupStack::PopAndDestroy(hBuffer);
457 CleanupStack::PopAndDestroy(); // For theFile object
467 * Function Name : CFloggerTest027_05
468 * Input parameters : None
469 * Output parameters : None
470 * Description : This is the constructor
474 CFloggerTest027_05::CFloggerTest027_05()
476 // Store the name of this test case
477 SetTestStepName(_L("step_027_05"));
482 * Function Name :~ CFloggerTest027_05
483 * Input parameters : None
484 * Output parameters : None
485 * Description : This is the Destructor
489 CFloggerTest027_05::~CFloggerTest027_05()
495 * Function Name : doTestStepL
496 * Input parameters : None
497 * Output parameters : TVerdict
498 * Description : This function returns whether the test case 027_05 has
504 TVerdict CFloggerTest027_05::doTestStepL( )
506 INFO_PRINTF1(_L("Step 027.05 called "));
507 if ( executeStepL() == KErrNone )
508 SetTestStepResult(EPass);
511 SetTestStepResult(EFail);
514 return TestStepResult();
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
525 TInt CFloggerTest027_05::executeStepL(TBool)
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
539 TInt CFloggerTest027_05::executeStepL()
543 if ( ret == KErrNone)
545 TRAPD(r, ret = DoTestCheckWriteL());
553 TInt CFloggerTest027_05::DoTestWrite()
555 _LIT8(KTestMessageOne,"TC 27_05: The value of test integer variable :%d");
558 ptrSubSystem.Set(_L8("SubSystem"));
559 ptrComponent.Set(_L8("Component"));
560 __FLOG_DECLARATION_MEMBER;
561 __FLOG_OPEN(ptrSubSystem, ptrComponent);
563 __FLOG_1(KTestMessageOne, 100);
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.
579 TInt CFloggerTest027_05::DoTestCheckWriteL()
581 User::After(KTimeToLog);
586 RFs fileSystem; //For file operation create a file system
587 _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
589 TBuf8<256> testData; //To hold the test descriptor
591 _LIT8(KTestMessageOne,"TC 27_05: The value of test integer variable :%d");
592 testData.Format(KTestMessageOne,100);
594 User::LeaveIfError(fileSystem.Connect());
596 //Open the file in the read mode
597 User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
599 CleanupClosePushL(theFile);
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
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
612 CleanupStack::PopAndDestroy(hBuffer);
613 CleanupStack::PopAndDestroy(); // For theFile object
623 * Function Name : CFloggerTest027_06
624 * Input parameters : None
625 * Output parameters : None
626 * Description : This is the constructor
630 CFloggerTest027_06::CFloggerTest027_06()
632 // Store the name of this test case
633 SetTestStepName(_L("step_027_06"));
638 * Function Name :~ CFloggerTest027_06
639 * Input parameters : None
640 * Output parameters : None
641 * Description : This is the Destructor
645 CFloggerTest027_06::~CFloggerTest027_06()
651 * Function Name : doTestStepL
652 * Input parameters : None
653 * Output parameters : TVerdict
654 * Description : This function returns whether the test case 027_06 has
660 TVerdict CFloggerTest027_06::doTestStepL( )
662 INFO_PRINTF1(_L("Step 027.06 called "));
663 if ( executeStepL() == KErrNone )
664 SetTestStepResult(EPass);
667 SetTestStepResult(EFail);
670 return TestStepResult();
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
683 TInt CFloggerTest027_06::executeStepL()
687 if ( ret == KErrNone)
689 TRAPD(r, ret = DoTestCheckWriteL());
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
705 TInt CFloggerTest027_06::executeStepL(TBool)
710 TInt CFloggerTest027_06::DoTestWrite()
714 ptrSubSystem.Set(_L8("SubSystem"));
715 ptrComponent.Set(_L8("Component"));
716 _LIT8(descTxt,"TC 27_6:Test Msg");
718 __FLOG_DECLARATION_MEMBER;
719 __FLOG_OPEN(ptrSubSystem, ptrComponent);
721 __FLOG_HEXDUMP ( (descTxt) );
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.
737 TInt CFloggerTest027_06::DoTestCheckWriteL()
739 User::After(KTimeToLog);
744 RFs fileSystem; //For file operation create a file system
745 _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
747 _LIT8(KBodyTxt,"TC 27_6:Test Msg");// Test body descriptor
749 User::LeaveIfError(fileSystem.Connect());
751 //Open the file in the read mode
752 User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
754 CleanupClosePushL(theFile);
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
761 // Read from position 0: start of file
762 returnCode = theFile.Read(ptrString);
763 if (returnCode == KErrNone)
764 returnCode = ptrString.Find(KBodyTxt);
766 CleanupStack::PopAndDestroy(hBuffer);
767 CleanupStack::PopAndDestroy(); //theFile
777 * Function Name : CFloggerTest027_07
778 * Input parameters : None
779 * Output parameters : None
780 * Description : This is the constructor
784 CFloggerTest027_07::CFloggerTest027_07()
786 // Store the name of this test case
787 SetTestStepName(_L("step_027_07"));
792 * Function Name :~ CFloggerTest027_07
793 * Input parameters : None
794 * Output parameters : None
795 * Description : This is the Destructor
799 CFloggerTest027_07::~CFloggerTest027_07()
805 * Function Name : doTestStepL
806 * Input parameters : None
807 * Output parameters : TVerdict
808 * Description : This function returns whether the test case 027_07 has
814 TVerdict CFloggerTest027_07::doTestStepL( )
816 INFO_PRINTF1(_L("Step 027.07 called "));
817 if ( executeStepL() == KErrNone )
818 SetTestStepResult(EPass);
821 SetTestStepResult(EFail);
824 return TestStepResult();
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
837 TInt CFloggerTest027_07::executeStepL()
841 if ( ret == KErrNone)
843 TRAPD(r, ret = DoTestCheckWriteL());
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
858 TInt CFloggerTest027_07::executeStepL(TBool)
863 TInt CFloggerTest027_07::DoTestWrite()
867 ptrSubSystem.Set(_L8("SubSystem"));
868 ptrComponent.Set(_L8("Component"));
869 __FLOG_DECLARATION_MEMBER;
870 __FLOG_OPEN(ptrSubSystem, ptrComponent);
872 _LIT8(KTestMessage ,"TC no 27.7: This is test message");
873 __FLOG_BINARY(KTestMessage); //Write 8 bit test descriptor
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.
889 TInt CFloggerTest027_07::DoTestCheckWriteL()
891 User::After(KTimeToLog);
896 RFs fileSystem; //For file operation create a file system
897 _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
899 _LIT8(KTestMessage ,"TC no 27.7: This is test message");
901 User::LeaveIfError(fileSystem.Connect());
903 //Open the file in the read mode
904 User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
906 CleanupClosePushL(theFile);
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
913 // Read from position 0: start of file
914 returnCode = theFile.Read(ptrString);
916 returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
919 CleanupStack::PopAndDestroy(hBuffer);
920 CleanupStack::PopAndDestroy(); // For theFile object
931 * Function Name : CFloggerTest027_08
932 * Input parameters : None
933 * Output parameters : None
934 * Description : This is the constructor
938 CFloggerTest027_08::CFloggerTest027_08()
940 // Store the name of this test case
941 SetTestStepName(_L("step_027_08"));
946 * Function Name :~ CFloggerTest027_08
947 * Input parameters : None
948 * Output parameters : None
949 * Description : This is the Destructor
953 CFloggerTest027_08::~CFloggerTest027_08()
959 * Function Name : doTestStepL
960 * Input parameters : None
961 * Output parameters : TVerdict
962 * Description : This function returns whether the test case 027_07 has
968 TVerdict CFloggerTest027_08::doTestStepL( )
970 INFO_PRINTF1(_L("Step 027.08 called "));
971 if ( executeStepL() == KErrNone )
972 SetTestStepResult(EPass);
975 SetTestStepResult(EFail);
978 return TestStepResult();
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
989 TInt CFloggerTest027_08::executeStepL(TBool)
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
1002 TInt CFloggerTest027_08::executeStepL()
1004 TInt ret = KErrNone;
1005 ret = DoTestWrite();
1006 if ( ret == KErrNone)
1008 TRAPD(r, ret = DoTestCheckWriteL());
1016 TInt CFloggerTest027_08::DoTestWrite()
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);
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.
1036 TInt CFloggerTest027_08::DoTestCheckWriteL()
1038 User::After(KTimeToLog);
1043 RFs fileSystem; //For file operation create a file system
1044 _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
1046 _LIT8(KTestMessage ,"TC no 27.8: This is test message");
1048 User::LeaveIfError(fileSystem.Connect());
1050 //Open the file in the read mode
1051 User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
1053 CleanupClosePushL(theFile);
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
1060 // Read from position 0: start of file
1061 returnCode = theFile.Read(ptrString);
1063 returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
1066 CleanupStack::PopAndDestroy(hBuffer);
1067 CleanupStack::PopAndDestroy(); // For theFile object
1078 * Function Name : CFloggerTest027_09
1079 * Input parameters : None
1080 * Output parameters : None
1081 * Description : This is the constructor
1085 CFloggerTest027_09::CFloggerTest027_09()
1087 // Store the name of this test case
1088 SetTestStepName(_L("step_027_09"));
1093 * Function Name :~ CFloggerTest027_09
1094 * Input parameters : None
1095 * Output parameters : None
1096 * Description : This is the Destructor
1100 CFloggerTest027_09::~CFloggerTest027_09()
1106 * Function Name : doTestStepL
1107 * Input parameters : None
1108 * Output parameters : TVerdict
1109 * Description : This function returns whether the test case 027_09 has
1115 TVerdict CFloggerTest027_09::doTestStepL( )
1117 INFO_PRINTF1(_L("Step 027.09 called "));
1118 if ( executeStepL() == KErrNone )
1119 SetTestStepResult(EPass);
1122 SetTestStepResult(EFail);
1125 return TestStepResult();
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
1136 TInt CFloggerTest027_09::executeStepL(TBool)
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
1150 TInt CFloggerTest027_09::executeStepL()
1152 TInt ret = KErrNone;
1153 ret = DoTestWrite();
1154 if ( ret == KErrNone)
1156 TRAPD(r, ret = DoTestCheckWriteL());
1164 TInt CFloggerTest027_09::DoTestWrite()
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);
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.
1184 TInt CFloggerTest027_09::DoTestCheckWriteL()
1186 User::After(KTimeToLog);
1191 RFs fileSystem; //For file operation create a file system
1192 _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
1194 TBuf8<256> testData; //To hold the test descriptor
1196 _LIT8(KTestMessageOne,"TEST 27.09: The value of test integer variable :%d");
1197 testData.Format(KTestMessageOne,100);
1199 User::LeaveIfError(fileSystem.Connect());
1201 //Open the file in the read mode
1202 User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
1204 CleanupClosePushL(theFile);
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
1211 // Read from position 0: start of file
1212 returnCode = theFile.Read(ptrString);
1214 returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
1217 CleanupStack::PopAndDestroy(hBuffer);
1218 CleanupStack::PopAndDestroy(); // For theFile object
1229 * Function Name : CFloggerTest027_10
1230 * Input parameters : None
1231 * Output parameters : None
1232 * Description : This is the constructor
1236 CFloggerTest027_10::CFloggerTest027_10()
1238 // Store the name of this test case
1239 SetTestStepName(_L("step_027_10"));
1244 * Function Name :~ CFloggerTest027_10
1245 * Input parameters : None
1246 * Output parameters : None
1247 * Description : This is the Destructor
1251 CFloggerTest027_10::~CFloggerTest027_10()
1257 * Function Name : doTestStepL
1258 * Input parameters : None
1259 * Output parameters : TVerdict
1260 * Description : This function returns whether the test case 027_10 has
1266 TVerdict CFloggerTest027_10::doTestStepL( )
1268 INFO_PRINTF1(_L("Step 027.10 called "));
1269 if ( executeStepL() == KErrNone )
1270 SetTestStepResult(EPass);
1273 SetTestStepResult(EFail);
1276 return TestStepResult();
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
1288 TInt CFloggerTest027_10::executeStepL(TBool)
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
1301 TInt CFloggerTest027_10::executeStepL()
1303 TInt ret = KErrNone;
1304 ret = DoTestWrite();
1305 if ( ret == KErrNone)
1307 TRAPD(r, ret = DoTestCheckWriteL());
1315 TInt CFloggerTest027_10::DoTestWrite()
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);
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..
1335 TInt CFloggerTest027_10::DoTestCheckWriteL()
1337 User::After(KTimeToLog);
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");
1346 User::LeaveIfError(fileSystem.Connect());
1348 //Open the file in the read mode
1349 User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
1351 CleanupClosePushL(theFile);
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
1358 // Read from position 0: start of file
1359 returnCode = theFile.Read(ptrString);
1361 returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
1364 CleanupStack::PopAndDestroy(hBuffer);
1365 CleanupStack::PopAndDestroy(); // For theFile object
1376 * Function Name : CFloggerTest027_11
1377 * Input parameters : None
1378 * Output parameters : None
1379 * Description : This is the constructor
1383 CFloggerTest027_11::CFloggerTest027_11()
1385 // Store the name of this test case
1386 SetTestStepName(_L("step_027_11"));
1391 * Function Name :~ CFloggerTest027_11
1392 * Input parameters : None
1393 * Output parameters : None
1394 * Description : This is the Destructor
1398 CFloggerTest027_11::~CFloggerTest027_11()
1404 * Function Name : doTestStepL
1405 * Input parameters : None
1406 * Output parameters : TVerdict
1407 * Description : This function returns whether the test case 027_11 has
1413 TVerdict CFloggerTest027_11::doTestStepL( )
1415 INFO_PRINTF1(_L("Step 027.11 called "));
1416 if ( executeStepL() == KErrNone )
1417 SetTestStepResult(EPass);
1420 SetTestStepResult(EFail);
1423 return TestStepResult();
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
1435 TInt CFloggerTest027_11::executeStepL(TBool)
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
1449 TInt CFloggerTest027_11::executeStepL()
1451 TInt ret = KErrNone;
1452 ret = DoTestWrite();
1453 if ( ret == KErrNone)
1455 TRAPD(r, ret = DoTestCheckWriteL());
1463 TInt CFloggerTest027_11::DoTestWrite()
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));
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.
1485 TInt CFloggerTest027_11::DoTestCheckWriteL()
1487 User::After(KTimeToLog);
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");
1496 User::LeaveIfError(fileSystem.Connect());
1498 //Open the file in the read mode
1499 User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
1501 CleanupClosePushL(theFile);
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
1508 // Read from position 0: start of file
1509 returnCode = theFile.Read(ptrString);
1511 returnCode = ptrString.Find(KTestMessage); //find the test descriptor in the buffer read
1514 CleanupStack::PopAndDestroy(hBuffer);
1515 CleanupStack::PopAndDestroy(); // For theFile object
1526 * Function Name : CFloggerTest027_12
1527 * Input parameters : None
1528 * Output parameters : None
1529 * Description : This is the constructor
1533 CFloggerTest027_12::CFloggerTest027_12()
1535 // Store the name of this test case
1536 SetTestStepName(_L("step_027_12"));
1541 * Function Name :~ CFloggerTest027_12
1542 * Input parameters : None
1543 * Output parameters : None
1544 * Description : This is the Destructor
1548 CFloggerTest027_12::~CFloggerTest027_12()
1554 * Function Name : doTestStepL
1555 * Input parameters : None
1556 * Output parameters : TVerdict
1557 * Description : This function returns whether the test case 027_12 has
1563 TVerdict CFloggerTest027_12::doTestStepL( )
1565 INFO_PRINTF1(_L("Step 027.12 called "));
1566 if ( executeStepL() == KErrNone )
1567 SetTestStepResult(EPass);
1570 SetTestStepResult(EFail);
1573 return TestStepResult();
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
1584 TInt CFloggerTest027_12::executeStepL(TBool)
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
1597 TInt CFloggerTest027_12::executeStepL()
1599 TInt ret = KErrNone;
1600 ret = DoTestWrite();
1601 if ( ret == KErrNone)
1603 TRAPD(r, ret = DoTestCheckWriteL());
1611 TInt CFloggerTest027_12::DoTestWrite()
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);
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.
1633 TInt CFloggerTest027_12::DoTestCheckWriteL()
1635 User::After(KTimeToLog);
1640 RFs fileSystem; //For file operation create a file system
1641 _LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
1643 TBuf8<256> testData; //To hold the test descriptor
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);
1648 User::LeaveIfError(fileSystem.Connect());
1650 //Open the file in the read mode
1651 User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
1653 CleanupClosePushL(theFile);
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
1660 // Read from position 0: start of file
1661 returnCode = theFile.Read(ptrString);
1663 returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
1666 CleanupStack::PopAndDestroy(hBuffer);
1667 CleanupStack::PopAndDestroy(); // For theFile object