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.
sl@0
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Example CTestStep derived implementation
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
/**
sl@0
    19
 @file TestResizeTraceBufferSizeStep.cpp
sl@0
    20
 @internalTechnology
sl@0
    21
*/
sl@0
    22
#include "testtracebuffermodestep.h"
sl@0
    23
#include "te_uloggerclientsuitedefs.h"
sl@0
    24
sl@0
    25
CTestTraceBufferModeStep::~CTestTraceBufferModeStep()
sl@0
    26
/**
sl@0
    27
 * Destructor
sl@0
    28
 */
sl@0
    29
	{
sl@0
    30
	}
sl@0
    31
sl@0
    32
CTestTraceBufferModeStep::CTestTraceBufferModeStep()
sl@0
    33
/**
sl@0
    34
 * Constructor
sl@0
    35
 */
sl@0
    36
	{
sl@0
    37
	// **MUST** call SetTestStepName in the constructor as the controlling
sl@0
    38
	// framework uses the test step name immediately following construction to set
sl@0
    39
	// up the step's unique logging ID.
sl@0
    40
	SetTestStepName(KTestTraceBufferModeStep);
sl@0
    41
	}
sl@0
    42
sl@0
    43
TVerdict CTestTraceBufferModeStep::doTestStepPreambleL()
sl@0
    44
/**
sl@0
    45
 * @return - TVerdict code
sl@0
    46
 * Override of base class virtual
sl@0
    47
 */
sl@0
    48
	{
sl@0
    49
	INFO_PRINTF1(_L("TestResizeTraceBufferSizeStep started"));
sl@0
    50
	CTestUloggerClientApiStepBase::doTestStepPreambleL();
sl@0
    51
	return TestStepResult();
sl@0
    52
	}
sl@0
    53
sl@0
    54
sl@0
    55
TVerdict CTestTraceBufferModeStep::doTestStepL()
sl@0
    56
/**
sl@0
    57
 * @return - TVerdict code
sl@0
    58
 * Override of base class pure virtual
sl@0
    59
 * Our implementation only gets called if the base class doTestStepPreambleL() did
sl@0
    60
 * not leave. That being the case, the current test result value will be EPass.
sl@0
    61
 */
sl@0
    62
	{
sl@0
    63
	  if (TestStepResult()==EPass)
sl@0
    64
		{
sl@0
    65
			iSession->Connect();
sl@0
    66
			TInt iBufferMode =  0; // circular buffer mode
sl@0
    67
			TInt err = iSession->SetBufferMode(iBufferMode); 
sl@0
    68
			if( err == KErrNone )
sl@0
    69
			{
sl@0
    70
				TInt iBufferModeIn = 0;
sl@0
    71
				iSession->GetBufferMode(iBufferModeIn);
sl@0
    72
				if( iBufferMode == iBufferModeIn )
sl@0
    73
				{
sl@0
    74
					INFO_PRINTF1(_L("Buffer Mode right"));
sl@0
    75
					SetTestStepResult(EPass);
sl@0
    76
				}
sl@0
    77
				else
sl@0
    78
				{
sl@0
    79
					INFO_PRINTF1(_L("Buffer Mode returned, doesn't match"));
sl@0
    80
					SetTestStepResult(EFail);
sl@0
    81
				}
sl@0
    82
			}
sl@0
    83
			else
sl@0
    84
			{
sl@0
    85
				INFO_PRINTF2(_L("SetBufferMode() returned error : %d"), err);
sl@0
    86
				SetTestStepResult(EFail);
sl@0
    87
			}
sl@0
    88
			
sl@0
    89
			
sl@0
    90
			iBufferMode =  1; // straight buffer mode
sl@0
    91
			err = iSession->SetBufferMode(iBufferMode); 
sl@0
    92
			if( err == KErrNone )
sl@0
    93
			{
sl@0
    94
				TInt iBufferModeIn = 0;
sl@0
    95
				iSession->GetBufferMode(iBufferModeIn);
sl@0
    96
				if( iBufferMode == iBufferModeIn )
sl@0
    97
				{
sl@0
    98
					INFO_PRINTF1(_L("Buffer Mode right"));
sl@0
    99
					SetTestStepResult(EPass);
sl@0
   100
				}
sl@0
   101
				else
sl@0
   102
				{
sl@0
   103
					INFO_PRINTF1(_L("Buffer Mode returned, doesn't match"));
sl@0
   104
					SetTestStepResult(EFail);
sl@0
   105
				}
sl@0
   106
			}
sl@0
   107
			else
sl@0
   108
			{
sl@0
   109
				INFO_PRINTF2(_L("SetBufferMode() returned error : %d"), err);
sl@0
   110
				SetTestStepResult(EFail);
sl@0
   111
			}
sl@0
   112
			
sl@0
   113
			iBufferMode =  99; // wrong buffer mode
sl@0
   114
			err = iSession->SetBufferMode(iBufferMode); 
sl@0
   115
			if( err == KErrNone )
sl@0
   116
			{
sl@0
   117
				INFO_PRINTF1(_L("Buffer Mode set wrong"));
sl@0
   118
				SetTestStepResult(EFail);
sl@0
   119
				
sl@0
   120
			}
sl@0
   121
			else
sl@0
   122
			{
sl@0
   123
				INFO_PRINTF1(_L("Buffer mode worked correctly"));
sl@0
   124
				SetTestStepResult(EPass);
sl@0
   125
			}
sl@0
   126
			
sl@0
   127
			//SetTestStepResult(EPass);
sl@0
   128
			
sl@0
   129
			//SetTestStepResult(EPass);
sl@0
   130
		}
sl@0
   131
	  return TestStepResult();
sl@0
   132
	}
sl@0
   133
sl@0
   134
sl@0
   135
sl@0
   136
TVerdict CTestTraceBufferModeStep::doTestStepPostambleL()
sl@0
   137
/**
sl@0
   138
 * @return - TVerdict code
sl@0
   139
 * Override of base class virtual
sl@0
   140
 */
sl@0
   141
	{
sl@0
   142
	INFO_PRINTF1(_L("TestResizeTraceBufferSizeStep completed"));
sl@0
   143
	CTestUloggerClientApiStepBase::doTestStepPostambleL();
sl@0
   144
	return TestStepResult();
sl@0
   145
	}