|
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 #include "TEAlarmTestServer.h" |
|
17 #include "TEAlarmTestSilentForStep.h" |
|
18 #include "TEAlarmTestSilentUntilStep.h" |
|
19 |
|
20 #include "TEAlarmTestAlarmPlayConfig.h" |
|
21 #include "TEAlarmTestMultipleAlarmsStep.h" |
|
22 #include "tealarmtestgetalarmdatastep.h" |
|
23 |
|
24 #include <consolealarmalertservermain.h> |
|
25 |
|
26 |
|
27 _LIT(KServerName, "alarmserverunittestserver"); |
|
28 |
|
29 |
|
30 CTEAlarmTestServer* CTEAlarmTestServer::NewL() |
|
31 { |
|
32 CTEAlarmTestServer * server = new (ELeave) CTEAlarmTestServer(); |
|
33 CleanupStack::PushL(server); |
|
34 server->StartL(KServerName); |
|
35 CleanupStack::Pop(server); |
|
36 |
|
37 return server; |
|
38 } |
|
39 |
|
40 CTestStep* CTEAlarmTestServer::CreateTestStep(const TDesC& aStepName) |
|
41 { |
|
42 CTestStep* testStep = NULL; |
|
43 |
|
44 if (aStepName == KTEAlarmTestSilentForStep) |
|
45 { |
|
46 testStep = new CTEAlarmTestSilentForStep(); |
|
47 } |
|
48 else if(aStepName == KTEAlarmTestSilentUntilStep) |
|
49 { |
|
50 testStep = new CTEAlarmTestSilentUntilStep(); |
|
51 } |
|
52 else if(aStepName == KTEAlarmTestAlarmPlayConfigStep) |
|
53 { |
|
54 testStep = new CTEAlarmTestAlarmPlayConfigStep(); |
|
55 } |
|
56 else if(aStepName == KTEAlarmTestAPCSetIntervalsStep) |
|
57 { |
|
58 testStep = new CTEAlarmTestAPCSetIntervalsStep(); |
|
59 } |
|
60 else if(aStepName == KTEAlarmTestMultipleAlarmsStep) |
|
61 { |
|
62 testStep = new CTEAlarmTestMultipleAlarmsStep(); |
|
63 } |
|
64 else if(aStepName == KTEAlarmTestGetAlarmDataStep) |
|
65 { |
|
66 testStep = new CTEAlarmTestGetAlarmDataStep(); |
|
67 } |
|
68 |
|
69 return testStep; |
|
70 } |
|
71 |
|
72 LOCAL_C void MainL() |
|
73 { |
|
74 __UHEAP_MARK; |
|
75 CActiveScheduler* sched=NULL; |
|
76 sched=new(ELeave) CActiveScheduler; |
|
77 CActiveScheduler::Install(sched); |
|
78 CTEAlarmTestServer* server = NULL; |
|
79 // Create the CTestServer derived server |
|
80 TRAPD(err,server = CTEAlarmTestServer::NewL()); |
|
81 |
|
82 if(!err) |
|
83 { |
|
84 // Sync with the client and enter the active scheduler |
|
85 RProcess::Rendezvous(KErrNone); |
|
86 sched->Start(); |
|
87 } |
|
88 delete server; |
|
89 delete sched; |
|
90 __UHEAP_MARKEND; |
|
91 } |
|
92 |
|
93 GLDEF_C TInt E32Main() |
|
94 { |
|
95 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
96 if(cleanup == NULL) |
|
97 { |
|
98 return KErrNoMemory; |
|
99 } |
|
100 |
|
101 TRAP_IGNORE(MainL()); |
|
102 delete cleanup; |
|
103 return KErrNone; |
|
104 } |