CDiagTestPluginBase Class Reference

class CDiagTestPluginBase : public CActive

Diagnostics Framework Test Plugin Base Class

This class provides further simplification of test execution. It handles execution parameter and reporting results to engine

Since
S60 v5.0

Inherits from

Nested Classes and Structures

Public Member Functions
~CDiagTestPluginBase()
Protected Member Functions
CDiagTestPluginBase(CDiagPluginConstructionParam *)
IMPORT_C TBoolAreDependenciesSatisfiedL(MDiagEngineCommon &, RArray< TUid > *&)
IMPORT_C voidBaseConstructL(const TDesC &)
IMPORT_C CCoeEnv &CoeEnv()
IMPORT_C voidCompleteTestL(CDiagResultsDatabaseItem::TResult)
IMPORT_C MDiagResultDetail *CreateDetailL(const CDiagResultsDatabaseItem &)
IMPORT_C CGulIcon *CreateIconL()
IMPORT_C TAny *CustomOperationL(TUid, TAny *)
IMPORT_C TAny *CustomParam()
IMPORT_C voidDismissWaitingDialog()
IMPORT_C voidDoExecutionStopL(MDiagTestPlugin::TStopReason, CDiagResultsDatabaseItem::TResult &)
voidDoRunTestL()
voidDoStopAndCleanupL()
IMPORT_C TDiagTestExecParam &ExecutionParam()
IMPORT_C CDiagResultsDatabaseItem *ExecutionStopL(TStopReason)
IMPORT_C TAny *GetCustomL(TUid, TAny *)
IMPORT_C HBufC *GetDescriptionL()
IMPORT_C voidGetLogicalDependenciesL(CPtrCArray &)
IMPORT_C HBufC *GetTitleL()
IMPORT_C TBoolIsDependencyCheckSkipped()
IMPORT_C TBoolIsDependencyExecution()
IMPORT_C TBoolIsSupported()
IMPORT_C TUintOrder()
IMPORT_C TUidParentUid()
IMPORT_C voidReportTestProgressL(TUint)
IMPORT_C voidResetWatchdog(TDiagEngineWatchdogTypes, CDiagResultsDatabaseItem::TResult)
IMPORT_C voidResetWatchdog(TInt, CDiagResultsDatabaseItem::TResult)
IMPORT_C voidResetWatchdogToDefault()
IMPORT_C CDiagResultsDbItemBuilder &ResultsDbItemBuilder()
IMPORT_C voidResumeL()
IMPORT_C TIntRunError(TInt)
IMPORT_C voidRunTestL(TDiagTestExecParam *, TBool, TBool, TAny *)
IMPORT_C TBoolRunWaitingDialogL(CAknDialog *, TInt &)
IMPORT_C const TDesC &ServiceLogicalName()
IMPORT_C voidSetDtorIdKey(TUid)
IMPORT_C TBoolSinglePluginExecution()
IMPORT_C voidStopAndCleanupL()
IMPORT_C voidSuspendL()
IMPORT_C voidTestSessionBeginL(MDiagEngineCommon &, TBool, TAny *)
IMPORT_C voidTestSessionEndL(MDiagEngineCommon &, TBool, TAny *)
IMPORT_C TPluginTypeType()
IMPORT_C CDiagResultsDatabaseItem::TResultVerifyDependenciesL(MDiagEngineCommon &, RArray< TUid > *&)
Private Member Functions
voidBaseStopAndCleanup()
voidGetAllDependentTestsL(MDiagEngineCommon &, RPointerArray< MDiagTestPlugin > &)
CDiagResultsDatabaseItem::TResult SummarizeOverallTestResultsL(MDiagEngineCommon &, const RPointerArray< MDiagTestPlugin > &, RArray< TUid > &)
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::DoCancel()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::RunL()
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Inherited Enumerations
CActive:TPriority
Private Attributes
CCoeEnv &iCoeEnv
CDiagPluginConstructionParam *iConstructionParam
TPrivateData *iData
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CDiagTestPluginBase(CDiagPluginConstructionParam *)

IMPORT_CCDiagTestPluginBase(CDiagPluginConstructionParam *aConstructionParam)[protected]

C++ constructor

Note that BaseConstructL() must be called to complete object construction.

Parameters

CDiagPluginConstructionParam * aConstructionParamConstruction parameters.

~CDiagTestPluginBase()

IMPORT_C~CDiagTestPluginBase()[virtual]

Destructor.

Member Functions Documentation

AreDependenciesSatisfiedL(MDiagEngineCommon &, RArray< TUid > *&)

IMPORT_C TBoolAreDependenciesSatisfiedL(MDiagEngineCommon &aEngine,
RArray< TUid > *&aFailedUids
)const [protected, virtual]

Verify that all dependencies are satisfied. Also returns a list of failed dependencies.

Parameters

MDiagEngineCommon & aEngine
RArray< TUid > *& aFailedUids

BaseConstructL(const TDesC &)

IMPORT_C voidBaseConstructL(const TDesC &aResourceFileName)[protected]

2nd phase Base class constructor This initializes CDiagTestPluginBase class. Derived class must call this method in its ConstructL() method.

Parameters

const TDesC & aResourceFileNameDrive and name of resource file in format <path>:<rsc_file_name>

BaseStopAndCleanup()

voidBaseStopAndCleanup()[private]

Stop and clean up CDiagTestPluginBase

CoeEnv()

IMPORT_C CCoeEnv &CoeEnv()[protected]

CompleteTestL(CDiagResultsDatabaseItem::TResult)

IMPORT_C voidCompleteTestL(CDiagResultsDatabaseItem::TResultaResult)[protected]

Report test result to test observer. Note that this function should be called only during test execution. If called in other states, it will Panic with EDiagPluginBasePanicInvalidState

This function will also call StopAndCleanupL(), which will call DoStopAndCleanupL(). After CompleteTestL() is called, ExecutionParam() and other test state specific API will fail.

Parameters

CDiagResultsDatabaseItem::TResult aResult- Test result.

CreateDetailL(const CDiagResultsDatabaseItem &)

IMPORT_C MDiagResultDetail *CreateDetailL(const CDiagResultsDatabaseItem &aResult)const [protected, virtual]

Create test result detail. CDiagTestPluginBase::CreateDetailL

Parameters

const CDiagResultsDatabaseItem & aResult

CreateIconL()

IMPORT_C CGulIcon *CreateIconL()const [protected, virtual]

Create an icon that represents the plug-in.

CustomOperationL(TUid, TAny *)

IMPORT_C TAny *CustomOperationL(TUidaUid,
TAny *aParam
)[protected, virtual]

Reserved for future use/plugin's custom functionality.

Parameters

TUid aUidUnique identifier of the operation.
TAny * aParamCustom parameter.

CustomParam()

IMPORT_C TAny *CustomParam()const [protected]

Get custom parameter passed to from the engine Note that this function should be called only during test execution. If called in other states, it will Panic with EDiagPluginBasePanicInvalidState

DismissWaitingDialog()

IMPORT_C voidDismissWaitingDialog()[protected]

Dismiss the waiting dialog. This will cause the RunDialogLD() function to return with aIsUserResponse = Efalse. If nothing is being displayed, this function does nothing.

DoExecutionStopL(MDiagTestPlugin::TStopReason, CDiagResultsDatabaseItem::TResult &)

IMPORT_C voidDoExecutionStopL(MDiagTestPlugin::TStopReasonaReason,
CDiagResultsDatabaseItem::TResult &aTestResult
)[protected, virtual]

This is called by CDiagTestPluginBase::ExecutionStopL() to allow the derived class to provide additional behavior in ExecutionStopL(). Default implementation does nothing. For more information about how this is called, CDiagTestPluginBase::ExecutionStopL()

Parameters

MDiagTestPlugin::TStopReason aReason- Reason why ExecutionStopL() is being called.
CDiagResultsDatabaseItem::TResult & aTestResult- Test result to write to in database. This is IN/OUT parameter. By default, it contains default result based on aReason. Plug-in can provide different test result, assign new result to this variable.

DoRunTestL()

voidDoRunTestL()[protected, pure virtual]

Execute test. This is called by CDiagTestPluginBase::RunTestL() Note that CDiagTestPluginBase takes ownership of all parameters given in RunTestL() function. If specific parameter is needed use the following set of functions:

Parameters are available via the following APIs. Observer: ExecutionParam().Observer(); Engine: ExecutionParam().Engine(); Dependency Execution: IsDependencyExecution(); Skip Depdency: IsDependencyCheckSkipped(); Custom Parameter: CustomParam();

Also, a new instance of CDiagResultsDbItemBuilder is created and accessible via:

Result Db Item Builder: ResultsDbItemBuilder();

DoStopAndCleanupL()

voidDoStopAndCleanupL()[protected, pure virtual]

Stop current execution and free any data associated with the test. This is called by StopAndCleanupL

ExecutionParam()

IMPORT_C TDiagTestExecParam &ExecutionParam()[protected]

Returns execution parameter. Note that this function should be called only during test execution. If called in other states, it will Panic with EDiagPluginBasePanicInvalidState

ExecutionStopL(TStopReason)

IMPORT_C CDiagResultsDatabaseItem *ExecutionStopL(TStopReasonaReason)[protected, virtual]

Handle execution stop. MDiagTestPlugin::ExecutionStopL()This method does the following: a) Call DoExecutionStopL() b) Call StopAndCleanupL() -> Calls DoStopAndCleanupL() c) Return either EWatchdogCancel or ECancelled depending on the stop reason.

Note: If derived class wants override this function, be sure to call StopAndCleanupL() to allow proper clean up of CDiagTestPluginBase class. StopAndCleanupL() will call DoStopAndCleanupL().

DoExecutionStopL() StopAndCleanupL()

Parameters

TStopReason aReason

GetAllDependentTestsL(MDiagEngineCommon &, RPointerArray< MDiagTestPlugin > &)

voidGetAllDependentTestsL(MDiagEngineCommon &aEngine,
RPointerArray< MDiagTestPlugin > &aPluginList
)const [private]

Utility function to get all dependent test plug-ins. If suite is found, it will be expanded to test plug-ins.

Parameters

MDiagEngineCommon & aEngine
RPointerArray< MDiagTestPlugin > & aPluginList- Output array. Upon completion, it will hold list of test plug-ins. If this plug-in does not depend on any tests, it will be empty. Ownership of individual items are not trasferred, so ResetAndDestroy() must not be called.

GetCustomL(TUid, TAny *)

IMPORT_C TAny *GetCustomL(TUidaUid,
TAny *aParam
)[protected, virtual]

Reserved for future use/plugin's custom functionality.

Parameters

TUid aUidUnique identifier of the property
TAny * aParamCustom parameter.

GetDescriptionL()

IMPORT_C HBufC *GetDescriptionL()const [protected, virtual]

Get description of the plugin. Default implementation in CDiagTestPluginBase will leave with KErrNotSupported. If plug-in has a description, plug-in must override this method. MDiagPlugin::GetDescriptionL()

GetLogicalDependenciesL(CPtrCArray &)

IMPORT_C voidGetLogicalDependenciesL(CPtrCArray &aArray)const [protected, virtual]

Get logical dependencies. One plug-in can have multiple dependencies to other plug-ins.

ServiceLogicalNameL

Parameters

CPtrCArray & aArrayAn array of logical names.

GetTitleL()

IMPORT_C HBufC *GetTitleL()const [protected, virtual]

Get title of the plugin. Default implementation in CDiagTestPluginBase will leave with KErrNotSupported. If plug-in has a title, plug-ins must override this method. MDiagPlugin::GetTitleL()

IsDependencyCheckSkipped()

IMPORT_C TBoolIsDependencyCheckSkipped()const [protected]

Check if current test session has dependency check skip flag set. Note that this function should be called only during test execution. If called in other states, it will Panic with EDiagPluginBasePanicInvalidState

IsDependencyExecution()

IMPORT_C TBoolIsDependencyExecution()const [protected]

Check if current test is being executed to satisfy dependency or if it is being executed explicitly. Note that this function should be called only during test execution. If called in other states, it will Panic with EDiagPluginBasePanicInvalidState

IsSupported()

IMPORT_C TBoolIsSupported()const [protected, virtual]

Order()

IMPORT_C TUintOrder()const [protected, virtual]

Get the order number that this plug-in should appear in its parent list.

ParentUid()

IMPORT_C TUidParentUid()const [protected, virtual]

Get UID of the parent.

ReportTestProgressL(TUint)

IMPORT_C voidReportTestProgressL(TUintaCurrentStep)[protected]

Report test progress test observer. This function will call engine's TestProgressL method with watchdog type value that is based on plug-in RunMode.

If EAutomatic plug-in, it will use EDiagEngineWatchdogTypeNonInteractive. If EInteractiveView or EInteractiveDialog, EDiagEngineWatchdogTypeInteractive.

When watchdog is timed out, it will stop test with test result CDiagResultsDatabaseItem::EWatchdogCancel.

Note that this function should be called only during test execution. If called in other states, it will Panic with EDiagPluginBasePanicInvalidState

Parameters

TUint aCurrentStep- Current execution step

ResetWatchdog(TDiagEngineWatchdogTypes, CDiagResultsDatabaseItem::TResult)

IMPORT_C voidResetWatchdog(TDiagEngineWatchdogTypesaWatchdogType,
CDiagResultsDatabaseItem::TResultaResultType
)[protected]

Reset watchdog value and watchdog failure result type. When watchdog is timed out, it will use the given result type as value to report back to engine.

Note that this function should be called only during test execution. If called in other states, it will Panic with EDiagPluginBasePanicInvalidState

Parameters

TDiagEngineWatchdogTypes aWatchdogType- Type of watchdog requested.
CDiagResultsDatabaseItem::TResult aResultType- Result to report when wachdog is failed.

ResetWatchdog(TInt, CDiagResultsDatabaseItem::TResult)

IMPORT_C voidResetWatchdog(TIntaTimeToCompletion,
CDiagResultsDatabaseItem::TResultaResultType
)[protected]

Reset watchdog value and watchdog failure result type. For most plug-ins, the other ResetWatchdog should be better. This should be used only if specific time must be given for the step.

When watchdog is timed out, it will use the given result type as value to report back to engine.

Note that this function should be called only during test execution. If called in other states, it will Panic with EDiagPluginBasePanicInvalidState

Parameters

TInt aTimeToCompletion- Time needed to complete current operation. Unit is in microseconds.
CDiagResultsDatabaseItem::TResult aResultType- Result to report when wachdog is failed.

ResetWatchdogToDefault()

IMPORT_C voidResetWatchdogToDefault()[protected]

Reset watchdog value and watchdog failure result type to default values. This will also reset watchdog on engine.

Note that this function should be called only during test execution. If called in other states, it will Panic with EDiagPluginBasePanicInvalidState

ResultsDbItemBuilder()

IMPORT_C CDiagResultsDbItemBuilder &ResultsDbItemBuilder()[protected]

Get currently result db item builder. Note that this function should be called only during test execution. If called in other states, it will Panic with EDiagPluginBasePanicInvalidState

ResumeL()

IMPORT_C voidResumeL()[protected, virtual]

RunError(TInt)

IMPORT_C TIntRunError(TIntaError)[protected, virtual]

RunError. Handle leaves from test. If test is currently running, CDiagTestPluginBase will handle the error by calling CompleteTestL( CDiagResultsDatabaseItem::EFailed ). If test was not running, it will return the error back to active scheduler.

If this behavior is not desired, derived class should override this method.

For parameters and return value, CActive::RunError

Parameters

TInt aError

RunTestL(TDiagTestExecParam *, TBool, TBool, TAny *)

IMPORT_C voidRunTestL(TDiagTestExecParam *aExecParam,
TBoolaSkipDependencyCheck,
TBoolaDependencyExecution,
TAny *aCustomParams
)[protected, virtual]

Execute diagnostics test. MDiagTestPlugin::RunTestL

Parameters

TDiagTestExecParam * aExecParam
TBool aSkipDependencyCheck
TBool aDependencyExecution
TAny * aCustomParams

RunWaitingDialogL(CAknDialog *, TInt &)

IMPORT_C TBoolRunWaitingDialogL(CAknDialog *aDialog,
TInt &aDialogResponse
)[protected]

Run a dialog that waits for response. It is highly recommended that all plug-ins use this function to display dialogs since it can detect deletion of dialogs.

The difference from normal dialog RunLD is that this function returns ETrue if dialog exited due to user response and EFalse if it was by other means, such as object deletion or by DismissWaitingDialog() method.

!!!! NOTE THAT PLUG-IN MUST RETURN IMMEDIATELY WITHOUT ACCESSING !!!! !!!! LOCAL VARIABLE OR LOCAL FUNCITONS WHEN THIS FUNCTION RETURNS !!!! !!!! EFalse VALUE BECAUSE "THIS" POINTER MAY BE FREED ALREADY. !!!!

The normal dialog response is returned via aDialogResponse reference. This function can only display one dialog at a time. Calling it again while it has not been returned will cause panic.

avkon.hrh "CBA constants". E.g. EAknSoftkeyYes The only exception is that if cancel is pressed, it will be 0.

Parameters

CAknDialog * aDialog- Pointer to dialog to run. If the dialog does not have EEikDialogFlagWait flag set, it will panic with EDiagPluginBaseBadArgument
TInt & aDialogResponse- Response from the dialog. For detailed values

ServiceLogicalName()

IMPORT_C const TDesC &ServiceLogicalName()const [protected, virtual]

Get the name of the service that the plug-in provides.

SetDtorIdKey(TUid)

IMPORT_C voidSetDtorIdKey(TUidaDtorIdKey)[protected, virtual]

MDiagPlugin::SetDTorIdKey()

Parameters

TUid aDtorIdKey

SinglePluginExecution()

IMPORT_C TBoolSinglePluginExecution()const [protected]

Check if current test is being executed as a single plugin or as a part of a suite Note that this function should be called only during test execution. If called in other states, it will Panic with EDiagPluginBasePanicInvalidState

StopAndCleanupL()

IMPORT_C voidStopAndCleanupL()[protected]

Stop current execution and free any data associated with the test. This method will call DoStopAndCleanupL() function to allow derived class to clean up.

It will also call DismissWaitingDialog() and CActive::Cancel().

If derived class overrides ExecutionStopL() function, this function must be called by derived version of ExecutionStopL() to allow proper clean up of CDiagTestPluginBase.

CDiagTestPluginBase::ExecutionStopL

SummarizeOverallTestResultsL(MDiagEngineCommon &, const RPointerArray< MDiagTestPlugin > &, RArray< TUid > &)

CDiagResultsDatabaseItem::TResult SummarizeOverallTestResultsL(MDiagEngineCommon &aEngine,
const RPointerArray< MDiagTestPlugin > &aPluginList,
RArray< TUid > &aFailedUidList
)const [private]

Utility function to check results of tests in array and come up with best overall result of tests.

Parameters

MDiagEngineCommon & aEngine
const RPointerArray< MDiagTestPlugin > & aPluginList- List of test plug-ins.
RArray< TUid > & aFailedUidList- Output array. Upon completion, it will contain list of uids that failed.

SuspendL()

IMPORT_C voidSuspendL()[protected, virtual]

TestSessionBeginL(MDiagEngineCommon &, TBool, TAny *)

IMPORT_C voidTestSessionBeginL(MDiagEngineCommon &aEngine,
TBoolaSkipDependencyCheck,
TAny *aCustomParams
)[protected, virtual]

Initialization Step. This method is called before any plugin are executed. This can be used to clean up any left over data from previous execution sessions. All plug-ins in execution plan will have a chance to clean up before any plug-ins are run. This is a synchrouns method.

Parameters

MDiagEngineCommon & aEngine- Reference to engine.
TBool aSkipDependencyCheck- If ETrue, plug-in will be executed even if dependencies are not executed.
TAny * aCustomParamsCustom parameters for plug-ins. It can used to pass arbitrary data from application to the plug-ins. Owership is not transferred and plug-in must not delete this parameter.

TestSessionEndL(MDiagEngineCommon &, TBool, TAny *)

IMPORT_C voidTestSessionEndL(MDiagEngineCommon &aEngine,
TBoolaSkipDependencyCheck,
TAny *aCustomParams
)[protected, virtual]

Cleanup Step. This method is called after all plug-ins in the execution plan is completed to clean up any left over data from current sesison. This can be used to clean up any data that provides dependent service created for its dependencies. This is a synchrouns method.

Parameters

MDiagEngineCommon & aEngine- Reference to engine.
TBool aSkipDependencyCheck- If ETrue, plug-in as executed even if dependencies are not executed.
TAny * aCustomParamsCustom parameters for plug-ins. It can used to pass arbitrary data from application to the plug-ins. Owership is not transferred and plug-in must not delete this parameter.

Type()

IMPORT_C TPluginTypeType()const [protected, virtual]

Return the type of the plug-in.

TPluginType.

VerifyDependenciesL(MDiagEngineCommon &, RArray< TUid > *&)

IMPORT_C CDiagResultsDatabaseItem::TResultVerifyDependenciesL(MDiagEngineCommon &aEngine,
RArray< TUid > *&aFailedUids
)const [protected, virtual]

Check result of dependencies. This will check each dependency and determine the best overall result of all the dependencies.

Parameters

MDiagEngineCommon & aEngine
RArray< TUid > *& aFailedUids

Member Data Documentation

CCoeEnv & iCoeEnv

CCoeEnv &iCoeEnv[private]

CCoeEnv. This is needed for handling resources.

CDiagPluginConstructionParam * iConstructionParam

CDiagPluginConstructionParam *iConstructionParam[private]

Plug-in constructor parameter. Ownership: this

TPrivateData * iData

TPrivateData *iData[private]

Plug-in base's private data