|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @test |
|
19 */ |
|
20 |
|
21 #include <ecom/ecom.h> |
|
22 |
|
23 #include "egltestserver.h" |
|
24 #include "eglteststep.h" |
|
25 |
|
26 |
|
27 _LIT(KEGLTestServerName,"egltestserver"); |
|
28 |
|
29 |
|
30 CTestStep* CTestEGLServer::CreateTestStep(const TDesC& aStepName) |
|
31 { |
|
32 return EglTestStepFactory::GetEglTestStep(aStepName); |
|
33 } |
|
34 |
|
35 CTestEGLServer* CTestEGLServer::NewL() |
|
36 { |
|
37 CTestEGLServer* server = new(ELeave) CTestEGLServer(); |
|
38 CleanupStack::PushL(server); |
|
39 // CServer base class call |
|
40 TParsePtrC serverName(RProcess().FileName()); |
|
41 server->StartL(serverName.Name()); |
|
42 CleanupStack::Pop(server); |
|
43 return server; |
|
44 } |
|
45 |
|
46 static void MainL() |
|
47 { |
|
48 CActiveScheduler* sched=NULL; |
|
49 sched=new(ELeave) CActiveScheduler; |
|
50 CActiveScheduler::Install(sched); |
|
51 |
|
52 #ifdef __WINS__ |
|
53 // Construct and destroy a process-wide state object in emulator builds. |
|
54 // This will cause initialisation of PLS for EGL and SgDriver |
|
55 // and allow checking for leaks in tests |
|
56 if(!eglReleaseThread()) |
|
57 { |
|
58 // Call to eglReleaseThread failed |
|
59 User::Leave(KErrGeneral); |
|
60 } |
|
61 #endif //__WINS__ |
|
62 |
|
63 CTestEGLServer* server = NULL; |
|
64 // Create the CTestServer derived server |
|
65 TRAPD(err, server = CTestEGLServer::NewL()); |
|
66 if(!err) |
|
67 { |
|
68 // Sync with the client and enter the active scheduler |
|
69 RProcess::Rendezvous(KErrNone); |
|
70 sched->Start(); |
|
71 } |
|
72 delete server; |
|
73 delete sched; |
|
74 } |
|
75 |
|
76 /** |
|
77 @return Standard Epoc error code on process exit |
|
78 Process entry point. Called by client using RProcess API |
|
79 */ |
|
80 TInt E32Main() |
|
81 { |
|
82 __UHEAP_MARK; |
|
83 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
84 if(cleanup == NULL) |
|
85 { |
|
86 return KErrNoMemory; |
|
87 } |
|
88 TRAPD(err,MainL()); |
|
89 |
|
90 if (err) |
|
91 { |
|
92 RDebug::Print(_L("CTestEGLServer::MainL - Error: %d"), err); |
|
93 User::Panic(KEGLTestServerName,err); |
|
94 } |
|
95 |
|
96 delete cleanup; |
|
97 REComSession::FinalClose(); |
|
98 __UHEAP_MARKEND; |
|
99 return KErrNone; |
|
100 } |