0
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-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 the License "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 |
#include "F32PerformanceServer.h"
|
|
19 |
#include "EntryStep.h"
|
|
20 |
#include "ReadFileStep.h"
|
|
21 |
#include "SeekFileStep.h"
|
|
22 |
#include "WriteFileStep.h"
|
|
23 |
#include "UtilsCleanupStep.h"
|
|
24 |
#include "UtilsSetupStep.h"
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
// Function : CT_F32PerformanceServer
|
|
29 |
// Description :CT_F32PerformanceServer class constructor
|
|
30 |
// @return :CT_F32PerformanceServer
|
|
31 |
CT_F32PerformanceServer::CT_F32PerformanceServer()
|
|
32 |
:CTestServer ()
|
|
33 |
{
|
|
34 |
|
|
35 |
}
|
|
36 |
|
|
37 |
|
|
38 |
// Function : NewL
|
|
39 |
// @return :An instance of test server
|
|
40 |
// Description: Same code for Secure and non-secure variants
|
|
41 |
// Called inside the MainL() function to create and start the
|
|
42 |
// CTestServer derived server.
|
|
43 |
|
|
44 |
CT_F32PerformanceServer* CT_F32PerformanceServer::NewL()
|
|
45 |
{
|
|
46 |
CT_F32PerformanceServer* performServer=new(ELeave) CT_F32PerformanceServer();
|
|
47 |
CleanupStack::PushL(performServer);
|
|
48 |
performServer->ConstructL(KT_PerformServ);
|
|
49 |
CleanupStack::Pop(performServer);
|
|
50 |
return performServer;
|
|
51 |
}
|
|
52 |
|
|
53 |
// Function : ~CT_F32PerformanceServer
|
|
54 |
// Description :CT_F32PerformanceServer class destructor
|
|
55 |
CT_F32PerformanceServer::~CT_F32PerformanceServer()
|
|
56 |
{
|
|
57 |
|
|
58 |
}
|
|
59 |
|
|
60 |
|
|
61 |
// Function : MainL
|
|
62 |
// Description: Secure variant
|
|
63 |
// Much simpler, uses the new Rendezvous()
|
|
64 |
// call to sync with the client
|
|
65 |
LOCAL_C void MainL()
|
|
66 |
{
|
|
67 |
// Leave the hooks in for platform security
|
|
68 |
#if (defined __DATA_CAGING__)
|
|
69 |
RProcess().DataCaging(RProcess::EDataCagingOn);
|
|
70 |
RProcess().SecureApi(RProcess::ESecureApiOn);
|
|
71 |
#endif
|
|
72 |
|
|
73 |
CActiveScheduler* performScheduler=NULL;
|
|
74 |
performScheduler=new(ELeave) CActiveScheduler;
|
|
75 |
//Install me as current ActiveScheduler
|
|
76 |
CActiveScheduler::Install(performScheduler);
|
|
77 |
CT_F32PerformanceServer* server = NULL;
|
|
78 |
|
|
79 |
// Create CT_ F32PerformanceServer(the CTestServer derived server)
|
|
80 |
TRAPD(err,server = CT_F32PerformanceServer::NewL());
|
|
81 |
if(!err)
|
|
82 |
{
|
|
83 |
// Sync with the client and enter this active scheduler
|
|
84 |
RProcess::Rendezvous(KErrNone);
|
|
85 |
performScheduler->Start();
|
|
86 |
}
|
|
87 |
|
|
88 |
delete server;
|
|
89 |
delete performScheduler;
|
|
90 |
|
|
91 |
}
|
|
92 |
//End MainL
|
|
93 |
|
|
94 |
|
|
95 |
// Function : E32Main
|
|
96 |
// @return Standard Epoc error code on exit
|
|
97 |
GLDEF_C TInt E32Main()
|
|
98 |
{
|
|
99 |
CTrapCleanup* cleanup = CTrapCleanup::New();
|
|
100 |
if(cleanup == NULL)
|
|
101 |
{
|
|
102 |
return KErrNoMemory;
|
|
103 |
}
|
|
104 |
|
|
105 |
#if (defined TRAP_IGNORE)
|
|
106 |
TRAP_IGNORE(MainL());
|
|
107 |
#else
|
|
108 |
TRAPD(err,MainL());
|
|
109 |
#endif
|
|
110 |
|
|
111 |
delete cleanup;
|
|
112 |
return KErrNone;
|
|
113 |
|
|
114 |
}
|
|
115 |
|
|
116 |
|
|
117 |
// @return - A CTestStep derived instance
|
|
118 |
// Description : Implementation of CTestServer pure virtual
|
|
119 |
// (i.e Creates the test steps)
|
|
120 |
// @param : aStepName The name of the test step to be created
|
|
121 |
CTestStep* CT_F32PerformanceServer::CreateTestStep(const TDesC& aStepName)
|
|
122 |
{
|
|
123 |
CTestStep* testStep = NULL;
|
|
124 |
if (aStepName == KT_EntryStep)
|
|
125 |
{
|
|
126 |
testStep = new CT_EntryStep();
|
|
127 |
}
|
|
128 |
else if (aStepName ==KT_ReadFileStep)
|
|
129 |
{
|
|
130 |
testStep = new CT_ReadFileStep ();
|
|
131 |
}
|
|
132 |
else if (aStepName==KT_SeekFileStep)
|
|
133 |
{
|
|
134 |
testStep= new CT_SeekFileStep ();
|
|
135 |
}
|
|
136 |
else if (aStepName==KT_WriteFileStep)
|
|
137 |
{
|
|
138 |
testStep= new CT_WriteFileStep ();
|
|
139 |
}
|
|
140 |
else if(aStepName==KT_CleanupStep)
|
|
141 |
{
|
|
142 |
testStep=new CT_CleanupStep();
|
|
143 |
}
|
|
144 |
else if (aStepName==KT_SetupStep)
|
|
145 |
{
|
|
146 |
testStep=new CT_SetupStep();
|
|
147 |
}
|
|
148 |
return testStep;
|
|
149 |
}
|
|
150 |
|