|
1 // Copyright (c) 2005-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 "TScdvServer.h" |
|
23 #include "Tlld.h" |
|
24 #include "TScdvScaling.h" |
|
25 #include "TScdvTest.h" |
|
26 #include "TRWindows.h" |
|
27 |
|
28 #if defined(SYMBIAN_GRAPHICS_GCE) |
|
29 #include "TDirectScreenBitmap.h" |
|
30 #include "tscdvdevorientation.h" |
|
31 #endif //SYMBIAN_GRAPHICS_GCE |
|
32 |
|
33 /* |
|
34 z:\GraphicsTest\scdvtest.script |
|
35 */ |
|
36 |
|
37 _LIT(KServerName,"TScdvServer"); |
|
38 |
|
39 CTScdvServer* CTScdvServer::NewL() |
|
40 /** |
|
41 @return - Instance of the test server |
|
42 Same code for Secure and non-secure variants |
|
43 Called inside the MainL() function to create and start the |
|
44 CTestServer derived server. |
|
45 */ |
|
46 { |
|
47 CTScdvServer * server = new (ELeave) CTScdvServer(); |
|
48 CleanupStack::PushL(server); |
|
49 // CServer base class call |
|
50 server->StartL(KServerName); |
|
51 CleanupStack::Pop(server); |
|
52 return server; |
|
53 } |
|
54 |
|
55 |
|
56 LOCAL_C void MainL() |
|
57 // |
|
58 // Secure variant |
|
59 // Much simpler, uses the new Rendezvous() call to sync with the client |
|
60 // |
|
61 { |
|
62 #if (defined __DATA_CAGING__) |
|
63 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
64 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
65 #endif |
|
66 CActiveScheduler* sched=NULL; |
|
67 sched=new(ELeave) CActiveScheduler; |
|
68 CActiveScheduler::Install(sched); |
|
69 CTScdvServer* server = NULL; |
|
70 // Create the CTestServer derived server |
|
71 TRAPD(err,server = CTScdvServer::NewL()); |
|
72 if(!err) |
|
73 { |
|
74 // Sync with the client and enter the active scheduler |
|
75 RProcess::Rendezvous(KErrNone); |
|
76 sched->Start(); |
|
77 } |
|
78 delete server; |
|
79 delete sched; |
|
80 } |
|
81 |
|
82 GLDEF_C TInt E32Main() |
|
83 |
|
84 /** @return - Standard Epoc error code on process exit |
|
85 Secure variant only |
|
86 Process entry point. Called by client using RProcess API |
|
87 */ |
|
88 { |
|
89 __UHEAP_MARK; |
|
90 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
91 if(cleanup == NULL) |
|
92 { |
|
93 return KErrNoMemory; |
|
94 } |
|
95 TRAPD(err,MainL()); |
|
96 // This if statement is here just to shut up RVCT, which would otherwise warn |
|
97 // that err was set but never used |
|
98 if (err) |
|
99 { |
|
100 err = KErrNone; |
|
101 } |
|
102 delete cleanup; |
|
103 __UHEAP_MARKEND; |
|
104 return KErrNone; |
|
105 } |
|
106 |
|
107 CTestStep* CTScdvServer::CreateTestStep(const TDesC& aStepName) |
|
108 /** |
|
109 @return - A CTestStep derived instance |
|
110 Secure and non-secure variants |
|
111 Implementation of CTestServer pure virtual |
|
112 */ |
|
113 { |
|
114 CTestStep* testStep = NULL; |
|
115 if(aStepName == KTLowLevelStep) |
|
116 testStep = new CTLowLevelStep(); |
|
117 else if(aStepName == KTLowLevel1Step) |
|
118 testStep = new CTLowLevel1Step(); |
|
119 else if(aStepName == KTRWindowsStep) |
|
120 testStep = new CTRWindowsStep(); |
|
121 else if(aStepName == KTScalingStep) |
|
122 testStep = new CTScalingStep(); |
|
123 else if(aStepName == KTScdvStep) |
|
124 testStep = new CTScdvStep(); |
|
125 #if defined(SYMBIAN_GRAPHICS_GCE) |
|
126 else if (aStepName == KTDevOrientationStep) |
|
127 testStep = new CTDevOrientationStep(); |
|
128 else if(aStepName == KTDirectScreenBitmapStep) |
|
129 testStep = new CTDirectScreenBitmapStep(); |
|
130 #endif //SYMBIAN_GRAPHICS_GCE |
|
131 |
|
132 return testStep; |
|
133 } |