sl@0
|
1 |
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// The implementation of the transition classes upon the CTransition class methods,
|
sl@0
|
15 |
// together with the derived transition used for testing.
|
sl@0
|
16 |
//
|
sl@0
|
17 |
//
|
sl@0
|
18 |
|
sl@0
|
19 |
// ______________________________________________________________________________
|
sl@0
|
20 |
//
|
sl@0
|
21 |
_LIT(KTargetNullMethodTransition,"CTarget_NullMethod_Transition");
|
sl@0
|
22 |
|
sl@0
|
23 |
inline CTarget_NullMethod_Transition::CTarget_NullMethod_Transition(CUnitTestContext& aUTContext,
|
sl@0
|
24 |
TTransitionValidator& aValidator)
|
sl@0
|
25 |
: CTransition(KTargetNullMethodTransition, aUTContext, aValidator)
|
sl@0
|
26 |
{
|
sl@0
|
27 |
// Do nothing here.
|
sl@0
|
28 |
}
|
sl@0
|
29 |
|
sl@0
|
30 |
inline void CTarget_NullMethod_Transition::TransitMethodL()
|
sl@0
|
31 |
{
|
sl@0
|
32 |
// There is no method to execute
|
sl@0
|
33 |
// However exercise both possible results by
|
sl@0
|
34 |
// provoking a leave with the context's leave code
|
sl@0
|
35 |
// on the second TransitMethodL call.
|
sl@0
|
36 |
_LIT(KTargetNullMethodTransitMethod, "CTarget::NullMethod transition");
|
sl@0
|
37 |
Context().DataLogger().LogInformation(KTargetNullMethodTransitMethod);
|
sl@0
|
38 |
if(Context().iLeaveCode != KErrNone)
|
sl@0
|
39 |
User::Leave(Context().iLeaveCode);
|
sl@0
|
40 |
else
|
sl@0
|
41 |
Context().iLeaveCode = KErrAbort; // For next entry
|
sl@0
|
42 |
}
|
sl@0
|
43 |
|
sl@0
|
44 |
inline CTargetTransition_UnitTestContext& CTarget_NullMethod_Transition::Context() const
|
sl@0
|
45 |
{
|
sl@0
|
46 |
return REINTERPRET_CAST(CTargetTransition_UnitTestContext&,iUTContext);
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
// ______________________________________________________________________________
|
sl@0
|
50 |
//
|
sl@0
|
51 |
inline CTargetTransition_UnitTestContext::CTargetTransition_UnitTestContext(CDataLogger& aDataLogger,
|
sl@0
|
52 |
MStateAccessor& aStateAccessor,
|
sl@0
|
53 |
MTransitionObserver& aObserver)
|
sl@0
|
54 |
: CUnitTestContext(aDataLogger, aStateAccessor, aObserver)
|
sl@0
|
55 |
{
|
sl@0
|
56 |
//Do nothing
|
sl@0
|
57 |
}
|
sl@0
|
58 |
|
sl@0
|
59 |
inline CTargetTransition_UnitTestContext::~CTargetTransition_UnitTestContext()
|
sl@0
|
60 |
{
|
sl@0
|
61 |
// Do Nothing
|
sl@0
|
62 |
}
|
sl@0
|
63 |
|
sl@0
|
64 |
// ______________________________________________________________________________
|
sl@0
|
65 |
//
|
sl@0
|
66 |
_LIT(KTransitionNewLTransition,"CTransition_NewL_Transition");
|
sl@0
|
67 |
|
sl@0
|
68 |
inline CTransition_NewL_Transition::CTransition_NewL_Transition(CUnitTestContext& aUTContext,
|
sl@0
|
69 |
TTransitionValidator& aValidator)
|
sl@0
|
70 |
: CTransitionType(KTransitionNewLTransition, aUTContext, aValidator)
|
sl@0
|
71 |
{
|
sl@0
|
72 |
// Do nothing here.
|
sl@0
|
73 |
}
|
sl@0
|
74 |
|
sl@0
|
75 |
inline void CTransition_NewL_Transition::TransitMethodL()
|
sl@0
|
76 |
{
|
sl@0
|
77 |
_LIT(KTransitionNewLTransitMethod, "CTransition::NewL transition");
|
sl@0
|
78 |
Context().DataLogger().LogInformation(KTransitionNewLTransitMethod);
|
sl@0
|
79 |
Context().iTargetTransition = new(ELeave)CTarget_NullMethod_Transition(*(Context().iTargetContext), *(Context().iTargetValidator));
|
sl@0
|
80 |
}
|
sl@0
|
81 |
|
sl@0
|
82 |
inline CTransition_UnitTestContext& CTransition_NewL_Transition::Context() const
|
sl@0
|
83 |
{
|
sl@0
|
84 |
return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
|
sl@0
|
85 |
}
|
sl@0
|
86 |
|
sl@0
|
87 |
// ______________________________________________________________________________
|
sl@0
|
88 |
//
|
sl@0
|
89 |
_LIT(KTransitionDtorTransition,"CTransition_Dtor_Transition");
|
sl@0
|
90 |
|
sl@0
|
91 |
inline CTransition_Dtor_Transition::CTransition_Dtor_Transition(CUnitTestContext& aUTContext,
|
sl@0
|
92 |
TTransitionValidator& aValidator)
|
sl@0
|
93 |
: CTransition(KTransitionDtorTransition, aUTContext, aValidator)
|
sl@0
|
94 |
{
|
sl@0
|
95 |
// Do nothing here.
|
sl@0
|
96 |
}
|
sl@0
|
97 |
|
sl@0
|
98 |
inline void CTransition_Dtor_Transition::TransitMethodL()
|
sl@0
|
99 |
{
|
sl@0
|
100 |
_LIT(KTransitionDtorTransitMethod, "CTransition::Dtor transition");
|
sl@0
|
101 |
Context().DataLogger().LogInformation(KTransitionDtorTransitMethod);
|
sl@0
|
102 |
delete Context().iTargetTransition;
|
sl@0
|
103 |
Context().iTargetTransition = NULL;
|
sl@0
|
104 |
}
|
sl@0
|
105 |
|
sl@0
|
106 |
inline CTransition_UnitTestContext& CTransition_Dtor_Transition::Context() const
|
sl@0
|
107 |
{
|
sl@0
|
108 |
return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
|
sl@0
|
109 |
}
|
sl@0
|
110 |
|
sl@0
|
111 |
// ______________________________________________________________________________
|
sl@0
|
112 |
//
|
sl@0
|
113 |
_LIT(KTransitionTransitMethodLTransition,"CTransition_TransitMethodL_Transition");
|
sl@0
|
114 |
|
sl@0
|
115 |
inline CTransition_TransitMethodL_Transition::CTransition_TransitMethodL_Transition(CUnitTestContext& aUTContext,
|
sl@0
|
116 |
TTransitionValidator& aValidator)
|
sl@0
|
117 |
: CTransitionType(KTransitionTransitMethodLTransition, aUTContext, aValidator)
|
sl@0
|
118 |
{
|
sl@0
|
119 |
// Do nothing here.
|
sl@0
|
120 |
}
|
sl@0
|
121 |
|
sl@0
|
122 |
inline void CTransition_TransitMethodL_Transition::TransitMethodL()
|
sl@0
|
123 |
{
|
sl@0
|
124 |
_LIT(KTransitionTransitMethodLTransitMethod, "CTransition::TransitMethodL transition");
|
sl@0
|
125 |
Context().DataLogger().LogInformation(KTransitionTransitMethodLTransitMethod);
|
sl@0
|
126 |
Context().iTargetTransition->TransitMethodL();
|
sl@0
|
127 |
}
|
sl@0
|
128 |
|
sl@0
|
129 |
inline CTransition_UnitTestContext& CTransition_TransitMethodL_Transition::Context() const
|
sl@0
|
130 |
{
|
sl@0
|
131 |
return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
|
sl@0
|
132 |
}
|
sl@0
|
133 |
|
sl@0
|
134 |
// ______________________________________________________________________________
|
sl@0
|
135 |
//
|
sl@0
|
136 |
_LIT(KTransitionRepeatOnceTransition,"CTransition_RepeatOnce_Transition");
|
sl@0
|
137 |
|
sl@0
|
138 |
inline CTransition_RepeatOnce_Transition::CTransition_RepeatOnce_Transition(CUnitTestContext& aUTContext,
|
sl@0
|
139 |
TTransitionValidator& aValidator)
|
sl@0
|
140 |
: CTransition(KTransitionRepeatOnceTransition, aUTContext, aValidator)
|
sl@0
|
141 |
{
|
sl@0
|
142 |
// Do nothing here.
|
sl@0
|
143 |
}
|
sl@0
|
144 |
|
sl@0
|
145 |
inline void CTransition_RepeatOnce_Transition::TransitMethodL()
|
sl@0
|
146 |
{
|
sl@0
|
147 |
_LIT(KTransitionRepeatOnceTransitMethod, "CTransition::RepeatOnce transition");
|
sl@0
|
148 |
Context().DataLogger().LogInformation(KTransitionRepeatOnceTransitMethod);
|
sl@0
|
149 |
Context().iTargetTransition->RepeatOnce();
|
sl@0
|
150 |
}
|
sl@0
|
151 |
|
sl@0
|
152 |
inline CTransition_UnitTestContext& CTransition_RepeatOnce_Transition::Context() const
|
sl@0
|
153 |
{
|
sl@0
|
154 |
return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
|
sl@0
|
155 |
}
|
sl@0
|
156 |
|
sl@0
|
157 |
// ______________________________________________________________________________
|
sl@0
|
158 |
//
|
sl@0
|
159 |
_LIT(KTransitionTransitionIdTransition,"CTransition_TransitionId_Transition");
|
sl@0
|
160 |
|
sl@0
|
161 |
inline CTransition_TransitionId_Transition::CTransition_TransitionId_Transition(CUnitTestContext& aUTContext,
|
sl@0
|
162 |
TTransitionValidator& aValidator)
|
sl@0
|
163 |
: CTransition(KTransitionTransitionIdTransition, aUTContext, aValidator)
|
sl@0
|
164 |
{
|
sl@0
|
165 |
// Do nothing here.
|
sl@0
|
166 |
}
|
sl@0
|
167 |
|
sl@0
|
168 |
inline void CTransition_TransitionId_Transition::TransitMethodL()
|
sl@0
|
169 |
{
|
sl@0
|
170 |
_LIT(KTransitionTransitionIdTransitMethod, "CTransition::TransitionId transition");
|
sl@0
|
171 |
Context().DataLogger().LogInformation(KTransitionTransitionIdTransitMethod);
|
sl@0
|
172 |
Context().iTransitionId = CONST_CAST(TDesC*, &(Context().iTargetTransition->TransitionId()));
|
sl@0
|
173 |
}
|
sl@0
|
174 |
|
sl@0
|
175 |
inline CTransition_UnitTestContext& CTransition_TransitionId_Transition::Context() const
|
sl@0
|
176 |
{
|
sl@0
|
177 |
return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
|
sl@0
|
178 |
}
|
sl@0
|
179 |
|
sl@0
|
180 |
// ______________________________________________________________________________
|
sl@0
|
181 |
//
|
sl@0
|
182 |
_LIT(KTransitionTransitionInfoTransition,"CTransition_TransitionInfo_Transition");
|
sl@0
|
183 |
|
sl@0
|
184 |
inline CTransition_TransitionInfo_Transition::CTransition_TransitionInfo_Transition(CUnitTestContext& aUTContext,
|
sl@0
|
185 |
TTransitionValidator& aValidator)
|
sl@0
|
186 |
: CTransition(KTransitionTransitionInfoTransition, aUTContext, aValidator)
|
sl@0
|
187 |
{
|
sl@0
|
188 |
// Do nothing here.
|
sl@0
|
189 |
}
|
sl@0
|
190 |
|
sl@0
|
191 |
inline void CTransition_TransitionInfo_Transition::TransitMethodL()
|
sl@0
|
192 |
{
|
sl@0
|
193 |
_LIT(KTransitionTransitionInfoTransitMethod, "CTransition::TransitionInfo transition");
|
sl@0
|
194 |
Context().DataLogger().LogInformation(KTransitionTransitionInfoTransitMethod);
|
sl@0
|
195 |
Context().iTransitionInfo = CONST_CAST(TTransitionInfo*, &(Context().iTargetTransition->TransitionInfo()));
|
sl@0
|
196 |
}
|
sl@0
|
197 |
|
sl@0
|
198 |
inline CTransition_UnitTestContext& CTransition_TransitionInfo_Transition::Context() const
|
sl@0
|
199 |
{
|
sl@0
|
200 |
return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
|
sl@0
|
201 |
}
|
sl@0
|
202 |
|
sl@0
|
203 |
// ______________________________________________________________________________
|
sl@0
|
204 |
//
|
sl@0
|
205 |
_LIT(KTransitionSetBlockingTransition,"CTransition_SetBlocking_Transition");
|
sl@0
|
206 |
|
sl@0
|
207 |
inline CTransition_SetBlocking_Transition::CTransition_SetBlocking_Transition(CUnitTestContext& aUTContext,
|
sl@0
|
208 |
TTransitionValidator& aValidator)
|
sl@0
|
209 |
: CTransition(KTransitionSetBlockingTransition, aUTContext, aValidator)
|
sl@0
|
210 |
{
|
sl@0
|
211 |
// Do nothing here.
|
sl@0
|
212 |
}
|
sl@0
|
213 |
|
sl@0
|
214 |
inline void CTransition_SetBlocking_Transition::TransitMethodL()
|
sl@0
|
215 |
{
|
sl@0
|
216 |
_LIT(KTransitionSetBlockingTransitMethod, "CTransition::SetBlocking transition");
|
sl@0
|
217 |
Context().DataLogger().LogInformation(KTransitionSetBlockingTransitMethod);
|
sl@0
|
218 |
Context().iTargetTransition->SetBlockingTransition(Context().iBlockingTransition);
|
sl@0
|
219 |
}
|
sl@0
|
220 |
|
sl@0
|
221 |
inline CTransition_UnitTestContext& CTransition_SetBlocking_Transition::Context() const
|
sl@0
|
222 |
{
|
sl@0
|
223 |
return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
|
sl@0
|
224 |
}
|
sl@0
|
225 |
|
sl@0
|
226 |
// ______________________________________________________________________________
|
sl@0
|
227 |
//
|
sl@0
|
228 |
_LIT(KTransitionIsBlockingTransition,"CTransition_IsBlocking_Transition");
|
sl@0
|
229 |
|
sl@0
|
230 |
inline CTransition_IsBlocking_Transition::CTransition_IsBlocking_Transition(CUnitTestContext& aUTContext,
|
sl@0
|
231 |
TTransitionValidator& aValidator)
|
sl@0
|
232 |
: CTransition(KTransitionIsBlockingTransition, aUTContext, aValidator)
|
sl@0
|
233 |
{
|
sl@0
|
234 |
// Do nothing here.
|
sl@0
|
235 |
}
|
sl@0
|
236 |
|
sl@0
|
237 |
inline void CTransition_IsBlocking_Transition::TransitMethodL()
|
sl@0
|
238 |
{
|
sl@0
|
239 |
_LIT(KTransitionIsBlockingTransitMethod, "CTransition::IsBlocking transition");
|
sl@0
|
240 |
Context().DataLogger().LogInformation(KTransitionIsBlockingTransitMethod);
|
sl@0
|
241 |
Context().iBlockingTransition = !Context().iTargetTransition->IsBlockingTransition();
|
sl@0
|
242 |
}
|
sl@0
|
243 |
|
sl@0
|
244 |
inline CTransition_UnitTestContext& CTransition_IsBlocking_Transition::Context() const
|
sl@0
|
245 |
{
|
sl@0
|
246 |
return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
|
sl@0
|
247 |
}
|
sl@0
|
248 |
|
sl@0
|
249 |
// ______________________________________________________________________________
|
sl@0
|
250 |
//
|
sl@0
|
251 |
_LIT(KTransitionGetErrorCodeTransition,"CTransition_GetErrorCode_Transition");
|
sl@0
|
252 |
|
sl@0
|
253 |
inline CTransition_GetErrorCode_Transition::CTransition_GetErrorCode_Transition(CUnitTestContext& aUTContext,
|
sl@0
|
254 |
TTransitionValidator& aValidator)
|
sl@0
|
255 |
: CTransition(KTransitionGetErrorCodeTransition, aUTContext, aValidator)
|
sl@0
|
256 |
{
|
sl@0
|
257 |
// Do nothing here.
|
sl@0
|
258 |
}
|
sl@0
|
259 |
|
sl@0
|
260 |
inline void CTransition_GetErrorCode_Transition::TransitMethodL()
|
sl@0
|
261 |
{
|
sl@0
|
262 |
_LIT(KTransitionGetErrorCodeTransitMethod, "CTransition::GetErrorCode transition");
|
sl@0
|
263 |
Context().DataLogger().LogInformation(KTransitionGetErrorCodeTransitMethod);
|
sl@0
|
264 |
Context().iTargetErrorCode = Context().iTargetTransition->GetErrorCode();
|
sl@0
|
265 |
}
|
sl@0
|
266 |
|
sl@0
|
267 |
inline CTransition_UnitTestContext& CTransition_GetErrorCode_Transition::Context() const
|
sl@0
|
268 |
{
|
sl@0
|
269 |
return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
|
sl@0
|
270 |
}
|
sl@0
|
271 |
|
sl@0
|
272 |
// ______________________________________________________________________________
|
sl@0
|
273 |
//
|
sl@0
|
274 |
_LIT(KTransitionRunTransitionTransition,"CTransition_RunTransition_Transition");
|
sl@0
|
275 |
|
sl@0
|
276 |
inline CTransition_RunTransition_Transition::CTransition_RunTransition_Transition(CUnitTestContext& aUTContext,
|
sl@0
|
277 |
TTransitionValidator& aValidator)
|
sl@0
|
278 |
: CTransition(KTransitionRunTransitionTransition, aUTContext, aValidator)
|
sl@0
|
279 |
{
|
sl@0
|
280 |
// Do nothing here.
|
sl@0
|
281 |
}
|
sl@0
|
282 |
|
sl@0
|
283 |
inline void CTransition_RunTransition_Transition::TransitMethodL()
|
sl@0
|
284 |
{
|
sl@0
|
285 |
_LIT(KTransitionRunTransitionTransitMethod, "CTransition::RunTransition transition");
|
sl@0
|
286 |
Context().DataLogger().LogInformation(KTransitionRunTransitionTransitMethod);
|
sl@0
|
287 |
// Kick off this transition as an asynchronous call on the RunTransition
|
sl@0
|
288 |
// So that this transition will complete when our target transition completes and signals its observer
|
sl@0
|
289 |
iStatus = KRequestPending;
|
sl@0
|
290 |
TRequestStatus* status = &iStatus;
|
sl@0
|
291 |
Context().iTargetTransition->RunTransition(status);
|
sl@0
|
292 |
}
|
sl@0
|
293 |
|
sl@0
|
294 |
inline void CTransition_RunTransition_Transition::DoCancel()
|
sl@0
|
295 |
{
|
sl@0
|
296 |
_LIT(KTransitionRunTransitionTransitMethodCancel, "CTransition::RunTransition transition cancelled");
|
sl@0
|
297 |
Context().DataLogger().LogInformation(KTransitionRunTransitionTransitMethodCancel);
|
sl@0
|
298 |
Context().iTargetTransition->Cancel();
|
sl@0
|
299 |
}
|
sl@0
|
300 |
|
sl@0
|
301 |
inline CTransition_UnitTestContext& CTransition_RunTransition_Transition::Context() const
|
sl@0
|
302 |
{
|
sl@0
|
303 |
return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
|
sl@0
|
304 |
}
|
sl@0
|
305 |
|
sl@0
|
306 |
// ______________________________________________________________________________
|
sl@0
|
307 |
//
|
sl@0
|
308 |
_LIT(KTransitionCancelTransition,"CTransition_Cancel_Transition");
|
sl@0
|
309 |
|
sl@0
|
310 |
inline CTransition_Cancel_Transition::CTransition_Cancel_Transition(CUnitTestContext& aUTContext,
|
sl@0
|
311 |
TTransitionValidator& aValidator)
|
sl@0
|
312 |
: CTransition(KTransitionCancelTransition, aUTContext, aValidator)
|
sl@0
|
313 |
{
|
sl@0
|
314 |
// Do nothing here.
|
sl@0
|
315 |
}
|
sl@0
|
316 |
|
sl@0
|
317 |
inline void CTransition_Cancel_Transition::TransitMethodL()
|
sl@0
|
318 |
{
|
sl@0
|
319 |
_LIT(KTransitionCancelTransitMethod, "CTransition::Cancel transition");
|
sl@0
|
320 |
Context().DataLogger().LogInformation(KTransitionCancelTransitMethod);
|
sl@0
|
321 |
Context().iTargetTransition->Cancel();
|
sl@0
|
322 |
}
|
sl@0
|
323 |
|
sl@0
|
324 |
inline CTransition_UnitTestContext& CTransition_Cancel_Transition::Context() const
|
sl@0
|
325 |
{
|
sl@0
|
326 |
return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
|
sl@0
|
327 |
}
|
sl@0
|
328 |
|