|
1 // Copyright (c) 2006-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 @publishedAll |
|
19 @released |
|
20 */ |
|
21 |
|
22 #include "CntPerfServer.h" |
|
23 #include "ClientServer.h" |
|
24 #include "CustomLabelUid.h" |
|
25 #include "UnifiedSingular.h" |
|
26 #include "ViewDefAllFieldsTest.h" |
|
27 #include "SimpleViewDefTests.h" |
|
28 #include "ViewDefAnyFieldsTest.h" |
|
29 #include "ViewDefCustomFieldsTest.h" |
|
30 #include "CustomTemplateTest.h" |
|
31 #include "AccessCountTests.h" |
|
32 #include "ContactViewTest.h" |
|
33 #include "CContactViewEventQueue.h" |
|
34 #include "ContactUtilitiesCollection.h" |
|
35 #include "TestContactViewAccessStep.h" |
|
36 #include "PrepareDataTestStep.h" |
|
37 #include "TestContactViewUnderLyingViewUpdateStep.h" |
|
38 #include "TestContactViewCRUDOperationsStep.h" |
|
39 |
|
40 |
|
41 |
|
42 CCntPerfServer* CCntPerfServer::NewL() |
|
43 /** |
|
44 * @return - Instance of the test server |
|
45 * Called inside the MainL() function to create and start the |
|
46 * CTestServer derived server. |
|
47 */ |
|
48 { |
|
49 CCntPerfServer * server = new (ELeave) CCntPerfServer(); |
|
50 CleanupStack::PushL(server); |
|
51 |
|
52 // Either use a StartL or ConstructL, the latter will permit |
|
53 // Server Logging. |
|
54 TParsePtrC serverName(RProcess().FileName()); |
|
55 server->ConstructL( serverName.Name() ); |
|
56 CleanupStack::Pop(server); |
|
57 return server; |
|
58 } |
|
59 |
|
60 LOCAL_C void MainL() |
|
61 /** |
|
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().SecureApi(RProcess::ESecureApiOn); |
|
69 #endif |
|
70 CActiveScheduler* sched=NULL; |
|
71 sched=new(ELeave) CActiveScheduler; |
|
72 CActiveScheduler::Install(sched); |
|
73 CCntPerfServer* server = NULL; |
|
74 // Create the CTestServer derived server |
|
75 TRAPD(err,server = CCntPerfServer::NewL()); |
|
76 if(!err) |
|
77 { |
|
78 // Sync with the client and enter the active scheduler |
|
79 RProcess::Rendezvous(KErrNone); |
|
80 sched->Start(); |
|
81 } |
|
82 delete server; |
|
83 delete sched; |
|
84 } |
|
85 |
|
86 GLDEF_C TInt E32Main() |
|
87 /** |
|
88 * @return - Standard Epoc error code on exit |
|
89 */ |
|
90 { |
|
91 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
92 if(cleanup == NULL) |
|
93 { |
|
94 return KErrNoMemory; |
|
95 } |
|
96 TRAPD(err,MainL()); |
|
97 delete cleanup; |
|
98 return err; |
|
99 } |
|
100 |
|
101 CTestStep* CCntPerfServer::CreateTestStep(const TDesC& aStepName) |
|
102 /** |
|
103 * @return - A CTestStep derived instance |
|
104 * Implementation of CTestServer pure virtual |
|
105 */ |
|
106 { |
|
107 CTestStep* testStep = NULL; |
|
108 |
|
109 if(aStepName == SharedConstants::KCustomLabelUid) |
|
110 { |
|
111 testStep = new CCustomLabelUid(); |
|
112 } |
|
113 else if(aStepName == SharedConstants::KUnifiedSingular) |
|
114 { |
|
115 testStep = new CUnifiedSingular(); |
|
116 } |
|
117 else if(aStepName == SharedConstants::KViewDefAllFieldsTest) |
|
118 { |
|
119 testStep = new CViewDefAllFieldsTest(); |
|
120 } |
|
121 else if(aStepName == SharedConstants::KSimpleViewDefTest) |
|
122 { |
|
123 testStep = new CSimpleViewDefTest(); |
|
124 } |
|
125 else if(aStepName == SharedConstants::KViewDefAnyFieldsTest) |
|
126 { |
|
127 testStep = new CViewDefAnyFieldsTest(); |
|
128 } |
|
129 else if(aStepName == SharedConstants::KViewDefCustomFieldsTest) |
|
130 { |
|
131 testStep = new CViewDefCustomFieldsTest(); |
|
132 } |
|
133 else if(aStepName == SharedConstants::KCustomTemplateTest) |
|
134 { |
|
135 testStep = new CCustomTemplateTest(); |
|
136 } |
|
137 else if(aStepName == SharedConstants::KAccessCountTests) |
|
138 { |
|
139 testStep = new CAccessCountTests( *this ); |
|
140 } |
|
141 else if(aStepName == SharedConstants::KContactViewTest) |
|
142 { |
|
143 testStep = new CContactViewTest(*this); |
|
144 } |
|
145 else if(aStepName == KTestContactViewAccessStep) |
|
146 { |
|
147 testStep = new CTestContactViewAccessStep(); |
|
148 } |
|
149 else if(aStepName == KPrepareDataTestStep) |
|
150 { |
|
151 testStep = new CPrepareDataTestStep(); |
|
152 } |
|
153 else if(aStepName == KTestContactViewUnderLyingViewUpdateStep) |
|
154 { |
|
155 testStep = new CTestContactViewUnderlyingViewUpdateStep(); |
|
156 } |
|
157 else if(aStepName == KTestContactViewCRUDOperationsStep) |
|
158 { |
|
159 testStep = new CTestContactViewCRUDOperationsStep(); |
|
160 } |
|
161 else |
|
162 { |
|
163 _LIT(KInvalid,"Invalid Test Step"); |
|
164 User::Panic(KInvalid, 2204); |
|
165 } |
|
166 |
|
167 return testStep; |
|
168 } |
|
169 |