installationservices/swcomponentregistry/test/tscr/inc/tscrstep.h
changeset 24 84a16765cd86
child 25 98b66e4fb0be
equal deleted inserted replaced
6:aba6b8104af3 24:84a16765cd86
       
     1 /*
       
     2 * Copyright (c) 2008-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 the License "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 * Defines the basic test step for the Software Component Registry test harness
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file 
       
    22  @internalComponent
       
    23  @test
       
    24 */
       
    25 
       
    26 #ifndef TSCRSTEP_H
       
    27 #define TSCRSTEP_H
       
    28 
       
    29 #include <scs/oomteststep.h>
       
    30 #include <usif/usifcommon.h>
       
    31 #include <usif/scr/scr.h>
       
    32 
       
    33 class CScrTestServer;
       
    34 
       
    35 // Shared operators for comparing properties
       
    36 TBool operator !=(Usif::CPropertyEntry& lhsEntry, Usif::CPropertyEntry& rhsEntry);
       
    37 TBool operator ==(Usif::CPropertyEntry& lhsEntry, Usif::CPropertyEntry& rhsEntry);
       
    38 TBool operator ==(const Usif::CComponentEntry& aLhsEntry, const Usif::CComponentEntry& aRhsEntry);
       
    39 TBool operator !=(const Usif::CComponentEntry& aLhsEntry, const Usif::CComponentEntry& aRhsEntry);
       
    40 
       
    41 class CScrTestStep : public COomTestStep
       
    42 /**
       
    43  	Base class used to provide handy functions available to test step classes.
       
    44  */
       
    45 	{
       
    46 	friend class CScrPerformanceTestStep;
       
    47 public:
       
    48 	virtual ~CScrTestStep();
       
    49 	void MarkAsPerformanceStep();
       
    50 	
       
    51 protected:
       
    52 	CScrTestStep(CScrTestServer& aParent);
       
    53 	
       
    54 	// From COomTestStep
       
    55 	void ImplTestStepPreambleL();
       
    56 	void ImplTestStepL();
       
    57 	void ImplTestStepPostambleL();
       
    58 	RScsClientBase* ClientHandle();
       
    59 	
       
    60 	// Utility Functions
       
    61 	void PrintErrorL(const TDesC& aMsg, TInt aErrNum,...);
       
    62 	
       
    63 	// Shared code for comparing properties
       
    64 	TBool ComparePropertiesL(RPointerArray<Usif::CPropertyEntry>& aFoundProperties, RPointerArray<Usif::CPropertyEntry>& aExpectedProperties);
       
    65 	static void GenerateIndexedAttributeNameL(TDes& aInitialAttributeName, TInt aIndex);
       
    66 	void CompareComponentIdsL(RArray<Usif::TComponentId>& aFoundComponents, RArray<Usif::TComponentId>& aExpectedComponents);
       
    67 	
       
    68 	// Helper functions for getting common test step attributes	
       
    69 	void AppendSharedComponentIdL(Usif::TComponentId aComponentId);
       
    70 	void GetSoftwareTypeNameL(TPtrC& aSwTypeName);
       
    71 	TBool GetGlobalIdNameL(TPtrC& aGlobalIdName);
       
    72 	Usif::CGlobalComponentId* GetGlobalComponentIdLC();
       
    73 	Usif::CGlobalComponentId* GetGlobalComponentIdLC(const TDesC& aGlobalIdName, const TDesC& aSwTypeName);
       
    74 	HBufC* GetVersionFromConfigL(const TDesC& aVersionName);
       
    75 	void GetExpectedVersionedComponentIdListL(RPointerArray<Usif::CVersionedComponentId>& aVerCompIdList);
       
    76 	TBool CompareVersionedComponentIdsL(RPointerArray<Usif::CVersionedComponentId>& aFoundVerCompIdList, RPointerArray<Usif::CVersionedComponentId>& aExpectedVerCompIdList);
       
    77 	TBool GetLocaleFromConfigL(const TDesC& aParamName, TLanguage &aLocale);
       
    78 	TBool GetLocaleFromConfigL(TLanguage &aLocale);
       
    79 	void GetFileNameFromConfigL(TPtrC& aFileName);
       
    80 	void GetFileNameListFromConfigL(RPointerArray<HBufC>& aFileList);
       
    81 	TInt GetComponentIdL();
       
    82 	void ReadAllSharedComponentIdsL(RArray<TInt>& aComponentList);
       
    83 	void GetComponentNameFromConfigL(TPtrC& aComponentName);
       
    84 	void GetVendorNameFromConfigL(TPtrC& aVendorName);
       
    85 	Usif::CComponentEntry* GetComponentEntryFromConfigLC(TBool aIsSingle=ETrue, TInt aIndex=0); 
       
    86 	void GetPropertiesFromConfigL(RPointerArray<Usif::CPropertyEntry>& aProperties, TBool aSupportLocalized=EFalse);
       
    87 	Usif::CPropertyEntry* GetPropertyFromConfigLC(TBool aIsSingle, TInt aIndex = 0, TBool aSupportLocalized=EFalse);
       
    88 	void GetComponentIdsFromConfigL(RArray<Usif::TComponentId>& aComponentIds);
       
    89 	void GetComponentLocalizablesFromConfigL(TInt aIndex, TPtrC& aName, TPtrC& aVendor, TLanguage& aLocale);
       
    90 	void GetLocalisedComponentsFromConfigL(RPointerArray<Usif::CLocalizableComponentInfo>& aComponentInfo);
       
    91 	TBool GetInstalledDrivesFromConfigL(TDriveList& aDriveList, const TDesC& aAttributeName);
       
    92 	TBool GetScomoStateFromConfigL(Usif::TScomoState& aScomoState, const TDesC& aAttributeName);
       
    93 	TInt GetSetSizeFromConfigL();
       
    94 	TBool Get64BitIntegerFromConfigL(const TDesC& aConfigKeyName, TInt64& aRetVal);
       
    95 	
       
    96 	// Read component names from config file and add a new component
       
    97 	Usif::TComponentId AddNonLocalisableComponentL();
       
    98 	
       
    99 	// Read filter properties from config file
       
   100 	Usif::CComponentFilter* ReadComponentFilterFromConfigLC();
       
   101 	void ReadFilterPropertiesL(Usif::CComponentFilter* aFilter, TInt aPropertiesCount);
       
   102 	void StartTimer();
       
   103 	
       
   104 protected:
       
   105 	CScrTestServer& iParent;
       
   106 	Usif::RSoftwareComponentRegistry iScrSession;
       
   107 
       
   108 private:
       
   109 	TInt ReadSharedComponentIdL(TInt aOffset);
       
   110 	void StopTimerAndPrintResultL();
       
   111 	void PrintPerformanceLog(TTime aTime);
       
   112 
       
   113 protected:
       
   114 	// For plugin management test cases, the time is measured externally because they are performed via another accessor server (scr accessor).
       
   115 	// The actual test time is measured on the scr accessor server side and returned to the test code.
       
   116 	TInt iTimeMeasuredExternally;
       
   117 	
       
   118 private:
       
   119 	TBool iIsPerformanceTest;
       
   120 	TTime iStartTime;
       
   121 	};
       
   122 
       
   123 #endif /* TSCRSTEP_H */