os/persistentdata/traceservices/tracefw/ulogger/unit_test/te-client/teststartstep.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-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 TestStartStep.cpp
    20  @internalTechnology
    21 */
    22 #include "teststartstep.h"
    23 #include "te_uloggerclientsuitedefs.h"
    24 
    25 CTestStartStep::~CTestStartStep()
    26 /**
    27  * Destructor
    28  */
    29 	{
    30 	}
    31 
    32 CTestStartStep::CTestStartStep()
    33 /**
    34  * Constructor
    35  */
    36 	{
    37 	// **MUST** call SetTestStepName in the constructor as the controlling
    38 	// framework uses the test step name immediately following construction to set
    39 	// up the step's unique logging ID.
    40 	SetTestStepName(KTestStartStep);
    41 	}
    42 
    43 TVerdict CTestStartStep::doTestStepPreambleL()
    44 /**
    45  * @return - TVerdict code
    46  * Override of base class virtual
    47  */
    48 {
    49 	CTestUloggerClientApiStepBase::doTestStepPreambleL();
    50 	return TestStepResult(); 
    51 }
    52 
    53 TVerdict CTestStartStep::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() == EPass)
    62 	{
    63 		TInt iErrCode = KErrNone;
    64 		//iErrCode = iSession->Start();
    65 		//if( KErrNone != iErrCode )
    66 		//{
    67 			CTestUloggerClientApiStepBase::prepareForStartTestL();
    68 			iErrCode = iSession->ActivateOutputPlugin(_L8("uloggerfileplugin"));
    69 			if(!( (iErrCode==KErrNone) || (iErrCode==KErrAlreadyExists) ))
    70 			{
    71 				INFO_PRINTF2(_L("Failed to Set ActiveOutput plugin : %d"), iErrCode);	
    72 				SetTestStepResult(EFail);
    73 			}
    74 			else
    75 			{
    76 				iErrCode = iSession->Start();
    77 				if( KErrNone == iErrCode || KErrInUse == iErrCode)
    78 				{
    79 					INFO_PRINTF1(_L("Logging started"));		
    80 					SetTestStepResult(EPass);
    81 				}
    82 				else if(KErrNotFound == iErrCode)
    83 				{
    84 					INFO_PRINTF2(_L("Logging failed to start with error KErrNotFound (%d)"), iErrCode);
    85 					SetTestStepResult(EPass);
    86 				}
    87 				else
    88 				{
    89 				 	INFO_PRINTF2(_L("Logging failed to start with error: %d"), iErrCode);
    90 				 	SetTestStepResult(EFail);
    91 				}
    92 			}
    93 	//}
    94 	//else
    95 	//{
    96 		//INFO_PRINTF1(_L("Session returned sucess without connection"));
    97 		//SetTestStepResult(EFail);
    98 	//}
    99 	}
   100 
   101 	return TestStepResult();
   102 }
   103 
   104 TVerdict CTestStartStep::doTestStepPostambleL()
   105 /**
   106  * @return - TVerdict code
   107  * Override of base class virtual
   108  */
   109 {
   110 	INFO_PRINTF1(_L("TestStartStep completed"));
   111 	CTestUloggerClientApiStepBase::doTestStepPostambleL();
   112 	return TestStepResult();
   113 }