sl@0: // Copyright (c) 2004-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: // Example CTestStep derived implementation sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file conn_closeStep.cpp sl@0: */ sl@0: #include "conn_closeStep.h" sl@0: #include "Te_RFileLoggerSuiteDefs.h" sl@0: sl@0: Cconn_closeStep::~Cconn_closeStep() sl@0: /** sl@0: * Destructor sl@0: */ sl@0: { sl@0: } sl@0: sl@0: Cconn_closeStep::Cconn_closeStep() sl@0: /** sl@0: * Constructor sl@0: */ sl@0: { sl@0: // **MUST** call SetTestStepName in the constructor as the controlling sl@0: // framework uses the test step name immediately following construction to set sl@0: // up the step's unique logging ID. sl@0: SetTestStepName(Kconn_closeStep); sl@0: } sl@0: sl@0: TVerdict Cconn_closeStep::doTestStepPreambleL() sl@0: /** sl@0: * @return - TVerdict code sl@0: * Override of base class virtual sl@0: */ sl@0: { sl@0: CTe_RFileLoggerSuiteStepBase::doTestStepPreambleL(); sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: sl@0: TVerdict Cconn_closeStep::doTestStepL() sl@0: /** sl@0: * @return - TVerdict code sl@0: * Override of base class pure virtual sl@0: * Our implementation only gets called if the base class doTestStepPreambleL() did sl@0: * not leave. That being the case, the current test result value will be EPass. sl@0: */ sl@0: { sl@0: if(TestStepResult()==EFail) return TestStepResult(); sl@0: TInt err; sl@0: INFO_PRINTF1(_L("1. Connect test ...")); sl@0: RFileFlogger ilogger; sl@0: err=ilogger.Connect(); sl@0: if(err!=KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("Connect error. The error number = %d"),err); sl@0: SetTestStepResult(EFail); sl@0: return TestStepResult(); sl@0: } sl@0: else INFO_PRINTF1(_L("Connect test passed")); sl@0: err=ilogger.Connect(); sl@0: INFO_PRINTF1(_L("2. Connect again test after connected")); sl@0: if(err==KErrAlreadyExists) sl@0: { sl@0: INFO_PRINTF2(_L("Test pass. Return value = %d as expected"),err); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("Failed. the error = %d"), err); sl@0: SetTestStepResult(EFail); sl@0: return TestStepResult(); sl@0: sl@0: } sl@0: INFO_PRINTF1(_L("3. Close test...")); sl@0: ilogger.Close(); sl@0: err=ilogger.Connect(); sl@0: if(!err) sl@0: { sl@0: INFO_PRINTF1(_L("Close test passed")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("Close error value = %d"),err); sl@0: SetTestStepResult(EFail); sl@0: return TestStepResult(); sl@0: sl@0: } sl@0: INFO_PRINTF1(_L("4. CreateLog test...")); sl@0: err=ilogger.CreateLog(KLogFile1,RFileFlogger::ELogModeAppend); sl@0: if(!err) sl@0: { sl@0: INFO_PRINTF1(_L("CreateLog test passed")); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("CreateLog error value = %d"),err); sl@0: SetTestStepResult(EFail); sl@0: return TestStepResult(); sl@0: sl@0: } sl@0: ilogger.Close(); sl@0: sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: sl@0: sl@0: TVerdict Cconn_closeStep::doTestStepPostambleL() sl@0: /** sl@0: * @return - TVerdict code sl@0: * Override of base class virtual sl@0: */ sl@0: { sl@0: return TestStepResult(); sl@0: }