|
1 // Copyright (c) 2005-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 #include "TestImpExvCardSuiteServer.h" |
|
17 #include "TestImpRevLocalTZ.h" |
|
18 #include "TestImpRevLocal.h" |
|
19 #include "TestImpNoRev.h" |
|
20 #include "TestImpRevUTC.h" |
|
21 #include "TestImpBDay.h" |
|
22 #include "TestImpNoBDay.h" |
|
23 #include "TestImpOOM.h" |
|
24 #include "TestExRevUTC.h" |
|
25 #include "TestExBDayLocal.h" |
|
26 #include "TestExNoBDay.h" |
|
27 #include "TestImpExvCardSuiteDefs.h" |
|
28 #include "TestExportContactStep.h" |
|
29 #include "TestImportContactInsertModeStep.h" |
|
30 #include "TestImportContactMergeModeStep.h" |
|
31 #include "TestContactsPBAPExport.h" |
|
32 #include "TestCompareCntFiles.h" |
|
33 #include "TestContactOperations.h" |
|
34 #include "TestContactsPBAPExportPerformance.h" |
|
35 #include "TestContactsPBAPExportContents.h" |
|
36 #include "TestGenericImportStep.h" |
|
37 |
|
38 _LIT(KServerName,"TestImpExvCardSuite"); |
|
39 CTestImpExvCardSuite* CTestImpExvCardSuite::NewL() |
|
40 /** |
|
41 * @return - Instance of the test server |
|
42 * Same code for Secure and non-secure variants |
|
43 * Called inside the MainL() function to create and start the |
|
44 * CTestServer derived server. |
|
45 */ |
|
46 { |
|
47 CTestImpExvCardSuite * server = new (ELeave) CTestImpExvCardSuite(); |
|
48 CleanupStack::PushL(server); |
|
49 // CServer base class call which can be either StartL or ConstructL, |
|
50 // the later will permit Server Logging. |
|
51 |
|
52 server->StartL(KServerName); |
|
53 CleanupStack::Pop(server); |
|
54 return server; |
|
55 } |
|
56 |
|
57 // Secure variants much simpler |
|
58 // For EKA2, just an E32Main and a MainL() |
|
59 LOCAL_C void MainL() |
|
60 /** |
|
61 * Secure variant |
|
62 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
63 */ |
|
64 { |
|
65 // Leave the hooks in for platform security |
|
66 #if (defined __DATA_CAGING__) |
|
67 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
68 RProcess().DataCaging(RProcess::ESecureApiOn); |
|
69 #endif |
|
70 CActiveScheduler* sched = NULL; |
|
71 sched = new(ELeave) CActiveScheduler; |
|
72 CActiveScheduler::Install(sched); |
|
73 CTestImpExvCardSuite* server = NULL; |
|
74 // Create the CTestServer derived server |
|
75 TRAPD(err,server = CTestImpExvCardSuite::NewL()); |
|
76 if(!err) |
|
77 { |
|
78 RProcess::Rendezvous(KErrNone); |
|
79 sched->Start(); |
|
80 } |
|
81 |
|
82 delete server; |
|
83 delete sched; |
|
84 } |
|
85 |
|
86 GLDEF_C TInt E32Main() |
|
87 /** |
|
88 * @return - Standard Epoc error code on process exit |
|
89 * Secure variant only |
|
90 * Process entry point. Called by client using RProcess API |
|
91 */ |
|
92 { |
|
93 __UHEAP_MARK; |
|
94 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
95 if(cleanup == NULL) |
|
96 { |
|
97 return KErrNoMemory; |
|
98 } |
|
99 TRAP_IGNORE(MainL()); |
|
100 delete cleanup; |
|
101 __UHEAP_MARKEND; |
|
102 return KErrNone; |
|
103 } |
|
104 |
|
105 CTestStep* CTestImpExvCardSuite::CreateTestStep(const TDesC& aStepName) |
|
106 /** |
|
107 * @return - A CTestStep derived instance |
|
108 * Secure and non-secure variants |
|
109 * Implementation of CTestServer pure virtual |
|
110 */ |
|
111 { |
|
112 CTestStep* testStep = NULL; |
|
113 // They are created "just in time" when the worker thread is created |
|
114 // More test steps can be added below |
|
115 if(aStepName == KTestImpRevLocalTZ) |
|
116 { |
|
117 testStep = new CTestImpRevLocalTZ(); |
|
118 } |
|
119 else if (aStepName == KTestImpRevLocal) |
|
120 { |
|
121 testStep = new CTestImpRevLocal(); |
|
122 } |
|
123 else if (aStepName == KTestImpNoRev) |
|
124 { |
|
125 testStep = new CTestImpNoRev(); |
|
126 } |
|
127 else if (aStepName == KTestImpRevUTC) |
|
128 { |
|
129 testStep = new CTestImpRevUTC(); |
|
130 } |
|
131 else if (aStepName == KTestImpBDay) |
|
132 { |
|
133 testStep = new CTestImpBDay(); |
|
134 } |
|
135 else if (aStepName == KTestImpNoBDay) |
|
136 { |
|
137 testStep = new CTestImpNoBDay(); |
|
138 } |
|
139 else if (aStepName == KTestExRevUTC) |
|
140 { |
|
141 testStep = new CTestExRevUTC(); |
|
142 } |
|
143 else if (aStepName == KTestExBDayLocal) |
|
144 { |
|
145 testStep = new CTestExBDayLocal(); |
|
146 } |
|
147 else if (aStepName == KTestExNoBDay) |
|
148 { |
|
149 testStep = new CTestExNoBDay(); |
|
150 } |
|
151 else if (aStepName == KTestExportContactStep) |
|
152 { |
|
153 testStep = new CTestExportContactStep(); |
|
154 } |
|
155 else if (aStepName == KTestImportContactInsertModeStep) |
|
156 { |
|
157 testStep = new CTestImportContactInsertModeStep(); |
|
158 } |
|
159 else if (aStepName == KTestImportContactMergeModeStep) |
|
160 { |
|
161 testStep = new CTestImportContactMergeModeStep(); |
|
162 } |
|
163 else if (aStepName == KTestImpOOM) |
|
164 { |
|
165 testStep = new CTestImpOOM(); |
|
166 } |
|
167 else if (aStepName == KTestGenericImportStep) |
|
168 { |
|
169 testStep = new CTestGenericImportStep(); |
|
170 } |
|
171 else if (aStepName == KTestContactsPBAPExport) |
|
172 { |
|
173 testStep = new CTestContactsPBAPExport(); |
|
174 } |
|
175 else if (aStepName == KTestCompareCntFiles) |
|
176 { |
|
177 testStep = new CTestCompareCntFiles(); |
|
178 } |
|
179 else if (aStepName == KTestContactOperations) |
|
180 { |
|
181 testStep = new CTestContactOperations(); |
|
182 } |
|
183 else if (aStepName == KTestContactsPBAPExportContents) |
|
184 { |
|
185 testStep = new CTestContactsPBAPExportContents(); |
|
186 } |
|
187 else if (aStepName == KTestContactsPBAPExportPerformance) |
|
188 { |
|
189 testStep = new CTestContactsPBAPExportPerformance(); |
|
190 } |
|
191 return testStep; |
|
192 } |