|
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 "tgsa_server.h" |
|
24 #include "tgsa_step_startup.h" |
|
25 #include "tgsa_step_normal.h" |
|
26 #include "tgsa_step_shutdown.h" |
|
27 #include "tgsa_step_fail.h" |
|
28 |
|
29 |
|
30 _LIT(KGsaTestServerName, "GsaTestServer"); |
|
31 |
|
32 CGsaTestServer* CGsaTestServer::NewLC( ) |
|
33 { |
|
34 CGsaTestServer * server = new (ELeave) CGsaTestServer(); |
|
35 CleanupStack::PushL(server); |
|
36 TParsePtrC serverName(RProcess().FileName()); |
|
37 server->StartL(serverName.Name()); |
|
38 return server; |
|
39 } |
|
40 |
|
41 static void MainL() |
|
42 { |
|
43 CActiveScheduler* sched = new(ELeave) CActiveScheduler; |
|
44 CleanupStack::PushL (sched); |
|
45 CActiveScheduler::Install (sched); |
|
46 |
|
47 CGsaTestServer* server = CGsaTestServer::NewLC( ); |
|
48 RProcess::Rendezvous (KErrNone ); |
|
49 sched->Start( ); |
|
50 |
|
51 CleanupStack::PopAndDestroy (server ); |
|
52 CleanupStack::PopAndDestroy (sched ); |
|
53 } |
|
54 |
|
55 /** |
|
56 Process entry point. Called by client using RProcess API |
|
57 @return - Standard Epoc error code on process exit |
|
58 */ |
|
59 TInt E32Main(void) //lint -e765 -e714 Suppress 'not referenced' and 'could be static' |
|
60 { |
|
61 __UHEAP_MARK; |
|
62 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
63 if(cleanup == NULL) |
|
64 { |
|
65 return KErrNoMemory; |
|
66 } |
|
67 TRAPD(err,MainL()); |
|
68 if (err) |
|
69 { |
|
70 _LIT(KMainErrorStatement, "GsaTestServer::MainL - Error: %d"); |
|
71 RDebug::Print(KMainErrorStatement, err); |
|
72 User::Panic(KGsaTestServerName, err); |
|
73 } |
|
74 delete cleanup; |
|
75 |
|
76 __UHEAP_MARKEND; |
|
77 return KErrNone; |
|
78 } |
|
79 |
|
80 /** |
|
81 @return - A CTestStep derived instance |
|
82 */ |
|
83 CTestStep* CGsaTestServer::CreateTestStep(const TDesC& aStepName ) |
|
84 { |
|
85 CTestStep* testStep = NULL; |
|
86 if (aStepName == KTGsaStartupStep) |
|
87 { |
|
88 testStep = new CGsaStartupTest(); |
|
89 } |
|
90 else if (aStepName == KTGsaNormalStep) |
|
91 { |
|
92 testStep = new CGsaNormalTest(); |
|
93 } |
|
94 else if (aStepName == KTGsaShutdownStep) |
|
95 { |
|
96 testStep = new CGsaShutdownTest(); |
|
97 } |
|
98 else if (aStepName == KTGsaFailStep) |
|
99 { |
|
100 testStep = new CGsaFailTest(); |
|
101 } |
|
102 else |
|
103 { |
|
104 RDebug::Printf ("Unknown GsaTest step %S", &aStepName ); |
|
105 } |
|
106 |
|
107 return testStep; |
|
108 } |