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