|
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 |
|
23 #include "tadaptation_plugin.h" |
|
24 #include "tstate_adaptationplugin_step.h" |
|
25 #include "tsim_adaptationplugin_step.h" |
|
26 #include "trtc_adaptationplugin_step.h" |
|
27 #include "tmisc_adaptationplugin_step.h" |
|
28 #include "temergencycallrf_adaptationplugin_step.h" |
|
29 |
|
30 |
|
31 CAdaptationPluginTestServer* CAdaptationPluginTestServer::NewLC( ) |
|
32 { |
|
33 CAdaptationPluginTestServer * server = new (ELeave) CAdaptationPluginTestServer(); |
|
34 CleanupStack::PushL(server); |
|
35 TParsePtrC serverName(RProcess().FileName()); |
|
36 server->StartL(serverName.Name()); |
|
37 return server; |
|
38 } |
|
39 |
|
40 static void MainL() |
|
41 { |
|
42 CActiveScheduler* sched = new(ELeave) CActiveScheduler; |
|
43 CleanupStack::PushL (sched); |
|
44 CActiveScheduler::Install (sched); |
|
45 |
|
46 CAdaptationPluginTestServer* server = CAdaptationPluginTestServer::NewLC( ); |
|
47 RProcess::Rendezvous (KErrNone ); |
|
48 sched->Start( ); |
|
49 |
|
50 CleanupStack::PopAndDestroy (server ); |
|
51 CleanupStack::PopAndDestroy (sched ); |
|
52 } |
|
53 |
|
54 /** |
|
55 Process entry point. Called by client using RProcess API |
|
56 @return - Standard Epoc error code on process exit |
|
57 */ |
|
58 TInt E32Main(void) |
|
59 { |
|
60 __UHEAP_MARK; |
|
61 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
62 if(cleanup == NULL) |
|
63 { |
|
64 return KErrNoMemory; |
|
65 } |
|
66 TRAPD(err,MainL()); |
|
67 if (err) |
|
68 { |
|
69 #ifdef _DEBUG |
|
70 _LIT(KMainErrorStatement, "CmdTestServer::MainL - Error: %d"); |
|
71 //INFO_PRINTF1(_L(KMainErrorStatement));//, err); |
|
72 User::Panic(KMainErrorStatement, err); |
|
73 #endif |
|
74 SSMLOGLEAVE(err); |
|
75 } |
|
76 delete cleanup; |
|
77 |
|
78 __UHEAP_MARKEND; |
|
79 return KErrNone; |
|
80 } |
|
81 |
|
82 /** |
|
83 @return - A CTestStep derived instance |
|
84 */ |
|
85 CTestStep* CAdaptationPluginTestServer::CreateTestStep(const TDesC& aStepName ) |
|
86 { |
|
87 CTestStep* testStep = NULL; |
|
88 if (aStepName == KTCTestStateAdaptationPlugin) |
|
89 { |
|
90 testStep = new CTestStateAdaptationPlugin(); |
|
91 } |
|
92 else if (aStepName == KTCTestSimAdaptationPlugin) |
|
93 { |
|
94 testStep = new CTestSimAdaptationPlugin(); |
|
95 } |
|
96 else if (aStepName == KTCTestRtcAdaptationPlugin) |
|
97 { |
|
98 testStep = new CTestRtcAdaptationPlugin(); |
|
99 } |
|
100 else if (aStepName == KTCTestMiscAdaptationPlugin) |
|
101 { |
|
102 testStep = new CTestMiscAdaptationPlugin(); |
|
103 } |
|
104 else if (aStepName == KTCTestEmergencyCallRfAdaptationPlugin) |
|
105 { |
|
106 testStep = new CTestEmergencyCallRfAdaptationPlugin(); |
|
107 } |
|
108 else |
|
109 { |
|
110 DEBUGPRINT2(_L("Unknown Adaptation step %S"), &aStepName); |
|
111 User::Panic(KTCTestStateAdaptationPlugin, KErrArgument); |
|
112 } |
|
113 |
|
114 return testStep; |
|
115 } |