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