phonebookengines/contactsmodel/tsrc/Integration/CntPerfTest/inc/TestContactViewAccessStep.h
changeset 0 e686773b3f54
child 24 0ba2181d7c28
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /**
       
     2 * Copyright (c) 2007-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 * The test step to construct the views and access the view Api's like CountL(), AtL(), 
       
    16 * ContactAtL(), FindL(), SortOrder(), ViewPreferences(), AllFieldsLC(), RefineFindView(), 
       
    17 * GetContactsMatchingCriteria() and GetContactsMatchingPrefix() based on the variable set
       
    18 * in the ini file. 
       
    19 * Verify and Validate the values returned by the view API's
       
    20 * 
       
    21 *
       
    22 */
       
    23 
       
    24 
       
    25  
       
    26 #ifndef TEST_CONTACT_VIEW_ACCESS_STEP_H
       
    27 #define TEST_CONTACT_VIEW_ACCESS_STEP_H
       
    28 
       
    29 // System Includes
       
    30 #include <test/testexecutestepbase.h>
       
    31 #include <cntdef.h>
       
    32 #include <cntviewbase.h>
       
    33 #include <cntdb.h>
       
    34 #include <e32property.h>
       
    35 #include <connect/sbeclient.h>
       
    36 
       
    37 // User Includes
       
    38 #include "CntPerfServer.h"
       
    39 #include "ClientServer.h"
       
    40 #include "ContactUtilitiesCollection.h"
       
    41 
       
    42 _LIT(KViewAccessList,				"viewaccesslist");
       
    43 _LIT(KTestAtLAPI,					"testatlapi");
       
    44 _LIT(KTestContactAtLAPI,			"testcontactatlapi");
       
    45 _LIT(KTestCountLAPI,				"testcountlapi");
       
    46 _LIT(KTestAllFieldsAPI,				"testallfieldslapi");
       
    47 _LIT(KTestFindLAPI,					"testfindlapi");
       
    48 _LIT(KTestSortOrder,				"testsortorder");
       
    49 _LIT(KTestViewPreferences,			"testviewpreferences");
       
    50 _LIT(KTestContactsMatchingCriteria,	"testcontactsmatchingcriteria");
       
    51 _LIT(KTestContactsMatchingPrefix,	"testcontactsmatchingprefix");
       
    52 _LIT(KTestSearchContactId,			"testsearchcontactid");
       
    53 _LIT(KTestContactssortorderchange,	"testContactssortorderchange");
       
    54 _LIT(KRefineFindView,				"refinefindview");
       
    55 _LIT(KFindWords,					"findwords");
       
    56 _LIT(KSortOrder,					"sortorder");
       
    57 _LIT(KErrorCondition,				"errorcondition");
       
    58 _LIT(KInfoContactFields,			"Contact fields %S");
       
    59 _LIT(KInvalidData,					"invaliddata");
       
    60 
       
    61 
       
    62 /**
       
    63  * This class supports performing Backup and Restore operations.  
       
    64  */	
       
    65 class CBackupRestoreHelper : public CBase
       
    66 	{
       
    67 public:
       
    68 	static CBackupRestoreHelper* NewL(CTestStep& aTestStep);
       
    69 	~CBackupRestoreHelper();
       
    70 
       
    71 	/* Backup and Restore related tests */
       
    72 	void  StartBackupL();
       
    73 	void  EndBackupL();
       
    74 	void  StartRestoreL();
       
    75 	void  EndRestoreL();
       
    76 
       
    77 	/* General utility Functions */
       
    78 	void Validate(const TBool& aValid);
       
    79 	void Validate(const TInt& aDesiredResult,  const TInt& aActualResult);
       
    80 	CTestStep& BaseTestStepReference();
       
    81 
       
    82 private:
       
    83 	CBackupRestoreHelper(CTestStep& aTestStep);
       
    84 	void ConstructL();
       
    85 
       
    86 private:
       
    87 	TDriveList 			iDriveList;
       
    88 	conn::CSBEClient* 	iBackupClient;
       
    89 	CTestStep& 			iBaseTestStep;
       
    90 	RFs					iFs;
       
    91 	};
       
    92 	
       
    93 /**
       
    94  * The test step class is used to construct the views and access the view Api's like CountL(), AtL(), 
       
    95  * ContactAtL(), FindL(), SortOrder(), ViewPreferences(), AllFieldsLC(), RefineFindView(), 
       
    96  * GetContactsMatchingCriteria() and GetContactsMatchingPrefix() based on the variable set
       
    97  * in the ini file. 
       
    98  */			
       
    99 class CTestContactViewAccessStep : public CTestStep
       
   100 	{
       
   101 public:
       
   102 	CTestContactViewAccessStep();
       
   103 	~CTestContactViewAccessStep();
       
   104 
       
   105 	// from CTestStep
       
   106 	TVerdict	doTestStepPreambleL();
       
   107 	TVerdict	doTestStepL();
       
   108 	TVerdict	doTestStepPostambleL();
       
   109 
       
   110 private:
       
   111 	void	CreateUtilityClassL();
       
   112 	void	TestViewAPIsL(const RArray<TPtrC>& aSection);
       
   113 	void	TestContactViewAtL(const TPtrC& aSection, CContactViewBase* aView);
       
   114 	void	TestContactAtL(const TPtrC& aSection, CContactViewBase* aView);
       
   115 	void	TestCountL(const TPtrC& aSection, CContactViewBase* aView);
       
   116 	void	TestFindL(const TPtrC& aSection, CContactViewBase* aView);
       
   117 	void	TestContactFieldsL(const TPtrC& aSection, CContactViewBase* aView);
       
   118 	void	TestContactViewPreferencesL(const TPtrC& aSection, CContactViewBase* aView);
       
   119 	void	TestSortOrderL(const TPtrC& aSection, CContactViewBase* aView);
       
   120 	CContactDatabase* CreateAndOpenDataBaseL(const TPtrC& aDbName, TBool aCreateDataBase = EFalse);
       
   121 	CContactDatabase& DatabaseReference();
       
   122 	CContactViewCollection& ViewCollectionReference();
       
   123 
       
   124 	void 	AccessViewsL();
       
   125 	
       
   126 	void 	TestViewsUnderBackupRestoreL();	
       
   127 	void 	InitateBackupL();
       
   128 	void 	StopBackupL();
       
   129 	void 	InitiateRestoreL();
       
   130 	void 	StopRestoreL();	
       
   131 	
       
   132 private:
       
   133 	CContactUtilitiesCollection* iContactUtility;
       
   134 	CContactDatabase* iCntDb;
       
   135 	CContactViewApiTest* iContactViewTest;
       
   136 	CContactViewValidation* iViewValidation;
       
   137 	CActiveScheduler*	iActiveScheduler;
       
   138 	CContactViewCollection* iViewCollection;
       
   139 	CBackupRestoreHelper* iBackupHelper;
       
   140 	TPtrC	iDbName;
       
   141 	};
       
   142 
       
   143 _LIT(KTestContactViewAccessStep, "TestContactViewAccessStep");
       
   144 
       
   145 #endif