os/ossrv/lowlevellibsandfws/pluginfw/Framework/RegistrarTest/RegistrarTransitions.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 // The implementation of the transition methods for the CRegistrar class.
    15 // 
    16 //
    17 
    18 #include "RegistrarStateAccessor.h"
    19 
    20 // ______________________________________________________________________________
    21 //
    22 _LIT(KRegistrarNewLTransition,"CRegistrar_NewL_Transition");
    23 
    24 inline CRegistrar_NewL_Transition::CRegistrar_NewL_Transition(CUnitTestContext& aUTContext,
    25 													TTransitionValidator& aValidator)
    26 : CTransition(KRegistrarNewLTransition, aUTContext, aValidator)
    27 	{
    28 	// Do nothing here.
    29 	}
    30 
    31 inline void CRegistrar_NewL_Transition::TransitMethodL()
    32 	{
    33 	_LIT(KRegistrarNewLTransitMethod, "CRegistrar::NewL transition");
    34 	Context().DataLogger().LogInformation(KRegistrarNewLTransitMethod);
    35 	Context().iRegistrar = CRegistrar::NewL(Context().iRegistryData, Context().iRegistrarObserver, Context().iFs);
    36 	}
    37 
    38 inline CRegistrar_UnitTestContext& CRegistrar_NewL_Transition::Context() const
    39 	{
    40 	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
    41 	}
    42 
    43 // ______________________________________________________________________________
    44 //
    45 _LIT(KRegistrarDtorTransition,"CRegistrar_Dtor_Transition");
    46 
    47 inline CRegistrar_Dtor_Transition::CRegistrar_Dtor_Transition(CUnitTestContext& aUTContext,
    48 													TTransitionValidator& aValidator)
    49 : CTransition(KRegistrarDtorTransition, aUTContext, aValidator)
    50 	{
    51 	// Do nothing here.
    52 	}
    53 
    54 inline void CRegistrar_Dtor_Transition::TransitMethodL()
    55 	{
    56 	_LIT(KRegistrarDtorTransitMethod, "CRegistrar::Dtor transition");
    57 	Context().DataLogger().LogInformation(KRegistrarDtorTransitMethod);
    58 	delete Context().iRegistrar;
    59 	Context().iRegistrar = NULL;
    60 	}
    61 
    62 inline CRegistrar_UnitTestContext& CRegistrar_Dtor_Transition::Context() const
    63 	{
    64 	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
    65 	}
    66 
    67 // ______________________________________________________________________________
    68 //
    69 _LIT(KRegistrarDiscoveriesBeginTransition,"CRegistrar_DiscoveriesBegin_Transition");
    70 
    71 inline CRegistrar_DiscoveriesBegin_Transition::CRegistrar_DiscoveriesBegin_Transition(CUnitTestContext& aUTContext,
    72 													TTransitionValidator& aValidator)
    73 : CTransition(KRegistrarDiscoveriesBeginTransition, aUTContext, aValidator)
    74 	{
    75 	// Do nothing here.
    76 	}
    77 
    78 inline void CRegistrar_DiscoveriesBegin_Transition::TransitMethodL()
    79 	{
    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));
    85 	}
    86 
    87 inline CRegistrar_UnitTestContext& CRegistrar_DiscoveriesBegin_Transition::Context() const
    88 	{
    89 	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
    90 	}
    91 
    92 // ______________________________________________________________________________
    93 //
    94 _LIT(KRegistrarDiscoveriesCompleteTransition,"CRegistrar_DiscoveriesComplete_Transition");
    95 
    96 inline CRegistrar_DiscoveriesComplete_Transition::CRegistrar_DiscoveriesComplete_Transition(CUnitTestContext& aUTContext,
    97 													TTransitionValidator& aValidator)
    98 : CTransition(KRegistrarDiscoveriesCompleteTransition, aUTContext, aValidator)
    99 	{
   100 	// Do nothing here.
   101 	}
   102 
   103 inline void CRegistrar_DiscoveriesComplete_Transition::TransitMethodL()
   104 	{
   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);
   110 	}
   111 
   112 inline CRegistrar_UnitTestContext& CRegistrar_DiscoveriesComplete_Transition::Context() const
   113 	{
   114 	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
   115 	}
   116 
   117 // ______________________________________________________________________________
   118 //
   119 _LIT(KRegistrarResumeTransition,"CRegistrar_Resume_Transition");
   120 
   121 inline CRegistrar_Resume_Transition::CRegistrar_Resume_Transition(CUnitTestContext& aUTContext,
   122 													TTransitionValidator& aValidator)
   123 : CTransition(KRegistrarResumeTransition, aUTContext, aValidator)
   124 	{
   125 	// Do nothing here.
   126 	}
   127 
   128 inline void CRegistrar_Resume_Transition::TransitMethodL()
   129 	{
   130 	_LIT(KRegistrarResumeTransitMethod, "CRegistrar::Resume transition");
   131 	Context().DataLogger().LogInformation(KRegistrarResumeTransitMethod);
   132 	Context().iReturnErrorCode = Context().iRegistrar->Resume();
   133 	}
   134 
   135 inline CRegistrar_UnitTestContext& CRegistrar_Resume_Transition::Context() const
   136 	{
   137 	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
   138 	}
   139 
   140 // ______________________________________________________________________________
   141 //
   142 _LIT(KRegistrarSuspendTransition,"CRegistrar_Suspend_Transition");
   143 
   144 inline CRegistrar_Suspend_Transition::CRegistrar_Suspend_Transition(CUnitTestContext& aUTContext,
   145 													TTransitionValidator& aValidator)
   146 : CTransition(KRegistrarSuspendTransition, aUTContext, aValidator)
   147 	{
   148 	// Do nothing here.
   149 	}
   150 
   151 inline void CRegistrar_Suspend_Transition::TransitMethodL()
   152 	{
   153 	_LIT(KRegistrarSuspendTransitMethod, "CRegistrar::Suspend transition");
   154 	Context().DataLogger().LogInformation(KRegistrarSuspendTransitMethod);
   155 	Context().iReturnErrorCode = Context().iRegistrar->Suspend();
   156 	}
   157 
   158 inline CRegistrar_UnitTestContext& CRegistrar_Suspend_Transition::Context() const
   159 	{
   160 	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
   161 	}
   162 
   163 // ______________________________________________________________________________
   164 //
   165 _LIT(KRegistrarParseLTransition,"CRegistrar_ParseL_Transition");
   166 
   167 inline CRegistrar_ParseL_Transition::CRegistrar_ParseL_Transition(CUnitTestContext& aUTContext,
   168 													TTransitionValidator& aValidator)
   169 : CTransitionType(KRegistrarParseLTransition, aUTContext, aValidator)
   170 	{
   171 	// Do nothing here.
   172 	}
   173 
   174 inline void CRegistrar_ParseL_Transition::TransitMethodL()
   175 	{
   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);
   181 	}
   182 
   183 inline CRegistrar_UnitTestContext& CRegistrar_ParseL_Transition::Context() const
   184 	{
   185 	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
   186 	}
   187 
   188 // ______________________________________________________________________________
   189 //
   190 _LIT(KRegistrarDisableTransition,"CRegistrar_Disable_Transition");
   191 
   192 inline CRegistrar_Disable_Transition::CRegistrar_Disable_Transition(CUnitTestContext& aUTContext,
   193 													TTransitionValidator& aValidator)
   194 : CTransition(KRegistrarDisableTransition, aUTContext, aValidator)
   195 	{
   196 	// Do nothing here.
   197 	}
   198 
   199 inline void CRegistrar_Disable_Transition::TransitMethodL()
   200 	{
   201 	_LIT(KRegistrarDisableTransitMethod, "CRegistrar::Disable transition");
   202 	Context().DataLogger().LogInformation(KRegistrarDisableTransitMethod);
   203 	Context().iReturnErrorCode = Context().iRegistrar->Disable(Context().iImplementationUid);
   204 	}
   205 
   206 inline CRegistrar_UnitTestContext& CRegistrar_Disable_Transition::Context() const
   207 	{
   208 	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
   209 	}
   210 
   211 // ______________________________________________________________________________
   212 //
   213 _LIT(KRegistrarDriveReinstatedLTransition,"CRegistrar_DriveReinstatedL_Transition");
   214 
   215 inline CRegistrar_DriveReinstatedL_Transition::CRegistrar_DriveReinstatedL_Transition(CUnitTestContext& aUTContext,
   216 													TTransitionValidator& aValidator)
   217 : CTransitionType(KRegistrarDriveReinstatedLTransition, aUTContext, aValidator)
   218 	{
   219 	// Do nothing here.
   220 	}
   221 
   222 inline void CRegistrar_DriveReinstatedL_Transition::TransitMethodL()
   223 	{
   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);
   229 	}
   230 
   231 inline CRegistrar_UnitTestContext& CRegistrar_DriveReinstatedL_Transition::Context() const
   232 	{
   233 	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
   234 	}
   235 
   236 // ______________________________________________________________________________
   237 //
   238 _LIT(KRegistrarDriveRemovedTransition,"CRegistrar_DriveRemoved_Transition");
   239 
   240 inline CRegistrar_DriveRemoved_Transition::CRegistrar_DriveRemoved_Transition(CUnitTestContext& aUTContext,
   241 													TTransitionValidator& aValidator)
   242 : CTransition(KRegistrarDriveRemovedTransition, aUTContext, aValidator)
   243 	{
   244 	// Do nothing here.
   245 	}
   246 
   247 inline void CRegistrar_DriveRemoved_Transition::TransitMethodL()
   248 	{
   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);
   254 	}
   255 
   256 inline CRegistrar_UnitTestContext& CRegistrar_DriveRemoved_Transition::Context() const
   257 	{
   258 	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
   259 	}
   260 
   261 // ______________________________________________________________________________
   262 //
   263 _LIT(KRegistrarEnableTransition,"CRegistrar_Enable_Transition");
   264 
   265 inline CRegistrar_Enable_Transition::CRegistrar_Enable_Transition(CUnitTestContext& aUTContext,
   266 													TTransitionValidator& aValidator)
   267 : CTransition(KRegistrarEnableTransition, aUTContext, aValidator)
   268 	{
   269 	// Do nothing here.
   270 	}
   271 
   272 inline void CRegistrar_Enable_Transition::TransitMethodL()
   273 	{
   274 	_LIT(KRegistrarEnableTransitMethod, "CRegistrar::Enable transition");
   275 	Context().DataLogger().LogInformation(KRegistrarEnableTransitMethod);
   276 	Context().iReturnErrorCode = Context().iRegistrar->Enable(Context().iImplementationUid);
   277 	}
   278 
   279 inline CRegistrar_UnitTestContext& CRegistrar_Enable_Transition::Context() const
   280 	{
   281 	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
   282 	}
   283 
   284 // ______________________________________________________________________________
   285 //
   286 _LIT(KRegistrarRegisterDiscoveryLTransition,"CRegistrar_RegisterDiscoveryL_Transition");
   287 
   288 inline CRegistrar_RegisterDiscoveryL_Transition::CRegistrar_RegisterDiscoveryL_Transition(CUnitTestContext& aUTContext,
   289 													TTransitionValidator& aValidator)
   290 : CTransitionType(KRegistrarRegisterDiscoveryLTransition, aUTContext, aValidator)
   291 	{
   292 	// Do nothing here.
   293 	}
   294 
   295 inline void CRegistrar_RegisterDiscoveryL_Transition::TransitMethodL()
   296 	{
   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);
   302 	}
   303 
   304 inline CRegistrar_UnitTestContext& CRegistrar_RegisterDiscoveryL_Transition::Context() const
   305 	{
   306 	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
   307 	}
   308 
   309 // ______________________________________________________________________________
   310 //
   311 _LIT(KRegistrarParseRegistrationDataLTransition,"CRegistrar_ParseRegistrationDataL_Transition");
   312 
   313 inline CRegistrar_ParseRegistrationDataL_Transition::CRegistrar_ParseRegistrationDataL_Transition(CUnitTestContext& aUTContext,
   314 													TTransitionValidator& aValidator)
   315 : CTransitionType(KRegistrarParseRegistrationDataLTransition, aUTContext, aValidator)
   316 	{
   317 	// Do nothing here.
   318 	}
   319 
   320 inline void CRegistrar_ParseRegistrationDataL_Transition::TransitMethodL()
   321 	{
   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, 
   330 									 Context().iDllEntry, 
   331 									 KResourceFileName, 
   332 									 driveUnit,
   333 									 Context().iUpdate,
   334 									 Context().iIndex);
   335 	}
   336 
   337 inline CRegistrar_UnitTestContext& CRegistrar_ParseRegistrationDataL_Transition::Context() const
   338 	{
   339 	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
   340 	}
   341