os/ossrv/lowlevellibsandfws/pluginfw/Framework/RegistrarTest/RegistrarTransitions.inl
Update contrib.
1 // Copyright (c) 1997-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 methods for the CRegistrar class.
18 #include "RegistrarStateAccessor.h"
20 // ______________________________________________________________________________
22 _LIT(KRegistrarNewLTransition,"CRegistrar_NewL_Transition");
24 inline CRegistrar_NewL_Transition::CRegistrar_NewL_Transition(CUnitTestContext& aUTContext,
25 TTransitionValidator& aValidator)
26 : CTransition(KRegistrarNewLTransition, aUTContext, aValidator)
31 inline void CRegistrar_NewL_Transition::TransitMethodL()
33 _LIT(KRegistrarNewLTransitMethod, "CRegistrar::NewL transition");
34 Context().DataLogger().LogInformation(KRegistrarNewLTransitMethod);
35 Context().iRegistrar = CRegistrar::NewL(Context().iRegistryData, Context().iRegistrarObserver, Context().iFs);
38 inline CRegistrar_UnitTestContext& CRegistrar_NewL_Transition::Context() const
40 return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
43 // ______________________________________________________________________________
45 _LIT(KRegistrarDtorTransition,"CRegistrar_Dtor_Transition");
47 inline CRegistrar_Dtor_Transition::CRegistrar_Dtor_Transition(CUnitTestContext& aUTContext,
48 TTransitionValidator& aValidator)
49 : CTransition(KRegistrarDtorTransition, aUTContext, aValidator)
54 inline void CRegistrar_Dtor_Transition::TransitMethodL()
56 _LIT(KRegistrarDtorTransitMethod, "CRegistrar::Dtor transition");
57 Context().DataLogger().LogInformation(KRegistrarDtorTransitMethod);
58 delete Context().iRegistrar;
59 Context().iRegistrar = NULL;
62 inline CRegistrar_UnitTestContext& CRegistrar_Dtor_Transition::Context() const
64 return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
67 // ______________________________________________________________________________
69 _LIT(KRegistrarDiscoveriesBeginTransition,"CRegistrar_DiscoveriesBegin_Transition");
71 inline CRegistrar_DiscoveriesBegin_Transition::CRegistrar_DiscoveriesBegin_Transition(CUnitTestContext& aUTContext,
72 TTransitionValidator& aValidator)
73 : CTransition(KRegistrarDiscoveriesBeginTransition, aUTContext, aValidator)
78 inline void CRegistrar_DiscoveriesBegin_Transition::TransitMethodL()
80 _LIT(KRegistrarDiscoveriesBeginTransitMethod, "CRegistrar::DiscoveriesBegin transition");
81 Context().DataLogger().LogInformation(KRegistrarDiscoveriesBeginTransitMethod);
82 TRegistrar_StateAccessor& accessor =
83 REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
84 accessor.DiscoveriesBegin(*(Context().iRegistrar));
87 inline CRegistrar_UnitTestContext& CRegistrar_DiscoveriesBegin_Transition::Context() const
89 return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
92 // ______________________________________________________________________________
94 _LIT(KRegistrarDiscoveriesCompleteTransition,"CRegistrar_DiscoveriesComplete_Transition");
96 inline CRegistrar_DiscoveriesComplete_Transition::CRegistrar_DiscoveriesComplete_Transition(CUnitTestContext& aUTContext,
97 TTransitionValidator& aValidator)
98 : CTransition(KRegistrarDiscoveriesCompleteTransition, aUTContext, aValidator)
103 inline void CRegistrar_DiscoveriesComplete_Transition::TransitMethodL()
105 _LIT(KRegistrarDiscoveriesCompleteTransitMethod, "CRegistrar::DiscoveriesComplete transition");
106 Context().DataLogger().LogInformation(KRegistrarDiscoveriesCompleteTransitMethod);
107 TRegistrar_StateAccessor& accessor =
108 REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
109 accessor.DiscoveriesComplete(*(Context().iRegistrar), ETrue);
112 inline CRegistrar_UnitTestContext& CRegistrar_DiscoveriesComplete_Transition::Context() const
114 return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
117 // ______________________________________________________________________________
119 _LIT(KRegistrarResumeTransition,"CRegistrar_Resume_Transition");
121 inline CRegistrar_Resume_Transition::CRegistrar_Resume_Transition(CUnitTestContext& aUTContext,
122 TTransitionValidator& aValidator)
123 : CTransition(KRegistrarResumeTransition, aUTContext, aValidator)
128 inline void CRegistrar_Resume_Transition::TransitMethodL()
130 _LIT(KRegistrarResumeTransitMethod, "CRegistrar::Resume transition");
131 Context().DataLogger().LogInformation(KRegistrarResumeTransitMethod);
132 Context().iReturnErrorCode = Context().iRegistrar->Resume();
135 inline CRegistrar_UnitTestContext& CRegistrar_Resume_Transition::Context() const
137 return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
140 // ______________________________________________________________________________
142 _LIT(KRegistrarSuspendTransition,"CRegistrar_Suspend_Transition");
144 inline CRegistrar_Suspend_Transition::CRegistrar_Suspend_Transition(CUnitTestContext& aUTContext,
145 TTransitionValidator& aValidator)
146 : CTransition(KRegistrarSuspendTransition, aUTContext, aValidator)
151 inline void CRegistrar_Suspend_Transition::TransitMethodL()
153 _LIT(KRegistrarSuspendTransitMethod, "CRegistrar::Suspend transition");
154 Context().DataLogger().LogInformation(KRegistrarSuspendTransitMethod);
155 Context().iReturnErrorCode = Context().iRegistrar->Suspend();
158 inline CRegistrar_UnitTestContext& CRegistrar_Suspend_Transition::Context() const
160 return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
163 // ______________________________________________________________________________
165 _LIT(KRegistrarParseLTransition,"CRegistrar_ParseL_Transition");
167 inline CRegistrar_ParseL_Transition::CRegistrar_ParseL_Transition(CUnitTestContext& aUTContext,
168 TTransitionValidator& aValidator)
169 : CTransitionType(KRegistrarParseLTransition, aUTContext, aValidator)
174 inline void CRegistrar_ParseL_Transition::TransitMethodL()
176 _LIT(KRegistrarParseLTransitMethod, "CRegistrar::ParseL transition");
177 Context().DataLogger().LogInformation(KRegistrarParseLTransitMethod);
178 TRegistrar_StateAccessor& accessor =
179 REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
180 accessor.ParseL(*Context().iRegistrar, *Context().iDllData, KResourceFileName);
183 inline CRegistrar_UnitTestContext& CRegistrar_ParseL_Transition::Context() const
185 return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
188 // ______________________________________________________________________________
190 _LIT(KRegistrarDisableTransition,"CRegistrar_Disable_Transition");
192 inline CRegistrar_Disable_Transition::CRegistrar_Disable_Transition(CUnitTestContext& aUTContext,
193 TTransitionValidator& aValidator)
194 : CTransition(KRegistrarDisableTransition, aUTContext, aValidator)
199 inline void CRegistrar_Disable_Transition::TransitMethodL()
201 _LIT(KRegistrarDisableTransitMethod, "CRegistrar::Disable transition");
202 Context().DataLogger().LogInformation(KRegistrarDisableTransitMethod);
203 Context().iReturnErrorCode = Context().iRegistrar->Disable(Context().iImplementationUid);
206 inline CRegistrar_UnitTestContext& CRegistrar_Disable_Transition::Context() const
208 return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
211 // ______________________________________________________________________________
213 _LIT(KRegistrarDriveReinstatedLTransition,"CRegistrar_DriveReinstatedL_Transition");
215 inline CRegistrar_DriveReinstatedL_Transition::CRegistrar_DriveReinstatedL_Transition(CUnitTestContext& aUTContext,
216 TTransitionValidator& aValidator)
217 : CTransitionType(KRegistrarDriveReinstatedLTransition, aUTContext, aValidator)
222 inline void CRegistrar_DriveReinstatedL_Transition::TransitMethodL()
224 _LIT(KRegistrarDriveReinstatedLTransitMethod, "CRegistrar::DriveReinstatedL transition");
225 Context().DataLogger().LogInformation(KRegistrarDriveReinstatedLTransitMethod);
226 TRegistrar_StateAccessor& accessor =
227 REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
228 accessor.DriveReinstatedL(*(Context().iRegistrar), Context().iDriveUnit);
231 inline CRegistrar_UnitTestContext& CRegistrar_DriveReinstatedL_Transition::Context() const
233 return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
236 // ______________________________________________________________________________
238 _LIT(KRegistrarDriveRemovedTransition,"CRegistrar_DriveRemoved_Transition");
240 inline CRegistrar_DriveRemoved_Transition::CRegistrar_DriveRemoved_Transition(CUnitTestContext& aUTContext,
241 TTransitionValidator& aValidator)
242 : CTransition(KRegistrarDriveRemovedTransition, aUTContext, aValidator)
247 inline void CRegistrar_DriveRemoved_Transition::TransitMethodL()
249 _LIT(KRegistrarDriveRemovedTransitMethod, "CRegistrar::DriveRemoved transition");
250 Context().DataLogger().LogInformation(KRegistrarDriveRemovedTransitMethod);
251 TRegistrar_StateAccessor& accessor =
252 REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
253 accessor.DriveRemoved(*(Context().iRegistrar), Context().iDriveUnit);
256 inline CRegistrar_UnitTestContext& CRegistrar_DriveRemoved_Transition::Context() const
258 return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
261 // ______________________________________________________________________________
263 _LIT(KRegistrarEnableTransition,"CRegistrar_Enable_Transition");
265 inline CRegistrar_Enable_Transition::CRegistrar_Enable_Transition(CUnitTestContext& aUTContext,
266 TTransitionValidator& aValidator)
267 : CTransition(KRegistrarEnableTransition, aUTContext, aValidator)
272 inline void CRegistrar_Enable_Transition::TransitMethodL()
274 _LIT(KRegistrarEnableTransitMethod, "CRegistrar::Enable transition");
275 Context().DataLogger().LogInformation(KRegistrarEnableTransitMethod);
276 Context().iReturnErrorCode = Context().iRegistrar->Enable(Context().iImplementationUid);
279 inline CRegistrar_UnitTestContext& CRegistrar_Enable_Transition::Context() const
281 return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
284 // ______________________________________________________________________________
286 _LIT(KRegistrarRegisterDiscoveryLTransition,"CRegistrar_RegisterDiscoveryL_Transition");
288 inline CRegistrar_RegisterDiscoveryL_Transition::CRegistrar_RegisterDiscoveryL_Transition(CUnitTestContext& aUTContext,
289 TTransitionValidator& aValidator)
290 : CTransitionType(KRegistrarRegisterDiscoveryLTransition, aUTContext, aValidator)
295 inline void CRegistrar_RegisterDiscoveryL_Transition::TransitMethodL()
297 _LIT(KRegistrarRegisterDiscoveryLTransitMethod, "CRegistrar::RegisterDiscoveryL transition");
298 Context().DataLogger().LogInformation(KRegistrarRegisterDiscoveryLTransitMethod);
299 TRegistrar_StateAccessor& accessor =
300 REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
301 accessor.RegisterDiscoveryL(*(Context().iRegistrar), Context().iDllEntry);
304 inline CRegistrar_UnitTestContext& CRegistrar_RegisterDiscoveryL_Transition::Context() const
306 return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
309 // ______________________________________________________________________________
311 _LIT(KRegistrarParseRegistrationDataLTransition,"CRegistrar_ParseRegistrationDataL_Transition");
313 inline CRegistrar_ParseRegistrationDataL_Transition::CRegistrar_ParseRegistrationDataL_Transition(CUnitTestContext& aUTContext,
314 TTransitionValidator& aValidator)
315 : CTransitionType(KRegistrarParseRegistrationDataLTransition, aUTContext, aValidator)
320 inline void CRegistrar_ParseRegistrationDataL_Transition::TransitMethodL()
322 _LIT(KRegistrarParseRegistrationDataLTransitMethod, "CRegistrar::ParseRegistrationDataL transition");
323 Context().DataLogger().LogInformation(KRegistrarParseRegistrationDataLTransitMethod);
324 // Find the appropriate drive entry
325 TChar driveLetter = User::UpperCase((Context().iDllEntry.iName)[0]) - 'A';
326 TDriveUnit driveUnit = EDriveA + driveLetter;
327 TRegistrar_StateAccessor& accessor =
328 REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
329 accessor.ParseRegistrationDataL(*Context().iRegistrar,
337 inline CRegistrar_UnitTestContext& CRegistrar_ParseRegistrationDataL_Transition::Context() const
339 return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);