|
1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef _TE_SYNCSUITE_H_ |
|
23 #define _TE_SYNCSUITE_H_ |
|
24 |
|
25 |
|
26 #include "f32file.h" |
|
27 #include "c32comm.h" |
|
28 |
|
29 #include <e32base.h> |
|
30 #include <e32test.h> |
|
31 #include <phbksync.h> |
|
32 #include <cntdb.h> |
|
33 #include <cntdef.h> |
|
34 #include <etelmm.h> |
|
35 #include <simtsy.h> |
|
36 #include <connect/sbeclient.h> |
|
37 #include <testconfigfileparser.h> |
|
38 #include <test/testexecuteserverbase.h> |
|
39 |
|
40 using namespace conn; |
|
41 |
|
42 |
|
43 _LIT(KNameFormat,"AAAAAAAAAAAAAAAAA%03d"); |
|
44 _LIT(KNumberFormat,"00000000000000000%03d"); |
|
45 _LIT(KModifiedName,"ABC"); |
|
46 _LIT(KTestName,"Name"); |
|
47 _LIT(KTestNumber,"02079460099"); |
|
48 |
|
49 |
|
50 // |
|
51 // Test macros |
|
52 // |
|
53 _LIT(KTestCheckFailText, "Failed: Got %d while expecting %d."); |
|
54 _LIT(KTestCheckConditionFailText, "Failed: Condition was false."); |
|
55 _LIT(KTestCheckStringFailText, "Failed: Got \"%S\" while expecting \"%S\"."); |
|
56 |
|
57 #define TESTCHECKL(a, b) \ |
|
58 { \ |
|
59 if((a)!=(b)) \ |
|
60 { \ |
|
61 INFO_PRINTF3(KTestCheckFailText, a, b); \ |
|
62 SetTestStepResult(EFail); \ |
|
63 User::Leave(EFail); \ |
|
64 } \ |
|
65 } |
|
66 |
|
67 #define TESTCHECKCONDITIONL(a) \ |
|
68 { \ |
|
69 if (!(a)) \ |
|
70 { \ |
|
71 INFO_PRINTF1(KTestCheckConditionFailText); \ |
|
72 SetTestStepResult(EFail); \ |
|
73 User::Leave(EFail); \ |
|
74 } \ |
|
75 } |
|
76 |
|
77 #define TESTCHECKSTRL(a, b) \ |
|
78 { \ |
|
79 if((a)!=(b)) \ |
|
80 { \ |
|
81 INFO_PRINTF3(KTestCheckStringFailText, &(a), &(b)); \ |
|
82 SetTestStepResult(EFail); \ |
|
83 User::Leave(EFail); \ |
|
84 } \ |
|
85 } |
|
86 |
|
87 #define TESTCHECK(a, b) \ |
|
88 { \ |
|
89 if((a)!=(b)) \ |
|
90 { \ |
|
91 INFO_PRINTF3(KTestCheckFailText, a, b); \ |
|
92 SetTestStepResult(EFail); \ |
|
93 } \ |
|
94 } |
|
95 |
|
96 #define TESTCHECKCONDITION(a) \ |
|
97 { \ |
|
98 if (!(a)) \ |
|
99 { \ |
|
100 INFO_PRINTF1(KTestCheckConditionFailText); \ |
|
101 SetTestStepResult(EFail); \ |
|
102 } \ |
|
103 } |
|
104 |
|
105 #define TESTCHECKSTR(a, b) \ |
|
106 { \ |
|
107 if((a)!=(b)) \ |
|
108 { \ |
|
109 INFO_PRINTF3(KTestCheckStringFailText, &(a), &(b)); \ |
|
110 SetTestStepResult(EFail); \ |
|
111 } \ |
|
112 } |
|
113 |
|
114 |
|
115 class CSyncTestStep : public CTestStep |
|
116 { |
|
117 public: |
|
118 class TContactICCEntry |
|
119 /** |
|
120 * This class is used to store the contacts phonebook data (supplied in CContactICCEntry) |
|
121 * in the Phonebook Server internal format. |
|
122 */ |
|
123 { |
|
124 public: |
|
125 TContactICCEntry(); |
|
126 void Reset(); |
|
127 public: |
|
128 enum |
|
129 { |
|
130 KMaxPhBkNameSize=241 |
|
131 }; |
|
132 |
|
133 TBuf16<KMaxPhBkNameSize> iName; |
|
134 TBuf16<RMobilePhone::KMaxMobileTelNumberSize> iNumber; |
|
135 TInt iSlotNum; |
|
136 RMobilePhone::TMobileTON iTON; |
|
137 TContactItemId iContactUID; |
|
138 }; |
|
139 |
|
140 typedef TPckg<TContactICCEntry> TContactICCEntryPckg; |
|
141 |
|
142 public: |
|
143 virtual TVerdict doTestStepPreambleL(); |
|
144 virtual TVerdict doTestStepPostambleL(); |
|
145 |
|
146 void WriteContactToICCL(TContactICCEntry& iccEntry, TRequestStatus& aStatus); |
|
147 void AddTextFieldToIccContactL(TStorageType aType, TFieldType aFieldType, TUid aMapping, TDesC& aField, CContactICCEntry* aIccEntry); |
|
148 TContactItemId GetValidUIDFromContactsDbL(); |
|
149 |
|
150 void ConfigurePhbkSyncToIdleL(); |
|
151 void ConfigurePhbkSyncToFullL(); |
|
152 |
|
153 public: |
|
154 RPhoneBookSession iSession; |
|
155 |
|
156 private: |
|
157 CActiveScheduler* iScheduler; |
|
158 CSBEClient* iSecureBackupEngine; |
|
159 }; |
|
160 |
|
161 |
|
162 #endif |