sl@0: // Copyright (c) 1997-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: // Implementations for the transition validation classes for ECom sl@0: // sl@0: // sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: inline TExampleInterface_Ctor_TransitionValidator::TExampleInterface_Ctor_TransitionValidator(CUnitTestContext& aUTContext) sl@0: :TTransitionValidator(aUTContext) sl@0: { sl@0: // Do nothing sl@0: } sl@0: sl@0: inline TBool TExampleInterface_Ctor_TransitionValidator::ValidatePreConditions() sl@0: { sl@0: return ETrue; sl@0: } sl@0: sl@0: inline TBool TExampleInterface_Ctor_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */) sl@0: { sl@0: CExampleInterface_UnitTestContext& context = sl@0: REINTERPRET_CAST(CExampleInterface_UnitTestContext&,iUTContext); sl@0: TExampleInterface_StateAccessor& accessor = sl@0: REINTERPRET_CAST(TExampleInterface_StateAccessor&, iUTContext.StateAccessor()); sl@0: sl@0: _LIT(KTUidMessage, "Created an implementation with uid = 0x%x"); sl@0: TUid implUid = accessor.GetDtorKey(context.iExampleInterface); sl@0: context.DataLogger().LogInformationWithParameters(KTUidMessage, implUid.iUid); sl@0: if(accessor.InvariantTest(context.iExampleInterface)) sl@0: return EFalse; sl@0: return ETrue; sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: inline TExampleInterface_Dtor_TransitionValidator::TExampleInterface_Dtor_TransitionValidator(CUnitTestContext& aUTContext) sl@0: :TTransitionValidator(aUTContext) sl@0: { sl@0: // Do nothing sl@0: } sl@0: sl@0: inline TBool TExampleInterface_Dtor_TransitionValidator::ValidatePreConditions() sl@0: { sl@0: if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CExampleInterface_UnitTestContext&,iUTContext).iExampleInterface)) sl@0: return EFalse; sl@0: return ETrue; sl@0: } sl@0: sl@0: inline TBool TExampleInterface_Dtor_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */) sl@0: { sl@0: return ETrue; sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: inline TExampleInterface_ListImplementations_TransitionValidator::TExampleInterface_ListImplementations_TransitionValidator(CUnitTestContext& aUTContext) sl@0: :TTransitionValidator(aUTContext) sl@0: { sl@0: // Do nothing sl@0: } sl@0: sl@0: inline TBool TExampleInterface_ListImplementations_TransitionValidator::ValidatePreConditions() sl@0: { sl@0: // static function so there are no preconditions sl@0: return ETrue; sl@0: } sl@0: sl@0: inline TBool TExampleInterface_ListImplementations_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */) sl@0: { sl@0: CExampleInterface_UnitTestContext& context = REINTERPRET_CAST(CExampleInterface_UnitTestContext&, sl@0: iUTContext); sl@0: const TInt count = context.iImplementations.Count(); sl@0: _LIT(KImplementationsReturned,"List Implementations transition returned %d implementations"); sl@0: context.DataLogger().LogInformationWithParameters(KImplementationsReturned,count); sl@0: for(TInt i = 0; i < count; ++i) sl@0: { sl@0: CImplementationInformation* info = (context.iImplementations)[i]; sl@0: context.DataLogger().LogInformation(info->DisplayName()); sl@0: context.DataLogger().LogInformation(info->DataType()); sl@0: _LIT(KVersionLogLine,"Version number = %d"); sl@0: context.DataLogger().LogInformationWithParameters(KVersionLogLine,info->Version()); sl@0: } sl@0: return ETrue; sl@0: } sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: inline TExampleInterface_Default_TransitionValidator::TExampleInterface_Default_TransitionValidator(CUnitTestContext& aUTContext) sl@0: :TTransitionValidator(aUTContext) sl@0: { sl@0: // Do nothing sl@0: } sl@0: sl@0: inline TBool TExampleInterface_Default_TransitionValidator::ValidatePreConditions() sl@0: { sl@0: if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CExampleInterface_UnitTestContext&,iUTContext).iExampleInterface)) sl@0: return EFalse; sl@0: return ETrue; sl@0: } sl@0: sl@0: inline TBool TExampleInterface_Default_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */) sl@0: { sl@0: if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CExampleInterface_UnitTestContext&,iUTContext).iExampleInterface)) sl@0: return EFalse; sl@0: return ETrue; sl@0: } sl@0: