72
|
1 |
//
|
|
2 |
// Copyright (c) 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 |
// TE_UseCasesServer.cpp
|
|
19 |
//
|
|
20 |
//
|
|
21 |
// This main DLL entry point for the TE_ConServer.dll
|
|
22 |
|
|
23 |
|
|
24 |
#include "TE_UseCasesStep.h"
|
|
25 |
#include "TE_UseCasesSteps.h"
|
|
26 |
|
|
27 |
|
|
28 |
EXPORT_C CTE_UseCasesServer* NewUseCasesServer( void )
|
|
29 |
//
|
|
30 |
// NewTestSuiteUseCasesL is exported at ordinal 1
|
|
31 |
// this provides the interface to allow schedule test
|
|
32 |
// to create instances of this test suite
|
|
33 |
//
|
|
34 |
{
|
|
35 |
CTE_UseCasesServer* ts = 0;
|
|
36 |
TRAPD(err,ts = new (ELeave) CTE_UseCasesServer);
|
|
37 |
if (err == KErrNone)
|
|
38 |
return ts;
|
|
39 |
return 0;
|
|
40 |
}
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
// __EDIT_ME__ - Substitute the name of your test server
|
|
45 |
_LIT(KServerName,"te_usecases");
|
|
46 |
// __EDIT_ME__ - Use your own server class name
|
|
47 |
CTE_UseCasesServer* CTE_UseCasesServer::NewL()
|
|
48 |
/**
|
|
49 |
* @return - Instance of the test server
|
|
50 |
* Called inside the MainL() function to create and start the
|
|
51 |
* CTestServer derived server.
|
|
52 |
*/
|
|
53 |
{
|
|
54 |
// __EDIT_ME__ new your server class here
|
|
55 |
CTE_UseCasesServer * server = new (ELeave) CTE_UseCasesServer();
|
|
56 |
CleanupStack::PushL(server);
|
|
57 |
|
|
58 |
// Either use a StartL or ConstructL, the latter will permit
|
|
59 |
// Server Logging.
|
|
60 |
|
|
61 |
//server->StartL(KServerName);
|
|
62 |
server-> ConstructL(KServerName);
|
|
63 |
CleanupStack::Pop(server);
|
|
64 |
return server;
|
|
65 |
}
|
|
66 |
|
|
67 |
// EKA2 much simpler
|
|
68 |
// Just an E32Main and a MainL()
|
|
69 |
LOCAL_C void MainL()
|
|
70 |
/**
|
|
71 |
* Much simpler, uses the new Rendezvous() call to sync with the client
|
|
72 |
*/
|
|
73 |
{
|
|
74 |
// Leave the hooks in for platform security
|
|
75 |
#if (defined __DATA_CAGING__)
|
|
76 |
RProcess().DataCaging(RProcess::EDataCagingOn);
|
|
77 |
RProcess().SecureApi(RProcess::ESecureApiOn);
|
|
78 |
#endif
|
|
79 |
CActiveScheduler* sched=NULL;
|
|
80 |
sched=new(ELeave) CActiveScheduler;
|
|
81 |
CActiveScheduler::Install(sched);
|
|
82 |
// __EDIT_ME__ Your server name
|
|
83 |
CTE_UseCasesServer* server = NULL;
|
|
84 |
// Create the CTestServer derived server
|
|
85 |
// __EDIT_ME__ Your server name
|
|
86 |
TRAPD(err,server = CTE_UseCasesServer::NewL());
|
|
87 |
if(!err)
|
|
88 |
{
|
|
89 |
// Sync with the client and enter the active scheduler
|
|
90 |
RProcess::Rendezvous(KErrNone);
|
|
91 |
sched->Start();
|
|
92 |
}
|
|
93 |
delete server;
|
|
94 |
delete sched;
|
|
95 |
}
|
|
96 |
|
|
97 |
// Only a DLL on emulator for typhoon and earlier
|
|
98 |
|
|
99 |
GLDEF_C TInt E32Main()
|
|
100 |
/**
|
|
101 |
* @return - Standard Epoc error code on exit
|
|
102 |
*/
|
|
103 |
{
|
|
104 |
CTrapCleanup* cleanup = CTrapCleanup::New();
|
|
105 |
if(cleanup == NULL)
|
|
106 |
{
|
|
107 |
return KErrNoMemory;
|
|
108 |
}
|
|
109 |
TRAP_IGNORE(MainL());
|
|
110 |
delete cleanup;
|
|
111 |
return KErrNone;
|
|
112 |
}
|
|
113 |
|
|
114 |
// Create a thread in the calling process
|
|
115 |
// Emulator typhoon and earlier
|
|
116 |
|
|
117 |
// __EDIT_ME__ - Use your own server class name
|
|
118 |
CTestStep* CTE_UseCasesServer::CreateTestStep(const TDesC& aStepName)
|
|
119 |
/**
|
|
120 |
* @return - A CTestStep derived instance
|
|
121 |
* Implementation of CTestServer pure virtual
|
|
122 |
*/
|
|
123 |
{
|
|
124 |
|
|
125 |
CTestStep* testStep = NULL;
|
|
126 |
// __EDIT_ME__ - Create your own test steps here
|
|
127 |
// This server creates just one step but create as many as you want
|
|
128 |
// They are created "just in time" when the worker thread is created
|
|
129 |
|
|
130 |
|
|
131 |
if(aStepName.Compare(_L("CreatingDatabaseAndView")) == 0 )
|
|
132 |
testStep = new(ELeave) CTE_CreatingDatabaseAndView();
|
|
133 |
else if(aStepName.Compare(_L("UsecaseReading")) == 0 )
|
|
134 |
testStep = new(ELeave) CTE_UsecaseReading();
|
|
135 |
else if(aStepName.Compare(_L("UsecaseWriting")) == 0 )
|
|
136 |
testStep = new(ELeave) CTE_UsecaseWriting();
|
|
137 |
else if(aStepName.Compare(_L("UsecaseOverridingATableEntry")) == 0 )
|
|
138 |
testStep = new(ELeave) CTE_UsecaseOverridingATableEntry();
|
|
139 |
else if(aStepName.Compare(_L("UsecaseOverridingThePreferenceTable")) == 0 )
|
|
140 |
testStep = new(ELeave) CTE_UsecaseOverridingThePreferenceTable();
|
|
141 |
else if(aStepName.Compare(_L("UsecaseUsingATemplate")) == 0 )
|
|
142 |
testStep = new(ELeave) CTE_UsecaseUsingATemplate();
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
return testStep;
|
|
147 |
}
|
|
148 |
|
|
149 |
|
|
150 |
|
|
151 |
// make a version string available for test system
|
|
152 |
TPtrC CTE_UseCasesServer::GetVersion( void )
|
|
153 |
{
|
|
154 |
|
|
155 |
#ifdef _DEBUG
|
|
156 |
_LIT(KTxtVersion,"1.0 (udeb)");
|
|
157 |
#else
|
|
158 |
_LIT(KTxtVersion,"1.0");
|
|
159 |
#endif
|
|
160 |
|
|
161 |
return KTxtVersion();
|
|
162 |
}
|
|
163 |
|
|
164 |
|