|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // The unit test class implementations for the CLoadManager tests |
|
15 // |
|
16 // |
|
17 |
|
18 #include "LoadManagerUnitTest.h" |
|
19 #include "RegistryData.h" |
|
20 |
|
21 CLoadManager_CreateAndDestroy_UnitTest* CLoadManager_CreateAndDestroy_UnitTest::NewL(CDataLogger& aDataLogger, |
|
22 MUnitTestObserver& aObserver) |
|
23 { |
|
24 CLoadManager_CreateAndDestroy_UnitTest* self = |
|
25 new(ELeave) CLoadManager_CreateAndDestroy_UnitTest(aDataLogger, |
|
26 aObserver); |
|
27 CleanupStack::PushL(self); |
|
28 self->ConstructL(); |
|
29 CleanupStack::Pop(); |
|
30 return self; |
|
31 } |
|
32 |
|
33 // Now the Individual transitions need to be added. |
|
34 inline void CLoadManager_CreateAndDestroy_UnitTest::ConstructL() |
|
35 { |
|
36 // Perform the base class initialization |
|
37 UnitTestConstructL(); |
|
38 |
|
39 // Create the Unit test state accessor |
|
40 iStateAccessor = new(ELeave) TLoadManager_StateAccessor; |
|
41 // Construct the Unit test context. |
|
42 iUTContext = new(ELeave) CLoadManager_UnitTestContext(iDataLogger, *iStateAccessor, *this); |
|
43 // Add the Transitions in the order they are to run |
|
44 // C'tor first, D'tor last... |
|
45 iCtorValidator = new(ELeave) TLoadManager_Ctor_TransitionValidator(*iUTContext); |
|
46 AddTransitionL(new(ELeave)CLoadManager_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
47 iDtorValidator = new(ELeave) TLoadManager_Dtor_TransitionValidator(*iUTContext); |
|
48 AddTransitionL(new(ELeave)CLoadManager_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
49 } |
|
50 |
|
51 void CLoadManager_CreateAndDestroy_UnitTest::PrepareUnitTestL() |
|
52 { |
|
53 // Give the context a constructed set of data |
|
54 iUTContext->iRegistryData = CRegistryData::NewL(iFs); |
|
55 } |
|
56 |
|
57 // ______________________________________________________________________________ |
|
58 // |
|
59 CLoadManager_FindInstantiationAndDestroy_UnitTest* CLoadManager_FindInstantiationAndDestroy_UnitTest::NewL(CDataLogger& aDataLogger, |
|
60 MUnitTestObserver& aObserver) |
|
61 { |
|
62 CLoadManager_FindInstantiationAndDestroy_UnitTest* self = |
|
63 new(ELeave) CLoadManager_FindInstantiationAndDestroy_UnitTest(aDataLogger, |
|
64 aObserver); |
|
65 CleanupStack::PushL(self); |
|
66 self->ConstructL(); |
|
67 CleanupStack::Pop(); |
|
68 return self; |
|
69 } |
|
70 |
|
71 // Now the Individual transitions need to be added. |
|
72 inline void CLoadManager_FindInstantiationAndDestroy_UnitTest::ConstructL() |
|
73 { |
|
74 // Perform the base class initialization |
|
75 UnitTestConstructL(); |
|
76 |
|
77 // Create the Unit test state accessor |
|
78 iStateAccessor = new(ELeave) TLoadManager_StateAccessor; |
|
79 // Construct the Unit test context. |
|
80 iUTContext = new(ELeave) CLoadManager_UnitTestContext(iDataLogger, *iStateAccessor, *this); |
|
81 |
|
82 iUTContext->iUniqueImplementationUid = KUniqueImplementationUid_Works; |
|
83 // Add the Transitions in the order they are to run |
|
84 // C'tor first, D'tor last... |
|
85 iCtorValidator = new(ELeave) TLoadManager_Ctor_TransitionValidator(*iUTContext); |
|
86 AddTransitionL(new(ELeave)CLoadManager_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
87 |
|
88 iInstantiationMethodValidator = new(ELeave) TLoadManager_InstantiationMethod_TransitionValidator(*iUTContext); |
|
89 AddTransitionL(new(ELeave)CLoadManager_InstantiationMethodL_Transition(*iUTContext,*iInstantiationMethodValidator)); |
|
90 |
|
91 iDestroyThisValidator = new(ELeave) TLoadManager_DestroyThis_TransitionValidator(*iUTContext); |
|
92 AddTransitionL(new(ELeave)CLoadManager_DestroyedThis_Transition(*iUTContext,*iDestroyThisValidator)); |
|
93 |
|
94 iDtorValidator = new(ELeave) TLoadManager_Dtor_TransitionValidator(*iUTContext); |
|
95 AddTransitionL(new(ELeave)CLoadManager_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
96 } |
|
97 |
|
98 void CLoadManager_FindInstantiationAndDestroy_UnitTest::PrepareUnitTestL() |
|
99 { |
|
100 iUTContext->iRegistryData = CRegistryData::NewL(iFs); |
|
101 } |
|
102 |
|
103 // ______________________________________________________________________________ |
|
104 // |
|
105 CLoadManager_FindInstantiationFailure_UnitTest* CLoadManager_FindInstantiationFailure_UnitTest::NewL(CDataLogger& aDataLogger, |
|
106 MUnitTestObserver& aObserver) |
|
107 { |
|
108 CLoadManager_FindInstantiationFailure_UnitTest* self = |
|
109 new(ELeave) CLoadManager_FindInstantiationFailure_UnitTest(aDataLogger, |
|
110 aObserver); |
|
111 CleanupStack::PushL(self); |
|
112 self->ConstructL(); |
|
113 CleanupStack::Pop(); |
|
114 return self; |
|
115 } |
|
116 |
|
117 // Now the Individual transitions need to be added. |
|
118 inline void CLoadManager_FindInstantiationFailure_UnitTest::ConstructL() |
|
119 { |
|
120 // Perform the base class initialization |
|
121 UnitTestConstructL(); |
|
122 |
|
123 // Create the Unit test state accessor |
|
124 iStateAccessor = new(ELeave) TLoadManager_StateAccessor; |
|
125 // Construct the Unit test context. |
|
126 iUTContext = new(ELeave) CLoadManager_UnitTestContext(iDataLogger, *iStateAccessor, *this); |
|
127 |
|
128 iUTContext->iUniqueImplementationUid = KUniqueImplementationUid_Fails; |
|
129 iUTContext->iRegistryData = CRegistryData::NewL(iFs); |
|
130 // Add the Transitions in the order they are to run |
|
131 // C'tor first, D'tor last... |
|
132 iCtorValidator = new(ELeave) TLoadManager_Ctor_TransitionValidator(*iUTContext); |
|
133 AddTransitionL(new(ELeave)CLoadManager_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
134 |
|
135 iInstantiationMethodValidator = new(ELeave) TLoadManager_InstantiationFailure_TransitionValidator(*iUTContext); |
|
136 AddTransitionL(new(ELeave)CLoadManager_InstantiationMethodL_Transition(*iUTContext,*iInstantiationMethodValidator)); |
|
137 |
|
138 iDtorValidator = new(ELeave) TLoadManager_Dtor_TransitionValidator(*iUTContext); |
|
139 AddTransitionL(new(ELeave)CLoadManager_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
140 } |
|
141 |
|
142 // ______________________________________________________________________________ |
|
143 // |
|
144 CLoadManager_DefectFOT56ULPM_UnitTest* CLoadManager_DefectFOT56ULPM_UnitTest::NewL(CDataLogger& aDataLogger, |
|
145 MUnitTestObserver& aObserver) |
|
146 { |
|
147 CLoadManager_DefectFOT56ULPM_UnitTest* self = |
|
148 new(ELeave) CLoadManager_DefectFOT56ULPM_UnitTest(aDataLogger, |
|
149 aObserver); |
|
150 CleanupStack::PushL(self); |
|
151 self->ConstructL(); |
|
152 CleanupStack::Pop(); |
|
153 return self; |
|
154 } |
|
155 |
|
156 // Now the Individual transitions need to be added. |
|
157 inline void CLoadManager_DefectFOT56ULPM_UnitTest::ConstructL() |
|
158 { |
|
159 // Perform the base class initialization |
|
160 UnitTestConstructL(); |
|
161 |
|
162 // Create the Unit test state accessor |
|
163 iStateAccessor = new(ELeave) TLoadManager_StateAccessor; |
|
164 // Construct the Unit test context. |
|
165 iUTContext = new(ELeave) CLoadManager_UnitTestContext(iDataLogger, *iStateAccessor, *this); |
|
166 |
|
167 iUTContext->iUniqueImplementationUid = KUniqueImplementationUid_Works; |
|
168 iUTContext->iRegistryData = CRegistryData::NewL(iFs); |
|
169 // Add the Transitions in the order they are to run |
|
170 // C'tor first, D'tor last... |
|
171 iCtorValidator = new(ELeave) TLoadManager_Ctor_TransitionValidator(*iUTContext); |
|
172 iInstantiationMethodValidator = new(ELeave) TLoadManager_InstantiationMethod_TransitionValidator(*iUTContext); |
|
173 iDestroyThisValidator = new(ELeave) TLoadManager_DestroyThis_TransitionValidator(*iUTContext); |
|
174 iDtorValidator = new(ELeave) TLoadManager_Dtor_TransitionValidator(*iUTContext); |
|
175 |
|
176 AddTransitionL(new(ELeave)CLoadManager_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
177 AddTransitionL(new(ELeave)CLoadManager_InstantiationMethodL_Transition(*iUTContext,*iInstantiationMethodValidator)); |
|
178 AddTransitionL(new(ELeave)CLoadManager_DestroyCreate_Transition(*iUTContext,*iDestroyThisValidator)); |
|
179 AddTransitionL(new(ELeave)CLoadManager_DestroyedThis_Transition(*iUTContext,*iDestroyThisValidator)); |
|
180 AddTransitionL(new(ELeave)CLoadManager_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
181 } |
|
182 |