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