os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/TestControllerTest/TestControllerTransitions.inl
Update contrib.
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 transition classes upon the CTestController class methods.
18 IMPORT_C CComponentTester* NewComponentTestLC_STUB(
19 CDataLogger& aDataLogger,
20 MComponentTestObserver& aComponentTestObserver);
22 // ______________________________________________________________________________
24 _LIT(KTestControllerNewLTransition,"CTestController_NewL_Transition");
26 inline CTestController_NewL_Transition::CTestController_NewL_Transition(CUnitTestContext& aUTContext,
27 TTransitionValidator& aValidator)
28 : CTransitionType(KTestControllerNewLTransition, aUTContext, aValidator)
33 inline void CTestController_NewL_Transition::TransitMethodL()
35 _LIT(KTestControllerNewLTransitMethod, "CTestController::NewL transition");
36 Context().DataLogger().LogInformation(KTestControllerNewLTransitMethod);
37 Context().iTestController = CTestController::NewL(Context().iScheduler, NewComponentTestLC_STUB, NULL, Context().iLogInfo);
40 inline CTestController_UnitTestContext& CTestController_NewL_Transition::Context() const
42 return REINTERPRET_CAST(CTestController_UnitTestContext&,iUTContext);
45 // ______________________________________________________________________________
47 _LIT(KTestControllerDtorTransition,"CTestController_Dtor_Transition");
49 inline CTestController_Dtor_Transition::CTestController_Dtor_Transition(CUnitTestContext& aUTContext,
50 TTransitionValidator& aValidator)
51 : CTransition(KTestControllerDtorTransition, aUTContext, aValidator)
56 inline void CTestController_Dtor_Transition::TransitMethodL()
58 _LIT(KTestControllerDtorTransitMethod, "CTestController::Dtor transition");
59 Context().DataLogger().LogInformation(KTestControllerDtorTransitMethod);
60 delete Context().iTestController;
61 Context().iTestController = NULL;
64 inline CTestController_UnitTestContext& CTestController_Dtor_Transition::Context() const
66 return REINTERPRET_CAST(CTestController_UnitTestContext&,iUTContext);
69 // ______________________________________________________________________________
71 _LIT(KTestControllerFindComponentsTransition,"CTestController_FindComponents_Transition");
73 inline CTestController_FindComponents_Transition::CTestController_FindComponents_Transition(CUnitTestContext& aUTContext,
74 TTransitionValidator& aValidator)
75 : CTransition(KTestControllerFindComponentsTransition, aUTContext, aValidator)
80 // This is the name of the test that we wish to find
81 _LIT(KComponentInfoCreateAndDestroyUnitTest,"CTestController_CreateAndDestroy_UnitTest_STUB");
83 inline void CTestController_FindComponents_Transition::TransitMethodL()
85 _LIT(KTestControllerFindComponentsTransitMethod, "CTestController::FindComponents transition");
86 Context().DataLogger().LogInformation(KTestControllerFindComponentsTransitMethod);
88 Context().iTests.ResetAndDestroy();
89 // Find the available components and place them in an array
90 const RPointerArray<CComponentInfo>& components = Context().iTestController->FindComponents();
91 const TInt ccount = components.Count();
93 for(TInt i = 0; i < ccount && !found; ++i)
95 // Find the unit tests available for each the previously found components
96 const RPointerArray<CUnitTestInfo>& unitTests = components[i]->UnitTestsInfo();
97 const TInt ucount = unitTests.Count();
98 for(TInt j = 0; j < ucount && !found; ++j)
100 // Look for the unit test that matches the one that we wish to find
101 found = unitTests[j]->UnitTestId() == KComponentInfoCreateAndDestroyUnitTest;
104 TTestInfo* testInfo = new(ELeave) TTestInfo;
105 testInfo->iComponentId = i;
106 testInfo->iUnitTestId = j;
107 testInfo->iRunTime = 0; // Run immediately
108 testInfo->iParameters = NULL;
109 User::LeaveIfError(Context().iTests.Append(testInfo));
114 User::Leave(KErrNotFound);
117 inline CTestController_UnitTestContext& CTestController_FindComponents_Transition::Context() const
119 return REINTERPRET_CAST(CTestController_UnitTestContext&,iUTContext);
122 // ______________________________________________________________________________
124 _LIT(KTestControllerStartTransition,"CTestController_Start_Transition");
126 inline CTestController_Start_Transition::CTestController_Start_Transition(CUnitTestContext& aUTContext,
127 TTransitionValidator& aValidator)
128 : CTransition(KTestControllerStartTransition, aUTContext, aValidator)
133 inline void CTestController_Start_Transition::TransitMethodL()
135 _LIT(KTestControllerStartTransitMethod, "CTestController::Start transition");
136 Context().DataLogger().LogInformation(KTestControllerStartTransitMethod);
137 Context().iTestController->Start(&Context().iTests);
140 inline CTestController_UnitTestContext& CTestController_Start_Transition::Context() const
142 return REINTERPRET_CAST(CTestController_UnitTestContext&,iUTContext);
146 // Add additional Transition class Implementations here...