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
Public Member Functions | |
---|---|
~CDiagTestPluginBase () |
Private Member Functions | |
---|---|
void | BaseStopAndCleanup () |
void | GetAllDependentTestsL (MDiagEngineCommon &, RPointerArray < MDiagTestPlugin > &) |
CDiagResultsDatabaseItem::TResult | SummarizeOverallTestResultsL (MDiagEngineCommon &, const RPointerArray < MDiagTestPlugin > &, RArray < TUid > &) |
Inherited Enumerations | |
---|---|
CActive:TPriority |
Private Attributes | |
---|---|
CCoeEnv & | iCoeEnv |
CDiagPluginConstructionParam * | iConstructionParam |
TPrivateData * | iData |
Inherited Attributes | |
---|---|
CActive::iStatus |
IMPORT_C | CDiagTestPluginBase | ( | CDiagPluginConstructionParam * | aConstructionParam | ) | [protected] |
C++ constructor
Note that BaseConstructL() must be called to complete object construction.
CDiagPluginConstructionParam * aConstructionParam | Construction parameters. |
IMPORT_C TBool | AreDependenciesSatisfiedL | ( | MDiagEngineCommon & | aEngine, |
RArray < TUid > *& | aFailedUids | |||
) | const [protected, virtual] |
Verify that all dependencies are satisfied. Also returns a list of failed dependencies.
IMPORT_C void | BaseConstructL | ( | const TDesC & | aResourceFileName | ) | [protected] |
2nd phase Base class constructor This initializes CDiagTestPluginBase class. Derived class must call this method in its ConstructL() method.
const TDesC & aResourceFileName | Drive and name of resource file in format <path>:<rsc_file_name> |
IMPORT_C void | CompleteTestL | ( | CDiagResultsDatabaseItem::TResult | aResult | ) | [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.
CDiagResultsDatabaseItem::TResult aResult | - Test result. |
IMPORT_C MDiagResultDetail * | CreateDetailL | ( | const CDiagResultsDatabaseItem & | aResult | ) | const [protected, virtual] |
Create test result detail. CDiagTestPluginBase::CreateDetailL
const CDiagResultsDatabaseItem & aResult |
IMPORT_C CGulIcon * | CreateIconL | ( | ) | const [protected, virtual] |
Create an icon that represents the plug-in.
IMPORT_C TAny * | CustomOperationL | ( | TUid | aUid, |
TAny * | aParam | |||
) | [protected, virtual] |
Reserved for future use/plugin's custom functionality.
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
IMPORT_C void | DismissWaitingDialog | ( | ) | [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.
IMPORT_C void | DoExecutionStopL | ( | MDiagTestPlugin::TStopReason | aReason, |
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()
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. |
void | DoRunTestL | ( | ) | [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() ;
void | DoStopAndCleanupL | ( | ) | [protected, pure virtual] |
Stop current execution and free any data associated with the test. This is called by StopAndCleanupL
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
IMPORT_C CDiagResultsDatabaseItem * | ExecutionStopL | ( | TStopReason | aReason | ) | [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() .
TStopReason aReason |
void | GetAllDependentTestsL | ( | 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.
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. |
IMPORT_C TAny * | GetCustomL | ( | TUid | aUid, |
TAny * | aParam | |||
) | [protected, virtual] |
Reserved for future use/plugin's custom functionality.
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()
IMPORT_C void | GetLogicalDependenciesL | ( | CPtrCArray & | aArray | ) | const [protected, virtual] |
Get logical dependencies. One plug-in can have multiple dependencies to other plug-ins.
ServiceLogicalNameL
CPtrCArray & aArray | An array of logical names. |
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()
IMPORT_C TBool | IsDependencyCheckSkipped | ( | ) | 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
IMPORT_C TBool | IsDependencyExecution | ( | ) | 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
IMPORT_C TUint | Order | ( | ) | const [protected, virtual] |
Get the order number that this plug-in should appear in its parent list.
IMPORT_C void | ReportTestProgressL | ( | TUint | aCurrentStep | ) | [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
TUint aCurrentStep | - Current execution step |
IMPORT_C void | ResetWatchdog | ( | TDiagEngineWatchdogTypes | aWatchdogType, |
CDiagResultsDatabaseItem::TResult | aResultType | |||
) | [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
TDiagEngineWatchdogTypes aWatchdogType | - Type of watchdog requested. |
CDiagResultsDatabaseItem::TResult aResultType | - Result to report when wachdog is failed. |
IMPORT_C void | ResetWatchdog | ( | TInt | aTimeToCompletion, |
CDiagResultsDatabaseItem::TResult | aResultType | |||
) | [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
TInt aTimeToCompletion | - Time needed to complete current operation. Unit is in microseconds. |
CDiagResultsDatabaseItem::TResult aResultType | - Result to report when wachdog is failed. |
IMPORT_C void | ResetWatchdogToDefault | ( | ) | [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
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
IMPORT_C TInt | RunError | ( | TInt | aError | ) | [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
TInt aError |
IMPORT_C void | RunTestL | ( | TDiagTestExecParam * | aExecParam, |
TBool | aSkipDependencyCheck, | |||
TBool | aDependencyExecution, | |||
TAny * | aCustomParams | |||
) | [protected, virtual] |
Execute diagnostics test. MDiagTestPlugin::RunTestL
IMPORT_C TBool | RunWaitingDialogL | ( | 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.
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 |
IMPORT_C const TDesC & | ServiceLogicalName | ( | ) | const [protected, virtual] |
Get the name of the service that the plug-in provides.
IMPORT_C void | SetDtorIdKey | ( | TUid | aDtorIdKey | ) | [protected, virtual] |
MDiagPlugin::SetDTorIdKey()
TUid aDtorIdKey |
IMPORT_C TBool | SinglePluginExecution | ( | ) | 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
IMPORT_C void | StopAndCleanupL | ( | ) | [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 .
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.
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. |
IMPORT_C void | TestSessionBeginL | ( | MDiagEngineCommon & | aEngine, |
TBool | aSkipDependencyCheck, | |||
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.
MDiagEngineCommon & aEngine | - Reference to engine. |
TBool aSkipDependencyCheck | - If ETrue, plug-in will be executed even if dependencies are not executed. |
TAny * aCustomParams | Custom 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. |
IMPORT_C void | TestSessionEndL | ( | MDiagEngineCommon & | aEngine, |
TBool | aSkipDependencyCheck, | |||
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.
MDiagEngineCommon & aEngine | - Reference to engine. |
TBool aSkipDependencyCheck | - If ETrue, plug-in as executed even if dependencies are not executed. |
TAny * aCustomParams | Custom 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. |
IMPORT_C TPluginType | Type | ( | ) | const [protected, virtual] |
Return the type of the plug-in.
TPluginType.
IMPORT_C CDiagResultsDatabaseItem::TResult | VerifyDependenciesL | ( | 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.
CDiagPluginConstructionParam * | iConstructionParam | [private] |
Plug-in constructor parameter. Ownership: this
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.