summaryrefslogtreecommitdiffstats
path: root/plugins/contacts/symbian/contactsmodel/tsrc/integration/testimpexvcard/src/testimpexvcardsuiteserver.cpp
blob: 5a7ce596cfe02ada9cf14861d32afd293f4181ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/*
* Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
* Contact: http://www.qt-project.org/legal
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
*
*/


#include "testimpexvcardsuiteserver.h"
#include "testimprevlocaltz.h"
#include "testimprevlocal.h"
#include "testimpnorev.h"
#include "testimprevutc.h"
#include "testimpbday.h"
#include "testimpnobday.h"
#include "testimpoom.h"
#include "testexrevutc.h"
#include "testexbdaylocal.h"
#include "testexnobday.h"
#include "testimpexvcardsuitedefs.h"
#include "testexportcontactstep.h"
#include "testimportcontactinsertmodestep.h"
#include "testimportcontactmergemodestep.h"
#include "testcontactspbapexport.h"
#include "testcomparecntfiles.h"
#include "testcontactoperations.h"
#include "testcontactspbapexportperformance.h"
#include "testcontactspbapexportcontents.h"
#include "testgenericimportstep.h"

_LIT(KServerName,"TestImpExvCardSuite");
CTestImpExvCardSuite* CTestImpExvCardSuite::NewL()
/**
 * @return - Instance of the test server
 * Same code for Secure and non-secure variants
 * Called inside the MainL() function to create and start the
 * CTestServer derived server.
 */
	{
	CTestImpExvCardSuite * server = new (ELeave) CTestImpExvCardSuite();
	CleanupStack::PushL(server);
	// CServer base class call which can be either StartL or ConstructL,
	// the later will permit Server Logging.

	server->StartL(KServerName);
	CleanupStack::Pop(server);
	return server;
	}

// Secure variants much simpler
// For EKA2, just an E32Main and a MainL()
LOCAL_C void MainL()
/**
 * Secure variant
 * Much simpler, uses the new Rendezvous() call to sync with the client
 */
	{
	// Leave the hooks in for platform security
#if (defined __DATA_CAGING__)
	RProcess().DataCaging(RProcess::EDataCagingOn);
	RProcess().DataCaging(RProcess::ESecureApiOn);
#endif
	CActiveScheduler* sched = NULL;
	sched = new(ELeave) CActiveScheduler;
	CActiveScheduler::Install(sched);
	CTestImpExvCardSuite* server = NULL;
	// Create the CTestServer derived server
	TRAPD(err,server = CTestImpExvCardSuite::NewL());
	if(!err)
		{
		RProcess::Rendezvous(KErrNone);
		sched->Start();
		}

	delete server;
	delete sched;
	}

GLDEF_C TInt E32Main()
/**
 * @return - Standard Epoc error code on process exit
 * Secure variant only
 * Process entry point. Called by client using RProcess API
 */
	{
	__UHEAP_MARK;
	CTrapCleanup* cleanup = CTrapCleanup::New();
	if(cleanup == NULL)
		{
		return KErrNoMemory;
		}
	TRAP_IGNORE(MainL());
	delete cleanup;
	__UHEAP_MARKEND;
	return KErrNone;
    }

CTestStep* CTestImpExvCardSuite::CreateTestStep(const TDesC& aStepName)
/**
 * @return - A CTestStep derived instance
 * Secure and non-secure variants
 * Implementation of CTestServer pure virtual
 */
	{
	CTestStep* testStep = NULL;
	// They are created "just in time" when the worker thread is created
	// More test steps can be added below
              if(aStepName == KTestImpRevLocalTZ)
              	{
              	testStep = new CTestImpRevLocalTZ();
              	}
              else if (aStepName == KTestImpRevLocal)
	              	   {
              		   testStep = new CTestImpRevLocal();
              		   }
              else if (aStepName == KTestImpNoRev)
	              	   {
              		   testStep = new CTestImpNoRev();
              		   }
              else if (aStepName == KTestImpRevUTC)
	              	   {
              		   testStep = new CTestImpRevUTC();
              		   }
              else if (aStepName == KTestImpBDay)
	              	   {
              		   testStep = new CTestImpBDay();
              		   }
              else if (aStepName == KTestImpNoBDay)
	              	   {
              		   testStep = new CTestImpNoBDay();
              		   }
              else if (aStepName == KTestExRevUTC)
	              	   {
              		   testStep = new CTestExRevUTC();
              		   }
              else if (aStepName == KTestExBDayLocal)
	              	   {
              		   testStep = new CTestExBDayLocal();
              		   }
              else if (aStepName == KTestExNoBDay)
	              	   {
              		   testStep = new CTestExNoBDay();
              		   }
              else if (aStepName == KTestExportContactStep)
	              	   {
              		   testStep = new CTestExportContactStep();
              		   }
              else if (aStepName == KTestImportContactInsertModeStep)
	              	   {
              		   testStep = new CTestImportContactInsertModeStep();
              		   }
              else if (aStepName == KTestImportContactMergeModeStep)
	              	   {
              		   testStep = new CTestImportContactMergeModeStep();
              		   }
              else if (aStepName == KTestImpOOM)
	              	   {
              		   testStep = new CTestImpOOM();
              		   }
              else if (aStepName == KTestGenericImportStep)
	              	   {
              		   testStep = new CTestGenericImportStep();
              		   }
              else if (aStepName == KTestContactsPBAPExport)
	              	   {
              		   testStep = new CTestContactsPBAPExport();
              		   }
              else if (aStepName == KTestCompareCntFiles)
	              	   {
              		   testStep = new CTestCompareCntFiles();
              		   }
              else if (aStepName == KTestContactOperations)
	              	   {
              		   testStep = new CTestContactOperations();
              		   }
              else if (aStepName == KTestContactsPBAPExportContents)
	              	   {
              		   testStep = new CTestContactsPBAPExportContents();
              		   }
              else if (aStepName == KTestContactsPBAPExportPerformance)
	              	   {
              		   testStep = new CTestContactsPBAPExportPerformance();
              		   }
	return testStep;
	}