os/persistentdata/traceservices/tracefw/ulogger/unit_test/te-client/testtracebuffermodestep.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 TestResizeTraceBufferSizeStep.cpp
    20  @internalTechnology
    21 */
    22 #include "testtracebuffermodestep.h"
    23 #include "te_uloggerclientsuitedefs.h"
    24 
    25 CTestTraceBufferModeStep::~CTestTraceBufferModeStep()
    26 /**
    27  * Destructor
    28  */
    29 	{
    30 	}
    31 
    32 CTestTraceBufferModeStep::CTestTraceBufferModeStep()
    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(KTestTraceBufferModeStep);
    41 	}
    42 
    43 TVerdict CTestTraceBufferModeStep::doTestStepPreambleL()
    44 /**
    45  * @return - TVerdict code
    46  * Override of base class virtual
    47  */
    48 	{
    49 	INFO_PRINTF1(_L("TestResizeTraceBufferSizeStep started"));
    50 	CTestUloggerClientApiStepBase::doTestStepPreambleL();
    51 	return TestStepResult();
    52 	}
    53 
    54 
    55 TVerdict CTestTraceBufferModeStep::doTestStepL()
    56 /**
    57  * @return - TVerdict code
    58  * Override of base class pure virtual
    59  * Our implementation only gets called if the base class doTestStepPreambleL() did
    60  * not leave. That being the case, the current test result value will be EPass.
    61  */
    62 	{
    63 	  if (TestStepResult()==EPass)
    64 		{
    65 			iSession->Connect();
    66 			TInt iBufferMode =  0; // circular buffer mode
    67 			TInt err = iSession->SetBufferMode(iBufferMode); 
    68 			if( err == KErrNone )
    69 			{
    70 				TInt iBufferModeIn = 0;
    71 				iSession->GetBufferMode(iBufferModeIn);
    72 				if( iBufferMode == iBufferModeIn )
    73 				{
    74 					INFO_PRINTF1(_L("Buffer Mode right"));
    75 					SetTestStepResult(EPass);
    76 				}
    77 				else
    78 				{
    79 					INFO_PRINTF1(_L("Buffer Mode returned, doesn't match"));
    80 					SetTestStepResult(EFail);
    81 				}
    82 			}
    83 			else
    84 			{
    85 				INFO_PRINTF2(_L("SetBufferMode() returned error : %d"), err);
    86 				SetTestStepResult(EFail);
    87 			}
    88 			
    89 			
    90 			iBufferMode =  1; // straight buffer mode
    91 			err = iSession->SetBufferMode(iBufferMode); 
    92 			if( err == KErrNone )
    93 			{
    94 				TInt iBufferModeIn = 0;
    95 				iSession->GetBufferMode(iBufferModeIn);
    96 				if( iBufferMode == iBufferModeIn )
    97 				{
    98 					INFO_PRINTF1(_L("Buffer Mode right"));
    99 					SetTestStepResult(EPass);
   100 				}
   101 				else
   102 				{
   103 					INFO_PRINTF1(_L("Buffer Mode returned, doesn't match"));
   104 					SetTestStepResult(EFail);
   105 				}
   106 			}
   107 			else
   108 			{
   109 				INFO_PRINTF2(_L("SetBufferMode() returned error : %d"), err);
   110 				SetTestStepResult(EFail);
   111 			}
   112 			
   113 			iBufferMode =  99; // wrong buffer mode
   114 			err = iSession->SetBufferMode(iBufferMode); 
   115 			if( err == KErrNone )
   116 			{
   117 				INFO_PRINTF1(_L("Buffer Mode set wrong"));
   118 				SetTestStepResult(EFail);
   119 				
   120 			}
   121 			else
   122 			{
   123 				INFO_PRINTF1(_L("Buffer mode worked correctly"));
   124 				SetTestStepResult(EPass);
   125 			}
   126 			
   127 			//SetTestStepResult(EPass);
   128 			
   129 			//SetTestStepResult(EPass);
   130 		}
   131 	  return TestStepResult();
   132 	}
   133 
   134 
   135 
   136 TVerdict CTestTraceBufferModeStep::doTestStepPostambleL()
   137 /**
   138  * @return - TVerdict code
   139  * Override of base class virtual
   140  */
   141 	{
   142 	INFO_PRINTF1(_L("TestResizeTraceBufferSizeStep completed"));
   143 	CTestUloggerClientApiStepBase::doTestStepPostambleL();
   144 	return TestStepResult();
   145 	}