|
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 - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 #include "tgraphicsresourceserver.h" |
|
23 #include "tsgdrawablegeneric.h" |
|
24 #include "tsgdrawablembx.h" |
|
25 #include "tsgdrawablesw.h" |
|
26 #include "tsgdriver.h" |
|
27 #include "tsgimagecollectiongeneric.h" |
|
28 #include "tsgimagecollectionmbx.h" |
|
29 #include "tsgimagecollectionsw.h" |
|
30 #include "tsgimagegeneric.h" |
|
31 #include "tsgimagembx.h" |
|
32 #include "tsgimagesw.h" |
|
33 |
|
34 /** |
|
35 @return - Instance of the test server |
|
36 Called inside the MainL() function to create and start the |
|
37 CTestServer derived server. |
|
38 */ |
|
39 CTSgServer* CTSgServer::NewL() |
|
40 { |
|
41 CTSgServer * server = new (ELeave) CTSgServer(); |
|
42 CleanupStack::PushL(server); |
|
43 |
|
44 // Get server name from process so we can use SetCap to change the capabilites and use this server with a different filename |
|
45 RProcess handle = RProcess(); |
|
46 TParsePtrC serverName(handle.FileName()); |
|
47 |
|
48 // CServer base class call |
|
49 server->StartL(serverName.Name()); |
|
50 CleanupStack::Pop(server); |
|
51 return server; |
|
52 } |
|
53 |
|
54 |
|
55 LOCAL_C void MainL() |
|
56 { |
|
57 CActiveScheduler* sched = new(ELeave) CActiveScheduler; |
|
58 CActiveScheduler::Install(sched); |
|
59 |
|
60 CTSgServer* server = NULL; |
|
61 // Create the CTestServer derived server |
|
62 TRAPD(err,server = CTSgServer::NewL()); |
|
63 if(err == KErrNone) |
|
64 { |
|
65 // Sync with the client |
|
66 RProcess::Rendezvous(KErrNone); |
|
67 sched->Start(); |
|
68 } |
|
69 delete server; |
|
70 delete sched; |
|
71 |
|
72 } |
|
73 |
|
74 /** @return - Standard Epoc error code on process exit |
|
75 Secure variant only |
|
76 Process entry point. Called by client using RProcess API |
|
77 */ |
|
78 GLDEF_C TInt E32Main() |
|
79 { |
|
80 __UHEAP_MARK; |
|
81 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
82 if(cleanup == NULL) |
|
83 { |
|
84 return KErrNoMemory; |
|
85 } |
|
86 TRAPD(err,MainL()); |
|
87 if (err != KErrNone) |
|
88 { |
|
89 RProcess handle = RProcess(); |
|
90 TParsePtrC serverName(handle.FileName()); |
|
91 User::Panic(serverName.Name(),err); |
|
92 } |
|
93 delete cleanup; |
|
94 __UHEAP_MARKEND; |
|
95 return KErrNone; |
|
96 } |
|
97 |
|
98 /** |
|
99 Secure and non-secure variants |
|
100 Implementation of CTestServer pure virtual |
|
101 @return - A CTestStep derived instance |
|
102 */ |
|
103 CTestStep* CTSgServer::CreateTestStep(const TDesC& aStepName) |
|
104 { |
|
105 CTestStep* testStep = NULL; |
|
106 |
|
107 if(aStepName == KTSgDrawableGeneric) |
|
108 { |
|
109 testStep = new CTSgDrawableGeneric(); |
|
110 } |
|
111 else if(aStepName == KTSgDriver) |
|
112 { |
|
113 testStep = new CTSgDriver(); |
|
114 } |
|
115 else if(aStepName == KTSgImageCollectionGeneric) |
|
116 { |
|
117 testStep = new CTSgImageCollectionGeneric(); |
|
118 } |
|
119 else if(aStepName == KTSgImageGeneric) |
|
120 { |
|
121 testStep = new CTSgImageGeneric(); |
|
122 } |
|
123 #ifndef __WINS__ |
|
124 #ifdef SYMBIAN_GRAPHICS_USE_GPU |
|
125 else if(aStepName == KTSgDrawableMbx) |
|
126 { |
|
127 testStep = new CTSgDrawableMbx(); |
|
128 } |
|
129 else if(aStepName == KTSgImageCollectionMbx) |
|
130 { |
|
131 testStep = new CTSgImageCollectionMbx(); |
|
132 } |
|
133 else if(aStepName == KTSgImageMbx) |
|
134 { |
|
135 testStep = new CTSgImageMbx(); |
|
136 } |
|
137 #else |
|
138 else if(aStepName == KTSgDrawableSw) |
|
139 { |
|
140 testStep = new CTSgDrawableSw(); |
|
141 } |
|
142 else if(aStepName == KTSgImageCollectionSw) |
|
143 { |
|
144 testStep = new CTSgImageCollectionSw(); |
|
145 } |
|
146 else if(aStepName == KTSgImageSw) |
|
147 { |
|
148 testStep = new CTSgImageSw(); |
|
149 } |
|
150 #endif |
|
151 #endif |
|
152 return testStep; |
|
153 } |