00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef TESTFLEXPERIODIC_H
00025 #define TESTFLEXPERIODIC_H
00026
00027 #include <e32base.h>
00028
00029
00030 class CFlexPeriodic;
00031
00040 NONSHARABLE_CLASS( CTestFlexPeriodic ) : public CBase
00041 {
00042
00046 struct TRestartInfo
00047 {
00048 CFlexPeriodic* iTimer;
00049 TInt iFirstTicksLeft;
00050 RArray<TTime>* iFirstTimestamps;
00051 RArray<TTime>* iSecondTimestamps;
00052 TTimeIntervalMicroSeconds iSecondInterval;
00053 };
00054
00058 struct TConfigureInfo
00059 {
00060 CFlexPeriodic* iTimer;
00061 TInt iDelayWindow;
00062 TInt iIntervalWindow;
00063 TInt iConfigResult32;
00064 TInt iConfigResult64;
00065 };
00066
00070 struct TTestCaseArguments
00071 {
00072 TInt (*iTestFunction)( TTestResult&, CTestFlexTimer* );
00073 TTestResult& iResult;
00074 CTestFlexTimer* iCallback;
00075 };
00076
00077 public:
00078
00082 virtual ~CTestFlexPeriodic();
00083
00105 static TInt StartOneTimerL( TTestResult& aResult,
00106 CTestFlexTimer* aCallback );
00107
00132 static TInt CallbackRestartL( TTestResult& aResult,
00133 CTestFlexTimer* aCallback );
00134
00169 static TInt ConfigureWindow32L( TTestResult& aResult,
00170 CTestFlexTimer* aCallback );
00171
00194 static TInt ConfigureWindow64L( TTestResult& aResult,
00195 CTestFlexTimer* aCallback );
00196
00221 static TInt ConfigureWindowMixL( TTestResult& aResult,
00222 CTestFlexTimer* aCallback );
00223
00256 static TInt ConfigureAfterStartL( TTestResult& aResult,
00257 CTestFlexTimer* aCallback );
00258
00270 static TInt StartAfterStartL( TTestResult& aResult,
00271 CTestFlexTimer* aCallback );
00272
00284 static TInt StartInCallbackL( TTestResult& aResult,
00285 CTestFlexTimer* aCallback );
00286
00297 static TInt StartWithNegativeDelay32L( TTestResult& aResult,
00298 CTestFlexTimer* aCallback );
00299
00310 static TInt StartWithZeroInterval32L( TTestResult& aResult,
00311 CTestFlexTimer* aCallback );
00312
00323 static TInt StartWithNegativeInterval32L( TTestResult& aResult,
00324 CTestFlexTimer* aCallback );
00325
00336 static TInt StartWithNegativeDelay64L( TTestResult& aResult,
00337 CTestFlexTimer* aCallback );
00338
00349 static TInt StartWithZeroInterval64L( TTestResult& aResult,
00350 CTestFlexTimer* aCallback );
00351
00362 static TInt StartWithNegativeInterval64L( TTestResult& aResult,
00363 CTestFlexTimer* aCallback );
00364
00376 static TInt ConfigureWithNegativeDelayWindow32L(
00377 TTestResult& aResult,
00378 CTestFlexTimer* aCallback );
00379
00391 static TInt ConfigureWithNegativeIntervalWindow32L(
00392 TTestResult& aResult,
00393 CTestFlexTimer* aCallback );
00394
00406 static TInt ConfigureWithNegativeDelayWindow64L(
00407 TTestResult& aResult,
00408 CTestFlexTimer* aCallback );
00409
00421 static TInt ConfigureWithNegativeIntervalWindow64L(
00422 TTestResult& aResult,
00423 CTestFlexTimer* aCallback );
00424
00425
00468 static TInt StartWithMinAndMaxL(
00469 TTestResult& aResult,
00470 CTestFlexTimer* aCallback );
00471
00472
00484 static TInt StartWithMaximumDelay64L(
00485 TTestResult& aResult,
00486 CTestFlexTimer* aCallback );
00487
00499 static TInt StartWithMaximumInterval64L(
00500 TTestResult& aResult,
00501 CTestFlexTimer* aCallback );
00502
00511 static TInt StartWithNullCallBack32L(
00512 TTestResult& aResult,
00513 CTestFlexTimer* aCallback );
00514
00523 static TInt StartWithNullCallBack64L(
00524 TTestResult& aResult,
00525 CTestFlexTimer* aCallback );
00526
00527
00545 static TInt ClientCrashL(
00546 TTestResult& aResult,
00547 CTestFlexTimer* aCallback );
00548
00549 private:
00550
00554 CTestFlexPeriodic();
00555
00560 static void WaitL( TTimeIntervalMicroSeconds32 aPeriod );
00561
00567 static TInt StopScheduler( TAny* aArgument );
00568
00569
00575 static TInt DoNothing( TAny* aArgument );
00576
00582 static TInt AddTimestamp( TAny* aArgument );
00583
00589 static TInt RestartTimer( TAny* aArgument );
00590
00597 static TInt ConfigureTimer( TAny* aArgument );
00598
00604 static TInt StartTimer( TAny* aArgument );
00605
00615 static TBool AreTimestampsAtWindow(
00616 const RArray<TTime>& aTimestamps,
00617 const TTimeIntervalMicroSeconds32& aDelay,
00618 const TTimeIntervalMicroSeconds32& aInterval,
00619 const TTimeIntervalMicroSeconds32& aDelayWindow,
00620 const TTimeIntervalMicroSeconds32& aIntervalWindow );
00621
00631 static TBool AreTimestampsAtWindow(
00632 const RArray<TTime>& aTimestamps,
00633 const TTimeIntervalMicroSeconds& aDelay,
00634 const TTimeIntervalMicroSeconds& aInterval,
00635 const TTimeIntervalMicroSeconds& aDelayWindow,
00636 const TTimeIntervalMicroSeconds& aIntervalWindow );
00637
00644 static TBool AreTimestampsSame(
00645 const RArray<TTime>& aLeft,
00646 const RArray<TTime>& aRight );
00647
00656 template <class firstType, class secondType>
00657 static TInt ConfigureWindowL( TTestResult& aResult );
00658
00678 template <class configureType, class startType>
00679 static void ConfigureAndStartTimerL(
00680 RArray<TTime>& aTimestamps,
00681 TInt64 aDelay,
00682 TInt64 aInterval,
00683 TInt64 aDelayWindow,
00684 TInt64 aIntervalWindow );
00685
00698 template <class startType>
00699 static TInt StartWithNullCallBackL(
00700 TTestResult& aResult,
00701 CTestFlexTimer* aCallback );
00702
00710 static TInt RunInThread(
00711 RThread& aThread,
00712 TTestCaseArguments& aArguments );
00713
00721 static TInt RunTestCase( TAny* aArgument );
00722
00729 static void RunTestCaseL( TAny* aArgument );
00730
00738 static TInt DoPanicL( TTestResult& aResult, CTestFlexTimer* aCallback );
00739
00740 };
00741
00742 #endif // TESTFLEXPERIODIC_H