os/persistentdata/loggingservices/rfilelogger/Logger/te_RFileLogger/src/conn_closeStep.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2004-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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Example CTestStep derived implementation
    15 // 
    16 //
    17 
    18 /**
    19  @file conn_closeStep.cpp
    20 */
    21 #include "conn_closeStep.h"
    22 #include "Te_RFileLoggerSuiteDefs.h"
    23 
    24 Cconn_closeStep::~Cconn_closeStep()
    25 /**
    26  * Destructor
    27  */
    28 	{
    29 	}
    30 
    31 Cconn_closeStep::Cconn_closeStep()
    32 /**
    33  * Constructor
    34  */
    35 	{
    36 	// **MUST** call SetTestStepName in the constructor as the controlling
    37 	// framework uses the test step name immediately following construction to set
    38 	// up the step's unique logging ID.
    39 	SetTestStepName(Kconn_closeStep);
    40 	}
    41 
    42 TVerdict Cconn_closeStep::doTestStepPreambleL()
    43 /**
    44  * @return - TVerdict code
    45  * Override of base class virtual
    46  */
    47 	{
    48 	CTe_RFileLoggerSuiteStepBase::doTestStepPreambleL();
    49 	return TestStepResult();
    50 	}
    51 
    52 
    53 TVerdict Cconn_closeStep::doTestStepL()
    54 /**
    55  * @return - TVerdict code
    56  * Override of base class pure virtual
    57  * Our implementation only gets called if the base class doTestStepPreambleL() did
    58  * not leave. That being the case, the current test result value will be EPass.
    59  */
    60 	{
    61 	if(TestStepResult()==EFail) return TestStepResult();
    62 	TInt err;
    63 	INFO_PRINTF1(_L("1.  Connect test ..."));
    64 	RFileFlogger ilogger;  
    65 	err=ilogger.Connect();
    66 	if(err!=KErrNone) 
    67 	{
    68 		ERR_PRINTF2(_L("Connect error. The error number = %d"),err);
    69 		SetTestStepResult(EFail);
    70 		return TestStepResult();
    71 	}
    72 	else  INFO_PRINTF1(_L("Connect test passed"));
    73 	err=ilogger.Connect();
    74 	INFO_PRINTF1(_L("2.  Connect again test after connected"));
    75 	if(err==KErrAlreadyExists)
    76 	{
    77 		INFO_PRINTF2(_L("Test pass. Return value = %d as expected"),err);
    78 	}
    79 	else  
    80 	{
    81 		ERR_PRINTF2(_L("Failed. the error = %d"), err);
    82 		SetTestStepResult(EFail);
    83 		return TestStepResult();
    84 
    85 	}
    86 	INFO_PRINTF1(_L("3.  Close test..."));
    87 	ilogger.Close();
    88 	err=ilogger.Connect();
    89 	if(!err)
    90 	{
    91 		INFO_PRINTF1(_L("Close test passed"));
    92 	}
    93 	else  
    94 	{
    95 		ERR_PRINTF2(_L("Close error value = %d"),err);
    96 		SetTestStepResult(EFail);
    97 		return TestStepResult();
    98 
    99 	}
   100 	INFO_PRINTF1(_L("4.  CreateLog test..."));	
   101 	err=ilogger.CreateLog(KLogFile1,RFileFlogger::ELogModeAppend);
   102 	if(!err)
   103 	{
   104 		INFO_PRINTF1(_L("CreateLog test passed"));
   105 	}
   106 	else  
   107 	{
   108 		ERR_PRINTF2(_L("CreateLog error value = %d"),err);
   109 		SetTestStepResult(EFail);
   110 		return TestStepResult();
   111 
   112 	}
   113 	ilogger.Close();
   114 
   115 	return TestStepResult();
   116 	}
   117 
   118 
   119 
   120 TVerdict Cconn_closeStep::doTestStepPostambleL()
   121 /**
   122  * @return - TVerdict code
   123  * Override of base class virtual
   124  */
   125 	{
   126 	return TestStepResult();
   127 	}