testexecfw/stf/stfext/testmodules/teftestmod/testexecmdw/filelogger/te_rfilelogger/src/conn_closestep.cpp
changeset 2 8bb370ba6d1d
equal deleted inserted replaced
1:bbd31066657e 2:8bb370ba6d1d
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 * Example CTestStep derived implementation
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  @file conn_closeStep.cpp
       
    23 */
       
    24 #include "conn_closestep.h"
       
    25 #include "te_rfileloggersuitedefs.h"
       
    26 
       
    27 Cconn_closeStep::~Cconn_closeStep()
       
    28 /**
       
    29  * Destructor
       
    30  */
       
    31 	{
       
    32 	}
       
    33 
       
    34 Cconn_closeStep::Cconn_closeStep()
       
    35 /**
       
    36  * Constructor
       
    37  */
       
    38 	{
       
    39 	// **MUST** call SetTestStepName in the constructor as the controlling
       
    40 	// framework uses the test step name immediately following construction to set
       
    41 	// up the step's unique logging ID.
       
    42 	SetTestStepName(Kconn_closeStep);
       
    43 	}
       
    44 
       
    45 TVerdict Cconn_closeStep::doTestStepPreambleL()
       
    46 /**
       
    47  * @return - TVerdict code
       
    48  * Override of base class virtual
       
    49  */
       
    50 	{
       
    51 	CTe_RFileLoggerSuiteStepBase::doTestStepPreambleL();
       
    52 	return TestStepResult();
       
    53 	}
       
    54 
       
    55 
       
    56 TVerdict Cconn_closeStep::doTestStepL()
       
    57 /**
       
    58  * @return - TVerdict code
       
    59  * Override of base class pure virtual
       
    60  * Our implementation only gets called if the base class doTestStepPreambleL() did
       
    61  * not leave. That being the case, the current test result value will be EPass.
       
    62  */
       
    63 	{
       
    64 	if(TestStepResult()==EFail) return TestStepResult();
       
    65 	TInt err;
       
    66 	INFO_PRINTF1(_L("1.  Connect test ..."));
       
    67 	RFileFlogger ilogger;  
       
    68 	err=ilogger.Connect();
       
    69 	if(err!=KErrNone) 
       
    70 	{
       
    71 		ERR_PRINTF2(_L("Connect error. The error number = %d"),err);
       
    72 		SetTestStepResult(EFail);
       
    73 		return TestStepResult();
       
    74 	}
       
    75 	else  INFO_PRINTF1(_L("Connect test passed"));
       
    76 	err=ilogger.Connect();
       
    77 	INFO_PRINTF1(_L("2.  Connect again test after connected"));
       
    78 	if(err==KErrAlreadyExists)
       
    79 	{
       
    80 		INFO_PRINTF2(_L("Test pass. Return value = %d as expected"),err);
       
    81 	}
       
    82 	else  
       
    83 	{
       
    84 		ERR_PRINTF2(_L("Failed. the error = %d"), err);
       
    85 		SetTestStepResult(EFail);
       
    86 		return TestStepResult();
       
    87 
       
    88 	}
       
    89 	INFO_PRINTF1(_L("3.  Close test..."));
       
    90 	ilogger.Close();
       
    91 	err=ilogger.Connect();
       
    92 	if(!err)
       
    93 	{
       
    94 		INFO_PRINTF1(_L("Close test passed"));
       
    95 	}
       
    96 	else  
       
    97 	{
       
    98 		ERR_PRINTF2(_L("Close error value = %d"),err);
       
    99 		SetTestStepResult(EFail);
       
   100 		return TestStepResult();
       
   101 
       
   102 	}
       
   103 	INFO_PRINTF1(_L("4.  CreateLog test..."));	
       
   104 	err=ilogger.CreateLog(KLogFile1,RFileFlogger::ELogModeAppend);
       
   105 	if(!err)
       
   106 	{
       
   107 		INFO_PRINTF1(_L("CreateLog test passed"));
       
   108 	}
       
   109 	else  
       
   110 	{
       
   111 		ERR_PRINTF2(_L("CreateLog error value = %d"),err);
       
   112 		SetTestStepResult(EFail);
       
   113 		return TestStepResult();
       
   114 
       
   115 	}
       
   116 	ilogger.Close();
       
   117 
       
   118 	return TestStepResult();
       
   119 	}
       
   120 
       
   121 
       
   122 
       
   123 TVerdict Cconn_closeStep::doTestStepPostambleL()
       
   124 /**
       
   125  * @return - TVerdict code
       
   126  * Override of base class virtual
       
   127  */
       
   128 	{
       
   129 	return TestStepResult();
       
   130 	}