1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/egl/eglrefimpl/test/src/egltestrefserver.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,99 @@
1.4 +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +/** @file
1.20 + @test
1.21 + */
1.22 +
1.23 +#include <ecom/ecom.h>
1.24 +
1.25 +#include "egltestrefserver.h"
1.26 +#include "egltestrefstep.h"
1.27 +
1.28 +
1.29 +_LIT(KEGLTestServerName,"egltestrefserver");
1.30 +
1.31 +
1.32 +CTestStep* CTestEGLRefServer::CreateTestStep(const TDesC& aStepName)
1.33 + {
1.34 + return EglTestStepFactory::GetEglTestStep(aStepName);
1.35 + }
1.36 +
1.37 +CTestEGLRefServer* CTestEGLRefServer::NewL()
1.38 + {
1.39 + CTestEGLRefServer* server = new(ELeave) CTestEGLRefServer();
1.40 + CleanupStack::PushL(server);
1.41 + // CServer base class call
1.42 + TParsePtrC serverName(RProcess().FileName());
1.43 + server->StartL(serverName.Name());
1.44 + CleanupStack::Pop(server);
1.45 + return server;
1.46 + }
1.47 +
1.48 +static void MainL()
1.49 + {
1.50 + CActiveScheduler* sched=NULL;
1.51 + sched=new(ELeave) CActiveScheduler;
1.52 + CActiveScheduler::Install(sched);
1.53 +
1.54 +#ifdef __WINS__
1.55 + // Construct and destroy a process-wide state object in emulator builds.
1.56 + // This will cause initialisation of PLS for EGL and SgDriver
1.57 + // and allow checking for leaks in tests
1.58 + if(!eglReleaseThread())
1.59 + {
1.60 + // Call to eglReleaseThread failed
1.61 + User::Leave(KErrGeneral);
1.62 + }
1.63 +#endif //__WINS__
1.64 +
1.65 + CTestEGLRefServer* server = NULL;
1.66 + // Create the CTestServer derived server
1.67 + TRAPD(err, server = CTestEGLRefServer::NewL());
1.68 + if(!err)
1.69 + {
1.70 + // Sync with the client and enter the active scheduler
1.71 + RProcess::Rendezvous(KErrNone);
1.72 + sched->Start();
1.73 + }
1.74 + delete server;
1.75 + delete sched;
1.76 + }
1.77 +
1.78 +/**
1.79 + @return Standard Epoc error code on process exit
1.80 + Process entry point. Called by client using RProcess API
1.81 + */
1.82 +TInt E32Main()
1.83 + {
1.84 + __UHEAP_MARK;
1.85 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.86 + if(cleanup == NULL)
1.87 + {
1.88 + return KErrNoMemory;
1.89 + }
1.90 + TRAPD(err,MainL());
1.91 +
1.92 + if (err)
1.93 + {
1.94 + RDebug::Print(_L("CTestEGLRefServer::MainL - Error: %d"), err);
1.95 + User::Panic(KEGLTestServerName,err);
1.96 + }
1.97 +
1.98 + delete cleanup;
1.99 + REComSession::FinalClose();
1.100 + __UHEAP_MARKEND;
1.101 + return KErrNone;
1.102 + }