1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: STIF testclass declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef PRESETUTILITYTESTMODULE_H |
|
19 #define PRESETUTILITYTESTMODULE_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <StifLogger.h> |
|
23 #include <TestScripterInternal.h> |
|
24 #include <StifTestModule.h> |
|
25 #include <TestclassAssert.h> |
|
26 //INTERNAL INCLUDES |
|
27 #include <presetutility.h> |
|
28 #include <presetutilityobserver.h> |
|
29 #include <RadioFmPresetUtility.h> |
|
30 #include <preset.h> |
|
31 #include "trace.h" |
|
32 |
|
33 |
|
34 // CONSTANTS |
|
35 const TInt KErrBadTestParameter= -1000; // Error on configuration file |
|
36 |
|
37 const TInt KErrEventPending =-2000; // Timeout and not callback |
|
38 const TInt KErrCallbackErrorCode = -2001; // Callback return error code |
|
39 const TInt KErrUnexpectedValue =-2002; // Unexpected value at setting |
|
40 const TInt KExpectedFrequencyChange = -2003; // Is not finding more than one station |
|
41 const TInt KErrTimeoutController = -2007; // Unexpected notification |
|
42 |
|
43 // MACROS |
|
44 //#define ?macro ?macro_def |
|
45 #define TEST_CLASS_VERSION_MAJOR 1 |
|
46 #define TEST_CLASS_VERSION_MINOR 1 |
|
47 #define TEST_CLASS_VERSION_BUILD 1 |
|
48 |
|
49 // Logging path |
|
50 _LIT( KPresetUtilityTestModuleLogPath, "\\logs\\testframework\\PresetUtilityTestModule\\" ); |
|
51 // Log file |
|
52 _LIT( KPresetUtilityTestModuleLogFile, "PresetUtilityTestModule.txt" ); |
|
53 _LIT( KPresetUtilityTestModuleLogFileWithTitle, "PresetUtilityTestModule_[%S].txt" ); |
|
54 |
|
55 // FUNCTION PROTOTYPES |
|
56 //?type ?function_name(?arg_list); |
|
57 |
|
58 // FORWARD DECLARATIONS |
|
59 //class ?FORWARD_CLASSNAME; |
|
60 //class CPresetUtilityTestModule; |
|
61 |
|
62 // DATA TYPES |
|
63 //enum ?declaration |
|
64 //typedef ?declaration |
|
65 //extern ?data_type; |
|
66 |
|
67 // CLASS DECLARATION |
|
68 |
|
69 /** |
|
70 * CPresetUtilityTestModule test class for STIF Test Framework TestScripter. |
|
71 * ?other_description_lines |
|
72 * |
|
73 * @lib ?library |
|
74 * @since ?Series60_version |
|
75 */ |
|
76 NONSHARABLE_CLASS(CPresetUtilityTestModule) : public CScriptBase, public MRadioPresetObserver, public MPresetUtilityObserver |
|
77 { |
|
78 public: // Constructors and destructor |
|
79 |
|
80 /** |
|
81 * Two-phased constructor. |
|
82 */ |
|
83 static CPresetUtilityTestModule* NewL( CTestModuleIf& aTestModuleIf ); |
|
84 |
|
85 /** |
|
86 * Destructor. |
|
87 */ |
|
88 virtual ~CPresetUtilityTestModule(); |
|
89 |
|
90 public: // New functions |
|
91 |
|
92 /** |
|
93 * ?member_description. |
|
94 * @since ?Series60_version |
|
95 * @param ?arg1 ?description |
|
96 * @return ?description |
|
97 */ |
|
98 //?type ?member_function( ?type ?arg1 ); |
|
99 |
|
100 public: // Functions from base classes |
|
101 |
|
102 /** |
|
103 * From CScriptBase Runs a script line. |
|
104 * @since ?Series60_version |
|
105 * @param aItem Script line containing method name and parameters |
|
106 * @return Symbian OS error code |
|
107 */ |
|
108 virtual TInt RunMethodL( CStifItemParser& aItem ); |
|
109 |
|
110 /** |
|
111 * From MPresetUtilityObserver |
|
112 * Called when a preset changes. |
|
113 * |
|
114 * NOTE: EPresetDeleted with aIndex == 0, indicates that all presets have been deleted. |
|
115 * |
|
116 * @since S60 3.2 |
|
117 * @param aChange Change event type |
|
118 * @param aIndex Index to the preset that has changed. Zero means all presets. |
|
119 */ |
|
120 virtual void PresetChanged( MPresetUtilityObserver::TPresetChangeEvent aChange, TInt aIndex ); |
|
121 |
|
122 /** |
|
123 * From MRadioPresetObserver |
|
124 * Called when a preset changes. |
|
125 * |
|
126 * NOTE: EPresetDeleted with aIndex == 0, indicates that all presets have been deleted. |
|
127 * |
|
128 * @since S60 3.2 |
|
129 * @param aChange Change event type |
|
130 * @param aIndex Index to the preset that has changed. Zero means all presets. |
|
131 */ |
|
132 virtual void MrpeoPresetChanged( MRadioPresetObserver::TPresetChangeEvent aChange, TInt aIndex ); |
|
133 |
|
134 protected: // New functions |
|
135 |
|
136 /** |
|
137 * ?member_description. |
|
138 * @since ?Series60_version |
|
139 * @param ?arg1 ?description |
|
140 * @return ?description |
|
141 */ |
|
142 //?type ?member_function( ?type ?arg1 ); |
|
143 // Test case functions |
|
144 TInt CreateRadioPresetL( CStifItemParser& aItem ); |
|
145 TInt CreatePresetUtilityL( CStifItemParser& aItem ); |
|
146 TInt CreateFmPresetUtilityL( CStifItemParser& aItem ); |
|
147 TInt DestroyRadioPresetL( CStifItemParser& aItem ); |
|
148 TInt DestroyPresetUtilityL( CStifItemParser& aItem ); |
|
149 TInt DestroyFmPresetUtilityL( CStifItemParser& aItem ); |
|
150 |
|
151 TInt SavePresetL( CStifItemParser& aItem ); |
|
152 |
|
153 TInt ReadPresetL( CStifItemParser& aItem ); |
|
154 |
|
155 TInt MaxNumberOfPresets( CStifItemParser& aItem ); |
|
156 |
|
157 TInt PresetCount( CStifItemParser& aItem ); |
|
158 |
|
159 TInt FirstPreset( CStifItemParser& aItem ); |
|
160 |
|
161 TInt NextPreset( CStifItemParser& aItem ); |
|
162 |
|
163 TInt DeletePreset( CStifItemParser& aItem ); |
|
164 |
|
165 // Old API |
|
166 TInt SetPresetL( CStifItemParser& aItem ); |
|
167 TInt GetPresetL( CStifItemParser& aItem ); |
|
168 TInt GetPresetNameL( CStifItemParser& aItem ); |
|
169 TInt GetPresetFrequencyL( CStifItemParser& aItem ); |
|
170 TInt GetMaxNumberOfPresets( CStifItemParser& aItem ); |
|
171 TInt GetNumberOfPresets( CStifItemParser& aItem ); |
|
172 TInt GetFirstPresetL( CStifItemParser& aItem ); |
|
173 TInt GetNextPresetL( CStifItemParser& aItem ); |
|
174 TInt DeletePresetL( CStifItemParser& aItem ); |
|
175 |
|
176 TInt SetPresetUrlL( CStifItemParser& aItem ); |
|
177 TInt SetPresetPtyL( CStifItemParser& aItem ); |
|
178 TInt SetPresetPICodeL( CStifItemParser& aItem ); |
|
179 TInt SetPresetFavouriteInfoL( CStifItemParser& aItem ); |
|
180 TInt SetPresetUserRenameInfoL( CStifItemParser& aItem ); |
|
181 TInt GetPresetUrlL( CStifItemParser& aItem ); |
|
182 TInt GetPresetPtyL( CStifItemParser& aItem ); |
|
183 TInt GetPresetPICodeL( CStifItemParser& aItem ); |
|
184 TInt GetPresetFavouriteInfoL( CStifItemParser& aItem ); |
|
185 TInt GetPresetUserRenameInfoL( CStifItemParser& aItem ); |
|
186 |
|
187 TInt SetFavorite( CStifItemParser& aItem ); |
|
188 TInt Favorite( CStifItemParser& aItem ); |
|
189 TInt SetLocalStation( CStifItemParser& aItem ); |
|
190 TInt LocalStation( CStifItemParser& aItem ); |
|
191 TInt SetRenamedByUser( CStifItemParser& aItem ); |
|
192 TInt RenamedByUser( CStifItemParser& aItem ); |
|
193 TInt SetGenre( CStifItemParser& aItem ); |
|
194 TInt Genre( CStifItemParser& aItem ); |
|
195 TInt SetPiCode( CStifItemParser& aItem ); |
|
196 TInt PiCode( CStifItemParser& aItem ); |
|
197 |
|
198 protected: // Functions from base classes |
|
199 |
|
200 /** |
|
201 * From ?base_class ?member_description |
|
202 */ |
|
203 //?type ?member_function(); |
|
204 |
|
205 private: |
|
206 |
|
207 /** |
|
208 * C++ default constructor. |
|
209 */ |
|
210 CPresetUtilityTestModule( CTestModuleIf& aTestModuleIf ); |
|
211 |
|
212 /** |
|
213 * By default Symbian 2nd phase constructor is private. |
|
214 */ |
|
215 void ConstructL(); |
|
216 |
|
217 // Prohibit copy constructor if not deriving from CBase. |
|
218 // ?classname( const ?classname& ); |
|
219 // Prohibit assigment operator if not deriving from CBase. |
|
220 // ?classname& operator=( const ?classname& ); |
|
221 |
|
222 /** |
|
223 * Frees all resources allocated from test methods. |
|
224 * @since ?Series60_version |
|
225 */ |
|
226 void Delete(); |
|
227 |
|
228 /** |
|
229 * Test methods are listed below. |
|
230 */ |
|
231 |
|
232 /** |
|
233 * Example test method. |
|
234 * @since ?Series60_version |
|
235 * @param aItem Script line containing parameters. |
|
236 * @return Symbian OS error code. |
|
237 */ |
|
238 virtual TInt ExampleL( CStifItemParser& aItem ); |
|
239 |
|
240 /** |
|
241 * Method used to log version of test class |
|
242 */ |
|
243 void SendTestClassVersion(); |
|
244 |
|
245 //ADD NEW METHOD DEC HERE |
|
246 //[TestMethods] - Do not remove |
|
247 |
|
248 public: // Data |
|
249 // ?one_line_short_description_of_data |
|
250 //?data_declaration; |
|
251 |
|
252 protected: // Data |
|
253 // ?one_line_short_description_of_data |
|
254 //?data_declaration; |
|
255 |
|
256 private: // Data |
|
257 |
|
258 // ?one_line_short_description_of_data |
|
259 //?data_declaration; |
|
260 |
|
261 // Reserved pointer for future extension |
|
262 //TAny* iReserved; |
|
263 |
|
264 /** FM Preset Utility */ |
|
265 CPresetUtility* iPresetUtility; |
|
266 |
|
267 /** Old interface FM Preset Utility */ |
|
268 CRadioFmPresetUtility* iRadioFmPresetUtility; |
|
269 |
|
270 /** Preset class instance */ |
|
271 TPreset* iPreset; |
|
272 |
|
273 public: // Friend classes |
|
274 //?friend_class_declaration; |
|
275 protected: // Friend classes |
|
276 //?friend_class_declaration; |
|
277 private: // Friend classes |
|
278 //?friend_class_declaration; |
|
279 |
|
280 }; |
|
281 |
|
282 #endif // PRESETUTILITYTESTMODULE_H |
|
283 |
|
284 // End of File |
|