|
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 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __TEST_CONTACTVIEW_CRUD_OPERATIONS_H__ |
|
21 #define __TEST_CONTACTVIEW_CRUD_OPERATIONS_H__ |
|
22 |
|
23 // System Includes |
|
24 #include <test/testexecutestepbase.h> |
|
25 #include <cntdb.h> |
|
26 #include <cntitem.h> |
|
27 #include <cntviewbase.h> |
|
28 #include <cntfldst.h> |
|
29 #include <cntfilt.h> |
|
30 #include <e32math.h> |
|
31 |
|
32 // User Includes |
|
33 #include "ContactUtilitiesCollection.h" |
|
34 #include "ClientServer.h" |
|
35 #include "AddModifyDeleteContactFields.h" |
|
36 #include "TestContactViewDatabaseUtilitiesStep.h" |
|
37 #include "ContactViewsThread.h" |
|
38 |
|
39 |
|
40 // Literals |
|
41 _LIT(KTestContactViewCRUDOperationsStep, "TestContactViewCRUDOperationsStep"); |
|
42 _LIT(KViewConstructionOperations, "ViewConstructionOperations"); |
|
43 _LIT(KAddContactOperations, "AddContactOperations"); |
|
44 _LIT(KRemoveContactsOperations, "RemoveContactsOperations"); |
|
45 _LIT(KUpdateContactOperations, "UpdateContactOperations"); |
|
46 _LIT(KSortOrderChangeOperations, "SortOrderChangeOperations"); |
|
47 _LIT(KServerRelatedOperations, "ServerRelatedOperations"); |
|
48 _LIT(KGroupChangedOperations, "GroupChangedOperations"); |
|
49 |
|
50 /** |
|
51 * This Test Step supports testing of contact views behaviour when CRUD operations are performed on the |
|
52 * contacts database. A seperate contact views thread is launched and contact views are created in the bew thread |
|
53 * CRUD operations are perfomed in the main thread and the contact view count and notifications are |
|
54 * validated in the Contact Views Thread |
|
55 */ |
|
56 class CTestContactViewCRUDOperationsStep : public CTestContactViewDatabaseUtilitiesStep, public TAddModifyDeleteContactFields |
|
57 { |
|
58 public: |
|
59 CTestContactViewCRUDOperationsStep(); |
|
60 ~CTestContactViewCRUDOperationsStep(); |
|
61 |
|
62 TVerdict doTestStepPreambleL(); |
|
63 TVerdict doTestStepL(); |
|
64 TVerdict doTestStepPostambleL(); |
|
65 |
|
66 void LaunchContactViewsThreadL(); |
|
67 void ResumeContactViewsThreadL(); |
|
68 |
|
69 void CreateContactItemsL(); |
|
70 void UpdateContactItemsL(); |
|
71 void RemoveContactItemsL(); |
|
72 void DeleteContactCardsL(); |
|
73 void DeleteContactGroupsL(); |
|
74 |
|
75 |
|
76 |
|
77 void AddContactEntriesL(); |
|
78 void AddContactFieldL(CContactItem& aContact, const RContactViewSortOrder& aSortOrder); |
|
79 void AddFieldsSpecificToFilterL(CContactItem& aContact); |
|
80 void AddMatchingStringToContactL(CContactItem& aContact); |
|
81 void UpdateContactEntriesL(); |
|
82 void SetExecutionCompleted(); |
|
83 void SetCurrentOperation (TPtrC aCurrentOperation); |
|
84 CContactDatabase* CreateAndOpenDataBaseL(const TPtrC& aDbName, TBool aCreateDataBase = EFalse); |
|
85 void IterateThroAllGroupSectionsAndUpdateContactL(const TPtrC& aGroupSection, CContactCard& aContact); |
|
86 void DeleteContactsInGroupL(const TInt aNumberOfContactsToBeUpdated, const TPtrC& aGroupSection); |
|
87 void UpdateContactsInGroupL(const TInt aNumberOfContactsToBeUpdated, const TPtrC& aGroupSection); |
|
88 |
|
89 |
|
90 |
|
91 private: |
|
92 RThread iThread; |
|
93 TBool* iExecutionCompleted; |
|
94 RSemaphore iSemaphore; |
|
95 TPtrC* iCurrentOperation; |
|
96 RChunk iChunk; |
|
97 }; |
|
98 |
|
99 #endif |