1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * This is the test class for TEF (PREQ10437). |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #include "tefpanictest.h" |
|
22 |
|
23 CTEFPanicSomeThingStep::CTEFPanicSomeThingStep() |
|
24 { |
|
25 SetTestStepName(KTEFPanicSomeThingStep); |
|
26 } |
|
27 TVerdict CTEFPanicSomeThingStep::doTestStepL() |
|
28 { |
|
29 User::Panic( _L("SomeThing"), 110); |
|
30 return TestStepResult(); |
|
31 } |
|
32 CTEFPanicEmptyStep::CTEFPanicEmptyStep() |
|
33 { |
|
34 SetTestStepName(KTEFPanicEmptyStep); |
|
35 } |
|
36 |
|
37 TVerdict CTEFPanicEmptyStep::doTestStepL(void) |
|
38 { |
|
39 User::Panic( _L(""), 110); |
|
40 return TestStepResult(); |
|
41 } |
|
42 |
|
43 CTEFPanicDblSpaceStep::CTEFPanicDblSpaceStep() |
|
44 { |
|
45 SetTestStepName(KTEFPanicDblSpaceStep); |
|
46 } |
|
47 TVerdict CTEFPanicDblSpaceStep::doTestStepL(void) |
|
48 { |
|
49 User::Panic( _L("a b"), 110); |
|
50 return TestStepResult(); |
|
51 } |
|
52 CTEFIgnoreStep::CTEFIgnoreStep() |
|
53 { |
|
54 SetTestStepName(KTEFIgnoreStep); |
|
55 } |
|
56 TVerdict CTEFIgnoreStep::doTestStepL(void) |
|
57 { |
|
58 SetTestStepResult(EIgnore); |
|
59 return TestStepResult(); |
|
60 } |
|
61 |
|
62 CTEFPassStep::CTEFPassStep() |
|
63 { |
|
64 SetTestStepName(KTEFPassStep); |
|
65 } |
|
66 TVerdict CTEFPassStep::doTestStepL(void) |
|
67 { |
|
68 SetTestStepResult(EPass); |
|
69 return TestStepResult(); |
|
70 } |
|
71 |
|
72 CTEFPanicBugServer* CTEFPanicBugServer::NewL() |
|
73 /** |
|
74 @return - Instance of the test server |
|
75 Same code for Secure and non-secure variants |
|
76 Called inside the MainL() function to create and start the |
|
77 CTestServer derived server. |
|
78 */ |
|
79 { |
|
80 CTEFPanicBugServer * server = new (ELeave) CTEFPanicBugServer(); |
|
81 CleanupStack::PushL(server); |
|
82 |
|
83 server->StartL(KServerName); |
|
84 CleanupStack::Pop(server); |
|
85 return server; |
|
86 } |
|
87 |
|
88 CTEFPanicBugStep::CTEFPanicBugStep() |
|
89 { |
|
90 SetTestStepName(KTEFPanicBugStep); |
|
91 } |
|
92 TVerdict CTEFPanicBugStep::doTestStepL() |
|
93 { |
|
94 User::Panic( _L("123"), 110); |
|
95 return TestStepResult(); |
|
96 } |
|
97 |
|
98 |
|
99 LOCAL_C void MainL() |
|
100 // |
|
101 // Secure variant |
|
102 // Much simpler, uses the new Rendezvous() call to sync with the client |
|
103 // |
|
104 |
|
105 { |
|
106 #if (defined __DATA_CAGING__) |
|
107 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
108 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
109 #endif |
|
110 CActiveScheduler* sched=NULL; |
|
111 sched=new(ELeave) CActiveScheduler; |
|
112 CActiveScheduler::Install(sched); |
|
113 CTEFPanicBugServer* server = NULL; |
|
114 // Create the CTestServer derived server |
|
115 TRAPD(err,server = CTEFPanicBugServer::NewL()); |
|
116 if(!err) |
|
117 { |
|
118 // Sync with the client and enter the active scheduler |
|
119 RProcess::Rendezvous(KErrNone); |
|
120 sched->Start(); |
|
121 } |
|
122 delete server; |
|
123 delete sched; |
|
124 } |
|
125 |
|
126 GLDEF_C TInt E32Main() |
|
127 |
|
128 /** @return - Standard Epoc error code on process exit |
|
129 Secure variant only |
|
130 Process entry point. Called by client using RProcess API |
|
131 */ |
|
132 { |
|
133 __UHEAP_MARK; |
|
134 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
135 if (cleanup == NULL) |
|
136 { |
|
137 return KErrNoMemory; |
|
138 } |
|
139 TRAPD(err,MainL()) |
|
140 ; |
|
141 // This if statement is here just to shut up RVCT, which would otherwise warn |
|
142 // that err was set but never used |
|
143 if (err) |
|
144 { |
|
145 err = KErrNone; |
|
146 } |
|
147 delete cleanup; |
|
148 __UHEAP_MARKEND; |
|
149 return KErrNone; |
|
150 } |
|
151 |
|
152 CTestStep* CTEFPanicBugServer::CreateTestStep(const TDesC& aStepName) |
|
153 /** |
|
154 @return - A CTestStep derived instance |
|
155 Secure and non-secure variants |
|
156 Implementation of CTestServer pure virtual |
|
157 */ |
|
158 { |
|
159 CTestStep* testStep= NULL; |
|
160 if (aStepName == KTEFPanicBugStep) |
|
161 { |
|
162 testStep = new CTEFPanicBugStep(); |
|
163 } |
|
164 else if (aStepName == KTEFIgnoreStep) |
|
165 { |
|
166 testStep = new CTEFIgnoreStep(); |
|
167 } |
|
168 else if (aStepName == KTEFPassStep) |
|
169 { |
|
170 testStep = new CTEFPassStep(); |
|
171 } |
|
172 else if (aStepName == KTEFPanicSomeThingStep) |
|
173 { |
|
174 testStep = new CTEFPanicSomeThingStep(); |
|
175 } |
|
176 else if (aStepName == KTEFPanicEmptyStep) |
|
177 { |
|
178 testStep = new CTEFPanicEmptyStep(); |
|
179 } |
|
180 else if (aStepName == KTEFPanicDblSpaceStep) |
|
181 { |
|
182 testStep = new CTEFPanicDblSpaceStep(); |
|
183 } |
|
184 return testStep; |
|
185 } |
|
186 |
|