First public contribution.
2 * Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #ifndef __T_TESTACTION_H__
20 #define __T_TESTACTION_H__
24 #include "t_testactionspec.h"
31 const TInt KMaxErrorSize = 100;
33 class CTestAction : public CBase
36 IMPORT_C virtual ~CTestAction();
45 IMPORT_C virtual void PerformPrerequisite(TRequestStatus& aStatus);
46 virtual void PerformAction(TRequestStatus& aStatus) = 0;
47 IMPORT_C virtual void PerformPostrequisite(TRequestStatus& aStatus);
49 IMPORT_C virtual void ReportAction();
50 IMPORT_C virtual void CheckResult(TInt aError);
51 IMPORT_C void virtual FailTestNow(TRequestStatus& aStatus);
52 IMPORT_C virtual TScriptError ScriptError(void);
53 IMPORT_C virtual void ScriptError(TDes& aError);
54 IMPORT_C virtual void SetScriptError(const TScriptError &iScriptError, const TDesC& aError);
56 // Specific functions for testing cancellation
58 IMPORT_C virtual void PerformCancel();
60 // Specific functions for testing OOM
62 IMPORT_C virtual void Reset();
63 IMPORT_C virtual void AfterOOMFailure();
64 IMPORT_C virtual void ResetState();
66 // Functions for accessing data shared between all test actions in a test run
68 void SetTestHandler(CTestHandler& aTestHandler);
70 IMPORT_C CBase* SharedData() const;
71 IMPORT_C void SetSharedData(CBase* aData);
74 IMPORT_C CTestAction(CConsoleBase& aConsole, Output& aOut);
75 IMPORT_C void ConstructL(const TTestActionSpec& aTestActionSpec);
78 IMPORT_C virtual void DoPerformPrerequisite(TRequestStatus& aStatus);
79 IMPORT_C virtual void DoPerformPostrequisite(TRequestStatus& aStatus);
80 virtual void DoReportAction() = 0;
81 virtual void DoCheckResult(TInt aError) = 0;
96 * After the test, this will be ETrue if the test succeeded or EFalse otherwise.
102 * Inidicates if it s .script file
107 * Denote a failure of any RUNTESTSTEP within a single TESTCASE
109 TBool iRunningResult;
113 * Indicates whether the test will fail because of known deferred defects etc
116 TActionState iActionState;
120 CConsoleBase& iConsole;
122 TBuf<KMaxErrorSize> aScriptErrorDescription;
123 TScriptError iScriptError;
124 CTestHandler* iTestHandler;