os/persistentdata/loggingservices/rfilelogger/Logger/te_RFileLogger/src/conn_closeStep.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/loggingservices/rfilelogger/Logger/te_RFileLogger/src/conn_closeStep.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,127 @@
     1.4 +// Copyright (c) 2004-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 +// Example CTestStep derived implementation
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +/**
    1.22 + @file conn_closeStep.cpp
    1.23 +*/
    1.24 +#include "conn_closeStep.h"
    1.25 +#include "Te_RFileLoggerSuiteDefs.h"
    1.26 +
    1.27 +Cconn_closeStep::~Cconn_closeStep()
    1.28 +/**
    1.29 + * Destructor
    1.30 + */
    1.31 +	{
    1.32 +	}
    1.33 +
    1.34 +Cconn_closeStep::Cconn_closeStep()
    1.35 +/**
    1.36 + * Constructor
    1.37 + */
    1.38 +	{
    1.39 +	// **MUST** call SetTestStepName in the constructor as the controlling
    1.40 +	// framework uses the test step name immediately following construction to set
    1.41 +	// up the step's unique logging ID.
    1.42 +	SetTestStepName(Kconn_closeStep);
    1.43 +	}
    1.44 +
    1.45 +TVerdict Cconn_closeStep::doTestStepPreambleL()
    1.46 +/**
    1.47 + * @return - TVerdict code
    1.48 + * Override of base class virtual
    1.49 + */
    1.50 +	{
    1.51 +	CTe_RFileLoggerSuiteStepBase::doTestStepPreambleL();
    1.52 +	return TestStepResult();
    1.53 +	}
    1.54 +
    1.55 +
    1.56 +TVerdict Cconn_closeStep::doTestStepL()
    1.57 +/**
    1.58 + * @return - TVerdict code
    1.59 + * Override of base class pure virtual
    1.60 + * Our implementation only gets called if the base class doTestStepPreambleL() did
    1.61 + * not leave. That being the case, the current test result value will be EPass.
    1.62 + */
    1.63 +	{
    1.64 +	if(TestStepResult()==EFail) return TestStepResult();
    1.65 +	TInt err;
    1.66 +	INFO_PRINTF1(_L("1.  Connect test ..."));
    1.67 +	RFileFlogger ilogger;  
    1.68 +	err=ilogger.Connect();
    1.69 +	if(err!=KErrNone) 
    1.70 +	{
    1.71 +		ERR_PRINTF2(_L("Connect error. The error number = %d"),err);
    1.72 +		SetTestStepResult(EFail);
    1.73 +		return TestStepResult();
    1.74 +	}
    1.75 +	else  INFO_PRINTF1(_L("Connect test passed"));
    1.76 +	err=ilogger.Connect();
    1.77 +	INFO_PRINTF1(_L("2.  Connect again test after connected"));
    1.78 +	if(err==KErrAlreadyExists)
    1.79 +	{
    1.80 +		INFO_PRINTF2(_L("Test pass. Return value = %d as expected"),err);
    1.81 +	}
    1.82 +	else  
    1.83 +	{
    1.84 +		ERR_PRINTF2(_L("Failed. the error = %d"), err);
    1.85 +		SetTestStepResult(EFail);
    1.86 +		return TestStepResult();
    1.87 +
    1.88 +	}
    1.89 +	INFO_PRINTF1(_L("3.  Close test..."));
    1.90 +	ilogger.Close();
    1.91 +	err=ilogger.Connect();
    1.92 +	if(!err)
    1.93 +	{
    1.94 +		INFO_PRINTF1(_L("Close test passed"));
    1.95 +	}
    1.96 +	else  
    1.97 +	{
    1.98 +		ERR_PRINTF2(_L("Close error value = %d"),err);
    1.99 +		SetTestStepResult(EFail);
   1.100 +		return TestStepResult();
   1.101 +
   1.102 +	}
   1.103 +	INFO_PRINTF1(_L("4.  CreateLog test..."));	
   1.104 +	err=ilogger.CreateLog(KLogFile1,RFileFlogger::ELogModeAppend);
   1.105 +	if(!err)
   1.106 +	{
   1.107 +		INFO_PRINTF1(_L("CreateLog test passed"));
   1.108 +	}
   1.109 +	else  
   1.110 +	{
   1.111 +		ERR_PRINTF2(_L("CreateLog error value = %d"),err);
   1.112 +		SetTestStepResult(EFail);
   1.113 +		return TestStepResult();
   1.114 +
   1.115 +	}
   1.116 +	ilogger.Close();
   1.117 +
   1.118 +	return TestStepResult();
   1.119 +	}
   1.120 +
   1.121 +
   1.122 +
   1.123 +TVerdict Cconn_closeStep::doTestStepPostambleL()
   1.124 +/**
   1.125 + * @return - TVerdict code
   1.126 + * Override of base class virtual
   1.127 + */
   1.128 +	{
   1.129 +	return TestStepResult();
   1.130 +	}