00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef TESTFLEXTIMER_H
00019 #define TESTFLEXTIMER_H
00020
00021
00022 #include "StifTestModule.h"
00023 #include <StifLogger.h>
00024 #include <NormalHardcodedAssert.h>
00025
00026
00027 #define TEST_MODULE_VERSION_MAJOR 0
00028 #define TEST_MODULE_VERSION_MINOR 0
00029 #define TEST_MODULE_VERSION_BUILD 0
00030
00031
00032 _LIT( KTestFlexTimerLogPath, "\\logs\\testframework\\TestFlexTimer\\" );
00033
00034 _LIT( KTestFlexTimerLogFile, "TestFlexTimer.txt" );
00035 _LIT( KTestFlexTimerLogFileWithTitle, "TestFlexTimer_[%S].txt" );
00036
00037 _LIT( KTestFlexTimerPanicCategory, "FLEX-TEST" );
00038
00039
00040 #define GETPTR &
00041 #define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
00042 #define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
00043 #define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
00044 #define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
00045
00046
00047
00048 class CTestFlexTimer;
00049
00050
00051
00052
00053 typedef TInt (*TestFunction)(TTestResult&, CTestFlexTimer*);
00054
00055 const TInt KTimerAccuracyMicroSeconds = 1000 * 1000;
00056 const double KDefaultWindowMultiplier = 0.2;
00057 const TUint KTickInMicroSeconds( 1000000 / 64 );
00058
00059
00060
00061
00069 class TCaseInfoInternal
00070 {
00071 public:
00072 const TText* iCaseName;
00073 TestFunction iMethod;
00074 TBool iIsOOMTest;
00075 TInt iFirstMemoryAllocation;
00076 TInt iLastMemoryAllocation;
00077 };
00078
00079
00080
00088 class TCaseInfo
00089 {
00090 public:
00091 TPtrC iCaseName;
00092 TestFunction iMethod;
00093 TBool iIsOOMTest;
00094 TInt iFirstMemoryAllocation;
00095 TInt iLastMemoryAllocation;
00096
00097 TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
00098 {
00099 };
00100 };
00101
00102
00103 class TExtendedTestResult
00104 {
00105 public:
00106 TTestResult *iTestResult;
00107 TInt iStatusCode;
00108 TBool iCaseAlreadyFailed;
00109 TInt iTimerID;
00110 TInt64 iTimerStartedTime;
00111 TInt64 iTimerStoppedTime;
00112 TInt64 iTimerExpiryTime;
00113
00114 TExtendedTestResult(TTestResult *aResult) : iTestResult( aResult ), iStatusCode(0), iCaseAlreadyFailed(EFalse),
00115 iTimerID(0), iTimerStartedTime(0), iTimerStoppedTime(0) {};
00116 };
00117
00118
00125 NONSHARABLE_CLASS(CTestFlexTimer) : public CTestModuleBase
00126 {
00127 public:
00128
00132 static CTestFlexTimer* NewL();
00133
00137 virtual ~CTestFlexTimer();
00138
00139 public:
00140
00141
00152 TInt InitL( TFileName& aIniFile, TBool aFirstTime );
00153
00162 TInt GetTestCasesL( const TFileName& aTestCaseFile,
00163 RPointerArray<TTestCaseInfo>& aTestCases );
00164
00175 TInt RunTestCaseL( const TInt aCaseNumber,
00176 const TFileName& aTestCaseFile,
00177 TTestResult& aResult );
00178
00189 virtual TBool OOMTestQueryL( const TFileName& ,
00190 const TInt ,
00191 TOOMFailureType& ,
00192 TInt& ,
00193 TInt& );
00194
00202 virtual void OOMTestInitializeL( const TFileName& ,
00203 const TInt );
00204
00213 virtual void OOMHandleWarningL( const TFileName& ,
00214 const TInt ,
00215 TInt& );
00216
00224 virtual void OOMTestFinalizeL( const TFileName& ,
00225 const TInt );
00226
00230 void SendTestModuleVersion();
00231
00232
00233 private:
00234
00238 CTestFlexTimer();
00239
00243 void ConstructL();
00244
00248 void CreateTitleLoggerL(void);
00249
00253 void DeleteTitleLogger(void);
00254
00261 const TCaseInfo Case( const TInt aCaseNumber ) const;
00262
00263
00264
00276 TInt Funct26( TTestResult& aResult, CTestFlexTimer *cb);
00277
00289 TInt Funct27( TTestResult& aResult, CTestFlexTimer *cb );
00290
00302 TInt Funct28( TTestResult& aResult, CTestFlexTimer *cb );
00303
00318 TInt Funct29( TTestResult& aResult, CTestFlexTimer *cb );
00319
00320
00321
00332 TInt Funct30( TTestResult& aResult, CTestFlexTimer *cb );
00333
00345 TInt Funct31( TTestResult& aResult, CTestFlexTimer *cb );
00346
00361 TInt Funct32( TTestResult& aResult, CTestFlexTimer *cb );
00362
00377 TInt Funct33( TTestResult& aResult, CTestFlexTimer *cb );
00378
00393 TInt Funct34( TTestResult& aResult, CTestFlexTimer *cb );
00394
00415 TInt Funct35( TTestResult& aResult, CTestFlexTimer *cb );
00416
00429 TInt Funct36( TTestResult& aResult, CTestFlexTimer *cb );
00430
00443 TInt Funct37( TTestResult& aResult, CTestFlexTimer *cb );
00444
00457 TInt Funct38( TTestResult& aResult, CTestFlexTimer *cb );
00458
00471 TInt Funct39( TTestResult& aResult, CTestFlexTimer *cb );
00472
00485 TInt Funct40( TTestResult& aResult, CTestFlexTimer *cb );
00486
00499 TInt Funct41( TTestResult& aResult, CTestFlexTimer *cb );
00500
00514 TInt Funct42( TTestResult& aResult, CTestFlexTimer *cb );
00515
00531 TInt Funct43( TTestResult& aResult, CTestFlexTimer *cb );
00532
00554 TInt Funct44( TTestResult& aResult, CTestFlexTimer *cb );
00555
00567 TInt Funct45( TTestResult& aResult, CTestFlexTimer *cb );
00568
00581 TInt Funct46( TTestResult& aResult, CTestFlexTimer *cb );
00582
00596 static TInt StartSecondServerL(
00597 TTestResult& aResult,
00598 CTestFlexTimer* aCallback );
00599
00607 static TInt SetThreadPriorityMuchMore(
00608 TTestResult& aResult,
00609 CTestFlexTimer* aCallback );
00610
00618 static TInt SetThreadPriorityNormal(
00619 TTestResult& aResult,
00620 CTestFlexTimer* aCallback );
00621
00622 public:
00623
00624
00625
00626 protected:
00627
00628
00629
00630 private:
00631
00632
00633
00634 CStifLogger * iLog;
00635
00636
00637 CStifLogger *iStdLog;
00638
00639
00640 CStifLogger *iTCLog;
00641
00642
00643 TBool iAddTestCaseTitleToLogName;
00644
00645
00646 TBool iVersionLogged;
00647
00648
00649
00650
00651
00652 TestFunction iMethod;
00653
00654
00655 TBool iCTimerCBFailedCase;
00656
00657 public:
00658
00659 protected:
00660
00661 private:
00662
00663
00664 };
00665
00666 #endif // TESTFLEXTIMER_H
00667
00668