imagingtestenv/imagingtestfw/Source/TestFramework/script.h
changeset 0 5752a19fdefe
equal deleted inserted replaced
-1:000000000000 0:5752a19fdefe
       
     1 // Copyright (c) 2002-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 //
       
    15 
       
    16 #ifndef __SCRIPT_H__
       
    17 #define __SCRIPT_H__
       
    18 
       
    19 /**
       
    20  *
       
    21  * File name / line buffer lengths
       
    22  *
       
    23  * @xxxx
       
    24  *
       
    25  */
       
    26 
       
    27 class CParseLine;
       
    28 class CFileName;
       
    29 
       
    30 /**
       
    31  *
       
    32  * Script processor.
       
    33  * Reads, parses and executes the test script.
       
    34  *
       
    35  * @xxxx
       
    36  *
       
    37  */
       
    38 class CScript : public CBase
       
    39 	{
       
    40 public:
       
    41 	static CScript* NewL(CTestUtils* aTestUtils, CLog* aLog, TInt64 aGuardTimer, const TDesC& aMatchString);
       
    42 	static CScript* NewL(CParseLine* aParse, CTestUtils* aTestUtils, CLog* aLog, TInt64 aGuardTimer, const TDesC& aMatchString);
       
    43 	static CScript* NewLC(CTestUtils* aTestUtils, CLog* aLog, TInt64 aGuardTimer, const TDesC& aMatchString);
       
    44 	static CScript* NewLC(CParseLine* aParse, CTestUtils* aTestUtils, CLog* aLog, TInt64 aGuardTimer, const TDesC& aMatchString);
       
    45 	~CScript();	
       
    46 
       
    47 	TBool OpenScriptFile(CFileName* aScriptFileName);		// read in a script file
       
    48 	TVerdict ExecuteScriptL();						// parse and execute script 
       
    49 	void DisplayResults();
       
    50 	void AddResult(TVerdict aTestVerdict);
       
    51 	void AddResult(CScript* aSubScript);
       
    52 	void Pause();
       
    53 	TBool BreakOnError();
       
    54 
       
    55 	TBool iPauseAtEnd;
       
    56 	// iMultThread removed - multithreading now standard
       
    57 
       
    58 protected:
       
    59 	CScript();
       
    60 	void ConstructL(CTestUtils* aTestUtils, CLog* aLog, TInt64 aGuardTimer, const TDesC& aMatchString);
       
    61 	void ConstructL(CParseLine* aParse, CTestUtils*, CLog* aLog, TInt64 aGuardTimer, const TDesC& aMatchString);
       
    62 
       
    63 private:
       
    64 	void ProcessLineL(const TDesC8& aNarrowline, TInt8 aLineNo);	// process a line of script
       
    65 	void LogExtra(const TText8* aFile, TInt aLine, TInt aSeverity,
       
    66 		TRefByValue<const TDesC16> aFmt, ...);
       
    67 
       
    68 private:
       
    69 	// data members
       
    70 	RFs		iTheFs;										// the file system
       
    71 	HBufC8* iScriptBuffer;								// ptr to script file in memory
       
    72 	TPath	iTheTestPath;								// test path
       
    73 
       
    74 	// line parse object
       
    75 	CParseLine* iParse;
       
    76 	// flag indicates whether iParse is owned or not
       
    77 	TBool	iParseOwner;
       
    78 
       
    79 	// recursion count - static global 
       
    80 // do not define static if Unit Testing
       
    81 #if !defined (__TSU_TESTFRAMEWORK__)
       
    82 	static TInt iScriptDepth;
       
    83 #endif
       
    84 
       
    85 	// log
       
    86 	CLog* iLog;
       
    87 
       
    88 	// default guard timer, if any
       
    89 	TInt64 iGuardTimer;
       
    90 	
       
    91 	// matchString if any
       
    92 	HBufC* iMatchString;
       
    93 
       
    94 	// current results
       
    95 	TInt	iPass;
       
    96 	TInt	iFail;
       
    97 	TInt	iInconclusive;
       
    98 	TInt	iTestSuiteError;
       
    99 	TInt	iAbort;
       
   100 	TInt	iKnownFailure;
       
   101 	TInt	iTotal;
       
   102 
       
   103 	};
       
   104 
       
   105 #endif // __SCRIPT_H__