os/ossrv/lowlevellibsandfws/pluginfw/Framework/DiscovererTest/DiscovererTransitions.inl
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Implementation of the CDiscoverer transition class methods.
    15 // 
    16 //
    17 
    18 #include "DiscovererObserverStub.h"
    19 
    20 // Public methods first
    21 // ______________________________________________________________________________
    22 //
    23 _LIT(KDiscovererNewLTransition,"CDiscoverer_NewL_Transition");
    24 
    25 inline CDiscoverer_NewL_Transition::CDiscoverer_NewL_Transition(CUnitTestContext& aUTContext,
    26 													TTransitionValidator& aValidator)
    27 : CTransitionType(KDiscovererNewLTransition, aUTContext, aValidator)
    28 	{
    29 	// Do nothing here.
    30 	}
    31 
    32 inline void CDiscoverer_NewL_Transition::TransitMethodL()
    33 	{
    34 	_LIT(KTransitMethod,"CDiscoverer::Ctor transition");
    35 	Context().DataLogger().LogInformation(KTransitMethod);
    36 	Context().iDiscoverer = CDiscoverer::NewL(Context().DiscovererObserver(), Context().iFs);
    37 	}
    38 
    39 inline CDiscoverer_UnitTestContext& CDiscoverer_NewL_Transition::Context() const
    40 	{
    41 	return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
    42 	}
    43 
    44 // ______________________________________________________________________________
    45 //
    46 _LIT(KDiscovererDtorTransition,"CDiscoverer_Dtor_Transition");
    47 
    48 inline CDiscoverer_Dtor_Transition::CDiscoverer_Dtor_Transition(CUnitTestContext& aUTContext,
    49 													TTransitionValidator& aValidator)
    50 : CTransition(KDiscovererDtorTransition, aUTContext, aValidator)
    51 	{
    52 	// Do nothing here.
    53 	}
    54 
    55 inline void CDiscoverer_Dtor_Transition::TransitMethodL()
    56 	{
    57 	_LIT(KTransitMethod,"CDiscoverer::Dtor transition");
    58 	Context().DataLogger().LogInformation(KTransitMethod);
    59 	delete Context().iDiscoverer;
    60 	Context().iDiscoverer = NULL;
    61 	}
    62 
    63 inline CDiscoverer_UnitTestContext& CDiscoverer_Dtor_Transition::Context() const
    64 	{
    65 	return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
    66 	}
    67 
    68 // ______________________________________________________________________________
    69 //
    70 _LIT(KDiscovererResumeTransition,"CDiscoverer_Resume_Transition");
    71 
    72 inline CDiscoverer_Resume_Transition::CDiscoverer_Resume_Transition(CUnitTestContext& aUTContext,
    73 													TTransitionValidator& aValidator)
    74 : CTransition(KDiscovererResumeTransition, aUTContext, aValidator)
    75 	{
    76 	// Do nothing here.
    77 	}
    78 
    79 inline void CDiscoverer_Resume_Transition::TransitMethodL()
    80 	{
    81 	_LIT(KTransitMethod,"CDiscoverer::Resume transition");
    82 	Context().DataLogger().LogInformation(KTransitMethod);
    83 	Context().iDiscoverer->Resume();
    84 	}
    85 
    86 inline CDiscoverer_UnitTestContext& CDiscoverer_Resume_Transition::Context() const
    87 	{
    88 	return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
    89 	}
    90 
    91 // ______________________________________________________________________________
    92 //
    93 _LIT(KDiscovererSuspendTransition,"CDiscoverer_Suspend_Transition");
    94 
    95 inline CDiscoverer_Suspend_Transition::CDiscoverer_Suspend_Transition(CUnitTestContext& aUTContext,
    96 													TTransitionValidator& aValidator)
    97 : CTransition(KDiscovererSuspendTransition, aUTContext, aValidator)
    98 	{
    99 	// Do nothing here.
   100 	}
   101 
   102 inline void CDiscoverer_Suspend_Transition::TransitMethodL()
   103 	{
   104 	_LIT(KTransitMethod,"CDiscoverer::Suspend transition");
   105 	Context().DataLogger().LogInformation(KTransitMethod);
   106 	Context().iDiscoverer->Suspend();
   107 	}
   108 
   109 inline CDiscoverer_UnitTestContext& CDiscoverer_Suspend_Transition::Context() const
   110 	{
   111 	return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
   112 	}
   113 
   114 // Private method transitions
   115 // ______________________________________________________________________________
   116 //
   117 _LIT(KDiscovererNotificationTransition,"CDiscoverer_Notification_Transition");
   118 
   119 inline CDiscoverer_Notification_Transition::CDiscoverer_Notification_Transition(CUnitTestContext& aUTContext,
   120 													TTransitionValidator& aValidator)
   121 : CTransition(KDiscovererNotificationTransition, aUTContext, aValidator)
   122 	{
   123 	// Do nothing here.
   124 	}
   125 
   126 inline void CDiscoverer_Notification_Transition::TransitMethodL()
   127 	{
   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);
   142 	}
   143 
   144 inline CDiscoverer_UnitTestContext& CDiscoverer_Notification_Transition::Context() const
   145 	{
   146 	return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
   147 	}
   148 
   149 // ______________________________________________________________________________
   150 //
   151 _LIT(KDiscovererScanDirectoryLTransition,"CDiscoverer_ScanDirectoryL_Transition");
   152 
   153 inline CDiscoverer_ScanDirectoryL_Transition::CDiscoverer_ScanDirectoryL_Transition(CUnitTestContext& aUTContext,
   154 													TTransitionValidator& aValidator)
   155 : CTransitionType(KDiscovererScanDirectoryLTransition, aUTContext, aValidator)
   156 	{
   157 	// Do nothing here.
   158 	}
   159 
   160 inline void CDiscoverer_ScanDirectoryL_Transition::TransitMethodL()
   161 	{
   162 	_LIT(KTransitMethod,"CDiscoverer::ScanDirectoryL transition");
   163 	Context().DataLogger().LogInformation(KTransitMethod);
   164 	REINTERPRET_CAST(TDiscoverer_StateAccessor&, Context().StateAccessor()).ScanDirectoryL(Context().iDiscoverer);
   165 	}
   166 
   167 inline CDiscoverer_UnitTestContext& CDiscoverer_ScanDirectoryL_Transition::Context() const
   168 	{
   169 	return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
   170 	}
   171 
   172 // ______________________________________________________________________________
   173 //
   174 _LIT(KDiscovererScanDirectoryIncrementLTransition,"CDiscoverer_ScanDirectoryIncrementL_Transition");
   175 
   176 inline CDiscoverer_ScanDirectoryIncrementL_Transition::CDiscoverer_ScanDirectoryIncrementL_Transition(CUnitTestContext& aUTContext,
   177 													TTransitionValidator& aValidator)
   178 : CTransitionType(KDiscovererScanDirectoryIncrementLTransition, aUTContext, aValidator)
   179 	{
   180 	// Do nothing here.
   181 	}
   182 
   183 inline void CDiscoverer_ScanDirectoryIncrementL_Transition::TransitMethodL()
   184 	{
   185 	_LIT(KTransitMethod,"CDiscoverer::ScanDirectoryIncrementL transition");
   186 	Context().DataLogger().LogInformation(KTransitMethod);
   187 	REINTERPRET_CAST(TDiscoverer_StateAccessor&, Context().StateAccessor()).ScanDirectoryIncrementL(Context().iDiscoverer);
   188 	}
   189 
   190 inline CDiscoverer_UnitTestContext& CDiscoverer_ScanDirectoryIncrementL_Transition::Context() const
   191 	{
   192 	return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
   193 	}
   194 
   195 // ______________________________________________________________________________
   196 //
   197 _LIT(KDiscovererScanDirectoryCancelTransition,"CDiscoverer_ScanDirectoryCancel_Transition");
   198 
   199 inline CDiscoverer_ScanDirectoryCancel_Transition::CDiscoverer_ScanDirectoryCancel_Transition(CUnitTestContext& aUTContext,
   200 													TTransitionValidator& aValidator)
   201 : CTransition(KDiscovererScanDirectoryCancelTransition, aUTContext, aValidator)
   202 	{
   203 	// Do nothing here.
   204 	}
   205 
   206 inline void CDiscoverer_ScanDirectoryCancel_Transition::TransitMethodL()
   207 	{
   208 	_LIT(KTransitMethod,"CDiscoverer::ScanDirectoryCancel transition");
   209 	Context().DataLogger().LogInformation(KTransitMethod);
   210 	REINTERPRET_CAST(TDiscoverer_StateAccessor&, Context().StateAccessor()).ScanDirectoryCancel(Context().iDiscoverer);
   211 	}
   212 
   213 inline CDiscoverer_UnitTestContext& CDiscoverer_ScanDirectoryCancel_Transition::Context() const
   214 	{
   215 	return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
   216 	}
   217 
   218 // ______________________________________________________________________________
   219 //
   220 _LIT(KDiscovererCompleteNotificationProcessingTransition,"CDiscoverer_CompleteNotificationProcessing_Transition");
   221 
   222 inline CDiscoverer_CompleteNotificationProcessing_Transition::CDiscoverer_CompleteNotificationProcessing_Transition(CUnitTestContext& aUTContext,
   223 													TTransitionValidator& aValidator)
   224 : CTransition(KDiscovererCompleteNotificationProcessingTransition, aUTContext, aValidator)
   225 	{
   226 	// Do nothing here.
   227 	}
   228 
   229 inline void CDiscoverer_CompleteNotificationProcessing_Transition::TransitMethodL()
   230 	{
   231 	_LIT(KTransitMethod,"CDiscoverer::CompleteNotificationProcessing transition");
   232 	Context().DataLogger().LogInformation(KTransitMethod);
   233 	REINTERPRET_CAST(TDiscoverer_StateAccessor&, Context().StateAccessor()).CompleteNotificationProcessing(Context().iDiscoverer);
   234 	}
   235 
   236 inline CDiscoverer_UnitTestContext& CDiscoverer_CompleteNotificationProcessing_Transition::Context() const
   237 	{
   238 	return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
   239 	}
   240 
   241 // ______________________________________________________________________________
   242 //
   243 _LIT(KDiscovererIsValidEntryLTransition,"CDiscoverer_IsValidEntryL_Transition");
   244 
   245 inline CDiscoverer_IsValidEntryL_Transition::CDiscoverer_IsValidEntryL_Transition(CUnitTestContext& aUTContext,
   246 													TTransitionValidator& aValidator)
   247 : CTransitionType(KDiscovererIsValidEntryLTransition, aUTContext, aValidator)
   248 	{
   249 	// Do nothing here.
   250 	}
   251 
   252 inline void CDiscoverer_IsValidEntryL_Transition::TransitMethodL()
   253 	{
   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();
   259 	if(count)
   260 		accessor.ValidateEntryL(Context().iDiscoverer, (*dir)[0], Context().iPath, Context().iReturnedFileEntry);
   261 	}
   262 
   263 inline CDiscoverer_UnitTestContext& CDiscoverer_IsValidEntryL_Transition::Context() const
   264 	{
   265 	return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
   266 	}
   267 
   268 // ______________________________________________________________________________
   269 //
   270 _LIT(KDiscovererProcessEntryLTransition,"CDiscoverer_ProcessEntryL_Transition");
   271 
   272 inline CDiscoverer_ProcessEntryL_Transition::CDiscoverer_ProcessEntryL_Transition(CUnitTestContext& aUTContext,
   273 													TTransitionValidator& aValidator)
   274 : CTransitionType(KDiscovererProcessEntryLTransition, aUTContext, aValidator)
   275 	{
   276 	// Do nothing here.
   277 	}
   278 
   279 inline void CDiscoverer_ProcessEntryL_Transition::TransitMethodL()
   280 	{
   281 	_LIT(KTransitMethod,"CDiscoverer::ProcessEntryL transition");
   282 	Context().DataLogger().LogInformation(KTransitMethod);
   283 	REINTERPRET_CAST(TDiscoverer_StateAccessor&, Context().StateAccessor()).ProcessEntryL(Context().iDiscoverer, *Context().iReturnedFileEntry);
   284 	}
   285 
   286 inline CDiscoverer_UnitTestContext& CDiscoverer_ProcessEntryL_Transition::Context() const
   287 	{
   288 	return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
   289 	}
   290 
   291 // ______________________________________________________________________________
   292 //
   293 _LIT(KDiscovererMountDriveLTransition,"CDiscoverer_MountDriveL_Transition");
   294 
   295 inline CDiscoverer_MountDriveL_Transition::CDiscoverer_MountDriveL_Transition(CUnitTestContext& aUTContext,
   296 													TTransitionValidator& aValidator)
   297 : CTransitionType(KDiscovererMountDriveLTransition, aUTContext, aValidator)
   298 	{
   299 	// Do nothing here.
   300 	}
   301 
   302 inline void CDiscoverer_MountDriveL_Transition::TransitMethodL()
   303 	{
   304 	_LIT(KTransitMethod,"CDiscoverer::MountDriveL transition");
   305 	Context().DataLogger().LogInformation(KTransitMethod);
   306 	REINTERPRET_CAST(TDiscoverer_StateAccessor&, Context().StateAccessor()).DriveMountedL(Context().iDiscoverer, Context().iDriveUnit);
   307 	}
   308 
   309 inline CDiscoverer_UnitTestContext& CDiscoverer_MountDriveL_Transition::Context() const
   310 	{
   311 	return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
   312 	}
   313 
   314 // ______________________________________________________________________________
   315 //
   316 _LIT(KDiscovererUnmountDriveTransition,"CDiscoverer_UnmountDrive_Transition");
   317 
   318 inline CDiscoverer_UnmountDrive_Transition::CDiscoverer_UnmountDrive_Transition(CUnitTestContext& aUTContext,
   319 													TTransitionValidator& aValidator)
   320 : CTransition(KDiscovererUnmountDriveTransition, aUTContext, aValidator)
   321 	{
   322 	// Do nothing here.
   323 	}
   324 
   325 inline void CDiscoverer_UnmountDrive_Transition::TransitMethodL()
   326 	{
   327 	_LIT(KTransitMethod,"CDiscoverer::DriveUnmountedL transition");
   328 	Context().DataLogger().LogInformation(KTransitMethod);
   329 	REINTERPRET_CAST(TDiscoverer_StateAccessor&, Context().StateAccessor()).DriveUnmountedL(Context().iDiscoverer, Context().iDriveUnit);
   330 	}
   331 
   332 inline CDiscoverer_UnitTestContext& CDiscoverer_UnmountDrive_Transition::Context() const
   333 	{
   334 	return REINTERPRET_CAST(CDiscoverer_UnitTestContext&,iUTContext);
   335 	}