os/ossrv/lowlevellibsandfws/pluginfw/Framework/RegistrarTest/RegistrarTransitions.inl
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Framework/RegistrarTest/RegistrarTransitions.inl Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,341 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// The implementation of the transition methods for the CRegistrar class.
1.18 +//
1.19 +//
1.20 +
1.21 +#include "RegistrarStateAccessor.h"
1.22 +
1.23 +// ______________________________________________________________________________
1.24 +//
1.25 +_LIT(KRegistrarNewLTransition,"CRegistrar_NewL_Transition");
1.26 +
1.27 +inline CRegistrar_NewL_Transition::CRegistrar_NewL_Transition(CUnitTestContext& aUTContext,
1.28 + TTransitionValidator& aValidator)
1.29 +: CTransition(KRegistrarNewLTransition, aUTContext, aValidator)
1.30 + {
1.31 + // Do nothing here.
1.32 + }
1.33 +
1.34 +inline void CRegistrar_NewL_Transition::TransitMethodL()
1.35 + {
1.36 + _LIT(KRegistrarNewLTransitMethod, "CRegistrar::NewL transition");
1.37 + Context().DataLogger().LogInformation(KRegistrarNewLTransitMethod);
1.38 + Context().iRegistrar = CRegistrar::NewL(Context().iRegistryData, Context().iRegistrarObserver, Context().iFs);
1.39 + }
1.40 +
1.41 +inline CRegistrar_UnitTestContext& CRegistrar_NewL_Transition::Context() const
1.42 + {
1.43 + return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
1.44 + }
1.45 +
1.46 +// ______________________________________________________________________________
1.47 +//
1.48 +_LIT(KRegistrarDtorTransition,"CRegistrar_Dtor_Transition");
1.49 +
1.50 +inline CRegistrar_Dtor_Transition::CRegistrar_Dtor_Transition(CUnitTestContext& aUTContext,
1.51 + TTransitionValidator& aValidator)
1.52 +: CTransition(KRegistrarDtorTransition, aUTContext, aValidator)
1.53 + {
1.54 + // Do nothing here.
1.55 + }
1.56 +
1.57 +inline void CRegistrar_Dtor_Transition::TransitMethodL()
1.58 + {
1.59 + _LIT(KRegistrarDtorTransitMethod, "CRegistrar::Dtor transition");
1.60 + Context().DataLogger().LogInformation(KRegistrarDtorTransitMethod);
1.61 + delete Context().iRegistrar;
1.62 + Context().iRegistrar = NULL;
1.63 + }
1.64 +
1.65 +inline CRegistrar_UnitTestContext& CRegistrar_Dtor_Transition::Context() const
1.66 + {
1.67 + return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
1.68 + }
1.69 +
1.70 +// ______________________________________________________________________________
1.71 +//
1.72 +_LIT(KRegistrarDiscoveriesBeginTransition,"CRegistrar_DiscoveriesBegin_Transition");
1.73 +
1.74 +inline CRegistrar_DiscoveriesBegin_Transition::CRegistrar_DiscoveriesBegin_Transition(CUnitTestContext& aUTContext,
1.75 + TTransitionValidator& aValidator)
1.76 +: CTransition(KRegistrarDiscoveriesBeginTransition, aUTContext, aValidator)
1.77 + {
1.78 + // Do nothing here.
1.79 + }
1.80 +
1.81 +inline void CRegistrar_DiscoveriesBegin_Transition::TransitMethodL()
1.82 + {
1.83 + _LIT(KRegistrarDiscoveriesBeginTransitMethod, "CRegistrar::DiscoveriesBegin transition");
1.84 + Context().DataLogger().LogInformation(KRegistrarDiscoveriesBeginTransitMethod);
1.85 + TRegistrar_StateAccessor& accessor =
1.86 + REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
1.87 + accessor.DiscoveriesBegin(*(Context().iRegistrar));
1.88 + }
1.89 +
1.90 +inline CRegistrar_UnitTestContext& CRegistrar_DiscoveriesBegin_Transition::Context() const
1.91 + {
1.92 + return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
1.93 + }
1.94 +
1.95 +// ______________________________________________________________________________
1.96 +//
1.97 +_LIT(KRegistrarDiscoveriesCompleteTransition,"CRegistrar_DiscoveriesComplete_Transition");
1.98 +
1.99 +inline CRegistrar_DiscoveriesComplete_Transition::CRegistrar_DiscoveriesComplete_Transition(CUnitTestContext& aUTContext,
1.100 + TTransitionValidator& aValidator)
1.101 +: CTransition(KRegistrarDiscoveriesCompleteTransition, aUTContext, aValidator)
1.102 + {
1.103 + // Do nothing here.
1.104 + }
1.105 +
1.106 +inline void CRegistrar_DiscoveriesComplete_Transition::TransitMethodL()
1.107 + {
1.108 + _LIT(KRegistrarDiscoveriesCompleteTransitMethod, "CRegistrar::DiscoveriesComplete transition");
1.109 + Context().DataLogger().LogInformation(KRegistrarDiscoveriesCompleteTransitMethod);
1.110 + TRegistrar_StateAccessor& accessor =
1.111 + REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
1.112 + accessor.DiscoveriesComplete(*(Context().iRegistrar), ETrue);
1.113 + }
1.114 +
1.115 +inline CRegistrar_UnitTestContext& CRegistrar_DiscoveriesComplete_Transition::Context() const
1.116 + {
1.117 + return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
1.118 + }
1.119 +
1.120 +// ______________________________________________________________________________
1.121 +//
1.122 +_LIT(KRegistrarResumeTransition,"CRegistrar_Resume_Transition");
1.123 +
1.124 +inline CRegistrar_Resume_Transition::CRegistrar_Resume_Transition(CUnitTestContext& aUTContext,
1.125 + TTransitionValidator& aValidator)
1.126 +: CTransition(KRegistrarResumeTransition, aUTContext, aValidator)
1.127 + {
1.128 + // Do nothing here.
1.129 + }
1.130 +
1.131 +inline void CRegistrar_Resume_Transition::TransitMethodL()
1.132 + {
1.133 + _LIT(KRegistrarResumeTransitMethod, "CRegistrar::Resume transition");
1.134 + Context().DataLogger().LogInformation(KRegistrarResumeTransitMethod);
1.135 + Context().iReturnErrorCode = Context().iRegistrar->Resume();
1.136 + }
1.137 +
1.138 +inline CRegistrar_UnitTestContext& CRegistrar_Resume_Transition::Context() const
1.139 + {
1.140 + return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
1.141 + }
1.142 +
1.143 +// ______________________________________________________________________________
1.144 +//
1.145 +_LIT(KRegistrarSuspendTransition,"CRegistrar_Suspend_Transition");
1.146 +
1.147 +inline CRegistrar_Suspend_Transition::CRegistrar_Suspend_Transition(CUnitTestContext& aUTContext,
1.148 + TTransitionValidator& aValidator)
1.149 +: CTransition(KRegistrarSuspendTransition, aUTContext, aValidator)
1.150 + {
1.151 + // Do nothing here.
1.152 + }
1.153 +
1.154 +inline void CRegistrar_Suspend_Transition::TransitMethodL()
1.155 + {
1.156 + _LIT(KRegistrarSuspendTransitMethod, "CRegistrar::Suspend transition");
1.157 + Context().DataLogger().LogInformation(KRegistrarSuspendTransitMethod);
1.158 + Context().iReturnErrorCode = Context().iRegistrar->Suspend();
1.159 + }
1.160 +
1.161 +inline CRegistrar_UnitTestContext& CRegistrar_Suspend_Transition::Context() const
1.162 + {
1.163 + return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
1.164 + }
1.165 +
1.166 +// ______________________________________________________________________________
1.167 +//
1.168 +_LIT(KRegistrarParseLTransition,"CRegistrar_ParseL_Transition");
1.169 +
1.170 +inline CRegistrar_ParseL_Transition::CRegistrar_ParseL_Transition(CUnitTestContext& aUTContext,
1.171 + TTransitionValidator& aValidator)
1.172 +: CTransitionType(KRegistrarParseLTransition, aUTContext, aValidator)
1.173 + {
1.174 + // Do nothing here.
1.175 + }
1.176 +
1.177 +inline void CRegistrar_ParseL_Transition::TransitMethodL()
1.178 + {
1.179 + _LIT(KRegistrarParseLTransitMethod, "CRegistrar::ParseL transition");
1.180 + Context().DataLogger().LogInformation(KRegistrarParseLTransitMethod);
1.181 + TRegistrar_StateAccessor& accessor =
1.182 + REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
1.183 + accessor.ParseL(*Context().iRegistrar, *Context().iDllData, KResourceFileName);
1.184 + }
1.185 +
1.186 +inline CRegistrar_UnitTestContext& CRegistrar_ParseL_Transition::Context() const
1.187 + {
1.188 + return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
1.189 + }
1.190 +
1.191 +// ______________________________________________________________________________
1.192 +//
1.193 +_LIT(KRegistrarDisableTransition,"CRegistrar_Disable_Transition");
1.194 +
1.195 +inline CRegistrar_Disable_Transition::CRegistrar_Disable_Transition(CUnitTestContext& aUTContext,
1.196 + TTransitionValidator& aValidator)
1.197 +: CTransition(KRegistrarDisableTransition, aUTContext, aValidator)
1.198 + {
1.199 + // Do nothing here.
1.200 + }
1.201 +
1.202 +inline void CRegistrar_Disable_Transition::TransitMethodL()
1.203 + {
1.204 + _LIT(KRegistrarDisableTransitMethod, "CRegistrar::Disable transition");
1.205 + Context().DataLogger().LogInformation(KRegistrarDisableTransitMethod);
1.206 + Context().iReturnErrorCode = Context().iRegistrar->Disable(Context().iImplementationUid);
1.207 + }
1.208 +
1.209 +inline CRegistrar_UnitTestContext& CRegistrar_Disable_Transition::Context() const
1.210 + {
1.211 + return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
1.212 + }
1.213 +
1.214 +// ______________________________________________________________________________
1.215 +//
1.216 +_LIT(KRegistrarDriveReinstatedLTransition,"CRegistrar_DriveReinstatedL_Transition");
1.217 +
1.218 +inline CRegistrar_DriveReinstatedL_Transition::CRegistrar_DriveReinstatedL_Transition(CUnitTestContext& aUTContext,
1.219 + TTransitionValidator& aValidator)
1.220 +: CTransitionType(KRegistrarDriveReinstatedLTransition, aUTContext, aValidator)
1.221 + {
1.222 + // Do nothing here.
1.223 + }
1.224 +
1.225 +inline void CRegistrar_DriveReinstatedL_Transition::TransitMethodL()
1.226 + {
1.227 + _LIT(KRegistrarDriveReinstatedLTransitMethod, "CRegistrar::DriveReinstatedL transition");
1.228 + Context().DataLogger().LogInformation(KRegistrarDriveReinstatedLTransitMethod);
1.229 + TRegistrar_StateAccessor& accessor =
1.230 + REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
1.231 + accessor.DriveReinstatedL(*(Context().iRegistrar), Context().iDriveUnit);
1.232 + }
1.233 +
1.234 +inline CRegistrar_UnitTestContext& CRegistrar_DriveReinstatedL_Transition::Context() const
1.235 + {
1.236 + return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
1.237 + }
1.238 +
1.239 +// ______________________________________________________________________________
1.240 +//
1.241 +_LIT(KRegistrarDriveRemovedTransition,"CRegistrar_DriveRemoved_Transition");
1.242 +
1.243 +inline CRegistrar_DriveRemoved_Transition::CRegistrar_DriveRemoved_Transition(CUnitTestContext& aUTContext,
1.244 + TTransitionValidator& aValidator)
1.245 +: CTransition(KRegistrarDriveRemovedTransition, aUTContext, aValidator)
1.246 + {
1.247 + // Do nothing here.
1.248 + }
1.249 +
1.250 +inline void CRegistrar_DriveRemoved_Transition::TransitMethodL()
1.251 + {
1.252 + _LIT(KRegistrarDriveRemovedTransitMethod, "CRegistrar::DriveRemoved transition");
1.253 + Context().DataLogger().LogInformation(KRegistrarDriveRemovedTransitMethod);
1.254 + TRegistrar_StateAccessor& accessor =
1.255 + REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
1.256 + accessor.DriveRemoved(*(Context().iRegistrar), Context().iDriveUnit);
1.257 + }
1.258 +
1.259 +inline CRegistrar_UnitTestContext& CRegistrar_DriveRemoved_Transition::Context() const
1.260 + {
1.261 + return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
1.262 + }
1.263 +
1.264 +// ______________________________________________________________________________
1.265 +//
1.266 +_LIT(KRegistrarEnableTransition,"CRegistrar_Enable_Transition");
1.267 +
1.268 +inline CRegistrar_Enable_Transition::CRegistrar_Enable_Transition(CUnitTestContext& aUTContext,
1.269 + TTransitionValidator& aValidator)
1.270 +: CTransition(KRegistrarEnableTransition, aUTContext, aValidator)
1.271 + {
1.272 + // Do nothing here.
1.273 + }
1.274 +
1.275 +inline void CRegistrar_Enable_Transition::TransitMethodL()
1.276 + {
1.277 + _LIT(KRegistrarEnableTransitMethod, "CRegistrar::Enable transition");
1.278 + Context().DataLogger().LogInformation(KRegistrarEnableTransitMethod);
1.279 + Context().iReturnErrorCode = Context().iRegistrar->Enable(Context().iImplementationUid);
1.280 + }
1.281 +
1.282 +inline CRegistrar_UnitTestContext& CRegistrar_Enable_Transition::Context() const
1.283 + {
1.284 + return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
1.285 + }
1.286 +
1.287 +// ______________________________________________________________________________
1.288 +//
1.289 +_LIT(KRegistrarRegisterDiscoveryLTransition,"CRegistrar_RegisterDiscoveryL_Transition");
1.290 +
1.291 +inline CRegistrar_RegisterDiscoveryL_Transition::CRegistrar_RegisterDiscoveryL_Transition(CUnitTestContext& aUTContext,
1.292 + TTransitionValidator& aValidator)
1.293 +: CTransitionType(KRegistrarRegisterDiscoveryLTransition, aUTContext, aValidator)
1.294 + {
1.295 + // Do nothing here.
1.296 + }
1.297 +
1.298 +inline void CRegistrar_RegisterDiscoveryL_Transition::TransitMethodL()
1.299 + {
1.300 + _LIT(KRegistrarRegisterDiscoveryLTransitMethod, "CRegistrar::RegisterDiscoveryL transition");
1.301 + Context().DataLogger().LogInformation(KRegistrarRegisterDiscoveryLTransitMethod);
1.302 + TRegistrar_StateAccessor& accessor =
1.303 + REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
1.304 + accessor.RegisterDiscoveryL(*(Context().iRegistrar), Context().iDllEntry);
1.305 + }
1.306 +
1.307 +inline CRegistrar_UnitTestContext& CRegistrar_RegisterDiscoveryL_Transition::Context() const
1.308 + {
1.309 + return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
1.310 + }
1.311 +
1.312 +// ______________________________________________________________________________
1.313 +//
1.314 +_LIT(KRegistrarParseRegistrationDataLTransition,"CRegistrar_ParseRegistrationDataL_Transition");
1.315 +
1.316 +inline CRegistrar_ParseRegistrationDataL_Transition::CRegistrar_ParseRegistrationDataL_Transition(CUnitTestContext& aUTContext,
1.317 + TTransitionValidator& aValidator)
1.318 +: CTransitionType(KRegistrarParseRegistrationDataLTransition, aUTContext, aValidator)
1.319 + {
1.320 + // Do nothing here.
1.321 + }
1.322 +
1.323 +inline void CRegistrar_ParseRegistrationDataL_Transition::TransitMethodL()
1.324 + {
1.325 + _LIT(KRegistrarParseRegistrationDataLTransitMethod, "CRegistrar::ParseRegistrationDataL transition");
1.326 + Context().DataLogger().LogInformation(KRegistrarParseRegistrationDataLTransitMethod);
1.327 + // Find the appropriate drive entry
1.328 + TChar driveLetter = User::UpperCase((Context().iDllEntry.iName)[0]) - 'A';
1.329 + TDriveUnit driveUnit = EDriveA + driveLetter;
1.330 + TRegistrar_StateAccessor& accessor =
1.331 + REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
1.332 + accessor.ParseRegistrationDataL(*Context().iRegistrar,
1.333 + Context().iDllEntry,
1.334 + KResourceFileName,
1.335 + driveUnit,
1.336 + Context().iUpdate,
1.337 + Context().iIndex);
1.338 + }
1.339 +
1.340 +inline CRegistrar_UnitTestContext& CRegistrar_ParseRegistrationDataL_Transition::Context() const
1.341 + {
1.342 + return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
1.343 + }
1.344 +