os/ossrv/lowlevellibsandfws/pluginfw/Framework/DiscovererTest/DiscovererTransitions.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 // Implementation of the CDiscoverer transition class methods.
18 #include "DiscovererObserverStub.h"
20 // Public methods first
21 // ______________________________________________________________________________
23 _LIT(KDiscovererNewLTransition,"CDiscoverer_NewL_Transition");
25 inline CDiscoverer_NewL_Transition::CDiscoverer_NewL_Transition(CUnitTestContext& aUTContext,
26 TTransitionValidator& aValidator)
27 : CTransitionType(KDiscovererNewLTransition, aUTContext, aValidator)
32 inline void CDiscoverer_NewL_Transition::TransitMethodL()
34 _LIT(KTransitMethod,"CDiscoverer::Ctor transition");
35 Context().DataLogger().LogInformation(KTransitMethod);
36 Context().iDiscoverer = CDiscoverer::NewL(Context().DiscovererObserver(), Context().iFs);
39 inline CDiscoverer_UnitTestContext& CDiscoverer_NewL_Transition::Context() const
41 return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
44 // ______________________________________________________________________________
46 _LIT(KDiscovererDtorTransition,"CDiscoverer_Dtor_Transition");
48 inline CDiscoverer_Dtor_Transition::CDiscoverer_Dtor_Transition(CUnitTestContext& aUTContext,
49 TTransitionValidator& aValidator)
50 : CTransition(KDiscovererDtorTransition, aUTContext, aValidator)
55 inline void CDiscoverer_Dtor_Transition::TransitMethodL()
57 _LIT(KTransitMethod,"CDiscoverer::Dtor transition");
58 Context().DataLogger().LogInformation(KTransitMethod);
59 delete Context().iDiscoverer;
60 Context().iDiscoverer = NULL;
63 inline CDiscoverer_UnitTestContext& CDiscoverer_Dtor_Transition::Context() const
65 return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
68 // ______________________________________________________________________________
70 _LIT(KDiscovererResumeTransition,"CDiscoverer_Resume_Transition");
72 inline CDiscoverer_Resume_Transition::CDiscoverer_Resume_Transition(CUnitTestContext& aUTContext,
73 TTransitionValidator& aValidator)
74 : CTransition(KDiscovererResumeTransition, aUTContext, aValidator)
79 inline void CDiscoverer_Resume_Transition::TransitMethodL()
81 _LIT(KTransitMethod,"CDiscoverer::Resume transition");
82 Context().DataLogger().LogInformation(KTransitMethod);
83 Context().iDiscoverer->Resume();
86 inline CDiscoverer_UnitTestContext& CDiscoverer_Resume_Transition::Context() const
88 return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
91 // ______________________________________________________________________________
93 _LIT(KDiscovererSuspendTransition,"CDiscoverer_Suspend_Transition");
95 inline CDiscoverer_Suspend_Transition::CDiscoverer_Suspend_Transition(CUnitTestContext& aUTContext,
96 TTransitionValidator& aValidator)
97 : CTransition(KDiscovererSuspendTransition, aUTContext, aValidator)
102 inline void CDiscoverer_Suspend_Transition::TransitMethodL()
104 _LIT(KTransitMethod,"CDiscoverer::Suspend transition");
105 Context().DataLogger().LogInformation(KTransitMethod);
106 Context().iDiscoverer->Suspend();
109 inline CDiscoverer_UnitTestContext& CDiscoverer_Suspend_Transition::Context() const
111 return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
114 // Private method transitions
115 // ______________________________________________________________________________
117 _LIT(KDiscovererNotificationTransition,"CDiscoverer_Notification_Transition");
119 inline CDiscoverer_Notification_Transition::CDiscoverer_Notification_Transition(CUnitTestContext& aUTContext,
120 TTransitionValidator& aValidator)
121 : CTransition(KDiscovererNotificationTransition, aUTContext, aValidator)
126 inline void CDiscoverer_Notification_Transition::TransitMethodL()
128 // Simulate the RunL of the notifier firing to run the
129 // notification transition.
130 _LIT(KTransitMethod,"CDiscoverer::Notification transition");
131 Context().DataLogger().LogInformation(KTransitMethod);
132 TDiscoverer_StateAccessor& accessor = REINTERPRET_CAST(TDiscoverer_StateAccessor&,Context().StateAccessor());
133 // Notification processing is asynchronous,
134 // but it is a backgrounding task, not a true async
135 // signally process so !???
136 iStatus = KRequestPending;
137 // give the flag to the stub so that we complete
138 // when the stub's completion method is called
139 Context().iNotificationStatus = &iStatus;
140 // and kick off the notification
141 accessor.Notification(Context().iDiscoverer);
144 inline CDiscoverer_UnitTestContext& CDiscoverer_Notification_Transition::Context() const
146 return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
149 // ______________________________________________________________________________
151 _LIT(KDiscovererScanDirectoryLTransition,"CDiscoverer_ScanDirectoryL_Transition");
153 inline CDiscoverer_ScanDirectoryL_Transition::CDiscoverer_ScanDirectoryL_Transition(CUnitTestContext& aUTContext,
154 TTransitionValidator& aValidator)
155 : CTransitionType(KDiscovererScanDirectoryLTransition, aUTContext, aValidator)
160 inline void CDiscoverer_ScanDirectoryL_Transition::TransitMethodL()
162 _LIT(KTransitMethod,"CDiscoverer::ScanDirectoryL transition");
163 Context().DataLogger().LogInformation(KTransitMethod);
164 REINTERPRET_CAST(TDiscoverer_StateAccessor&, Context().StateAccessor()).ScanDirectoryL(Context().iDiscoverer);
167 inline CDiscoverer_UnitTestContext& CDiscoverer_ScanDirectoryL_Transition::Context() const
169 return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
172 // ______________________________________________________________________________
174 _LIT(KDiscovererScanDirectoryIncrementLTransition,"CDiscoverer_ScanDirectoryIncrementL_Transition");
176 inline CDiscoverer_ScanDirectoryIncrementL_Transition::CDiscoverer_ScanDirectoryIncrementL_Transition(CUnitTestContext& aUTContext,
177 TTransitionValidator& aValidator)
178 : CTransitionType(KDiscovererScanDirectoryIncrementLTransition, aUTContext, aValidator)
183 inline void CDiscoverer_ScanDirectoryIncrementL_Transition::TransitMethodL()
185 _LIT(KTransitMethod,"CDiscoverer::ScanDirectoryIncrementL transition");
186 Context().DataLogger().LogInformation(KTransitMethod);
187 REINTERPRET_CAST(TDiscoverer_StateAccessor&, Context().StateAccessor()).ScanDirectoryIncrementL(Context().iDiscoverer);
190 inline CDiscoverer_UnitTestContext& CDiscoverer_ScanDirectoryIncrementL_Transition::Context() const
192 return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
195 // ______________________________________________________________________________
197 _LIT(KDiscovererScanDirectoryCancelTransition,"CDiscoverer_ScanDirectoryCancel_Transition");
199 inline CDiscoverer_ScanDirectoryCancel_Transition::CDiscoverer_ScanDirectoryCancel_Transition(CUnitTestContext& aUTContext,
200 TTransitionValidator& aValidator)
201 : CTransition(KDiscovererScanDirectoryCancelTransition, aUTContext, aValidator)
206 inline void CDiscoverer_ScanDirectoryCancel_Transition::TransitMethodL()
208 _LIT(KTransitMethod,"CDiscoverer::ScanDirectoryCancel transition");
209 Context().DataLogger().LogInformation(KTransitMethod);
210 REINTERPRET_CAST(TDiscoverer_StateAccessor&, Context().StateAccessor()).ScanDirectoryCancel(Context().iDiscoverer);
213 inline CDiscoverer_UnitTestContext& CDiscoverer_ScanDirectoryCancel_Transition::Context() const
215 return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
218 // ______________________________________________________________________________
220 _LIT(KDiscovererCompleteNotificationProcessingTransition,"CDiscoverer_CompleteNotificationProcessing_Transition");
222 inline CDiscoverer_CompleteNotificationProcessing_Transition::CDiscoverer_CompleteNotificationProcessing_Transition(CUnitTestContext& aUTContext,
223 TTransitionValidator& aValidator)
224 : CTransition(KDiscovererCompleteNotificationProcessingTransition, aUTContext, aValidator)
229 inline void CDiscoverer_CompleteNotificationProcessing_Transition::TransitMethodL()
231 _LIT(KTransitMethod,"CDiscoverer::CompleteNotificationProcessing transition");
232 Context().DataLogger().LogInformation(KTransitMethod);
233 REINTERPRET_CAST(TDiscoverer_StateAccessor&, Context().StateAccessor()).CompleteNotificationProcessing(Context().iDiscoverer);
236 inline CDiscoverer_UnitTestContext& CDiscoverer_CompleteNotificationProcessing_Transition::Context() const
238 return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
241 // ______________________________________________________________________________
243 _LIT(KDiscovererIsValidEntryLTransition,"CDiscoverer_IsValidEntryL_Transition");
245 inline CDiscoverer_IsValidEntryL_Transition::CDiscoverer_IsValidEntryL_Transition(CUnitTestContext& aUTContext,
246 TTransitionValidator& aValidator)
247 : CTransitionType(KDiscovererIsValidEntryLTransition, aUTContext, aValidator)
252 inline void CDiscoverer_IsValidEntryL_Transition::TransitMethodL()
254 _LIT(KTransitMethod,"CDiscoverer::IsValidEntryL transition");
255 Context().DataLogger().LogInformation(KTransitMethod);
256 TDiscoverer_StateAccessor& accessor = REINTERPRET_CAST(TDiscoverer_StateAccessor&, Context().StateAccessor());
257 CDir* dir = Context().iDir;
258 TInt count = dir->Count();
260 accessor.ValidateEntryL(Context().iDiscoverer, (*dir)[0], Context().iPath, Context().iReturnedFileEntry);
263 inline CDiscoverer_UnitTestContext& CDiscoverer_IsValidEntryL_Transition::Context() const
265 return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
268 // ______________________________________________________________________________
270 _LIT(KDiscovererProcessEntryLTransition,"CDiscoverer_ProcessEntryL_Transition");
272 inline CDiscoverer_ProcessEntryL_Transition::CDiscoverer_ProcessEntryL_Transition(CUnitTestContext& aUTContext,
273 TTransitionValidator& aValidator)
274 : CTransitionType(KDiscovererProcessEntryLTransition, aUTContext, aValidator)
279 inline void CDiscoverer_ProcessEntryL_Transition::TransitMethodL()
281 _LIT(KTransitMethod,"CDiscoverer::ProcessEntryL transition");
282 Context().DataLogger().LogInformation(KTransitMethod);
283 REINTERPRET_CAST(TDiscoverer_StateAccessor&, Context().StateAccessor()).ProcessEntryL(Context().iDiscoverer, *Context().iReturnedFileEntry);
286 inline CDiscoverer_UnitTestContext& CDiscoverer_ProcessEntryL_Transition::Context() const
288 return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
291 // ______________________________________________________________________________
293 _LIT(KDiscovererMountDriveLTransition,"CDiscoverer_MountDriveL_Transition");
295 inline CDiscoverer_MountDriveL_Transition::CDiscoverer_MountDriveL_Transition(CUnitTestContext& aUTContext,
296 TTransitionValidator& aValidator)
297 : CTransitionType(KDiscovererMountDriveLTransition, aUTContext, aValidator)
302 inline void CDiscoverer_MountDriveL_Transition::TransitMethodL()
304 _LIT(KTransitMethod,"CDiscoverer::MountDriveL transition");
305 Context().DataLogger().LogInformation(KTransitMethod);
306 REINTERPRET_CAST(TDiscoverer_StateAccessor&, Context().StateAccessor()).DriveMountedL(Context().iDiscoverer, Context().iDriveUnit);
309 inline CDiscoverer_UnitTestContext& CDiscoverer_MountDriveL_Transition::Context() const
311 return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
314 // ______________________________________________________________________________
316 _LIT(KDiscovererUnmountDriveTransition,"CDiscoverer_UnmountDrive_Transition");
318 inline CDiscoverer_UnmountDrive_Transition::CDiscoverer_UnmountDrive_Transition(CUnitTestContext& aUTContext,
319 TTransitionValidator& aValidator)
320 : CTransition(KDiscovererUnmountDriveTransition, aUTContext, aValidator)
325 inline void CDiscoverer_UnmountDrive_Transition::TransitMethodL()
327 _LIT(KTransitMethod,"CDiscoverer::DriveUnmountedL transition");
328 Context().DataLogger().LogInformation(KTransitMethod);
329 REINTERPRET_CAST(TDiscoverer_StateAccessor&, Context().StateAccessor()).DriveUnmountedL(Context().iDiscoverer, Context().iDriveUnit);
332 inline CDiscoverer_UnitTestContext& CDiscoverer_UnmountDrive_Transition::Context() const
334 return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);