tzservices/tzserver/test/Common/inc/DstStep.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /**
       
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #if (!defined __DSTSTEP_H__)
       
    21 #define __DSTSTEP_H__
       
    22 
       
    23 #include <test/testexecutestepbase.h>
       
    24 #include "DstServer.h"
       
    25 #include <tz.h>
       
    26 
       
    27 class CDstStep;
       
    28 /////////////////////////////////////////////////////////////////////////
       
    29 // CDSTActiveWorker
       
    30 //
       
    31 class CDSTActiveWorker : public CActive
       
    32 	{
       
    33 public:
       
    34 	static CDSTActiveWorker* NewL(const CDstStep& aTestStep);
       
    35 	~CDSTActiveWorker();
       
    36 	void Start();
       
    37 
       
    38 private:
       
    39 	CDSTActiveWorker(const CDstStep& aTestStep);
       
    40 	void CompleteSelf();
       
    41 
       
    42 	// from CActive
       
    43 	void RunL();
       
    44 	void DoCancel();
       
    45 	TInt RunError(TInt aError);
       
    46 
       
    47 private:
       
    48 	CDstStep& iTestStep;
       
    49 	};
       
    50 
       
    51 /////////////////////////////////////////////////////////////////////////
       
    52 // CDstStep
       
    53 //
       
    54 class CDstStep : public CTestStep
       
    55 	{
       
    56 public:
       
    57 	friend class CDSTActiveWorker;
       
    58 	CDstStep();
       
    59 	~CDstStep();
       
    60 
       
    61 	// Called by Asynchronous test steps when they complete their
       
    62 	// test
       
    63 	void TestCompleted(TInt aCondition);
       
    64 	
       
    65 	// Called by test step sub-class, 
       
    66 	// immediately after connecting to the session and before
       
    67 	// any other Component Under Test is created, 
       
    68 	// to register the file session for stress testing.
       
    69 	void SetFileSession(RFs& aFs);
       
    70 
       
    71 	// Logs the description if error Condition
       
    72 	// the whole test step is considered failed if any logged check is a failure
       
    73 	void LogCheck(const TDesC& aDescription, TInt aCondition);
       
    74 
       
    75 	// Reads a TTime-like format string but allows the use of proper month and day values
       
    76 	static TTime ReadTimeParamStringL(const TDesC& aParamString);
       
    77 	
       
    78 protected:
       
    79 	// Template Method Called by doTestStepL thru StartTest()
       
    80 	virtual TInt CreateAndRunTestUnitL() = 0;
       
    81 
       
    82 	// Template Method called by TestCompleted() thru FinishTest()
       
    83 	virtual void DestroyTestUnit() = 0;
       
    84 
       
    85 	// Template Method called by doTestStepPreambleL()
       
    86 	virtual void PrepareTestEnvironmentL();
       
    87 
       
    88 private:
       
    89 
       
    90 	enum TState 
       
    91 		{
       
    92 		EIdle=0,
       
    93 		ERunningLeakTest,
       
    94 		ERunningFileTest,
       
    95 		ERunningNormalTest,
       
    96 		};
       
    97 
       
    98 	enum TTestCmd 
       
    99 		{
       
   100 		ECreateUnit=0,
       
   101 		EDestroyUnit
       
   102 		};
       
   103 
       
   104 
       
   105 	// Called by ActiveWorker to start the test
       
   106 	TInt RunTest();
       
   107 
       
   108 	// Tidies up after each run of a test. The test may be run several times
       
   109 	// before the test step returns to TestExecute
       
   110 	TInt FinishTest();
       
   111 
       
   112 
       
   113 	// Kicks-off each run of a test. see FinishTest()
       
   114 	TInt StartTest();
       
   115 
       
   116 	// from CTestStep 
       
   117 	TVerdict doTestStepL(); 			// Pure virtual
       
   118 	TVerdict doTestStepPostambleL();	// virtual
       
   119 	TVerdict doTestStepPreambleL();
       
   120 
       
   121 protected:
       
   122 	RTz iTimeZoneServer;
       
   123 	RFs iFileServ;
       
   124 
       
   125 private:
       
   126 	TState iState;
       
   127 	TTestCmd iTestCmd;
       
   128 	TInt iTestCondition;
       
   129 	TInt iMaxRunTestCount;				
       
   130 	TInt iTestCount;
       
   131 	TInt iMaxLeakTestCount;
       
   132 	TInt iFirstLeakIter;
       
   133 	TInt iMaxFileTestCount;
       
   134 	TInt iStartPHandleCount;
       
   135 	TInt iStartTHandleCount;
       
   136 	TBool iCheckHandles;
       
   137 
       
   138 	TInt iChecksPassed;	// accummulates the number of checks passed 
       
   139 	TInt iChecksFailed;	// accummulates the number of checks failed
       
   140 
       
   141 	CActiveScheduler* iScheduler;
       
   142 	CDSTActiveWorker* iActiveWorker;
       
   143 	RFs* iFs;							// not owned
       
   144 	};
       
   145 
       
   146 #endif
       
   147 
       
   148