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