|
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 @internalComponent - Graphics Resource API Conformance Test Suite |
|
20 */ |
|
21 |
|
22 #include "tgraphicsresourceserver.h" |
|
23 #include "tsgdrawablegeneric.h" |
|
24 #include "tsgdriver.h" |
|
25 #include "tsgimagegeneric.h" |
|
26 #include "tsggenericmanual.h" |
|
27 |
|
28 /** |
|
29 @return - Instance of the test server |
|
30 Called inside the MainL() function to create and start the |
|
31 CTestServer derived server. |
|
32 */ |
|
33 CTSgServer* CTSgServer::NewL() |
|
34 { |
|
35 CTSgServer * server = new (ELeave) CTSgServer(); |
|
36 CleanupStack::PushL(server); |
|
37 |
|
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()); |
|
41 |
|
42 // CServer base class call |
|
43 server->StartL(serverName.Name()); |
|
44 CleanupStack::Pop(server); |
|
45 return server; |
|
46 } |
|
47 |
|
48 |
|
49 LOCAL_C void MainL() |
|
50 { |
|
51 CActiveScheduler* sched = new(ELeave) CActiveScheduler; |
|
52 CActiveScheduler::Install(sched); |
|
53 |
|
54 CTSgServer* server = NULL; |
|
55 // Create the CTestServer derived server |
|
56 TRAPD(err,server = CTSgServer::NewL()); |
|
57 if(err == KErrNone) |
|
58 { |
|
59 // Sync with the client |
|
60 RProcess::Rendezvous(KErrNone); |
|
61 sched->Start(); |
|
62 } |
|
63 delete server; |
|
64 delete sched; |
|
65 |
|
66 } |
|
67 |
|
68 /** @return - Standard Epoc error code on process exit |
|
69 Secure variant only |
|
70 Process entry point. Called by client using RProcess API |
|
71 */ |
|
72 GLDEF_C TInt E32Main() |
|
73 { |
|
74 __UHEAP_MARK; |
|
75 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
76 if(cleanup == NULL) |
|
77 { |
|
78 return KErrNoMemory; |
|
79 } |
|
80 TRAPD(err,MainL()); |
|
81 if (err != KErrNone) |
|
82 { |
|
83 RProcess handle = RProcess(); |
|
84 TParsePtrC serverName(handle.FileName()); |
|
85 User::Panic(serverName.Name(),err); |
|
86 } |
|
87 delete cleanup; |
|
88 __UHEAP_MARKEND; |
|
89 return KErrNone; |
|
90 } |
|
91 |
|
92 /** |
|
93 Secure and non-secure variants |
|
94 Implementation of CTestServer pure virtual |
|
95 @return - A CTestStep derived instance |
|
96 */ |
|
97 CTestStep* CTSgServer::CreateTestStep(const TDesC& aStepName) |
|
98 { |
|
99 CTestStep* testStep = NULL; |
|
100 |
|
101 if(aStepName == KTSgDrawableGeneric) |
|
102 { |
|
103 testStep = new CTSgDrawableGeneric(ETrue); |
|
104 } |
|
105 else if(aStepName == KTSgDriver) |
|
106 { |
|
107 testStep = new CTSgDriver(ETrue); |
|
108 } |
|
109 else if(aStepName == KTSgImageGeneric) |
|
110 { |
|
111 testStep = new CTSgImageGeneric(ETrue); |
|
112 } |
|
113 else if(aStepName == KTSgGenericManual) |
|
114 { |
|
115 testStep = new CTSgGenericManual(ETrue); |
|
116 } |
|
117 return testStep; |
|
118 } |