os/graphics/graphicsresourceservices/graphicsresourceimplementation/test/src/tgraphicsresourceserver.cpp
First public contribution.
1 // Copyright (c) 2007-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 @internalComponent - Graphics Resource API Conformance Test Suite
22 #include "tgraphicsresourceserver.h"
23 #include "tsgdrawablegeneric.h"
24 #include "tsgdriver.h"
25 #include "tsgimagegeneric.h"
26 #include "tsggenericmanual.h"
29 @return - Instance of the test server
30 Called inside the MainL() function to create and start the
31 CTestServer derived server.
33 CTSgServer* CTSgServer::NewL()
35 CTSgServer * server = new (ELeave) CTSgServer();
36 CleanupStack::PushL(server);
38 // Get server name from process so we can use SetCap to change the capabilites and use this server with a different filename
39 RProcess handle = RProcess();
40 TParsePtrC serverName(handle.FileName());
42 // CServer base class call
43 server->StartL(serverName.Name());
44 CleanupStack::Pop(server);
51 CActiveScheduler* sched = new(ELeave) CActiveScheduler;
52 CActiveScheduler::Install(sched);
54 CTSgServer* server = NULL;
55 // Create the CTestServer derived server
56 TRAPD(err,server = CTSgServer::NewL());
59 // Sync with the client
60 RProcess::Rendezvous(KErrNone);
68 /** @return - Standard Epoc error code on process exit
70 Process entry point. Called by client using RProcess API
72 GLDEF_C TInt E32Main()
75 CTrapCleanup* cleanup = CTrapCleanup::New();
83 RProcess handle = RProcess();
84 TParsePtrC serverName(handle.FileName());
85 User::Panic(serverName.Name(),err);
93 Secure and non-secure variants
94 Implementation of CTestServer pure virtual
95 @return - A CTestStep derived instance
97 CTestStep* CTSgServer::CreateTestStep(const TDesC& aStepName)
99 CTestStep* testStep = NULL;
101 if(aStepName == KTSgDrawableGeneric)
103 testStep = new CTSgDrawableGeneric(ETrue);
105 else if(aStepName == KTSgDriver)
107 testStep = new CTSgDriver(ETrue);
109 else if(aStepName == KTSgImageGeneric)
111 testStep = new CTSgImageGeneric(ETrue);
113 else if(aStepName == KTSgGenericManual)
115 testStep = new CTSgGenericManual(ETrue);