1 // Copyright (c) 2004-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 SmoketestContactsServer.cpp |
|
18 */ |
|
19 |
|
20 #include "SmoketestContactsServer.h" |
|
21 #include "TestContactsCreateDB.h" |
|
22 #include "TestContactsAddEntries.h" |
|
23 |
|
24 // __EDIT_ME__ - Substitute the name of the test server |
|
25 _LIT(KServerName,"Smoketest_Contacts_Server"); |
|
26 // __EDIT_ME__ - Use your own server class name |
|
27 CSmoketestContactsServer* CSmoketestContactsServer::NewL() |
|
28 /** |
|
29 * @return - Instance of the test server |
|
30 * Same code for Secure and non-secure variants |
|
31 * Called inside the MainL() function to create and start the |
|
32 * CTestServer derived server. |
|
33 */ |
|
34 { |
|
35 CSmoketestContactsServer * server = new (ELeave) CSmoketestContactsServer(); |
|
36 CleanupStack::PushL(server); |
|
37 // CServer base class call |
|
38 server->StartL(KServerName); |
|
39 CleanupStack::Pop(server); |
|
40 return server; |
|
41 } |
|
42 |
|
43 |
|
44 LOCAL_C void MainL() |
|
45 /** |
|
46 * Secure variant |
|
47 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
48 */ |
|
49 { |
|
50 #if (defined __DATA_CAGING__) |
|
51 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
52 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
53 #endif |
|
54 CActiveScheduler* sched=NULL; |
|
55 sched=new(ELeave) CActiveScheduler; |
|
56 CActiveScheduler::Install(sched); |
|
57 CSmoketestContactsServer* server = NULL; |
|
58 // Create the CTestServer derived server |
|
59 TRAPD(err,server = CSmoketestContactsServer::NewL()); |
|
60 if(!err) |
|
61 { |
|
62 // Sync with the client and enter the active scheduler |
|
63 RProcess::Rendezvous(KErrNone); |
|
64 sched->Start(); |
|
65 } |
|
66 delete server; |
|
67 delete sched; |
|
68 } |
|
69 |
|
70 GLDEF_C TInt E32Main() |
|
71 /** |
|
72 * @return - Standard Epoc error code on process exit |
|
73 * Secure variant only |
|
74 * Process entry point. Called by client using RProcess API |
|
75 */ |
|
76 { |
|
77 __UHEAP_MARK; |
|
78 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
79 if(cleanup == NULL) |
|
80 { |
|
81 return KErrNoMemory; |
|
82 } |
|
83 TRAPD(err,MainL()); |
|
84 |
|
85 if (!err) { } |
|
86 delete cleanup; |
|
87 __UHEAP_MARKEND; |
|
88 return KErrNone; |
|
89 } |
|
90 |
|
91 |
|
92 // __EDIT_ME__ - Use your own server class name |
|
93 CTestStep* CSmoketestContactsServer::CreateTestStep(const TDesC& aStepName) |
|
94 /** |
|
95 * @return - A CTestStep derived instance |
|
96 * Secure and non-secure variants |
|
97 * Implementation of CTestServer pure virtual |
|
98 */ |
|
99 { |
|
100 CTestStep* testStep = NULL; |
|
101 // __EDIT_ME__ - Create your own test steps here |
|
102 if(aStepName == _L("AddEntries")) |
|
103 testStep = new CTestContactsAddEntries(); |
|
104 if(aStepName == _L("CreateDB")) |
|
105 testStep = new CTestContactsCreateDB(); |
|
106 |
|
107 return testStep; |
|
108 } |
|