|
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 #include "tsysmon_server.h" |
|
23 |
|
24 #include "tsysmon_stepmultiprocmon.h" |
|
25 #include "tsysmon_stepnoprocmon.h" |
|
26 #include "tsysmon_stepprocmonignore.h" |
|
27 #include "tsysmon_stepselfmonignore.h" |
|
28 #include "tsysmon_stepprocmoninit.h" |
|
29 #include "tsysmon_stepprocrestart.h" |
|
30 #include "tsysmon_steprestartthrottle.h" |
|
31 #include "tsysmon_stepselfmoncancel.h" |
|
32 #include "tsysmon_stepselfmoncancel2.h" |
|
33 #include "tsysmon_stepnomoncancel.h" |
|
34 |
|
35 #include "tsysmon_step_connect_disconnect.h" |
|
36 #include "tsysmon_step_register.h" |
|
37 #include "tsysmon_step_register_twice_different.h" |
|
38 #include "tsysmon_step_register_twice_same.h" |
|
39 #include "tsysmon_step_result_check.h" |
|
40 #include "tsysmon_step_run_count_check.h" |
|
41 |
|
42 |
|
43 _LIT(KServerName, "tsysmon_server"); |
|
44 |
|
45 CSysMonTestServer* CSysMonTestServer::NewLC() |
|
46 { |
|
47 CSysMonTestServer * server = new (ELeave) CSysMonTestServer(); |
|
48 CleanupStack::PushL(server); |
|
49 server->StartL(KServerName); |
|
50 return server; |
|
51 } |
|
52 |
|
53 |
|
54 static void MainL() |
|
55 { |
|
56 CActiveScheduler* sched = new(ELeave) CActiveScheduler; |
|
57 CleanupStack::PushL(sched); |
|
58 CActiveScheduler::Install(sched); |
|
59 |
|
60 // Create the CTestServer derived server |
|
61 CSysMonTestServer* server = CSysMonTestServer::NewLC(); |
|
62 RProcess::Rendezvous(KErrNone); |
|
63 sched->Start(); |
|
64 |
|
65 CleanupStack::PopAndDestroy(server); |
|
66 CleanupStack::PopAndDestroy(sched); |
|
67 } |
|
68 |
|
69 |
|
70 TInt E32Main() |
|
71 { |
|
72 __UHEAP_MARK; |
|
73 |
|
74 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
75 TInt err = KErrNoMemory; |
|
76 if(cleanup) |
|
77 { |
|
78 TRAP(err, MainL()); |
|
79 delete cleanup; |
|
80 } |
|
81 |
|
82 __UHEAP_MARKEND; |
|
83 return err; |
|
84 } |
|
85 |
|
86 |
|
87 /** |
|
88 * @return - A CTestStep derived instance |
|
89 * Implementation of CTestServer pure virtual |
|
90 */ |
|
91 CTestStep* CSysMonTestServer::CreateTestStep(const TDesC& aStepName) |
|
92 { |
|
93 CTestStep* testStep = NULL; |
|
94 |
|
95 if (aStepName == KCTestCaseMultiProcMon) |
|
96 { |
|
97 testStep = new CStepMultiProcMon(); |
|
98 } |
|
99 else if (aStepName == KCTestCaseNoProcMon) |
|
100 { |
|
101 testStep = new CStepNoProcMon(); |
|
102 } |
|
103 else if (aStepName == KCTestCaseProcMonIgnore) |
|
104 { |
|
105 testStep = new CStepProcMonIgnore(); |
|
106 } |
|
107 else if (aStepName == KCTestCaseProcMonInit) |
|
108 { |
|
109 testStep = new CStepProcMonInit(); |
|
110 } |
|
111 else if (aStepName == KCTestCaseProcRestart) |
|
112 { |
|
113 testStep = new CStepProcRestart(); |
|
114 } |
|
115 else if (aStepName == KCTestCaseRestartThrottle) |
|
116 { |
|
117 testStep = new CStepRestartThrottle(); |
|
118 } |
|
119 else if (aStepName == KCTestCaseSelfMonCancel) |
|
120 { |
|
121 testStep = new CStepSelfMonCancel(); |
|
122 } |
|
123 else if (aStepName == KCTestCaseSelfMonIgnore) |
|
124 { |
|
125 testStep = new CStepSelfMonIgnore(); |
|
126 } |
|
127 else if (aStepName == KCTestCaseSelfMonCancel2) |
|
128 { |
|
129 testStep = new CStepSelfMonCancel2(); |
|
130 } |
|
131 else if (aStepName == KCTestCaseNoMonCancel) |
|
132 { |
|
133 testStep = new CStepNoMonCancel(); |
|
134 } |
|
135 else if(aStepName == KConnectDisconnectStep) |
|
136 { |
|
137 testStep = new CConnectDisconnectStep(); |
|
138 } |
|
139 else if(aStepName == KRegisterStep) |
|
140 { |
|
141 testStep = new CRegisterStep(); |
|
142 } |
|
143 else if(aStepName == KRegisterTwiceDifferentStep) |
|
144 { |
|
145 testStep = new CRegisterTwiceDifferentStep(); |
|
146 } |
|
147 else if(aStepName == KRegisterTwiceSameStep) |
|
148 { |
|
149 testStep = new CRegisterTwiceSameStep(); |
|
150 } |
|
151 else if(aStepName == KResultCheckStep) |
|
152 { |
|
153 testStep = new CResultCheckStep(); |
|
154 } |
|
155 else if(aStepName == KRunCountCheckStep) |
|
156 { |
|
157 testStep = new CRunCountCheckStep(); |
|
158 } |
|
159 else |
|
160 { |
|
161 RDebug::Printf("Unknown sysmon teststep %S", &aStepName); |
|
162 } |
|
163 |
|
164 return testStep; |
|
165 } |
|
166 |