os/ossrv/lowlevellibsandfws/pluginfw/Framework/RegistrarTest/RegistrarTransitionValidation.inl
First public contribution.
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // The implementation of the validation classes for the CRegistar tests.
18 // ______________________________________________________________________________
20 inline TRegistrar_Ctor_TransitionValidator::TRegistrar_Ctor_TransitionValidator(CUnitTestContext& aUTContext)
21 :TTransitionValidator(aUTContext)
26 inline TBool TRegistrar_Ctor_TransitionValidator::ValidatePreConditions()
31 inline TBool TRegistrar_Ctor_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */)
33 if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext).iRegistrar))
38 // ______________________________________________________________________________
40 inline TRegistrar_Dtor_TransitionValidator::TRegistrar_Dtor_TransitionValidator(CUnitTestContext& aUTContext)
41 :TTransitionValidator(aUTContext)
46 inline TBool TRegistrar_Dtor_TransitionValidator::ValidatePreConditions()
48 if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext).iRegistrar))
53 inline TBool TRegistrar_Dtor_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */)
58 // ______________________________________________________________________________
60 inline TRegistrar_Default_TransitionValidator::TRegistrar_Default_TransitionValidator(CUnitTestContext& aUTContext)
61 :TTransitionValidator(aUTContext)
66 inline TBool TRegistrar_Default_TransitionValidator::ValidatePreConditions()
68 if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext).iRegistrar))
73 inline TBool TRegistrar_Default_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */)
75 if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext).iRegistrar))
80 // ______________________________________________________________________________
82 inline TRegistrar_RegisterDiscoveryL_TransitionValidator::TRegistrar_RegisterDiscoveryL_TransitionValidator(CUnitTestContext& aUTContext)
83 :TTransitionValidator(aUTContext)
88 inline TBool TRegistrar_RegisterDiscoveryL_TransitionValidator::ValidatePreConditions()
90 // Only pre condition is that object is constructed
91 if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext).iRegistrar))
96 inline TBool TRegistrar_RegisterDiscoveryL_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */)
98 if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CRegistrar_UnitTestContext&, iUTContext).iRegistrar))
103 // ______________________________________________________________________________
105 inline TRegistrar_DriveRemoved_TransitionValidator::TRegistrar_DriveRemoved_TransitionValidator(CUnitTestContext& aUTContext)
106 :TTransitionValidator(aUTContext)
111 inline TBool TRegistrar_DriveRemoved_TransitionValidator::ValidatePreConditions()
113 if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext).iRegistrar))
118 inline TBool TRegistrar_DriveRemoved_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */)
120 //Do a list implementations and check that we get a list unavailable error
121 CRegistrar_UnitTestContext& context = REINTERPRET_CAST(CRegistrar_UnitTestContext&, iUTContext);
123 TRAPD(error, context.iRegistryData.ListImplementationsL(context.iInterfaceUid));
124 if(error != KEComErrNoInterfaceIdentified)
129 if(iUTContext.StateAccessor().InvariantTest(context.iRegistrar))
134 // ______________________________________________________________________________
136 inline TRegistrar_CheckRegWhileDiscovering_TransitionValidator::TRegistrar_CheckRegWhileDiscovering_TransitionValidator(CUnitTestContext& aUTContext)
137 :TTransitionValidator(aUTContext)
142 inline TBool TRegistrar_CheckRegWhileDiscovering_TransitionValidator::ValidatePreConditions()
144 if(iUTContext.StateAccessor().InvariantTest(REINTERPRET_CAST(CRegistrar_UnitTestContext&,iUTContext).iRegistrar))
149 inline TBool TRegistrar_CheckRegWhileDiscovering_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */)
151 //Do a list implementations and check that we get a list unavailable error
152 CRegistrar_UnitTestContext& context = REINTERPRET_CAST(CRegistrar_UnitTestContext&, iUTContext);
154 TRAPD(error, context.iRegistryData.ListImplementationsL(context.iInterfaceUid));
155 if(error != KEComErrListCurrentlyUnavailable)
157 _LIT(KCheckRegLeaveMessage, "In PostCondition - ListImplementationsL left with %d (expected KEComErrListCurrentlyUnavailable)");
158 context.DataLogger().LogInformationWithParameters(KCheckRegLeaveMessage, error);
162 if(iUTContext.StateAccessor().InvariantTest(context.iRegistrar))
167 // ______________________________________________________________________________
169 inline TRegistrar_NewLHasContent_TransitionValidator::TRegistrar_NewLHasContent_TransitionValidator(CUnitTestContext& aUTContext)
170 :TTransitionValidator(aUTContext)
175 inline TBool TRegistrar_NewLHasContent_TransitionValidator::ValidatePreConditions()
180 inline TBool TRegistrar_NewLHasContent_TransitionValidator::ValidatePostConditions(TTestBedAsyncState /* aAsyncState */)
182 // If this validation fails it is probably because there are no registered
183 // interfaces. This is most likely because the idx file is not valid.
185 CRegistrar_UnitTestContext& context = REINTERPRET_CAST(CRegistrar_UnitTestContext&, iUTContext);
187 TRAPD(error, context.iRegistryData.ListImplementationsL(context.iInterfaceUid));
188 if(error == KEComErrNoInterfaceIdentified)
190 // Then the index hasn't been rebuilt so
194 if(iUTContext.StateAccessor().InvariantTest(context.iRegistrar))