sl@0: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // The implementation of the transition classes upon the CTransition class methods, sl@0: // together with the derived transition used for testing. sl@0: // sl@0: // sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KTargetNullMethodTransition,"CTarget_NullMethod_Transition"); sl@0: sl@0: inline CTarget_NullMethod_Transition::CTarget_NullMethod_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KTargetNullMethodTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CTarget_NullMethod_Transition::TransitMethodL() sl@0: { sl@0: // There is no method to execute sl@0: // However exercise both possible results by sl@0: // provoking a leave with the context's leave code sl@0: // on the second TransitMethodL call. sl@0: _LIT(KTargetNullMethodTransitMethod, "CTarget::NullMethod transition"); sl@0: Context().DataLogger().LogInformation(KTargetNullMethodTransitMethod); sl@0: if(Context().iLeaveCode != KErrNone) sl@0: User::Leave(Context().iLeaveCode); sl@0: else sl@0: Context().iLeaveCode = KErrAbort; // For next entry sl@0: } sl@0: sl@0: inline CTargetTransition_UnitTestContext& CTarget_NullMethod_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CTargetTransition_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: inline CTargetTransition_UnitTestContext::CTargetTransition_UnitTestContext(CDataLogger& aDataLogger, sl@0: MStateAccessor& aStateAccessor, sl@0: MTransitionObserver& aObserver) sl@0: : CUnitTestContext(aDataLogger, aStateAccessor, aObserver) sl@0: { sl@0: //Do nothing sl@0: } sl@0: sl@0: inline CTargetTransition_UnitTestContext::~CTargetTransition_UnitTestContext() sl@0: { sl@0: // Do Nothing sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KTransitionNewLTransition,"CTransition_NewL_Transition"); sl@0: sl@0: inline CTransition_NewL_Transition::CTransition_NewL_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransitionType(KTransitionNewLTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CTransition_NewL_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KTransitionNewLTransitMethod, "CTransition::NewL transition"); sl@0: Context().DataLogger().LogInformation(KTransitionNewLTransitMethod); sl@0: Context().iTargetTransition = new(ELeave)CTarget_NullMethod_Transition(*(Context().iTargetContext), *(Context().iTargetValidator)); sl@0: } sl@0: sl@0: inline CTransition_UnitTestContext& CTransition_NewL_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KTransitionDtorTransition,"CTransition_Dtor_Transition"); sl@0: sl@0: inline CTransition_Dtor_Transition::CTransition_Dtor_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KTransitionDtorTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CTransition_Dtor_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KTransitionDtorTransitMethod, "CTransition::Dtor transition"); sl@0: Context().DataLogger().LogInformation(KTransitionDtorTransitMethod); sl@0: delete Context().iTargetTransition; sl@0: Context().iTargetTransition = NULL; sl@0: } sl@0: sl@0: inline CTransition_UnitTestContext& CTransition_Dtor_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KTransitionTransitMethodLTransition,"CTransition_TransitMethodL_Transition"); sl@0: sl@0: inline CTransition_TransitMethodL_Transition::CTransition_TransitMethodL_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransitionType(KTransitionTransitMethodLTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CTransition_TransitMethodL_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KTransitionTransitMethodLTransitMethod, "CTransition::TransitMethodL transition"); sl@0: Context().DataLogger().LogInformation(KTransitionTransitMethodLTransitMethod); sl@0: Context().iTargetTransition->TransitMethodL(); sl@0: } sl@0: sl@0: inline CTransition_UnitTestContext& CTransition_TransitMethodL_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KTransitionRepeatOnceTransition,"CTransition_RepeatOnce_Transition"); sl@0: sl@0: inline CTransition_RepeatOnce_Transition::CTransition_RepeatOnce_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KTransitionRepeatOnceTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CTransition_RepeatOnce_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KTransitionRepeatOnceTransitMethod, "CTransition::RepeatOnce transition"); sl@0: Context().DataLogger().LogInformation(KTransitionRepeatOnceTransitMethod); sl@0: Context().iTargetTransition->RepeatOnce(); sl@0: } sl@0: sl@0: inline CTransition_UnitTestContext& CTransition_RepeatOnce_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KTransitionTransitionIdTransition,"CTransition_TransitionId_Transition"); sl@0: sl@0: inline CTransition_TransitionId_Transition::CTransition_TransitionId_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KTransitionTransitionIdTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CTransition_TransitionId_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KTransitionTransitionIdTransitMethod, "CTransition::TransitionId transition"); sl@0: Context().DataLogger().LogInformation(KTransitionTransitionIdTransitMethod); sl@0: Context().iTransitionId = CONST_CAST(TDesC*, &(Context().iTargetTransition->TransitionId())); sl@0: } sl@0: sl@0: inline CTransition_UnitTestContext& CTransition_TransitionId_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KTransitionTransitionInfoTransition,"CTransition_TransitionInfo_Transition"); sl@0: sl@0: inline CTransition_TransitionInfo_Transition::CTransition_TransitionInfo_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KTransitionTransitionInfoTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CTransition_TransitionInfo_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KTransitionTransitionInfoTransitMethod, "CTransition::TransitionInfo transition"); sl@0: Context().DataLogger().LogInformation(KTransitionTransitionInfoTransitMethod); sl@0: Context().iTransitionInfo = CONST_CAST(TTransitionInfo*, &(Context().iTargetTransition->TransitionInfo())); sl@0: } sl@0: sl@0: inline CTransition_UnitTestContext& CTransition_TransitionInfo_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KTransitionSetBlockingTransition,"CTransition_SetBlocking_Transition"); sl@0: sl@0: inline CTransition_SetBlocking_Transition::CTransition_SetBlocking_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KTransitionSetBlockingTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CTransition_SetBlocking_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KTransitionSetBlockingTransitMethod, "CTransition::SetBlocking transition"); sl@0: Context().DataLogger().LogInformation(KTransitionSetBlockingTransitMethod); sl@0: Context().iTargetTransition->SetBlockingTransition(Context().iBlockingTransition); sl@0: } sl@0: sl@0: inline CTransition_UnitTestContext& CTransition_SetBlocking_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KTransitionIsBlockingTransition,"CTransition_IsBlocking_Transition"); sl@0: sl@0: inline CTransition_IsBlocking_Transition::CTransition_IsBlocking_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KTransitionIsBlockingTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CTransition_IsBlocking_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KTransitionIsBlockingTransitMethod, "CTransition::IsBlocking transition"); sl@0: Context().DataLogger().LogInformation(KTransitionIsBlockingTransitMethod); sl@0: Context().iBlockingTransition = !Context().iTargetTransition->IsBlockingTransition(); sl@0: } sl@0: sl@0: inline CTransition_UnitTestContext& CTransition_IsBlocking_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KTransitionGetErrorCodeTransition,"CTransition_GetErrorCode_Transition"); sl@0: sl@0: inline CTransition_GetErrorCode_Transition::CTransition_GetErrorCode_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KTransitionGetErrorCodeTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CTransition_GetErrorCode_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KTransitionGetErrorCodeTransitMethod, "CTransition::GetErrorCode transition"); sl@0: Context().DataLogger().LogInformation(KTransitionGetErrorCodeTransitMethod); sl@0: Context().iTargetErrorCode = Context().iTargetTransition->GetErrorCode(); sl@0: } sl@0: sl@0: inline CTransition_UnitTestContext& CTransition_GetErrorCode_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KTransitionRunTransitionTransition,"CTransition_RunTransition_Transition"); sl@0: sl@0: inline CTransition_RunTransition_Transition::CTransition_RunTransition_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KTransitionRunTransitionTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CTransition_RunTransition_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KTransitionRunTransitionTransitMethod, "CTransition::RunTransition transition"); sl@0: Context().DataLogger().LogInformation(KTransitionRunTransitionTransitMethod); sl@0: // Kick off this transition as an asynchronous call on the RunTransition sl@0: // So that this transition will complete when our target transition completes and signals its observer sl@0: iStatus = KRequestPending; sl@0: TRequestStatus* status = &iStatus; sl@0: Context().iTargetTransition->RunTransition(status); sl@0: } sl@0: sl@0: inline void CTransition_RunTransition_Transition::DoCancel() sl@0: { sl@0: _LIT(KTransitionRunTransitionTransitMethodCancel, "CTransition::RunTransition transition cancelled"); sl@0: Context().DataLogger().LogInformation(KTransitionRunTransitionTransitMethodCancel); sl@0: Context().iTargetTransition->Cancel(); sl@0: } sl@0: sl@0: inline CTransition_UnitTestContext& CTransition_RunTransition_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext); sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KTransitionCancelTransition,"CTransition_Cancel_Transition"); sl@0: sl@0: inline CTransition_Cancel_Transition::CTransition_Cancel_Transition(CUnitTestContext& aUTContext, sl@0: TTransitionValidator& aValidator) sl@0: : CTransition(KTransitionCancelTransition, aUTContext, aValidator) sl@0: { sl@0: // Do nothing here. sl@0: } sl@0: sl@0: inline void CTransition_Cancel_Transition::TransitMethodL() sl@0: { sl@0: _LIT(KTransitionCancelTransitMethod, "CTransition::Cancel transition"); sl@0: Context().DataLogger().LogInformation(KTransitionCancelTransitMethod); sl@0: Context().iTargetTransition->Cancel(); sl@0: } sl@0: sl@0: inline CTransition_UnitTestContext& CTransition_Cancel_Transition::Context() const sl@0: { sl@0: return REINTERPRET_CAST(CTransition_UnitTestContext&,iUTContext); sl@0: } sl@0: