|
1 // Copyright (c) 2001-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 definitions of the transition classes upon the CWspHeaderReader class methods. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file WspHeaderReaderTransitions.h |
|
20 */ |
|
21 |
|
22 #ifndef __WSPHEADERREADERTRANSITIONS_H__ |
|
23 #define __WSPHEADERREADERTRANSITIONS_H__ |
|
24 |
|
25 #include "TestUtilities.h" |
|
26 #include "StateAccessor.h" |
|
27 #include "LeakTestTransition.h" |
|
28 #include "DataLogger.h" |
|
29 #include "CWspHeaderReader.h" |
|
30 #include "WspHeaderReaderStateAccessor.h" |
|
31 #include "UnitTest.h" |
|
32 |
|
33 // Forward declarations |
|
34 class CHeaders; |
|
35 class CHeaderField; |
|
36 class RHeaderField; |
|
37 |
|
38 #define CTransitionType CTransition |
|
39 |
|
40 // ______________________________________________________________________________ |
|
41 // |
|
42 /** |
|
43 @internal |
|
44 @class CWspHeaderReader_UnitTestContext |
|
45 @Depends CWspHeaderReader & CUnitTestContext |
|
46 |
|
47 Comments : Provide all the CWspHeaderReader specific |
|
48 parameters and behaviour on the CWspHeaderReader |
|
49 test class for a transition. |
|
50 */ |
|
51 class CWspHeaderReader_UnitTestContext : public CUnitTestContext |
|
52 { |
|
53 public: |
|
54 /** |
|
55 @fn CWspHeaderReader_UnitTestContext(CDataLogger& aDataLogger, |
|
56 MStateAccessor& aStateAccessor, |
|
57 MTransitionObserver& aObserver) |
|
58 Intended Usage : Default constructor. |
|
59 Error Condition : None. |
|
60 @since 7.0 |
|
61 @param aDataLogger The output logging object. |
|
62 @param aObserver The observer of this UnitTest's Transitions. |
|
63 @param aStateAccessor WhiteBox state access to the CWspHeaderReader class under test. |
|
64 @pre None. |
|
65 @post CWspHeaderReader_UnitTestContext is fully constructed, and initialized. |
|
66 */ |
|
67 inline CWspHeaderReader_UnitTestContext(CDataLogger& aDataLogger, |
|
68 MStateAccessor& aStateAccessor, |
|
69 MTransitionObserver& aObserver, |
|
70 const TStringTable& aStrTable); |
|
71 |
|
72 /** |
|
73 @fn ~CWspHeaderReader_UnitTestContext() |
|
74 Intended Usage : Default Destructor |
|
75 @since 7.0 |
|
76 @pre CWspHeaderReader_UnitTestContext is fully constructed. |
|
77 @post CWspHeaderReader_UnitTestContext is fully destroyed |
|
78 */ |
|
79 virtual inline ~CWspHeaderReader_UnitTestContext(); |
|
80 |
|
81 inline void ConstructL(TInt aHeaderName); |
|
82 |
|
83 TInt iHeaderToken; |
|
84 |
|
85 inline void SetOutputL(); |
|
86 |
|
87 inline void SetTrapOutputL(); |
|
88 |
|
89 inline void SetExpectedL(const TDesC8& aExpectedData); |
|
90 |
|
91 CHeaderCodec* iCodec; |
|
92 |
|
93 RStringPool iStrPool; |
|
94 |
|
95 const TStringTable& iStrTable; |
|
96 |
|
97 CHeaders* iHeader; |
|
98 |
|
99 CHeaderField* iHeaderField; |
|
100 |
|
101 RHeaderField* iTestHeader; |
|
102 |
|
103 HBufC8* iExpectedData; |
|
104 |
|
105 HBufC8* iOutputData; |
|
106 }; // CWspHeaderReader_UnitTestContext |
|
107 |
|
108 // ______________________________________________________________________________ |
|
109 // |
|
110 /** |
|
111 @internal |
|
112 @class CWspHeaderReader_NewL_Transition |
|
113 @Depends CWspHeaderReader & CTransition |
|
114 |
|
115 Comments : Transition test of the CWspHeaderReader::NewL method. |
|
116 */ |
|
117 class CWspHeaderReader_NewL_Transition : public CTransitionType |
|
118 { |
|
119 public: |
|
120 /** |
|
121 @fn CWspHeaderReader_NewL_Transition(CUnitTestContext& aUTContext, |
|
122 TTransitionValidator& aValidator) |
|
123 Intended Usage : Standard c'tor method. |
|
124 Error Condition : None. |
|
125 @since 7.0 |
|
126 @param aUTContext The context this transition is operating in. |
|
127 @param aValidator Used for checking the pre & post conditions of the test object. |
|
128 @pre None. |
|
129 @post CWspHeaderReader_NewL_Transition is fully constructed. |
|
130 */ |
|
131 CWspHeaderReader_NewL_Transition(CUnitTestContext& aUTContext, |
|
132 TTransitionValidator& aValidator); |
|
133 /** |
|
134 @fn TransitMethodL() |
|
135 Intended Usage : To execute the CWspHeaderReader::NewL method for the test harness. |
|
136 Error Condition : Leaves with an error code. |
|
137 @exception KErrNoMemory, (@see CWspHeaderReader::NewL) |
|
138 @since 7.0 |
|
139 @return None |
|
140 @pre CWspHeaderReader_NewL_Transition is fully constructed. |
|
141 @post No change in the CWspHeaderReader_NewL_Transition apart |
|
142 from iWspHeaderReader, which may have changed state. |
|
143 (@see CWspHeaderReader::NewL post-condition) for iWspHeaderReader's new state. |
|
144 */ |
|
145 inline void TransitMethodL(); |
|
146 |
|
147 /** |
|
148 @fn Context() const |
|
149 Intended Usage : To provide access to the unit test context cast to the correct type. |
|
150 Error Condition : None. |
|
151 @since 7.0 |
|
152 @return The unit test context cast to a CWspHeaderReader_UnitTestContext |
|
153 @pre iUTContext is a valid CWspHeaderReader_UnitTestContext. |
|
154 @post No change in the CWspHeaderReader_NewL_Transition |
|
155 */ |
|
156 inline CWspHeaderReader_UnitTestContext& Context() const; |
|
157 }; // CWspHeaderReader_NewL_Transition |
|
158 |
|
159 // ______________________________________________________________________________ |
|
160 // |
|
161 /** |
|
162 @internal |
|
163 @class CWspHeaderReader_Dtor_Transition |
|
164 @Depends CWspHeaderReader & CTransition |
|
165 |
|
166 Comments : Transition test of the CWspHeaderReader::Dtor method. |
|
167 */ |
|
168 class CWspHeaderReader_Dtor_Transition : public CTransitionType |
|
169 { |
|
170 public: |
|
171 /** |
|
172 @fn CWspHeaderReader_Dtor_Transition(CUnitTestContext& aUTContext, |
|
173 TTransitionValidator& aValidator) |
|
174 Intended Usage : Standard c'tor method. |
|
175 Error Condition : None. |
|
176 @since 7.0 |
|
177 @param aUTContext The context this transition is operating in. |
|
178 @param aValidator Used for checking the pre & post conditions of the test object. |
|
179 @pre None. |
|
180 @post CWspHeaderReader_Dtor_Transition is fully constructed. |
|
181 */ |
|
182 CWspHeaderReader_Dtor_Transition(CUnitTestContext& aUTContext, |
|
183 TTransitionValidator& aValidator); |
|
184 /** |
|
185 @fn TransitMethodL() |
|
186 Intended Usage : To execute the CWspHeaderReader::Dtor method for the test harness. |
|
187 Error Condition : Leaves with an error code. |
|
188 @exception KErrNoMemory, (@see CWspHeaderReader::Dtor) |
|
189 @since 7.0 |
|
190 @return None |
|
191 @pre CWspHeaderReader_Dtor_Transition is fully constructed. |
|
192 @post No change in the CWspHeaderReader_Dtor_Transition apart |
|
193 from iWspHeaderReader, which may have changed state. |
|
194 (@see CWspHeaderReader::Dtor post-condition) for iWspHeaderReader's new state. |
|
195 */ |
|
196 inline void TransitMethodL(); |
|
197 |
|
198 /** |
|
199 @fn Context() const |
|
200 Intended Usage : To provide access to the unit test context cast to the correct type. |
|
201 Error Condition : None. |
|
202 @since 7.0 |
|
203 @return The unit test context cast to a CWspHeaderReader_UnitTestContext |
|
204 @pre iUTContext is a valid CWspHeaderReader_UnitTestContext. |
|
205 @post No change in the CWspHeaderReader_Dtor_Transition |
|
206 */ |
|
207 inline CWspHeaderReader_UnitTestContext& Context() const; |
|
208 }; // CWspHeaderReader_Dtor_Transition |
|
209 |
|
210 // ______________________________________________________________________________ |
|
211 // |
|
212 /** |
|
213 @internal |
|
214 @class CWspHeaderReader_DecodeHeaderL_Transition |
|
215 @Depends CWspHeaderReader & CTransition |
|
216 |
|
217 Comments : Transition test of the CWspHeaderReader::DecodeHeaderL method. |
|
218 */ |
|
219 class CWspHeaderReader_DecodeHeaderL_Transition : public CTransitionType |
|
220 { |
|
221 public: |
|
222 /** |
|
223 @fn CWspHeaderReader_DecodeHeaderL_Transition(CUnitTestContext& aUTContext, |
|
224 TTransitionValidator& aValidator) |
|
225 Intended Usage : Standard c'tor method. |
|
226 Error Condition : None. |
|
227 @since 7.0 |
|
228 @param aUTContext The context this transition is operating in. |
|
229 @param aValidator Used for checking the pre & post conditions of the test object. |
|
230 @pre None. |
|
231 @post CWspHeaderReader_DecodeHeaderL_Transition is fully constructed. |
|
232 */ |
|
233 CWspHeaderReader_DecodeHeaderL_Transition(CUnitTestContext& aUTContext, |
|
234 TTransitionValidator& aValidator); |
|
235 /** |
|
236 @fn TransitMethodL() |
|
237 Intended Usage : To execute the CWspHeaderReader::DecodeHeaderL method for the test harness. |
|
238 Error Condition : Leaves with an error code. |
|
239 @exception KErrNoMemory, (@see CWspHeaderReader::DecodeHeaderL) |
|
240 @since 7.0 |
|
241 @return None |
|
242 @pre CWspHeaderReader_DecodeHeaderL_Transition is fully constructed. |
|
243 @post No change in the CWspHeaderReader_DecodeHeaderL_Transition apart |
|
244 from iWspHeaderReader, which may have changed state. |
|
245 (@see CWspHeaderReader::DecodeHeaderL post-condition) for iWspHeaderReader's new state. |
|
246 */ |
|
247 inline void TransitMethodL(); |
|
248 |
|
249 /** |
|
250 @fn Context() const |
|
251 Intended Usage : To provide access to the unit test context cast to the correct type. |
|
252 Error Condition : None. |
|
253 @since 7.0 |
|
254 @return The unit test context cast to a CWspHeaderReader_UnitTestContext |
|
255 @pre iUTContext is a valid CWspHeaderReader_UnitTestContext. |
|
256 @post No change in the CWspHeaderReader_DecodeHeaderL_Transition |
|
257 */ |
|
258 inline CWspHeaderReader_UnitTestContext& Context() const; |
|
259 }; // CWspHeaderReader_DecodeHeaderL_Transition |
|
260 |
|
261 // ______________________________________________________________________________ |
|
262 // |
|
263 /** |
|
264 @internal |
|
265 @class CWspHeaderReader_DecodeHeaderLTrap_Transition |
|
266 @Depends CWspHeaderReader & CTransition |
|
267 |
|
268 Comments : Transition test of the CWspHeaderReader::DecodeHeaderLTrap method. |
|
269 */ |
|
270 class CWspHeaderReader_DecodeHeaderLTrap_Transition : public CTransitionType |
|
271 { |
|
272 public: |
|
273 /** |
|
274 @fn CWspHeaderReader_DecodeHeaderLTrap_Transition(CUnitTestContext& aUTContext, |
|
275 TTransitionValidator& aValidator) |
|
276 Intended Usage : Standard c'tor method. |
|
277 Error Condition : None. |
|
278 @since 7.0 |
|
279 @param aUTContext The context this transition is operating in. |
|
280 @param aValidator Used for checking the pre & post conditions of the test object. |
|
281 @pre None. |
|
282 @post CWspHeaderReader_DecodeHeaderLTrap_Transition is fully constructed. |
|
283 */ |
|
284 CWspHeaderReader_DecodeHeaderLTrap_Transition(CUnitTestContext& aUTContext, |
|
285 TTransitionValidator& aValidator); |
|
286 /** |
|
287 @fn TransitMethodL() |
|
288 Intended Usage : To execute the CWspHeaderReader::DecodeHeaderLTrap method for the test harness. |
|
289 Error Condition : Leaves with an error code. |
|
290 @exception KErrNoMemory, (@see CWspHeaderReader::DecodeHeaderLTrap) |
|
291 @since 7.0 |
|
292 @return None |
|
293 @pre CWspHeaderReader_DecodeHeaderLTrap_Transition is fully constructed. |
|
294 @post No change in the CWspHeaderReader_DecodeHeaderLTrap_Transition apart |
|
295 from iWspHeaderReader, which may have changed state. |
|
296 (@see CWspHeaderReader::DecodeHeaderLTrap post-condition) for iWspHeaderReader's new state. |
|
297 */ |
|
298 inline void TransitMethodL(); |
|
299 |
|
300 /** |
|
301 @fn Context() const |
|
302 Intended Usage : To provide access to the unit test context cast to the correct type. |
|
303 Error Condition : None. |
|
304 @since 7.0 |
|
305 @return The unit test context cast to a CWspHeaderReader_UnitTestContext |
|
306 @pre iUTContext is a valid CWspHeaderReader_UnitTestContext. |
|
307 @post No change in the CWspHeaderReader_DecodeHeaderLTrap_Transition |
|
308 */ |
|
309 inline CWspHeaderReader_UnitTestContext& Context() const; |
|
310 }; // CWspHeaderReader_DecodeHeaderLTrap_Transition |
|
311 |
|
312 #include "WspHeaderReaderTransitions.inl" |
|
313 |
|
314 #include "WspHeaderReaderUnitTestContext.inl" |
|
315 |
|
316 #endif // __WSPHEADERREADERTRANSITIONS_H__ |
|
317 |