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.
sl@0
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// The implementation of the transition methods for the CRegistrar class.
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include "RegistrarStateAccessor.h"
sl@0
    19
sl@0
    20
// ______________________________________________________________________________
sl@0
    21
//
sl@0
    22
_LIT(KRegistrarNewLTransition,"CRegistrar_NewL_Transition");
sl@0
    23
sl@0
    24
inline CRegistrar_NewL_Transition::CRegistrar_NewL_Transition(CUnitTestContext& aUTContext,
sl@0
    25
													TTransitionValidator& aValidator)
sl@0
    26
: CTransition(KRegistrarNewLTransition, aUTContext, aValidator)
sl@0
    27
	{
sl@0
    28
	// Do nothing here.
sl@0
    29
	}
sl@0
    30
sl@0
    31
inline void CRegistrar_NewL_Transition::TransitMethodL()
sl@0
    32
	{
sl@0
    33
	_LIT(KRegistrarNewLTransitMethod, "CRegistrar::NewL transition");
sl@0
    34
	Context().DataLogger().LogInformation(KRegistrarNewLTransitMethod);
sl@0
    35
	Context().iRegistrar = CRegistrar::NewL(Context().iRegistryData, Context().iRegistrarObserver, Context().iFs);
sl@0
    36
	}
sl@0
    37
sl@0
    38
inline CRegistrar_UnitTestContext& CRegistrar_NewL_Transition::Context() const
sl@0
    39
	{
sl@0
    40
	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
sl@0
    41
	}
sl@0
    42
sl@0
    43
// ______________________________________________________________________________
sl@0
    44
//
sl@0
    45
_LIT(KRegistrarDtorTransition,"CRegistrar_Dtor_Transition");
sl@0
    46
sl@0
    47
inline CRegistrar_Dtor_Transition::CRegistrar_Dtor_Transition(CUnitTestContext& aUTContext,
sl@0
    48
													TTransitionValidator& aValidator)
sl@0
    49
: CTransition(KRegistrarDtorTransition, aUTContext, aValidator)
sl@0
    50
	{
sl@0
    51
	// Do nothing here.
sl@0
    52
	}
sl@0
    53
sl@0
    54
inline void CRegistrar_Dtor_Transition::TransitMethodL()
sl@0
    55
	{
sl@0
    56
	_LIT(KRegistrarDtorTransitMethod, "CRegistrar::Dtor transition");
sl@0
    57
	Context().DataLogger().LogInformation(KRegistrarDtorTransitMethod);
sl@0
    58
	delete Context().iRegistrar;
sl@0
    59
	Context().iRegistrar = NULL;
sl@0
    60
	}
sl@0
    61
sl@0
    62
inline CRegistrar_UnitTestContext& CRegistrar_Dtor_Transition::Context() const
sl@0
    63
	{
sl@0
    64
	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
sl@0
    65
	}
sl@0
    66
sl@0
    67
// ______________________________________________________________________________
sl@0
    68
//
sl@0
    69
_LIT(KRegistrarDiscoveriesBeginTransition,"CRegistrar_DiscoveriesBegin_Transition");
sl@0
    70
sl@0
    71
inline CRegistrar_DiscoveriesBegin_Transition::CRegistrar_DiscoveriesBegin_Transition(CUnitTestContext& aUTContext,
sl@0
    72
													TTransitionValidator& aValidator)
sl@0
    73
: CTransition(KRegistrarDiscoveriesBeginTransition, aUTContext, aValidator)
sl@0
    74
	{
sl@0
    75
	// Do nothing here.
sl@0
    76
	}
sl@0
    77
sl@0
    78
inline void CRegistrar_DiscoveriesBegin_Transition::TransitMethodL()
sl@0
    79
	{
sl@0
    80
	_LIT(KRegistrarDiscoveriesBeginTransitMethod, "CRegistrar::DiscoveriesBegin transition");
sl@0
    81
	Context().DataLogger().LogInformation(KRegistrarDiscoveriesBeginTransitMethod);
sl@0
    82
	TRegistrar_StateAccessor& accessor = 
sl@0
    83
		REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
sl@0
    84
	accessor.DiscoveriesBegin(*(Context().iRegistrar));
sl@0
    85
	}
sl@0
    86
sl@0
    87
inline CRegistrar_UnitTestContext& CRegistrar_DiscoveriesBegin_Transition::Context() const
sl@0
    88
	{
sl@0
    89
	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
sl@0
    90
	}
sl@0
    91
sl@0
    92
// ______________________________________________________________________________
sl@0
    93
//
sl@0
    94
_LIT(KRegistrarDiscoveriesCompleteTransition,"CRegistrar_DiscoveriesComplete_Transition");
sl@0
    95
sl@0
    96
inline CRegistrar_DiscoveriesComplete_Transition::CRegistrar_DiscoveriesComplete_Transition(CUnitTestContext& aUTContext,
sl@0
    97
													TTransitionValidator& aValidator)
sl@0
    98
: CTransition(KRegistrarDiscoveriesCompleteTransition, aUTContext, aValidator)
sl@0
    99
	{
sl@0
   100
	// Do nothing here.
sl@0
   101
	}
sl@0
   102
sl@0
   103
inline void CRegistrar_DiscoveriesComplete_Transition::TransitMethodL()
sl@0
   104
	{
sl@0
   105
	_LIT(KRegistrarDiscoveriesCompleteTransitMethod, "CRegistrar::DiscoveriesComplete transition");
sl@0
   106
	Context().DataLogger().LogInformation(KRegistrarDiscoveriesCompleteTransitMethod);
sl@0
   107
	TRegistrar_StateAccessor& accessor = 
sl@0
   108
		REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
sl@0
   109
	accessor.DiscoveriesComplete(*(Context().iRegistrar), ETrue);
sl@0
   110
	}
sl@0
   111
sl@0
   112
inline CRegistrar_UnitTestContext& CRegistrar_DiscoveriesComplete_Transition::Context() const
sl@0
   113
	{
sl@0
   114
	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
sl@0
   115
	}
sl@0
   116
sl@0
   117
// ______________________________________________________________________________
sl@0
   118
//
sl@0
   119
_LIT(KRegistrarResumeTransition,"CRegistrar_Resume_Transition");
sl@0
   120
sl@0
   121
inline CRegistrar_Resume_Transition::CRegistrar_Resume_Transition(CUnitTestContext& aUTContext,
sl@0
   122
													TTransitionValidator& aValidator)
sl@0
   123
: CTransition(KRegistrarResumeTransition, aUTContext, aValidator)
sl@0
   124
	{
sl@0
   125
	// Do nothing here.
sl@0
   126
	}
sl@0
   127
sl@0
   128
inline void CRegistrar_Resume_Transition::TransitMethodL()
sl@0
   129
	{
sl@0
   130
	_LIT(KRegistrarResumeTransitMethod, "CRegistrar::Resume transition");
sl@0
   131
	Context().DataLogger().LogInformation(KRegistrarResumeTransitMethod);
sl@0
   132
	Context().iReturnErrorCode = Context().iRegistrar->Resume();
sl@0
   133
	}
sl@0
   134
sl@0
   135
inline CRegistrar_UnitTestContext& CRegistrar_Resume_Transition::Context() const
sl@0
   136
	{
sl@0
   137
	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
sl@0
   138
	}
sl@0
   139
sl@0
   140
// ______________________________________________________________________________
sl@0
   141
//
sl@0
   142
_LIT(KRegistrarSuspendTransition,"CRegistrar_Suspend_Transition");
sl@0
   143
sl@0
   144
inline CRegistrar_Suspend_Transition::CRegistrar_Suspend_Transition(CUnitTestContext& aUTContext,
sl@0
   145
													TTransitionValidator& aValidator)
sl@0
   146
: CTransition(KRegistrarSuspendTransition, aUTContext, aValidator)
sl@0
   147
	{
sl@0
   148
	// Do nothing here.
sl@0
   149
	}
sl@0
   150
sl@0
   151
inline void CRegistrar_Suspend_Transition::TransitMethodL()
sl@0
   152
	{
sl@0
   153
	_LIT(KRegistrarSuspendTransitMethod, "CRegistrar::Suspend transition");
sl@0
   154
	Context().DataLogger().LogInformation(KRegistrarSuspendTransitMethod);
sl@0
   155
	Context().iReturnErrorCode = Context().iRegistrar->Suspend();
sl@0
   156
	}
sl@0
   157
sl@0
   158
inline CRegistrar_UnitTestContext& CRegistrar_Suspend_Transition::Context() const
sl@0
   159
	{
sl@0
   160
	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
sl@0
   161
	}
sl@0
   162
sl@0
   163
// ______________________________________________________________________________
sl@0
   164
//
sl@0
   165
_LIT(KRegistrarParseLTransition,"CRegistrar_ParseL_Transition");
sl@0
   166
sl@0
   167
inline CRegistrar_ParseL_Transition::CRegistrar_ParseL_Transition(CUnitTestContext& aUTContext,
sl@0
   168
													TTransitionValidator& aValidator)
sl@0
   169
: CTransitionType(KRegistrarParseLTransition, aUTContext, aValidator)
sl@0
   170
	{
sl@0
   171
	// Do nothing here.
sl@0
   172
	}
sl@0
   173
sl@0
   174
inline void CRegistrar_ParseL_Transition::TransitMethodL()
sl@0
   175
	{
sl@0
   176
	_LIT(KRegistrarParseLTransitMethod, "CRegistrar::ParseL transition");
sl@0
   177
	Context().DataLogger().LogInformation(KRegistrarParseLTransitMethod);
sl@0
   178
	TRegistrar_StateAccessor& accessor = 
sl@0
   179
		REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
sl@0
   180
	accessor.ParseL(*Context().iRegistrar, *Context().iDllData, KResourceFileName);
sl@0
   181
	}
sl@0
   182
sl@0
   183
inline CRegistrar_UnitTestContext& CRegistrar_ParseL_Transition::Context() const
sl@0
   184
	{
sl@0
   185
	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
sl@0
   186
	}
sl@0
   187
sl@0
   188
// ______________________________________________________________________________
sl@0
   189
//
sl@0
   190
_LIT(KRegistrarDisableTransition,"CRegistrar_Disable_Transition");
sl@0
   191
sl@0
   192
inline CRegistrar_Disable_Transition::CRegistrar_Disable_Transition(CUnitTestContext& aUTContext,
sl@0
   193
													TTransitionValidator& aValidator)
sl@0
   194
: CTransition(KRegistrarDisableTransition, aUTContext, aValidator)
sl@0
   195
	{
sl@0
   196
	// Do nothing here.
sl@0
   197
	}
sl@0
   198
sl@0
   199
inline void CRegistrar_Disable_Transition::TransitMethodL()
sl@0
   200
	{
sl@0
   201
	_LIT(KRegistrarDisableTransitMethod, "CRegistrar::Disable transition");
sl@0
   202
	Context().DataLogger().LogInformation(KRegistrarDisableTransitMethod);
sl@0
   203
	Context().iReturnErrorCode = Context().iRegistrar->Disable(Context().iImplementationUid);
sl@0
   204
	}
sl@0
   205
sl@0
   206
inline CRegistrar_UnitTestContext& CRegistrar_Disable_Transition::Context() const
sl@0
   207
	{
sl@0
   208
	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
sl@0
   209
	}
sl@0
   210
sl@0
   211
// ______________________________________________________________________________
sl@0
   212
//
sl@0
   213
_LIT(KRegistrarDriveReinstatedLTransition,"CRegistrar_DriveReinstatedL_Transition");
sl@0
   214
sl@0
   215
inline CRegistrar_DriveReinstatedL_Transition::CRegistrar_DriveReinstatedL_Transition(CUnitTestContext& aUTContext,
sl@0
   216
													TTransitionValidator& aValidator)
sl@0
   217
: CTransitionType(KRegistrarDriveReinstatedLTransition, aUTContext, aValidator)
sl@0
   218
	{
sl@0
   219
	// Do nothing here.
sl@0
   220
	}
sl@0
   221
sl@0
   222
inline void CRegistrar_DriveReinstatedL_Transition::TransitMethodL()
sl@0
   223
	{
sl@0
   224
	_LIT(KRegistrarDriveReinstatedLTransitMethod, "CRegistrar::DriveReinstatedL transition");
sl@0
   225
	Context().DataLogger().LogInformation(KRegistrarDriveReinstatedLTransitMethod);
sl@0
   226
	TRegistrar_StateAccessor& accessor = 
sl@0
   227
		REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
sl@0
   228
	accessor.DriveReinstatedL(*(Context().iRegistrar), Context().iDriveUnit);
sl@0
   229
	}
sl@0
   230
sl@0
   231
inline CRegistrar_UnitTestContext& CRegistrar_DriveReinstatedL_Transition::Context() const
sl@0
   232
	{
sl@0
   233
	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
sl@0
   234
	}
sl@0
   235
sl@0
   236
// ______________________________________________________________________________
sl@0
   237
//
sl@0
   238
_LIT(KRegistrarDriveRemovedTransition,"CRegistrar_DriveRemoved_Transition");
sl@0
   239
sl@0
   240
inline CRegistrar_DriveRemoved_Transition::CRegistrar_DriveRemoved_Transition(CUnitTestContext& aUTContext,
sl@0
   241
													TTransitionValidator& aValidator)
sl@0
   242
: CTransition(KRegistrarDriveRemovedTransition, aUTContext, aValidator)
sl@0
   243
	{
sl@0
   244
	// Do nothing here.
sl@0
   245
	}
sl@0
   246
sl@0
   247
inline void CRegistrar_DriveRemoved_Transition::TransitMethodL()
sl@0
   248
	{
sl@0
   249
	_LIT(KRegistrarDriveRemovedTransitMethod, "CRegistrar::DriveRemoved transition");
sl@0
   250
	Context().DataLogger().LogInformation(KRegistrarDriveRemovedTransitMethod);
sl@0
   251
	TRegistrar_StateAccessor& accessor = 
sl@0
   252
		REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
sl@0
   253
	accessor.DriveRemoved(*(Context().iRegistrar), Context().iDriveUnit);
sl@0
   254
	}
sl@0
   255
sl@0
   256
inline CRegistrar_UnitTestContext& CRegistrar_DriveRemoved_Transition::Context() const
sl@0
   257
	{
sl@0
   258
	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
sl@0
   259
	}
sl@0
   260
sl@0
   261
// ______________________________________________________________________________
sl@0
   262
//
sl@0
   263
_LIT(KRegistrarEnableTransition,"CRegistrar_Enable_Transition");
sl@0
   264
sl@0
   265
inline CRegistrar_Enable_Transition::CRegistrar_Enable_Transition(CUnitTestContext& aUTContext,
sl@0
   266
													TTransitionValidator& aValidator)
sl@0
   267
: CTransition(KRegistrarEnableTransition, aUTContext, aValidator)
sl@0
   268
	{
sl@0
   269
	// Do nothing here.
sl@0
   270
	}
sl@0
   271
sl@0
   272
inline void CRegistrar_Enable_Transition::TransitMethodL()
sl@0
   273
	{
sl@0
   274
	_LIT(KRegistrarEnableTransitMethod, "CRegistrar::Enable transition");
sl@0
   275
	Context().DataLogger().LogInformation(KRegistrarEnableTransitMethod);
sl@0
   276
	Context().iReturnErrorCode = Context().iRegistrar->Enable(Context().iImplementationUid);
sl@0
   277
	}
sl@0
   278
sl@0
   279
inline CRegistrar_UnitTestContext& CRegistrar_Enable_Transition::Context() const
sl@0
   280
	{
sl@0
   281
	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
sl@0
   282
	}
sl@0
   283
sl@0
   284
// ______________________________________________________________________________
sl@0
   285
//
sl@0
   286
_LIT(KRegistrarRegisterDiscoveryLTransition,"CRegistrar_RegisterDiscoveryL_Transition");
sl@0
   287
sl@0
   288
inline CRegistrar_RegisterDiscoveryL_Transition::CRegistrar_RegisterDiscoveryL_Transition(CUnitTestContext& aUTContext,
sl@0
   289
													TTransitionValidator& aValidator)
sl@0
   290
: CTransitionType(KRegistrarRegisterDiscoveryLTransition, aUTContext, aValidator)
sl@0
   291
	{
sl@0
   292
	// Do nothing here.
sl@0
   293
	}
sl@0
   294
sl@0
   295
inline void CRegistrar_RegisterDiscoveryL_Transition::TransitMethodL()
sl@0
   296
	{
sl@0
   297
	_LIT(KRegistrarRegisterDiscoveryLTransitMethod, "CRegistrar::RegisterDiscoveryL transition");
sl@0
   298
	Context().DataLogger().LogInformation(KRegistrarRegisterDiscoveryLTransitMethod);
sl@0
   299
	TRegistrar_StateAccessor& accessor = 
sl@0
   300
		REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
sl@0
   301
	accessor.RegisterDiscoveryL(*(Context().iRegistrar), Context().iDllEntry);
sl@0
   302
	}
sl@0
   303
sl@0
   304
inline CRegistrar_UnitTestContext& CRegistrar_RegisterDiscoveryL_Transition::Context() const
sl@0
   305
	{
sl@0
   306
	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
sl@0
   307
	}
sl@0
   308
sl@0
   309
// ______________________________________________________________________________
sl@0
   310
//
sl@0
   311
_LIT(KRegistrarParseRegistrationDataLTransition,"CRegistrar_ParseRegistrationDataL_Transition");
sl@0
   312
sl@0
   313
inline CRegistrar_ParseRegistrationDataL_Transition::CRegistrar_ParseRegistrationDataL_Transition(CUnitTestContext& aUTContext,
sl@0
   314
													TTransitionValidator& aValidator)
sl@0
   315
: CTransitionType(KRegistrarParseRegistrationDataLTransition, aUTContext, aValidator)
sl@0
   316
	{
sl@0
   317
	// Do nothing here.
sl@0
   318
	}
sl@0
   319
sl@0
   320
inline void CRegistrar_ParseRegistrationDataL_Transition::TransitMethodL()
sl@0
   321
	{
sl@0
   322
	_LIT(KRegistrarParseRegistrationDataLTransitMethod, "CRegistrar::ParseRegistrationDataL transition");
sl@0
   323
	Context().DataLogger().LogInformation(KRegistrarParseRegistrationDataLTransitMethod);
sl@0
   324
	// Find the appropriate drive entry
sl@0
   325
	TChar driveLetter = User::UpperCase((Context().iDllEntry.iName)[0]) - 'A';
sl@0
   326
	TDriveUnit driveUnit = EDriveA + driveLetter;
sl@0
   327
	TRegistrar_StateAccessor& accessor = 
sl@0
   328
		REINTERPRET_CAST(TRegistrar_StateAccessor&, Context().StateAccessor());
sl@0
   329
	accessor.ParseRegistrationDataL(*Context().iRegistrar, 
sl@0
   330
									 Context().iDllEntry, 
sl@0
   331
									 KResourceFileName, 
sl@0
   332
									 driveUnit,
sl@0
   333
									 Context().iUpdate,
sl@0
   334
									 Context().iIndex);
sl@0
   335
	}
sl@0
   336
sl@0
   337
inline CRegistrar_UnitTestContext& CRegistrar_ParseRegistrationDataL_Transition::Context() const
sl@0
   338
	{
sl@0
   339
	return REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext);
sl@0
   340
	}
sl@0
   341