os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/TransitionTest/TransitionTransitions.inl
Update contrib.
1 // Copyright (c) 2001-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // The implementation of the transition classes upon the CTransition class methods,
15 // together with the derived transition used for testing.
19 // ______________________________________________________________________________
21 _LIT(KTargetNullMethodTransition,"CTarget_NullMethod_Transition");
23 inline CTarget_NullMethod_Transition::CTarget_NullMethod_Transition(CUnitTestContext& aUTContext,
24 TTransitionValidator& aValidator)
25 : CTransition(KTargetNullMethodTransition, aUTContext, aValidator)
30 inline void CTarget_NullMethod_Transition::TransitMethodL()
32 // There is no method to execute
33 // However exercise both possible results by
34 // provoking a leave with the context's leave code
35 // on the second TransitMethodL call.
36 _LIT(KTargetNullMethodTransitMethod, "CTarget::NullMethod transition");
37 Context().DataLogger().LogInformation(KTargetNullMethodTransitMethod);
38 if(Context().iLeaveCode != KErrNone)
39 User::Leave(Context().iLeaveCode);
41 Context().iLeaveCode = KErrAbort; // For next entry
44 inline CTargetTransition_UnitTestContext& CTarget_NullMethod_Transition::Context() const
46 return REINTERPRET_CAST(CTargetTransition_UnitTestContext&,iUTContext);
49 // ______________________________________________________________________________
51 inline CTargetTransition_UnitTestContext::CTargetTransition_UnitTestContext(CDataLogger& aDataLogger,
52 MStateAccessor& aStateAccessor,
53 MTransitionObserver& aObserver)
54 : CUnitTestContext(aDataLogger, aStateAccessor, aObserver)
59 inline CTargetTransition_UnitTestContext::~CTargetTransition_UnitTestContext()
64 // ______________________________________________________________________________
66 _LIT(KTransitionNewLTransition,"CTransition_NewL_Transition");
68 inline CTransition_NewL_Transition::CTransition_NewL_Transition(CUnitTestContext& aUTContext,
69 TTransitionValidator& aValidator)
70 : CTransitionType(KTransitionNewLTransition, aUTContext, aValidator)
75 inline void CTransition_NewL_Transition::TransitMethodL()
77 _LIT(KTransitionNewLTransitMethod, "CTransition::NewL transition");
78 Context().DataLogger().LogInformation(KTransitionNewLTransitMethod);
79 Context().iTargetTransition = new(ELeave)CTarget_NullMethod_Transition(*(Context().iTargetContext), *(Context().iTargetValidator));
82 inline CTransition_UnitTestContext& CTransition_NewL_Transition::Context() const
84 return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
87 // ______________________________________________________________________________
89 _LIT(KTransitionDtorTransition,"CTransition_Dtor_Transition");
91 inline CTransition_Dtor_Transition::CTransition_Dtor_Transition(CUnitTestContext& aUTContext,
92 TTransitionValidator& aValidator)
93 : CTransition(KTransitionDtorTransition, aUTContext, aValidator)
98 inline void CTransition_Dtor_Transition::TransitMethodL()
100 _LIT(KTransitionDtorTransitMethod, "CTransition::Dtor transition");
101 Context().DataLogger().LogInformation(KTransitionDtorTransitMethod);
102 delete Context().iTargetTransition;
103 Context().iTargetTransition = NULL;
106 inline CTransition_UnitTestContext& CTransition_Dtor_Transition::Context() const
108 return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
111 // ______________________________________________________________________________
113 _LIT(KTransitionTransitMethodLTransition,"CTransition_TransitMethodL_Transition");
115 inline CTransition_TransitMethodL_Transition::CTransition_TransitMethodL_Transition(CUnitTestContext& aUTContext,
116 TTransitionValidator& aValidator)
117 : CTransitionType(KTransitionTransitMethodLTransition, aUTContext, aValidator)
122 inline void CTransition_TransitMethodL_Transition::TransitMethodL()
124 _LIT(KTransitionTransitMethodLTransitMethod, "CTransition::TransitMethodL transition");
125 Context().DataLogger().LogInformation(KTransitionTransitMethodLTransitMethod);
126 Context().iTargetTransition->TransitMethodL();
129 inline CTransition_UnitTestContext& CTransition_TransitMethodL_Transition::Context() const
131 return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
134 // ______________________________________________________________________________
136 _LIT(KTransitionRepeatOnceTransition,"CTransition_RepeatOnce_Transition");
138 inline CTransition_RepeatOnce_Transition::CTransition_RepeatOnce_Transition(CUnitTestContext& aUTContext,
139 TTransitionValidator& aValidator)
140 : CTransition(KTransitionRepeatOnceTransition, aUTContext, aValidator)
145 inline void CTransition_RepeatOnce_Transition::TransitMethodL()
147 _LIT(KTransitionRepeatOnceTransitMethod, "CTransition::RepeatOnce transition");
148 Context().DataLogger().LogInformation(KTransitionRepeatOnceTransitMethod);
149 Context().iTargetTransition->RepeatOnce();
152 inline CTransition_UnitTestContext& CTransition_RepeatOnce_Transition::Context() const
154 return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
157 // ______________________________________________________________________________
159 _LIT(KTransitionTransitionIdTransition,"CTransition_TransitionId_Transition");
161 inline CTransition_TransitionId_Transition::CTransition_TransitionId_Transition(CUnitTestContext& aUTContext,
162 TTransitionValidator& aValidator)
163 : CTransition(KTransitionTransitionIdTransition, aUTContext, aValidator)
168 inline void CTransition_TransitionId_Transition::TransitMethodL()
170 _LIT(KTransitionTransitionIdTransitMethod, "CTransition::TransitionId transition");
171 Context().DataLogger().LogInformation(KTransitionTransitionIdTransitMethod);
172 Context().iTransitionId = CONST_CAST(TDesC*, &(Context().iTargetTransition->TransitionId()));
175 inline CTransition_UnitTestContext& CTransition_TransitionId_Transition::Context() const
177 return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
180 // ______________________________________________________________________________
182 _LIT(KTransitionTransitionInfoTransition,"CTransition_TransitionInfo_Transition");
184 inline CTransition_TransitionInfo_Transition::CTransition_TransitionInfo_Transition(CUnitTestContext& aUTContext,
185 TTransitionValidator& aValidator)
186 : CTransition(KTransitionTransitionInfoTransition, aUTContext, aValidator)
191 inline void CTransition_TransitionInfo_Transition::TransitMethodL()
193 _LIT(KTransitionTransitionInfoTransitMethod, "CTransition::TransitionInfo transition");
194 Context().DataLogger().LogInformation(KTransitionTransitionInfoTransitMethod);
195 Context().iTransitionInfo = CONST_CAST(TTransitionInfo*, &(Context().iTargetTransition->TransitionInfo()));
198 inline CTransition_UnitTestContext& CTransition_TransitionInfo_Transition::Context() const
200 return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
203 // ______________________________________________________________________________
205 _LIT(KTransitionSetBlockingTransition,"CTransition_SetBlocking_Transition");
207 inline CTransition_SetBlocking_Transition::CTransition_SetBlocking_Transition(CUnitTestContext& aUTContext,
208 TTransitionValidator& aValidator)
209 : CTransition(KTransitionSetBlockingTransition, aUTContext, aValidator)
214 inline void CTransition_SetBlocking_Transition::TransitMethodL()
216 _LIT(KTransitionSetBlockingTransitMethod, "CTransition::SetBlocking transition");
217 Context().DataLogger().LogInformation(KTransitionSetBlockingTransitMethod);
218 Context().iTargetTransition->SetBlockingTransition(Context().iBlockingTransition);
221 inline CTransition_UnitTestContext& CTransition_SetBlocking_Transition::Context() const
223 return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
226 // ______________________________________________________________________________
228 _LIT(KTransitionIsBlockingTransition,"CTransition_IsBlocking_Transition");
230 inline CTransition_IsBlocking_Transition::CTransition_IsBlocking_Transition(CUnitTestContext& aUTContext,
231 TTransitionValidator& aValidator)
232 : CTransition(KTransitionIsBlockingTransition, aUTContext, aValidator)
237 inline void CTransition_IsBlocking_Transition::TransitMethodL()
239 _LIT(KTransitionIsBlockingTransitMethod, "CTransition::IsBlocking transition");
240 Context().DataLogger().LogInformation(KTransitionIsBlockingTransitMethod);
241 Context().iBlockingTransition = !Context().iTargetTransition->IsBlockingTransition();
244 inline CTransition_UnitTestContext& CTransition_IsBlocking_Transition::Context() const
246 return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
249 // ______________________________________________________________________________
251 _LIT(KTransitionGetErrorCodeTransition,"CTransition_GetErrorCode_Transition");
253 inline CTransition_GetErrorCode_Transition::CTransition_GetErrorCode_Transition(CUnitTestContext& aUTContext,
254 TTransitionValidator& aValidator)
255 : CTransition(KTransitionGetErrorCodeTransition, aUTContext, aValidator)
260 inline void CTransition_GetErrorCode_Transition::TransitMethodL()
262 _LIT(KTransitionGetErrorCodeTransitMethod, "CTransition::GetErrorCode transition");
263 Context().DataLogger().LogInformation(KTransitionGetErrorCodeTransitMethod);
264 Context().iTargetErrorCode = Context().iTargetTransition->GetErrorCode();
267 inline CTransition_UnitTestContext& CTransition_GetErrorCode_Transition::Context() const
269 return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
272 // ______________________________________________________________________________
274 _LIT(KTransitionRunTransitionTransition,"CTransition_RunTransition_Transition");
276 inline CTransition_RunTransition_Transition::CTransition_RunTransition_Transition(CUnitTestContext& aUTContext,
277 TTransitionValidator& aValidator)
278 : CTransition(KTransitionRunTransitionTransition, aUTContext, aValidator)
283 inline void CTransition_RunTransition_Transition::TransitMethodL()
285 _LIT(KTransitionRunTransitionTransitMethod, "CTransition::RunTransition transition");
286 Context().DataLogger().LogInformation(KTransitionRunTransitionTransitMethod);
287 // Kick off this transition as an asynchronous call on the RunTransition
288 // So that this transition will complete when our target transition completes and signals its observer
289 iStatus = KRequestPending;
290 TRequestStatus* status = &iStatus;
291 Context().iTargetTransition->RunTransition(status);
294 inline void CTransition_RunTransition_Transition::DoCancel()
296 _LIT(KTransitionRunTransitionTransitMethodCancel, "CTransition::RunTransition transition cancelled");
297 Context().DataLogger().LogInformation(KTransitionRunTransitionTransitMethodCancel);
298 Context().iTargetTransition->Cancel();
301 inline CTransition_UnitTestContext& CTransition_RunTransition_Transition::Context() const
303 return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);
306 // ______________________________________________________________________________
308 _LIT(KTransitionCancelTransition,"CTransition_Cancel_Transition");
310 inline CTransition_Cancel_Transition::CTransition_Cancel_Transition(CUnitTestContext& aUTContext,
311 TTransitionValidator& aValidator)
312 : CTransition(KTransitionCancelTransition, aUTContext, aValidator)
317 inline void CTransition_Cancel_Transition::TransitMethodL()
319 _LIT(KTransitionCancelTransitMethod, "CTransition::Cancel transition");
320 Context().DataLogger().LogInformation(KTransitionCancelTransitMethod);
321 Context().iTargetTransition->Cancel();
324 inline CTransition_UnitTestContext& CTransition_Cancel_Transition::Context() const
326 return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext);