author | Maciej Seroka <maciejs@symbian.org> |
Thu, 10 Dec 2009 15:51:05 +0000 | |
changeset 821 | b24df46a3102 |
parent 276 | 140d2eb79802 |
child 872 | 17498133d9ad |
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 |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
5 |
// which accompanies this distribution, and is available |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
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 |
// This main DLL entry point for the Smoketest_AppLoader.dll |
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 |
// USER includes |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
19 |
#include "TestAppLoaderServer.h" |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
20 |
#include "TestAppLoaderAppStart.h" |
276
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
117
diff
changeset
|
21 |
#include "TestAppLoaderKeyEvents.h" |
117
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
22 |
#include "TestAppLoaderKillProcess.h" |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
23 |
#include "TestAppLoaderEndTask.h" |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
24 |
#include "TestAppLoaderTaskRunning.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 |
/*@{*/ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
27 |
_LIT(KServerName, "smoketest_apploader"); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
28 |
/*@}*/ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
29 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
30 |
CTestAppLoaderServer* CTestAppLoaderServer::NewL() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
31 |
/** |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
32 |
* @return - Instance of the test server |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
33 |
* Same code for Secure and non-secure variants |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
34 |
* 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
|
35 |
* CTestServer derived server. |
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 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
38 |
CTestAppLoaderServer* server = new (ELeave) CTestAppLoaderServer(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
39 |
CleanupStack::PushL(server); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
40 |
// CServer base class call |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
41 |
server->ConstructL(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
42 |
server->StartL(KServerName); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
43 |
CleanupStack::Pop(server); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
44 |
return server; |
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 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
47 |
CTestAppLoaderServer::CTestAppLoaderServer() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
48 |
: CTestServer() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
49 |
{ |
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 |
void CTestAppLoaderServer::ConstructL() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
53 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
54 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
55 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
56 |
CTestAppLoaderServer::~CTestAppLoaderServer() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
57 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
58 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
59 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
60 |
LOCAL_C void MainL() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
61 |
/** |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
62 |
* Secure variant |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
63 |
* 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
|
64 |
*/ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
65 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
66 |
#if (defined __DATA_CAGING__) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
67 |
RProcess().DataCaging(RProcess::EDataCagingOn); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
68 |
RProcess().SecureApi(RProcess::ESecureApiOn); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
69 |
#endif |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
70 |
CActiveScheduler* sched=NULL; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
71 |
sched=new(ELeave) CActiveScheduler; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
72 |
CActiveScheduler::Install(sched); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
73 |
CTestAppLoaderServer* server = NULL; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
74 |
// Create the CTestServer derived server |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
75 |
TRAPD(err,server = CTestAppLoaderServer::NewL()); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
76 |
if(!err) |
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 |
// Sync with the client and enter the active scheduler |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
79 |
RProcess::Rendezvous(KErrNone); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
80 |
sched->Start(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
81 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
82 |
delete server; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
83 |
delete sched; |
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 |
|
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 |
GLDEF_C TInt E32Main() |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
88 |
/** |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
89 |
* @return - Standard Epoc error code on process exit |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
90 |
* Secure variant only |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
91 |
* Process entry point. Called by client using RProcess API |
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 |
__UHEAP_MARK; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
95 |
CTrapCleanup* cleanup = CTrapCleanup::New(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
96 |
if(cleanup == NULL) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
97 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
98 |
return KErrNoMemory; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
99 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
100 |
TRAPD(err,MainL()); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
101 |
delete cleanup; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
102 |
__UHEAP_MARKEND; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
103 |
return err; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
104 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
105 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
106 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
107 |
CTestStep* CTestAppLoaderServer::CreateTestStep(const TDesC& aStepName) |
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 - A CTestStep derived instance |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
110 |
* Secure and non-secure variants |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
111 |
* Implementation of CTestServer pure virtual |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
112 |
*/ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
113 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
114 |
CTestStep* testStep = NULL; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
115 |
|
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
116 |
if(aStepName == _L("AppStart")) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
117 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
118 |
testStep = new CTestAppLoaderAppStart(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
119 |
} |
276
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
117
diff
changeset
|
120 |
else if(aStepName == _L("KeyEvents")) |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
117
diff
changeset
|
121 |
{ |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
117
diff
changeset
|
122 |
testStep = new CTestAppLoaderKeyEvents(); |
140d2eb79802
Add keyevent test at end of apploader test suite to remove prompt for location/time settings
Louis Henry Nayegon <louisn@symbian.org>
parents:
117
diff
changeset
|
123 |
} |
117
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
124 |
else if(aStepName == _L("KillProcess")) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
125 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
126 |
testStep = new CTestAppLoaderKillProcess(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
127 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
128 |
else if(aStepName == _L("EndTask")) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
129 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
130 |
testStep = new CTestAppLoaderEndTask(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
131 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
132 |
else if(aStepName == _L("TaskRunning")) |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
133 |
{ |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
134 |
testStep = new CTestAppLoaderTaskRunning(); |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
135 |
} |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
136 |
return testStep; |
483f966c6335
Add first draft of smoketests
Louis Henry Nayegon <louisn@symbian.org>
parents:
diff
changeset
|
137 |
} |