|
1 // Copyright (c) 2004-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 // |
|
15 |
|
16 #ifndef __OBEXHARNESS_H__ |
|
17 #define __OBEXHARNESS_H__ |
|
18 |
|
19 #include <sendas.h> // MSendAsObserver |
|
20 #include <obexmtmutil.h> |
|
21 #include "harness.h" // CMsvClientTest |
|
22 #include "obextestheaderlist.h" |
|
23 |
|
24 #include "cobextestfilenameandheaders.h" |
|
25 |
|
26 // Forward declarations |
|
27 class CObexTestUtils; |
|
28 class RTest; |
|
29 |
|
30 class CObexClientTest : public CMsvClientTest, public MSendAsObserver |
|
31 /** |
|
32 * The CObexClientTest class is the main repository for information |
|
33 * shared between test states. It runs these states using functions |
|
34 * inherited from CMsvClientTest. |
|
35 */ |
|
36 { |
|
37 public: |
|
38 /** |
|
39 * Factory function which initialises the class. This version is |
|
40 * passed in an existing MMS Test Utils object, of which it does not |
|
41 * take ownership. |
|
42 * @param aTestUtils A reference to an ObexTestUtils object |
|
43 * @param aTest The test object which provides a console, etc. |
|
44 */ |
|
45 static CObexClientTest* NewL(CObexTestUtils& aTestUtils, RTest& aTest); |
|
46 /** |
|
47 * Factory function which initialises the class. This version is |
|
48 * passed in an existing MMS Test Utils object, of which it does |
|
49 * take ownership. |
|
50 * @param aTestUtils A reference to an ObexTestUtils object |
|
51 * @param aTest The test object which provides a console, etc. |
|
52 */ |
|
53 static CObexClientTest* NewL(CObexTestUtils* aTestUtils, RTest& aTest); |
|
54 /** |
|
55 * C++ destructor. |
|
56 */ |
|
57 virtual ~CObexClientTest(); |
|
58 |
|
59 /** |
|
60 * Writes a comment to the error log. |
|
61 * @param aError The comment to write to the log. |
|
62 */ |
|
63 void LogCommentL(const TDesC& aError); |
|
64 |
|
65 /** |
|
66 * Deletes messages and the test utils object. |
|
67 */ |
|
68 void Reset(); |
|
69 |
|
70 /** |
|
71 * Returns a reference to the MMS test utilities object. |
|
72 * @return A reference to the test utilities. |
|
73 */ |
|
74 inline CObexTestUtils& ObexTestUtils(); |
|
75 |
|
76 /** |
|
77 * Creates the CSendAs object and its associated message. |
|
78 */ |
|
79 void CreateSendAsL(); |
|
80 /** |
|
81 * Returns a pointer to the SendAs object. |
|
82 * @return A pointer to the CSendAs object. |
|
83 */ |
|
84 inline CSendAs* SendAs(); |
|
85 |
|
86 /** |
|
87 * Sets the frequency with which progress of operations is checked. |
|
88 * @param aGranularity The granularity of the progress timer, in ms. |
|
89 */ |
|
90 inline void SetProgressGranularity(TInt aGranularity); |
|
91 /** |
|
92 * Gets the frequency with which progress of operations is checked. |
|
93 * @return aGranularity The granularity of the progress timer, in ms. |
|
94 */ |
|
95 inline TInt ProgressGranularity(); |
|
96 |
|
97 /** |
|
98 * Sets the time after which operations will be cancelled. |
|
99 * @param aGranularity The granularity of the cancel timer, in ms. |
|
100 */ |
|
101 inline void SetCancelGranularity(TInt aGranularity); |
|
102 /** |
|
103 * Sets the time after which operations will be cancelled. |
|
104 * @return The granularity of the cancel timer, in ms. |
|
105 */ |
|
106 inline TInt CancelGranularity(); |
|
107 |
|
108 /** |
|
109 * This class inherits from MSendAsObserver so that the SendAs class can |
|
110 * be instantiated, and hence needs to provide this function. It always returns true. |
|
111 * @return ETrue. |
|
112 */ |
|
113 inline TBool CapabilityOK(TUid aCapability, TInt aResponse); |
|
114 |
|
115 /** |
|
116 * Returns a flag to indicate whether or not the failure of a send operation results in the termination of the test harness |
|
117 * @return The value of the flag for ignoring send errors |
|
118 */ |
|
119 inline TBool IgnoreSendErrors(); |
|
120 |
|
121 /** |
|
122 * Sets a flag to indicate whether or not the failure of a send operation results in the termination of the test harness |
|
123 * @param aFlag The new value of the flag for ignoring send errors |
|
124 */ |
|
125 inline void SetIgnoreSendErrors(TBool aFlag); |
|
126 |
|
127 /** |
|
128 * Over ridden for test all passed logging. |
|
129 */ |
|
130 void RunL(); |
|
131 |
|
132 /** |
|
133 * Returns a pointer to the current obex headers list object. |
|
134 * @return A pointer to the CObexHeaderList object. |
|
135 */ |
|
136 inline CObexHeaderList* CurrentHeaders(); |
|
137 |
|
138 /** |
|
139 * Returns a pointer to the verify obex headers list object. |
|
140 * @return A pointer to the CObexHeader object. |
|
141 */ |
|
142 inline CObexTestHeaderList* VerifyHeaders(); |
|
143 |
|
144 /** |
|
145 * Clear the headers added to the current headers list object. |
|
146 */ |
|
147 void ClearCurrentHeadersL(); |
|
148 |
|
149 /** |
|
150 * . |
|
151 */ |
|
152 void ReleaseCurrentHeaders(); |
|
153 |
|
154 |
|
155 /** |
|
156 * Clear the headers added to the verify headers list object. |
|
157 */ |
|
158 void ClearVerifyHeadersL(); |
|
159 |
|
160 inline RPointerArray<CObexTestFilenameAndHeaders>& Attachments(); |
|
161 |
|
162 |
|
163 void ClearAttachmentsL(); |
|
164 |
|
165 protected: |
|
166 /** |
|
167 * Second-stage constructor. Simply calls the base class' ConstructL(). |
|
168 */ |
|
169 virtual void ConstructL(); |
|
170 /** |
|
171 * C++ constructor. This version is passed in an existing MMS Test |
|
172 * Utils object, of which it does not take ownership. |
|
173 * @param aTestUtils A reference to an ObexTestUtils object |
|
174 * @param aTest The test object which provides a console, etc. |
|
175 */ |
|
176 CObexClientTest(CObexTestUtils& aTestUtils, RTest& aTest); |
|
177 /** |
|
178 * C++ constructor. This version is passed in an existing MMS Test |
|
179 * Utils object, of which it does not take ownership. |
|
180 * @param aTestUtils A reference to an ObexTestUtils object |
|
181 * @param aTest The test object which provides a console, etc. |
|
182 */ |
|
183 CObexClientTest(CObexTestUtils* aTestUtils, RTest& aTest); |
|
184 |
|
185 |
|
186 protected: |
|
187 // A handle to the MMS test utils object. |
|
188 CObexTestUtils& iObexTestUtils; |
|
189 |
|
190 private: |
|
191 CObexTestUtils* iOwnedObexTestUtils; //< A pointer to the MMS test utils object, if the class owns it. |
|
192 TBool iSessionReset; //< Whether the session has been reset and the message objects deleted. |
|
193 CSendAs* iSendAs; //< A pointer to the SendAs object owned by the test harness. |
|
194 TInt iProgressGranularity; //< The granularity of the progress timer - how frequently to request progress, in ms |
|
195 TInt iCancelGranularity; //< The granularity of the cancellation timer - how quickly to cancel operations, in ms |
|
196 TBool iIgnoreSendErrors; //< A flag to indicate whether or not the failure of a send operation results in the termination of the test harness |
|
197 TBool iAllTestPassed; //<A flag to indicate if all the test states passed |
|
198 CObexHeaderList* iCurrentHeaders; |
|
199 CObexTestHeaderList* iVerifyHeaders; |
|
200 RPointerArray<CObexTestFilenameAndHeaders> iAttachmentsList; |
|
201 }; |
|
202 |
|
203 |
|
204 #include "ObexHarness.inl" |
|
205 |
|
206 |
|
207 #endif // __OBEXHARNESS_H__ |