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