author | sl@SLION-WIN7.fritz.box |
Fri, 15 Jun 2012 03:10:57 +0200 | |
changeset 0 | bde4ae8d615e |
permissions | -rw-r--r-- |
sl@0 | 1 |
// Copyright (c) 2002-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 |
// This file is a helper for TestFramework Unit Test classes. |
sl@0 | 15 |
// It subclasses the abstract RTestStep to produce a working class we can test |
sl@0 | 16 |
// |
sl@0 | 17 |
// |
sl@0 | 18 |
|
sl@0 | 19 |
// EPOC includes |
sl@0 | 20 |
#include <e32base.h> |
sl@0 | 21 |
|
sl@0 | 22 |
// Test system includes |
sl@0 | 23 |
#include <testframework.h> |
sl@0 | 24 |
|
sl@0 | 25 |
#include "TestStepVirtualStub.h" |
sl@0 | 26 |
|
sl@0 | 27 |
// -------------------------------------------- |
sl@0 | 28 |
// RTestStepVirtualStub |
sl@0 | 29 |
|
sl@0 | 30 |
RTestStepVirtualStub* RTestStepVirtualStub::NewL() |
sl@0 | 31 |
{ |
sl@0 | 32 |
RTestStepVirtualStub* self = new(ELeave) RTestStepVirtualStub; |
sl@0 | 33 |
return self; |
sl@0 | 34 |
} |
sl@0 | 35 |
|
sl@0 | 36 |
// Each test step initialises its own name |
sl@0 | 37 |
RTestStepVirtualStub::RTestStepVirtualStub() |
sl@0 | 38 |
{ |
sl@0 | 39 |
iTestStepName = KTestStepVirtualStubName; |
sl@0 | 40 |
|
sl@0 | 41 |
iPreambleRun = EFalse; |
sl@0 | 42 |
iPostambleRun = EFalse; |
sl@0 | 43 |
iStepRun = EFalse; |
sl@0 | 44 |
} |
sl@0 | 45 |
|
sl@0 | 46 |
// preamble |
sl@0 | 47 |
TVerdict RTestStepVirtualStub::OpenL() |
sl@0 | 48 |
{ |
sl@0 | 49 |
INFO_PRINTF1(_L("RTestStepVirtualStub::OpenL() has been called")); |
sl@0 | 50 |
iPreambleRun = ETrue; |
sl@0 | 51 |
return iTestStepResult = EPass; |
sl@0 | 52 |
} |
sl@0 | 53 |
|
sl@0 | 54 |
// postamble |
sl@0 | 55 |
void RTestStepVirtualStub::Close() |
sl@0 | 56 |
{ |
sl@0 | 57 |
INFO_PRINTF1(_L("RTestStepVirtualStub::Close() has been called")); |
sl@0 | 58 |
iPostambleRun = ETrue; |
sl@0 | 59 |
} |
sl@0 | 60 |
|
sl@0 | 61 |
// do the test step |
sl@0 | 62 |
TVerdict RTestStepVirtualStub::DoTestStepL() |
sl@0 | 63 |
{ |
sl@0 | 64 |
INFO_PRINTF1(_L("RTestStepVirtualStub::DoTestStepL() has been called")); |
sl@0 | 65 |
iStepRun = ETrue; |
sl@0 | 66 |
return iTestStepResult = EPass; |
sl@0 | 67 |
} |
sl@0 | 68 |
|
sl@0 | 69 |
// Extra methods by which RTestStep accessors can be tested. |
sl@0 | 70 |
// Not for use by anything except Test Harnesses |
sl@0 | 71 |
CTestSuite* RTestStepVirtualStub::TestGetSuite() const |
sl@0 | 72 |
{ |
sl@0 | 73 |
return iSuite; |
sl@0 | 74 |
} |
sl@0 | 75 |
|
sl@0 | 76 |
TVerdict RTestStepVirtualStub::TestGetResult() const |
sl@0 | 77 |
{ |
sl@0 | 78 |
return iTestStepResult; |
sl@0 | 79 |
} |
sl@0 | 80 |
|
sl@0 | 81 |
void RTestStepVirtualStub::TestSetStepName(const TDesC& aName) |
sl@0 | 82 |
{ |
sl@0 | 83 |
iTestStepName = aName; |
sl@0 | 84 |
} |
sl@0 | 85 |
|
sl@0 | 86 |
TBool RTestStepVirtualStub::PreambleRun() |
sl@0 | 87 |
{ |
sl@0 | 88 |
return iPreambleRun; |
sl@0 | 89 |
} |
sl@0 | 90 |
|
sl@0 | 91 |
TBool RTestStepVirtualStub::PostambleRun() |
sl@0 | 92 |
{ |
sl@0 | 93 |
return iPostambleRun; |
sl@0 | 94 |
} |
sl@0 | 95 |
|
sl@0 | 96 |
TBool RTestStepVirtualStub::StepRun() |
sl@0 | 97 |
{ |
sl@0 | 98 |
return iStepRun; |
sl@0 | 99 |
} |
sl@0 | 100 |
|
sl@0 | 101 |
TBool RTestStepVirtualStub::TestGetBoolFromConfig(const TDesC &aSectName, const TDesC &aKeyName, TBool &aResult) |
sl@0 | 102 |
{ |
sl@0 | 103 |
return GetBoolFromConfig(aSectName, aKeyName, aResult); |
sl@0 | 104 |
}; |
sl@0 | 105 |
|
sl@0 | 106 |
|
sl@0 | 107 |
// -------------------------------------------- |
sl@0 | 108 |
// RTestStepVirtualStub2 |
sl@0 | 109 |
|
sl@0 | 110 |
RTestStepVirtualStub2* RTestStepVirtualStub2::NewL() |
sl@0 | 111 |
{ |
sl@0 | 112 |
RTestStepVirtualStub2* self = new(ELeave) RTestStepVirtualStub2; |
sl@0 | 113 |
return self; |
sl@0 | 114 |
} |
sl@0 | 115 |
|
sl@0 | 116 |
// Each test step initialises its own name |
sl@0 | 117 |
RTestStepVirtualStub2::RTestStepVirtualStub2() |
sl@0 | 118 |
{ |
sl@0 | 119 |
iTestStepName = KTestStepVirtualStub2Name; |
sl@0 | 120 |
|
sl@0 | 121 |
iPreambleRun = EFalse; |
sl@0 | 122 |
iPostambleRun = EFalse; |
sl@0 | 123 |
iStepRun = EFalse; |
sl@0 | 124 |
} |
sl@0 | 125 |