os/persistentdata/traceservices/tracefw/ulogger/unit_test/te-client/testtracebuffermodestep.cpp
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Example CTestStep derived implementation
19 @file TestResizeTraceBufferSizeStep.cpp
22 #include "testtracebuffermodestep.h"
23 #include "te_uloggerclientsuitedefs.h"
25 CTestTraceBufferModeStep::~CTestTraceBufferModeStep()
32 CTestTraceBufferModeStep::CTestTraceBufferModeStep()
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);
43 TVerdict CTestTraceBufferModeStep::doTestStepPreambleL()
45 * @return - TVerdict code
46 * Override of base class virtual
49 INFO_PRINTF1(_L("TestResizeTraceBufferSizeStep started"));
50 CTestUloggerClientApiStepBase::doTestStepPreambleL();
51 return TestStepResult();
55 TVerdict CTestTraceBufferModeStep::doTestStepL()
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.
63 if (TestStepResult()==EPass)
66 TInt iBufferMode = 0; // circular buffer mode
67 TInt err = iSession->SetBufferMode(iBufferMode);
70 TInt iBufferModeIn = 0;
71 iSession->GetBufferMode(iBufferModeIn);
72 if( iBufferMode == iBufferModeIn )
74 INFO_PRINTF1(_L("Buffer Mode right"));
75 SetTestStepResult(EPass);
79 INFO_PRINTF1(_L("Buffer Mode returned, doesn't match"));
80 SetTestStepResult(EFail);
85 INFO_PRINTF2(_L("SetBufferMode() returned error : %d"), err);
86 SetTestStepResult(EFail);
90 iBufferMode = 1; // straight buffer mode
91 err = iSession->SetBufferMode(iBufferMode);
94 TInt iBufferModeIn = 0;
95 iSession->GetBufferMode(iBufferModeIn);
96 if( iBufferMode == iBufferModeIn )
98 INFO_PRINTF1(_L("Buffer Mode right"));
99 SetTestStepResult(EPass);
103 INFO_PRINTF1(_L("Buffer Mode returned, doesn't match"));
104 SetTestStepResult(EFail);
109 INFO_PRINTF2(_L("SetBufferMode() returned error : %d"), err);
110 SetTestStepResult(EFail);
113 iBufferMode = 99; // wrong buffer mode
114 err = iSession->SetBufferMode(iBufferMode);
115 if( err == KErrNone )
117 INFO_PRINTF1(_L("Buffer Mode set wrong"));
118 SetTestStepResult(EFail);
123 INFO_PRINTF1(_L("Buffer mode worked correctly"));
124 SetTestStepResult(EPass);
127 //SetTestStepResult(EPass);
129 //SetTestStepResult(EPass);
131 return TestStepResult();
136 TVerdict CTestTraceBufferModeStep::doTestStepPostambleL()
138 * @return - TVerdict code
139 * Override of base class virtual
142 INFO_PRINTF1(_L("TestResizeTraceBufferSizeStep completed"));
143 CTestUloggerClientApiStepBase::doTestStepPostambleL();
144 return TestStepResult();