sl@0: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // This contains Unit Test Case 025.01 sl@0: sl@0: // EPOC includes sl@0: #include sl@0: sl@0: // Test system includes sl@0: #include "teststepcomsdbg.h" sl@0: #include "TestMessage.h" sl@0: #include "step_025_xx.h" sl@0: #include "tlog1.h" sl@0: #include "tlog2.h" sl@0: #include "tlog3.h" sl@0: #include "tlog4.h" sl@0: sl@0: sl@0: #include sl@0: sl@0: sl@0: /** sl@0: * 025_BuildTestUdeb1: Test that flogger builds clients correctly sl@0: */ sl@0: sl@0: CFloggerTest025_BuildTestUdeb1::CFloggerTest025_BuildTestUdeb1() sl@0: { sl@0: // Store the name of this test case sl@0: SetTestStepName(_L("step_025_BuildTestUdeb1")); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: CFloggerTest025_BuildTestUdeb1::~CFloggerTest025_BuildTestUdeb1() sl@0: { sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: TVerdict CFloggerTest025_BuildTestUdeb1::doTestStepL( ) sl@0: { sl@0: if ( executeStepL() == KErrNone ) sl@0: SetTestStepResult(EPass); sl@0: sl@0: else sl@0: SetTestStepResult(EFail); sl@0: sl@0: sl@0: sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUdeb1::executeStepL(TBool) sl@0: { sl@0: return KErrGeneral; sl@0: } sl@0: sl@0: TInt CFloggerTest025_BuildTestUdeb1::executeStepL() sl@0: { sl@0: sl@0: TInt ret; sl@0: RFileLogger theFlogger; sl@0: sl@0: ret = theFlogger.Connect(); sl@0: sl@0: if ( ret == KErrNone) sl@0: { sl@0: theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8); sl@0: theFlogger.ClearLog(); sl@0: theFlogger.Close(); sl@0: sl@0: TestLog1::Test(); sl@0: ret = DoTestCheckWriteL(); sl@0: } sl@0: sl@0: return ret; sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUdeb1::DoTestCheckWriteL() sl@0: { sl@0: RFile theFile; sl@0: HBufC8 * hBuffer; sl@0: TInt listfilesize; sl@0: TInt returnCode; sl@0: RFs fileSystem; //For file operation create a file system sl@0: sl@0: User::After(KTimeToLog); sl@0: sl@0: User::LeaveIfError(fileSystem.Connect()); sl@0: sl@0: //Open the file in the read mode sl@0: User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead)); sl@0: sl@0: CleanupClosePushL(theFile); sl@0: sl@0: User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file sl@0: hBuffer = HBufC8::New(listfilesize); //Allocate the buffer sl@0: CleanupStack::PushL(hBuffer); sl@0: TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer sl@0: sl@0: // Read from position 0: start of file sl@0: returnCode = theFile.Read(ptrString); sl@0: if (returnCode == KErrNone) sl@0: returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read sl@0: //from the file sl@0: sl@0: CleanupStack::PopAndDestroy(hBuffer); sl@0: CleanupStack::PopAndDestroy(); // For theFile object sl@0: if (returnCode > 0) sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral; sl@0: } sl@0: sl@0: sl@0: sl@0: /** sl@0: * 025_BuildTestUdeb2: Test that flogger builds clients correctly sl@0: */ sl@0: sl@0: // We've had to disable this test case since the building of the class TestLog2 library tlog2.lib causes a linkage sl@0: // warning on WINS due to flogger.lib not being used in the debug build, but needed for the release build. sl@0: sl@0: /* sl@0: CFloggerTest025_BuildTestUdeb2::CFloggerTest025_BuildTestUdeb2() sl@0: { sl@0: // Store the name of this test case sl@0: SetTestStepName(_L("step_025_BuildTestUdeb2")); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: CFloggerTest025_BuildTestUdeb2::~CFloggerTest025_BuildTestUdeb2() sl@0: { sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: TVerdict CFloggerTest025_BuildTestUdeb2::doTestStepL( ) sl@0: { sl@0: if ( executeStepL() == KErrNone ) sl@0: SetTestStepResult(EPass); sl@0: sl@0: else sl@0: SetTestStepResult(EFail); sl@0: sl@0: sl@0: sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUdeb2::executeStepL() sl@0: { sl@0: sl@0: TInt ret; sl@0: RFileLogger theFlogger; sl@0: sl@0: ret = theFlogger.Connect(); sl@0: sl@0: if ( ret == KErrNone) sl@0: { sl@0: theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8); sl@0: theFlogger.ClearLog(); sl@0: theFlogger.Close(); sl@0: sl@0: TestLog2::Test(); sl@0: ret = DoTestCheckWriteL(); sl@0: } sl@0: sl@0: return ret; sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUdeb2::DoTestCheckWriteL() sl@0: { sl@0: RFile theFile; sl@0: HBufC8 * hBuffer; sl@0: TInt listfilesize; sl@0: TInt returnCode; sl@0: RFs fileSystem; //For file operation create a file system sl@0: TInt numSuccessful = 0; sl@0: sl@0: User::After(KTimeToLog); sl@0: sl@0: User::LeaveIfError(fileSystem.Connect()); sl@0: sl@0: //Open the file in the read mode sl@0: User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead)); sl@0: sl@0: CleanupClosePushL(theFile); sl@0: sl@0: User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file sl@0: hBuffer = HBufC8::New(listfilesize); //Allocate the buffer sl@0: CleanupStack::PushL(hBuffer); sl@0: TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer sl@0: sl@0: // Read from position 0: start of file sl@0: returnCode = theFile.Read(ptrString); sl@0: sl@0: // we should not find any log string sl@0: if (returnCode == KErrNone) sl@0: { sl@0: returnCode = ptrString.Find(KTestMessage8); sl@0: if (returnCode == KErrNotFound) sl@0: { sl@0: numSuccessful++; sl@0: } sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(hBuffer); sl@0: CleanupStack::PopAndDestroy(); // For theFile object sl@0: if (numSuccessful > 0) sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral; sl@0: } sl@0: sl@0: */ sl@0: sl@0: /** sl@0: * 025_BuildTestUdeb3: Test that flogger builds clients correctly sl@0: */ sl@0: sl@0: CFloggerTest025_BuildTestUdeb3::CFloggerTest025_BuildTestUdeb3() sl@0: { sl@0: // Store the name of this test case sl@0: SetTestStepName(_L("step_025_BuildTestUdeb3")); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: CFloggerTest025_BuildTestUdeb3::~CFloggerTest025_BuildTestUdeb3() sl@0: { sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: TVerdict CFloggerTest025_BuildTestUdeb3::doTestStepL( ) sl@0: { sl@0: if ( executeStepL() == KErrNone ) sl@0: SetTestStepResult(EPass); sl@0: sl@0: else sl@0: SetTestStepResult(EFail); sl@0: sl@0: sl@0: sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUdeb3::executeStepL(TBool) sl@0: { sl@0: return KErrGeneral; sl@0: } sl@0: sl@0: TInt CFloggerTest025_BuildTestUdeb3::executeStepL() sl@0: { sl@0: sl@0: TInt ret; sl@0: RFileLogger theFlogger; sl@0: sl@0: ret = theFlogger.Connect(); sl@0: sl@0: if ( ret == KErrNone) sl@0: { sl@0: theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8); sl@0: theFlogger.ClearLog(); sl@0: theFlogger.Close(); sl@0: sl@0: TestLog3::Test(); sl@0: ret = DoTestCheckWriteL(); sl@0: } sl@0: sl@0: return ret; sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUdeb3::DoTestCheckWriteL() sl@0: { sl@0: RFile theFile; sl@0: HBufC8 * hBuffer; sl@0: TInt listfilesize; sl@0: TInt returnCode; sl@0: RFs fileSystem; //For file operation create a file system sl@0: TInt numSuccessful = 0; sl@0: sl@0: User::After(KTimeToLog); sl@0: sl@0: User::LeaveIfError(fileSystem.Connect()); sl@0: sl@0: //Open the file in the read mode sl@0: User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead)); sl@0: sl@0: CleanupClosePushL(theFile); sl@0: sl@0: User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file sl@0: hBuffer = HBufC8::New(listfilesize); //Allocate the buffer sl@0: CleanupStack::PushL(hBuffer); sl@0: TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer sl@0: sl@0: // Read from position 0: start of file sl@0: returnCode = theFile.Read(ptrString); sl@0: sl@0: // we should not find any log string sl@0: if (returnCode == KErrNone) sl@0: { sl@0: returnCode = ptrString.Find(KTestMessage8); sl@0: if (returnCode == KErrNotFound) sl@0: { sl@0: numSuccessful++; sl@0: } sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(hBuffer); sl@0: CleanupStack::PopAndDestroy(); // For theFile object sl@0: if (numSuccessful > 0) sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: * 025_BuildTestUdeb4: Test that flogger builds clients correctly sl@0: */ sl@0: sl@0: CFloggerTest025_BuildTestUdeb4::CFloggerTest025_BuildTestUdeb4() sl@0: { sl@0: // Store the name of this test case sl@0: SetTestStepName(_L("step_025_BuildTestUdeb4")); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: CFloggerTest025_BuildTestUdeb4::~CFloggerTest025_BuildTestUdeb4() sl@0: { sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: TVerdict CFloggerTest025_BuildTestUdeb4::doTestStepL( ) sl@0: { sl@0: if ( executeStepL() == KErrNone ) sl@0: SetTestStepResult(EPass); sl@0: sl@0: else sl@0: SetTestStepResult(EFail); sl@0: sl@0: sl@0: sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUdeb4::executeStepL(TBool) sl@0: { sl@0: return KErrGeneral; sl@0: } sl@0: sl@0: TInt CFloggerTest025_BuildTestUdeb4::executeStepL() sl@0: { sl@0: sl@0: TInt ret; sl@0: RFileLogger theFlogger; sl@0: sl@0: ret = theFlogger.Connect(); sl@0: sl@0: if ( ret == KErrNone) sl@0: { sl@0: theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8); sl@0: theFlogger.ClearLog(); sl@0: theFlogger.Close(); sl@0: sl@0: TestLog4::Test(); sl@0: ret = DoTestCheckWriteL(); sl@0: } sl@0: sl@0: return ret; sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUdeb4::DoTestCheckWriteL() sl@0: { sl@0: RFile theFile; sl@0: HBufC8 * hBuffer; sl@0: TInt listfilesize; sl@0: TInt returnCode; sl@0: RFs fileSystem; //For file operation create a file system sl@0: sl@0: User::After(KTimeToLog); sl@0: sl@0: User::LeaveIfError(fileSystem.Connect()); sl@0: sl@0: //Open the file in the read mode sl@0: User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead)); sl@0: sl@0: CleanupClosePushL(theFile); sl@0: sl@0: User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file sl@0: hBuffer = HBufC8::New(listfilesize); //Allocate the buffer sl@0: CleanupStack::PushL(hBuffer); sl@0: TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer sl@0: sl@0: // Read from position 0: start of file sl@0: returnCode = theFile.Read(ptrString); sl@0: if (returnCode == KErrNone) sl@0: returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read sl@0: //from the file sl@0: sl@0: CleanupStack::PopAndDestroy(hBuffer); sl@0: CleanupStack::PopAndDestroy(); // For theFile object sl@0: if (returnCode > 0) sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: * 025_BuildTestUrel1: Test that flogger builds clients correctly sl@0: */ sl@0: sl@0: CFloggerTest025_BuildTestUrel1::CFloggerTest025_BuildTestUrel1() sl@0: { sl@0: // Store the name of this test case sl@0: SetTestStepName(_L("step_025_BuildTestUrel1")); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: CFloggerTest025_BuildTestUrel1::~CFloggerTest025_BuildTestUrel1() sl@0: { sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: TVerdict CFloggerTest025_BuildTestUrel1::doTestStepL( ) sl@0: { sl@0: if ( executeStepL() == KErrNone ) sl@0: SetTestStepResult(EPass); sl@0: sl@0: else sl@0: SetTestStepResult(EFail); sl@0: sl@0: sl@0: sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUrel1::executeStepL(TBool) sl@0: { sl@0: return KErrGeneral; sl@0: } sl@0: sl@0: TInt CFloggerTest025_BuildTestUrel1::executeStepL() sl@0: { sl@0: sl@0: TInt ret; sl@0: RFileLogger theFlogger; sl@0: sl@0: ret = theFlogger.Connect(); sl@0: sl@0: if ( ret == KErrNone) sl@0: { sl@0: theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8); sl@0: theFlogger.ClearLog(); sl@0: theFlogger.Close(); sl@0: sl@0: TestLog1::Test(); sl@0: ret = DoTestCheckWriteL(); sl@0: } sl@0: sl@0: return ret; sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUrel1::DoTestCheckWriteL() sl@0: { sl@0: RFile theFile; sl@0: HBufC8 * hBuffer; sl@0: TInt listfilesize; sl@0: TInt returnCode; sl@0: RFs fileSystem; //For file operation create a file system sl@0: TInt numSuccessful = 0; sl@0: sl@0: User::After(KTimeToLog); sl@0: sl@0: User::LeaveIfError(fileSystem.Connect()); sl@0: sl@0: //Open the file in the read mode sl@0: User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead)); sl@0: sl@0: CleanupClosePushL(theFile); sl@0: sl@0: User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file sl@0: hBuffer = HBufC8::New(listfilesize); //Allocate the buffer sl@0: CleanupStack::PushL(hBuffer); sl@0: TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer sl@0: sl@0: // Read from position 0: start of file sl@0: returnCode = theFile.Read(ptrString); sl@0: sl@0: // we should not find any log string sl@0: if (returnCode == KErrNone) sl@0: { sl@0: returnCode = ptrString.Find(KTestMessage8); sl@0: if (returnCode == KErrNotFound) sl@0: { sl@0: numSuccessful++; sl@0: } sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(hBuffer); sl@0: CleanupStack::PopAndDestroy(); // For theFile object sl@0: if (numSuccessful > 0) sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral; sl@0: } sl@0: sl@0: sl@0: /** sl@0: * 025_BuildTestUrel2: Test that flogger builds clients correctly sl@0: */ sl@0: sl@0: // We've had to disable this test case since the building of the class TestLog2 library tlog2.lib causes a linkage sl@0: // warning on WINS due to flogger.lib not being used in the debug build, but needed for the release build. sl@0: sl@0: /* sl@0: CFloggerTest025_BuildTestUrel2::CFloggerTest025_BuildTestUrel2() sl@0: { sl@0: // Store the name of this test case sl@0: SetTestStepName(_L("step_025_BuildTestUrel2")); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: CFloggerTest025_BuildTestUrel2::~CFloggerTest025_BuildTestUrel2() sl@0: { sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: TVerdict CFloggerTest025_BuildTestUrel2::doTestStepL( ) sl@0: { sl@0: if ( executeStepL() == KErrNone ) sl@0: SetTestStepResult(EPass); sl@0: sl@0: else sl@0: SetTestStepResult(EFail); sl@0: sl@0: sl@0: sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUrel2::executeStepL() sl@0: { sl@0: sl@0: TInt ret; sl@0: RFileLogger theFlogger; sl@0: sl@0: ret = theFlogger.Connect(); sl@0: sl@0: if ( ret == KErrNone) sl@0: { sl@0: theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8); sl@0: theFlogger.ClearLog(); sl@0: theFlogger.Close(); sl@0: sl@0: TestLog2::Test(); sl@0: ret = DoTestCheckWriteL(); sl@0: } sl@0: sl@0: return ret; sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUrel2::DoTestCheckWriteL() sl@0: { sl@0: RFile theFile; sl@0: HBufC8 * hBuffer; sl@0: TInt listfilesize; sl@0: TInt returnCode; sl@0: RFs fileSystem; //For file operation create a file system sl@0: sl@0: User::After(KTimeToLog); sl@0: sl@0: User::LeaveIfError(fileSystem.Connect()); sl@0: sl@0: //Open the file in the read mode sl@0: User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead)); sl@0: sl@0: CleanupClosePushL(theFile); sl@0: sl@0: User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file sl@0: hBuffer = HBufC8::New(listfilesize); //Allocate the buffer sl@0: CleanupStack::PushL(hBuffer); sl@0: TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer sl@0: sl@0: // Read from position 0: start of file sl@0: returnCode = theFile.Read(ptrString); sl@0: if (returnCode == KErrNone) sl@0: returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read sl@0: //from the file sl@0: sl@0: CleanupStack::PopAndDestroy(hBuffer); sl@0: CleanupStack::PopAndDestroy(); // For theFile object sl@0: if (returnCode > 0) sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral; sl@0: } sl@0: sl@0: */ sl@0: sl@0: /** sl@0: * 025_BuildTestUrel3: Test that flogger builds clients correctly sl@0: */ sl@0: sl@0: CFloggerTest025_BuildTestUrel3::CFloggerTest025_BuildTestUrel3() sl@0: { sl@0: // Store the name of this test case sl@0: SetTestStepName(_L("step_025_BuildTestUrel3")); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: CFloggerTest025_BuildTestUrel3::~CFloggerTest025_BuildTestUrel3() sl@0: { sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: TVerdict CFloggerTest025_BuildTestUrel3::doTestStepL( ) sl@0: { sl@0: if ( executeStepL() == KErrNone ) sl@0: SetTestStepResult(EPass); sl@0: sl@0: else sl@0: SetTestStepResult(EFail); sl@0: sl@0: sl@0: sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUrel3::executeStepL(TBool) sl@0: { sl@0: return KErrGeneral; sl@0: } sl@0: sl@0: TInt CFloggerTest025_BuildTestUrel3::executeStepL() sl@0: { sl@0: sl@0: TInt ret; sl@0: RFileLogger theFlogger; sl@0: sl@0: ret = theFlogger.Connect(); sl@0: sl@0: if ( ret == KErrNone) sl@0: { sl@0: theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8); sl@0: theFlogger.ClearLog(); sl@0: theFlogger.Close(); sl@0: sl@0: TestLog3::Test(); sl@0: ret = DoTestCheckWriteL(); sl@0: } sl@0: sl@0: return ret; sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUrel3::DoTestCheckWriteL() sl@0: { sl@0: RFile theFile; sl@0: HBufC8 * hBuffer; sl@0: TInt listfilesize; sl@0: TInt returnCode; sl@0: RFs fileSystem; //For file operation create a file system sl@0: TInt numSuccessful = 0; sl@0: sl@0: User::After(KTimeToLog); sl@0: sl@0: User::LeaveIfError(fileSystem.Connect()); sl@0: sl@0: //Open the file in the read mode sl@0: User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead)); sl@0: sl@0: CleanupClosePushL(theFile); sl@0: sl@0: User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file sl@0: hBuffer = HBufC8::New(listfilesize); //Allocate the buffer sl@0: CleanupStack::PushL(hBuffer); sl@0: TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer sl@0: sl@0: // Read from position 0: start of file sl@0: returnCode = theFile.Read(ptrString); sl@0: sl@0: // we should not find any log string sl@0: if (returnCode == KErrNone) sl@0: { sl@0: returnCode = ptrString.Find(KTestMessage8); sl@0: if (returnCode == KErrNotFound) sl@0: { sl@0: numSuccessful++; sl@0: } sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(hBuffer); sl@0: CleanupStack::PopAndDestroy(); // For theFile object sl@0: if (numSuccessful > 0) sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: * 025_BuildTestUrel4: Test that flogger builds clients correctly sl@0: */ sl@0: sl@0: CFloggerTest025_BuildTestUrel4::CFloggerTest025_BuildTestUrel4() sl@0: { sl@0: // Store the name of this test case sl@0: SetTestStepName(_L("step_025_BuildTestUrel4")); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: CFloggerTest025_BuildTestUrel4::~CFloggerTest025_BuildTestUrel4() sl@0: { sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: TVerdict CFloggerTest025_BuildTestUrel4::doTestStepL( ) sl@0: { sl@0: if ( executeStepL() == KErrNone ) sl@0: SetTestStepResult(EPass); sl@0: sl@0: else sl@0: SetTestStepResult(EFail); sl@0: sl@0: sl@0: sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUrel4::executeStepL(TBool) sl@0: { sl@0: return KErrGeneral; sl@0: } sl@0: sl@0: TInt CFloggerTest025_BuildTestUrel4::executeStepL() sl@0: { sl@0: sl@0: TInt ret; sl@0: RFileLogger theFlogger; sl@0: sl@0: ret = theFlogger.Connect(); sl@0: sl@0: if ( ret == KErrNone) sl@0: { sl@0: theFlogger.SetLogTags(KStdSubsysTag8, KStdCompTag8); sl@0: theFlogger.ClearLog(); sl@0: theFlogger.Close(); sl@0: sl@0: TestLog4::Test(); sl@0: ret = DoTestCheckWriteL(); sl@0: } sl@0: sl@0: return ret; sl@0: sl@0: } sl@0: sl@0: sl@0: sl@0: TInt CFloggerTest025_BuildTestUrel4::DoTestCheckWriteL() sl@0: { sl@0: RFile theFile; sl@0: HBufC8 * hBuffer; sl@0: TInt listfilesize; sl@0: TInt returnCode; sl@0: RFs fileSystem; //For file operation create a file system sl@0: sl@0: User::After(KTimeToLog); sl@0: sl@0: User::LeaveIfError(fileSystem.Connect()); sl@0: sl@0: //Open the file in the read mode sl@0: User::LeaveIfError(theFile.Open(fileSystem,KFloggerOutputFile,EFileRead)); sl@0: sl@0: CleanupClosePushL(theFile); sl@0: sl@0: User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file sl@0: hBuffer = HBufC8::New(listfilesize); //Allocate the buffer sl@0: CleanupStack::PushL(hBuffer); sl@0: TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer sl@0: sl@0: // Read from position 0: start of file sl@0: returnCode = theFile.Read(ptrString); sl@0: if (returnCode == KErrNone) sl@0: returnCode = ptrString.Find(KTestMessage8); //find the test descriptor in the buffer read sl@0: //from the file sl@0: sl@0: CleanupStack::PopAndDestroy(hBuffer); sl@0: CleanupStack::PopAndDestroy(); // For theFile object sl@0: if (returnCode > 0) sl@0: return KErrNone; sl@0: else sl@0: return KErrGeneral; sl@0: } sl@0: