|
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: This file contains testclass implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 // [INCLUDE FILES] - do not remove |
|
19 #include <e32svr.h> |
|
20 #include <StifParser.h> |
|
21 #include <Stiftestinterface.h> |
|
22 #include "PresetUtilityTestModule.h" |
|
23 #include <RadioPresetUtility.h> |
|
24 |
|
25 // EXTERNAL DATA STRUCTURES |
|
26 //extern ?external_data; |
|
27 |
|
28 // EXTERNAL FUNCTION PROTOTYPES |
|
29 //extern ?external_function( ?arg_type,?arg_type ); |
|
30 |
|
31 // CONSTANTS |
|
32 //const ?type ?constant_var = ?constant; |
|
33 _LIT( KStifScriptEmptyString, "EMPTYSTRING" ); |
|
34 _LIT( KEmptyString, "" ); |
|
35 |
|
36 // MACROS |
|
37 //#define ?macro ?macro_def |
|
38 |
|
39 // LOCAL CONSTANTS AND MACROS |
|
40 //const ?type ?constant_var = ?constant; |
|
41 //#define ?macro_name ?macro_def |
|
42 |
|
43 // MODULE DATA STRUCTURES |
|
44 //enum ?declaration |
|
45 //typedef ?declaration |
|
46 |
|
47 // LOCAL FUNCTION PROTOTYPES |
|
48 //?type ?function_name( ?arg_type, ?arg_type ); |
|
49 |
|
50 // FORWARD DECLARATIONS |
|
51 //class ?FORWARD_CLASSNAME; |
|
52 |
|
53 // ============================= LOCAL FUNCTIONS =============================== |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // ?function_name ?description. |
|
57 // ?description |
|
58 // Returns: ?value_1: ?description |
|
59 // ?value_n: ?description_line1 |
|
60 // ?description_line2 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 /* |
|
64 ?type ?function_name( |
|
65 ?arg_type arg, // ?description |
|
66 ?arg_type arg) // ?description |
|
67 { |
|
68 |
|
69 ?code // ?comment |
|
70 |
|
71 // ?comment |
|
72 ?code |
|
73 } |
|
74 */ |
|
75 |
|
76 // ============================ MEMBER FUNCTIONS =============================== |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CPresetUtilityTestModule::Delete |
|
80 // Delete here all resources allocated and opened from test methods. |
|
81 // Called from destructor. |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 void CPresetUtilityTestModule::Delete() |
|
85 { |
|
86 FUNC_LOG; |
|
87 |
|
88 } |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CPresetUtilityTestModule::RunMethodL |
|
92 // Run specified method. Contains also table of test mothods and their names. |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 TInt CPresetUtilityTestModule::RunMethodL( |
|
96 CStifItemParser& aItem ) |
|
97 { |
|
98 FUNC_LOG; |
|
99 |
|
100 static TStifFunctionInfo const KFunctions[] = |
|
101 { |
|
102 // Copy this line for every implemented function. |
|
103 // First string is the function name used in TestScripter script file. |
|
104 // Second is the actual implementation member function. |
|
105 ENTRY( "Example", CPresetUtilityTestModule::ExampleL ), |
|
106 // [test cases entries] - Do not remove |
|
107 ENTRY( "CreateRadioPresetL", CPresetUtilityTestModule::CreateRadioPresetL ), |
|
108 ENTRY( "DestroyRadioPreset", CPresetUtilityTestModule::DestroyRadioPresetL ), |
|
109 ENTRY( "CreatePresetUtility", CPresetUtilityTestModule::CreatePresetUtilityL ), |
|
110 ENTRY( "DestroyPresetUtility", CPresetUtilityTestModule::DestroyPresetUtilityL ), |
|
111 ENTRY( "CreateFmPresetUtility", CPresetUtilityTestModule::CreateFmPresetUtilityL ), |
|
112 ENTRY( "DestroyFmPresetUtility", CPresetUtilityTestModule::DestroyFmPresetUtilityL ), |
|
113 ENTRY( "SavePresetL", CPresetUtilityTestModule::SavePresetL ), |
|
114 ENTRY( "ReadPresetL", CPresetUtilityTestModule::ReadPresetL ), |
|
115 ENTRY( "MaxNumberOfPresets", CPresetUtilityTestModule::MaxNumberOfPresets ), |
|
116 ENTRY( "PresetCount", CPresetUtilityTestModule::PresetCount ), |
|
117 ENTRY( "FirstPreset", CPresetUtilityTestModule::FirstPreset ), |
|
118 ENTRY( "NextPreset", CPresetUtilityTestModule::NextPreset ), |
|
119 ENTRY( "DeletePreset", CPresetUtilityTestModule::DeletePreset ), |
|
120 ENTRY( "SetPresetL", CPresetUtilityTestModule::SetPresetL ), |
|
121 ENTRY( "GetPresetL", CPresetUtilityTestModule::GetPresetL ), |
|
122 ENTRY( "GetPresetNameL", CPresetUtilityTestModule::GetPresetNameL ), |
|
123 ENTRY( "GetPresetFrequencyL", CPresetUtilityTestModule::GetPresetFrequencyL ), |
|
124 ENTRY( "GetMaxNumberOfPresets", CPresetUtilityTestModule::GetMaxNumberOfPresets ), |
|
125 ENTRY( "GetNumberOfPresets", CPresetUtilityTestModule::GetNumberOfPresets ), |
|
126 ENTRY( "GetFirstPresetL", CPresetUtilityTestModule::GetFirstPresetL ), |
|
127 ENTRY( "GetNextPresetL", CPresetUtilityTestModule::GetNextPresetL ), |
|
128 ENTRY( "DeletePresetL", CPresetUtilityTestModule::DeletePresetL ), |
|
129 |
|
130 ENTRY( "SetPresetUrlL", CPresetUtilityTestModule::SetPresetUrlL ), |
|
131 ENTRY( "SetPresetPtyL", CPresetUtilityTestModule::SetPresetPtyL ), |
|
132 ENTRY( "SetPresetPICodeL", CPresetUtilityTestModule::SetPresetPICodeL ), |
|
133 ENTRY( "SetPresetFavouriteInfoL", CPresetUtilityTestModule::SetPresetFavouriteInfoL ), |
|
134 ENTRY( "SetPresetUserRenameInfoL", CPresetUtilityTestModule::SetPresetUserRenameInfoL ), |
|
135 ENTRY( "GetPresetUrlL", CPresetUtilityTestModule::GetPresetUrlL ), |
|
136 ENTRY( "GetPresetPtyL", CPresetUtilityTestModule::GetPresetPtyL ), |
|
137 ENTRY( "GetPresetPICodeL", CPresetUtilityTestModule::GetPresetPICodeL ), |
|
138 ENTRY( "GetPresetFavouriteInfoL", CPresetUtilityTestModule::GetPresetFavouriteInfoL ), |
|
139 ENTRY( "GetPresetUserRenameInfoL", CPresetUtilityTestModule::GetPresetUserRenameInfoL ), |
|
140 |
|
141 ENTRY( "SetFavorite", CPresetUtilityTestModule::SetFavorite ), |
|
142 ENTRY( "Favorite", CPresetUtilityTestModule::Favorite ), |
|
143 ENTRY( "SetLocalStation", CPresetUtilityTestModule::SetLocalStation ), |
|
144 ENTRY( "LocalStation", CPresetUtilityTestModule::LocalStation ), |
|
145 ENTRY( "SetRenamedByUser", CPresetUtilityTestModule::SetRenamedByUser ), |
|
146 ENTRY( "RenamedByUser", CPresetUtilityTestModule::RenamedByUser ), |
|
147 ENTRY( "SetGenre", CPresetUtilityTestModule::SetGenre ), |
|
148 ENTRY( "Genre", CPresetUtilityTestModule::Genre ), |
|
149 ENTRY( "SetPiCode", CPresetUtilityTestModule::SetPiCode ), |
|
150 ENTRY( "PiCode", CPresetUtilityTestModule::PiCode ) |
|
151 //ADD NEW ENTRY HERE |
|
152 |
|
153 }; |
|
154 |
|
155 const TInt count = sizeof( KFunctions ) / |
|
156 sizeof( TStifFunctionInfo ); |
|
157 |
|
158 return RunInternalL( KFunctions, count, aItem ); |
|
159 |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CPresetUtilityTestModule::ExampleL |
|
164 // Example test method function. |
|
165 // (other items were commented in a header). |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 TInt CPresetUtilityTestModule::ExampleL( CStifItemParser& aItem ) |
|
169 { |
|
170 FUNC_LOG; |
|
171 |
|
172 // Print to UI |
|
173 _LIT( KPresetUtilityTestModule, "PresetUtilityTestModule" ); |
|
174 _LIT( KExample, "In Example" ); |
|
175 TestModuleIf().Printf( 0, KPresetUtilityTestModule, KExample ); |
|
176 // Print to log file |
|
177 iLog->Log( KExample ); |
|
178 |
|
179 TInt i = 0; |
|
180 TPtrC string; |
|
181 _LIT( KParam, "Param[%i]: %S" ); |
|
182 while ( aItem.GetNextString ( string ) == KErrNone ) |
|
183 { |
|
184 TestModuleIf().Printf( i, KPresetUtilityTestModule, |
|
185 KParam, i, &string ); |
|
186 i++; |
|
187 } |
|
188 |
|
189 return KErrNone; |
|
190 |
|
191 } |
|
192 |
|
193 //----------------------------------------------------------------------------- |
|
194 // CPresetUtilityTest::CreateRadioPresetL |
|
195 //----------------------------------------------------------------------------- |
|
196 TInt CPresetUtilityTestModule::CreateRadioPresetL( |
|
197 CStifItemParser& /*aItem*/ ) |
|
198 { |
|
199 FUNC_LOG; |
|
200 |
|
201 TInt err = KErrNone; |
|
202 if( !iPreset ) |
|
203 { |
|
204 iPreset = new( ELeave ) TPreset; |
|
205 } |
|
206 else |
|
207 { |
|
208 err = KErrArgument; |
|
209 } |
|
210 |
|
211 return err; |
|
212 } |
|
213 |
|
214 //----------------------------------------------------------------------------- |
|
215 // CPresetUtilityTest::CreatePresetUtilityL |
|
216 //----------------------------------------------------------------------------- |
|
217 TInt CPresetUtilityTestModule::CreatePresetUtilityL( |
|
218 CStifItemParser& /*aItem*/ ) |
|
219 { |
|
220 FUNC_LOG; |
|
221 |
|
222 TInt err = KErrNone; |
|
223 if( !iPresetUtility ) |
|
224 { |
|
225 iPresetUtility = CPresetUtility::NewL(); |
|
226 } |
|
227 else |
|
228 { |
|
229 err = KErrArgument; |
|
230 } |
|
231 |
|
232 return err; |
|
233 } |
|
234 |
|
235 //----------------------------------------------------------------------------- |
|
236 // CPresetUtilityTest::CreatePresetFmUtilityL |
|
237 //----------------------------------------------------------------------------- |
|
238 TInt CPresetUtilityTestModule::CreateFmPresetUtilityL( |
|
239 CStifItemParser& /*aItem*/ ) |
|
240 { |
|
241 FUNC_LOG; |
|
242 |
|
243 TInt err = KErrNone; |
|
244 if( !iRadioFmPresetUtility ) |
|
245 { |
|
246 iRadioFmPresetUtility = CRadioFmPresetUtility::NewL(*this); |
|
247 } |
|
248 else |
|
249 { |
|
250 err = KErrArgument; |
|
251 } |
|
252 |
|
253 return err; |
|
254 } |
|
255 |
|
256 //----------------------------------------------------------------------------- |
|
257 // CPresetUtilityTestModule::DestroyRadioPresetL |
|
258 //----------------------------------------------------------------------------- |
|
259 TInt CPresetUtilityTestModule::DestroyRadioPresetL( |
|
260 CStifItemParser& /*aItem*/ ) |
|
261 { |
|
262 FUNC_LOG; |
|
263 |
|
264 delete iPreset; |
|
265 iPreset = NULL; |
|
266 |
|
267 return KErrNone; |
|
268 } |
|
269 |
|
270 |
|
271 |
|
272 //----------------------------------------------------------------------------- |
|
273 // CPresetUtilityTestModule::DestroyPresetUtilityL |
|
274 //----------------------------------------------------------------------------- |
|
275 TInt CPresetUtilityTestModule::DestroyPresetUtilityL( |
|
276 CStifItemParser& /*aItem*/ ) |
|
277 { |
|
278 FUNC_LOG; |
|
279 |
|
280 delete iPresetUtility; |
|
281 iPresetUtility = NULL; |
|
282 |
|
283 return KErrNone; |
|
284 } |
|
285 |
|
286 //----------------------------------------------------------------------------- |
|
287 // CPresetUtilityTestModule::DestroyFmPresetUtilityL |
|
288 //----------------------------------------------------------------------------- |
|
289 TInt CPresetUtilityTestModule::DestroyFmPresetUtilityL( |
|
290 CStifItemParser& /*aItem*/ ) |
|
291 { |
|
292 FUNC_LOG; |
|
293 |
|
294 delete iRadioFmPresetUtility; |
|
295 iRadioFmPresetUtility = NULL; |
|
296 |
|
297 return KErrNone; |
|
298 } |
|
299 |
|
300 // ----------------------------------------------------------------------------- |
|
301 // CPresetUtilityTestModule::SavePresetL() |
|
302 // Get program status. |
|
303 // Returns: Errors. |
|
304 // ----------------------------------------------------------------------------- |
|
305 TInt CPresetUtilityTestModule::SavePresetL( CStifItemParser& aItem ) |
|
306 { |
|
307 FUNC_LOG; |
|
308 TInt err=KErrNone; |
|
309 TInt index; |
|
310 TPtrC name; |
|
311 TInt freq; |
|
312 TPtrC url; |
|
313 TInt usedIndex( -1 ); |
|
314 |
|
315 // read parameters |
|
316 if ( aItem.GetNextInt(index) ) |
|
317 { |
|
318 err = KErrBadTestParameter; |
|
319 ERROR( err, "Missing Parameter: Preset index." ); |
|
320 } |
|
321 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
322 if ( aItem.GetNextString(name) ) |
|
323 { |
|
324 err = KErrBadTestParameter; |
|
325 ERROR( err, "Missing Parameter: Preset name." ); |
|
326 } |
|
327 aItem.SetParsingType( CStifItemParser::ENormalParsing ); |
|
328 if ( aItem.GetNextInt(freq) ) |
|
329 { |
|
330 err = KErrBadTestParameter; |
|
331 ERROR( err, "Missing Parameter: Preset frequency." ); |
|
332 } |
|
333 |
|
334 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
335 if ( aItem.GetNextString(url) ) |
|
336 { |
|
337 INFO( "Missing Parameter: url." ); |
|
338 } |
|
339 aItem.SetParsingType( CStifItemParser::ENormalParsing ); |
|
340 |
|
341 TPreset preset; |
|
342 preset.SetName( name ); |
|
343 preset.SetFrequency( freq ); |
|
344 preset.SetUrl( url ); |
|
345 |
|
346 TRAP(err, usedIndex = iPresetUtility->SavePresetL(preset, index)); |
|
347 INFO_4( "SavePreset: Index=%d, Name=%S, Freq=%d, Url=%S", usedIndex, &name, freq, &url ); |
|
348 if ( KErrNone != err ) |
|
349 { |
|
350 INFO_1( "SavePresetL Failed error code=%i", err ); |
|
351 User::Leave( err ); |
|
352 } |
|
353 return usedIndex; |
|
354 } |
|
355 |
|
356 // ----------------------------------------------------------------------------- |
|
357 // CPresetUtilityTestModule::ReadPresetL() |
|
358 // Read preset channel. |
|
359 // Returns: Errors. |
|
360 // ----------------------------------------------------------------------------- |
|
361 TInt CPresetUtilityTestModule::ReadPresetL( CStifItemParser& aItem ) |
|
362 { |
|
363 FUNC_LOG; |
|
364 TInt err = KErrNone; |
|
365 TInt index; |
|
366 TPtrC expectedName; |
|
367 TInt expectedFreq; |
|
368 TPtrC expectedUrl; |
|
369 |
|
370 // read parameters |
|
371 if ( aItem.GetNextInt(index) ) |
|
372 { |
|
373 err = KErrBadTestParameter; |
|
374 ERROR( err, "Missing Parameter: Preset index." ); |
|
375 } |
|
376 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
377 if ( aItem.GetNextString(expectedName) ) |
|
378 { |
|
379 err = KErrBadTestParameter; |
|
380 ERROR( err, "Missing Parameter: Expected preset name." ); |
|
381 } |
|
382 INFO_1( "ExpectedName=%S.", &expectedName ); |
|
383 |
|
384 aItem.SetParsingType( CStifItemParser::ENormalParsing ); |
|
385 if ( aItem.GetNextInt(expectedFreq) ) |
|
386 { |
|
387 err = KErrBadTestParameter; |
|
388 ERROR( err, "Missing Parameter: Expected preset frequency." ); |
|
389 } |
|
390 INFO_1( "ExpectedFreq=%d.", expectedFreq); |
|
391 |
|
392 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
393 if ( aItem.GetNextString(expectedUrl) ) |
|
394 { |
|
395 INFO( "Missing Parameter: Expected Url." ); |
|
396 } |
|
397 aItem.SetParsingType( CStifItemParser::ENormalParsing ); |
|
398 |
|
399 TPreset preset; |
|
400 TRAP(err, iPresetUtility->ReadPresetL(index,preset)); |
|
401 TPtrC actualName( preset.Name() ); |
|
402 TPtrC actualUrl( preset.Url() ); |
|
403 INFO_4( "ReadPreset Index=%d, Name=%S, Freq=%d, Url=%S", index, &expectedName, preset.Frequency(), &expectedUrl ); |
|
404 if ( !err ) |
|
405 { |
|
406 // Verification |
|
407 if ( preset.Name() != expectedName ) |
|
408 { |
|
409 INFO_2( "Failed: name=%S, expectedName=%S.", &actualName, &expectedName ); |
|
410 err = KErrUnexpectedValue; |
|
411 } |
|
412 else if ( preset.Frequency() != expectedFreq ) |
|
413 { |
|
414 INFO_2( "Failed: freq=%d, expectedFreq=%d.", preset.Frequency(), expectedFreq); |
|
415 err = KErrUnexpectedValue; |
|
416 } |
|
417 else if ( ( 0 < expectedUrl.Length() ) && ( preset.Url() != expectedUrl ) ) |
|
418 { |
|
419 INFO_2( "Failed: Url=%S, expectedUrl=%S.", &actualUrl, &expectedUrl ); |
|
420 err = KErrUnexpectedValue; |
|
421 } |
|
422 } |
|
423 return err; |
|
424 } |
|
425 |
|
426 // ----------------------------------------------------------------------------- |
|
427 // CPresetUtilityTestModule::MaxNumberOfPresets() |
|
428 // Get program status. |
|
429 // Returns: Errors. |
|
430 // ----------------------------------------------------------------------------- |
|
431 TInt CPresetUtilityTestModule::MaxNumberOfPresets( CStifItemParser& /*aItem*/ ) |
|
432 { |
|
433 FUNC_LOG; |
|
434 TInt maxPreset; |
|
435 |
|
436 maxPreset = iPresetUtility->MaxNumberOfPresets(); |
|
437 INFO_1( "MaxNumberOfPresets: maxPreset=%d", maxPreset); |
|
438 return maxPreset; |
|
439 } |
|
440 |
|
441 // ----------------------------------------------------------------------------- |
|
442 // CPresetUtilityTestModule::PresetCount() |
|
443 // Get program status. |
|
444 // Returns: Errors. |
|
445 // ----------------------------------------------------------------------------- |
|
446 TInt CPresetUtilityTestModule::PresetCount( CStifItemParser& aItem ) |
|
447 { |
|
448 FUNC_LOG; |
|
449 TInt err=KErrNone; |
|
450 TInt numPresets; |
|
451 TInt expectedNumPresets; |
|
452 |
|
453 // read parameters |
|
454 if ( aItem.GetNextInt(expectedNumPresets) ) |
|
455 { |
|
456 INFO( "Missing Parameter: Expected number of presets."); |
|
457 err = KErrBadTestParameter; |
|
458 } |
|
459 |
|
460 numPresets =iPresetUtility->PresetCount(); |
|
461 INFO_1( "PresetCount: numPresets=%d", numPresets); |
|
462 // Verification |
|
463 if ( numPresets != expectedNumPresets ) |
|
464 { |
|
465 INFO_2( "Failed: numPresets=%d, expectedNumPresets=%d.", numPresets, expectedNumPresets); |
|
466 err = KErrUnexpectedValue; |
|
467 } |
|
468 return err; |
|
469 } |
|
470 |
|
471 // ----------------------------------------------------------------------------- |
|
472 // CPresetUtilityTestModule::FirstPreset() |
|
473 // Get program status. |
|
474 // Returns: Errors. |
|
475 // ----------------------------------------------------------------------------- |
|
476 TInt CPresetUtilityTestModule::FirstPreset( CStifItemParser& aItem ) |
|
477 { |
|
478 FUNC_LOG; |
|
479 TInt err = KErrNone; |
|
480 TInt index; |
|
481 TInt expectedIndex; |
|
482 |
|
483 // read parameters |
|
484 if ( aItem.GetNextInt(expectedIndex) ) |
|
485 { |
|
486 INFO( "Missing Parameter: Expected preset index."); |
|
487 err = KErrBadTestParameter; |
|
488 } |
|
489 |
|
490 index = iPresetUtility->FirstPreset(); |
|
491 INFO_1( "FirstPreset: index=%d", index); |
|
492 // Verification |
|
493 if ( index != expectedIndex ) |
|
494 { |
|
495 INFO_2( "Failed: index=%d, expectedIndex=%d.", index, expectedIndex); |
|
496 err = KErrUnexpectedValue; |
|
497 } |
|
498 return err; |
|
499 } |
|
500 |
|
501 // ----------------------------------------------------------------------------- |
|
502 // CPresetUtilityTestModule::NextPreset() |
|
503 // Get program status. |
|
504 // Returns: Errors. |
|
505 // ----------------------------------------------------------------------------- |
|
506 TInt CPresetUtilityTestModule::NextPreset( CStifItemParser& aItem ) |
|
507 { |
|
508 FUNC_LOG; |
|
509 TInt err=KErrNone; |
|
510 TInt index; |
|
511 TInt nextIndex; |
|
512 TInt expectedNextIndex; |
|
513 |
|
514 // read parameters |
|
515 if ( aItem.GetNextInt(index) ) |
|
516 { |
|
517 INFO( "Missing Parameter: Current preset index."); |
|
518 err = KErrBadTestParameter; |
|
519 } |
|
520 if ( aItem.GetNextInt(expectedNextIndex) ) |
|
521 { |
|
522 INFO( "Missing Parameter: Expected next preset index."); |
|
523 err = KErrBadTestParameter; |
|
524 } |
|
525 |
|
526 nextIndex = iPresetUtility->NextPreset(index); |
|
527 INFO_1( "NextPreset: nextIndex=%d", nextIndex); |
|
528 // Verification |
|
529 if ( nextIndex != expectedNextIndex ) |
|
530 { |
|
531 INFO_2( "Failed: nextIndex=%d, expectedNextIndex=%d.", nextIndex, expectedNextIndex); |
|
532 err = KErrUnexpectedValue; |
|
533 } |
|
534 return err; |
|
535 } |
|
536 |
|
537 // ----------------------------------------------------------------------------- |
|
538 // CPresetUtilityTestModule::DeletePreset() |
|
539 // Get program status. |
|
540 // Returns: Errors. |
|
541 // ----------------------------------------------------------------------------- |
|
542 TInt CPresetUtilityTestModule::DeletePreset( CStifItemParser& aItem ) |
|
543 { |
|
544 FUNC_LOG; |
|
545 TInt err=KErrNone; |
|
546 TInt index; |
|
547 |
|
548 // read parameters |
|
549 if ( aItem.GetNextInt(index) ) |
|
550 { |
|
551 INFO( "Missing Parameter: Preset index to delete."); |
|
552 err = KErrBadTestParameter; |
|
553 } |
|
554 |
|
555 err = iPresetUtility->DeletePreset(index); |
|
556 INFO_1( "DeletePreset: index=%d", index); |
|
557 return err; |
|
558 } |
|
559 |
|
560 // Old preset utility API functions |
|
561 |
|
562 // ----------------------------------------------------------------------------- |
|
563 // CPresetUtilityTestModule::SetPresetL() |
|
564 // Get program status. |
|
565 // Returns: Errors. |
|
566 // ----------------------------------------------------------------------------- |
|
567 TInt CPresetUtilityTestModule::SetPresetL( CStifItemParser& aItem ) |
|
568 { |
|
569 FUNC_LOG; |
|
570 TInt err=KErrNone; |
|
571 TInt index; |
|
572 TPtrC name; |
|
573 TInt freq; |
|
574 |
|
575 // read parameters |
|
576 if ( aItem.GetNextInt(index) ) |
|
577 { |
|
578 err = KErrBadTestParameter; |
|
579 ERROR( err, "Missing Parameter: Preset index." ); |
|
580 } |
|
581 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
582 if ( aItem.GetNextString(name) ) |
|
583 { |
|
584 err = KErrBadTestParameter; |
|
585 ERROR( err, "Missing Parameter: Preset name." ); |
|
586 } |
|
587 TPtrC stifScriptEmptyString( KStifScriptEmptyString ); |
|
588 if ( !stifScriptEmptyString.Compare( name ) ) |
|
589 { |
|
590 TPtrC emptyString( KEmptyString ); |
|
591 name.Set(emptyString); |
|
592 } |
|
593 aItem.SetParsingType( CStifItemParser::ENormalParsing ); |
|
594 if ( aItem.GetNextInt(freq) ) |
|
595 { |
|
596 err = KErrBadTestParameter; |
|
597 ERROR( err, "Missing Parameter: Preset frequency." ); |
|
598 } |
|
599 |
|
600 TPresetName presetName( name ); |
|
601 TRAP(err, iRadioFmPresetUtility->SetPresetL(index, presetName, freq)); |
|
602 INFO_3("SetPresetL: Index=%d, Name=%S, Freq=%d", index, &name, freq ); |
|
603 return err; |
|
604 } |
|
605 |
|
606 // ----------------------------------------------------------------------------- |
|
607 // CPresetUtilityTestModule::GetPresetL() |
|
608 // Read preset channel. |
|
609 // Returns: Errors. |
|
610 // ----------------------------------------------------------------------------- |
|
611 TInt CPresetUtilityTestModule::GetPresetL( CStifItemParser& aItem ) |
|
612 { |
|
613 FUNC_LOG; |
|
614 TInt err = KErrNone; |
|
615 TInt index; |
|
616 TPtrC expectedName; |
|
617 TInt expectedFreq; |
|
618 TPtrC expectedUrl; |
|
619 |
|
620 // read parameters |
|
621 if ( aItem.GetNextInt(index) ) |
|
622 { |
|
623 err = KErrBadTestParameter; |
|
624 ERROR( err, "Missing Parameter: Preset index." ); |
|
625 } |
|
626 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
627 if ( aItem.GetNextString(expectedName) ) |
|
628 { |
|
629 err = KErrBadTestParameter; |
|
630 ERROR( err, "Missing Parameter: Expected preset name." ); |
|
631 } |
|
632 TPtrC stifScriptEmptyString( KStifScriptEmptyString ); |
|
633 if ( !stifScriptEmptyString.Compare( expectedName ) ) |
|
634 { |
|
635 TPtrC emptyString( KEmptyString ); |
|
636 expectedName.Set(emptyString); |
|
637 } |
|
638 INFO_1( "ExpectedName=%S.", &expectedName ); |
|
639 |
|
640 aItem.SetParsingType( CStifItemParser::ENormalParsing ); |
|
641 if ( aItem.GetNextInt(expectedFreq) ) |
|
642 { |
|
643 err = KErrBadTestParameter; |
|
644 ERROR( err, "Missing Parameter: Expected preset frequency." ); |
|
645 } |
|
646 INFO_1( "ExpectedFreq=%d.", expectedFreq); |
|
647 |
|
648 aItem.SetParsingType( CStifItemParser::ENormalParsing ); |
|
649 |
|
650 TPresetName presetName; |
|
651 TInt actualFreq( 0 ); |
|
652 TRAP(err, iRadioFmPresetUtility->GetPresetL(index, presetName, actualFreq)); |
|
653 INFO_3( "GetPresetL Index=%d, Name=%S, Freq=%d", index, &presetName, actualFreq ); |
|
654 if ( !err ) |
|
655 { |
|
656 // Verification |
|
657 if ( presetName != expectedName ) |
|
658 { |
|
659 INFO_2( "Failed: name=%S, expectedName=%S.", &presetName, &expectedName ); |
|
660 err = KErrUnexpectedValue; |
|
661 } |
|
662 else if ( actualFreq != expectedFreq ) |
|
663 { |
|
664 INFO_2( "Failed: freq=%d, expectedFreq=%d.", actualFreq, expectedFreq); |
|
665 err = KErrUnexpectedValue; |
|
666 } |
|
667 } |
|
668 return err; |
|
669 } |
|
670 |
|
671 // ----------------------------------------------------------------------------- |
|
672 // CPresetUtilityTestModule::GetMaxNumberOfPresets() |
|
673 // Get program status. |
|
674 // Returns: Errors. |
|
675 // ----------------------------------------------------------------------------- |
|
676 TInt CPresetUtilityTestModule::GetMaxNumberOfPresets( CStifItemParser& /*aItem*/ ) |
|
677 { |
|
678 FUNC_LOG; |
|
679 TInt maxPreset; |
|
680 |
|
681 iRadioFmPresetUtility->GetMaxNumberOfPresets( maxPreset ); |
|
682 INFO_1( "GetMaxNumberOfPresets: maxPreset=%d", maxPreset); |
|
683 return maxPreset; |
|
684 } |
|
685 |
|
686 // ----------------------------------------------------------------------------- |
|
687 // CPresetUtilityTestModule::GetNumberOfPresets() |
|
688 // Get program status. |
|
689 // Returns: Errors. |
|
690 // ----------------------------------------------------------------------------- |
|
691 TInt CPresetUtilityTestModule::GetNumberOfPresets( CStifItemParser& aItem ) |
|
692 { |
|
693 FUNC_LOG; |
|
694 TInt err=KErrNone; |
|
695 TInt numPresets; |
|
696 TInt expectedNumPresets; |
|
697 |
|
698 // read parameters |
|
699 if ( aItem.GetNextInt(expectedNumPresets) ) |
|
700 { |
|
701 INFO( "Missing Parameter: Expected number of presets."); |
|
702 err = KErrBadTestParameter; |
|
703 } |
|
704 |
|
705 err = iRadioFmPresetUtility->GetNumberOfPresets( numPresets ); |
|
706 INFO_1( "GetNumberOfPresets: numPresets=%d", numPresets); |
|
707 // Verification |
|
708 if ( numPresets != expectedNumPresets ) |
|
709 { |
|
710 INFO_2( "Failed: numPresets=%d, expectedNumPresets=%d.", numPresets, expectedNumPresets); |
|
711 err = KErrUnexpectedValue; |
|
712 } |
|
713 return err; |
|
714 } |
|
715 |
|
716 // ----------------------------------------------------------------------------- |
|
717 // CPresetUtilityTestModule::GetFirstPresetL() |
|
718 // Get program status. |
|
719 // Returns: Errors. |
|
720 // ----------------------------------------------------------------------------- |
|
721 TInt CPresetUtilityTestModule::GetFirstPresetL( CStifItemParser& aItem ) |
|
722 { |
|
723 FUNC_LOG; |
|
724 TInt err = KErrNone; |
|
725 TInt index; |
|
726 TInt expectedIndex; |
|
727 |
|
728 // read parameters |
|
729 if ( aItem.GetNextInt(expectedIndex) ) |
|
730 { |
|
731 INFO( "Missing Parameter: Expected preset index."); |
|
732 err = KErrBadTestParameter; |
|
733 } |
|
734 |
|
735 iRadioFmPresetUtility->GetFirstPresetL( index ); |
|
736 INFO_1( "GetFirstPresetL: index=%d", index); |
|
737 // Verification |
|
738 if ( index != expectedIndex ) |
|
739 { |
|
740 INFO_2( "Failed: index=%d, expectedIndex=%d.", index, expectedIndex); |
|
741 err = KErrUnexpectedValue; |
|
742 } |
|
743 return err; |
|
744 } |
|
745 |
|
746 // ----------------------------------------------------------------------------- |
|
747 // CPresetUtilityTestModule::GetNextPresetL() |
|
748 // Get program status. |
|
749 // Returns: Errors. |
|
750 // ----------------------------------------------------------------------------- |
|
751 TInt CPresetUtilityTestModule::GetNextPresetL( CStifItemParser& aItem ) |
|
752 { |
|
753 FUNC_LOG; |
|
754 TInt err=KErrNone; |
|
755 TInt index; |
|
756 TInt nextIndex; |
|
757 TInt expectedNextIndex; |
|
758 |
|
759 // read parameters |
|
760 if ( aItem.GetNextInt(index) ) |
|
761 { |
|
762 INFO( "Missing Parameter: Current preset index."); |
|
763 err = KErrBadTestParameter; |
|
764 } |
|
765 if ( aItem.GetNextInt(expectedNextIndex) ) |
|
766 { |
|
767 INFO( "Missing Parameter: Expected next preset index."); |
|
768 err = KErrBadTestParameter; |
|
769 } |
|
770 |
|
771 iRadioFmPresetUtility->GetNextPresetL( index, nextIndex ); |
|
772 INFO_1( "GetNextPresetL: nextIndex=%d", nextIndex); |
|
773 // Verification |
|
774 if ( nextIndex != expectedNextIndex ) |
|
775 { |
|
776 INFO_2( "Failed: nextIndex=%d, expectedNextIndex=%d.", nextIndex, expectedNextIndex); |
|
777 err = KErrUnexpectedValue; |
|
778 } |
|
779 return err; |
|
780 } |
|
781 |
|
782 // ----------------------------------------------------------------------------- |
|
783 // CPresetUtilityTestModule::DeletePresetL() |
|
784 // Get program status. |
|
785 // Returns: Errors. |
|
786 // ----------------------------------------------------------------------------- |
|
787 TInt CPresetUtilityTestModule::DeletePresetL( CStifItemParser& aItem ) |
|
788 { |
|
789 FUNC_LOG; |
|
790 TInt err=KErrNone; |
|
791 TInt index; |
|
792 |
|
793 // read parameters |
|
794 if ( aItem.GetNextInt(index) ) |
|
795 { |
|
796 INFO( "Missing Parameter: Preset index to delete."); |
|
797 err = KErrBadTestParameter; |
|
798 } |
|
799 |
|
800 TRAP( err, iRadioFmPresetUtility->DeletePresetL(index) ); |
|
801 INFO_1( "DeletePresetL: index=%d", index); |
|
802 return err; |
|
803 } |
|
804 |
|
805 // ----------------------------------------------------------------------------- |
|
806 // CPresetUtilityTestModule::GetPresetNameL() |
|
807 // Read preset channel. |
|
808 // Returns: Errors. |
|
809 // ----------------------------------------------------------------------------- |
|
810 TInt CPresetUtilityTestModule::GetPresetNameL( CStifItemParser& aItem ) |
|
811 { |
|
812 FUNC_LOG; |
|
813 TInt err = KErrNone; |
|
814 TInt index; |
|
815 TPtrC expectedName; |
|
816 |
|
817 // read parameters |
|
818 if ( aItem.GetNextInt(index) ) |
|
819 { |
|
820 err = KErrBadTestParameter; |
|
821 ERROR( err, "Missing Parameter: Preset index." ); |
|
822 } |
|
823 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
824 if ( aItem.GetNextString(expectedName) ) |
|
825 { |
|
826 err = KErrBadTestParameter; |
|
827 ERROR( err, "Missing Parameter: Expected preset name." ); |
|
828 } |
|
829 TPtrC stifScriptEmptyString( KStifScriptEmptyString ); |
|
830 if ( !stifScriptEmptyString.Compare( expectedName ) ) |
|
831 { |
|
832 TPtrC emptyString( KEmptyString ); |
|
833 expectedName.Set(emptyString); |
|
834 } |
|
835 INFO_1( "ExpectedName=%S.", &expectedName ); |
|
836 |
|
837 |
|
838 TFmPresetName presetName; |
|
839 TRAP(err, iRadioFmPresetUtility->GetPresetNameL(index,presetName)); |
|
840 INFO_2( "GetPresetNameL Index=%d, Name=%S", index, &presetName ); |
|
841 if ( !err ) |
|
842 { |
|
843 // Verification |
|
844 if ( presetName != expectedName ) |
|
845 { |
|
846 INFO_2( "Failed: name=%S, expectedName=%S.", &presetName, &expectedName ); |
|
847 err = KErrUnexpectedValue; |
|
848 } |
|
849 } |
|
850 return err; |
|
851 } |
|
852 |
|
853 // ----------------------------------------------------------------------------- |
|
854 // CPresetUtilityTestModule::GetPresetFrequencyL() |
|
855 // Read preset channel's frequency value. |
|
856 // Returns: Errors. |
|
857 // ----------------------------------------------------------------------------- |
|
858 TInt CPresetUtilityTestModule::GetPresetFrequencyL( CStifItemParser& aItem ) |
|
859 { |
|
860 FUNC_LOG; |
|
861 TInt index; |
|
862 TInt expectedFreq( 0 ); |
|
863 TInt freq( 0 ); |
|
864 TInt err( KErrNone ); |
|
865 |
|
866 // read parameters |
|
867 if ( aItem.GetNextInt(index) ) |
|
868 { |
|
869 err = KErrBadTestParameter; |
|
870 ERROR( err, "Missing Parameter: Preset index." ); |
|
871 } |
|
872 if ( aItem.GetNextInt(expectedFreq) ) |
|
873 { |
|
874 err = KErrBadTestParameter; |
|
875 ERROR( err, "Missing Parameter: Expected preset frequency." ); |
|
876 } |
|
877 iRadioFmPresetUtility->GetPresetFrequencyL( index, freq ); |
|
878 INFO_1( "GetPresetrequency=%d.", freq ); |
|
879 if ( freq != expectedFreq ) |
|
880 { |
|
881 INFO_2( "Failed: freq=%d, expectedFreq=%d.", freq, expectedFreq); |
|
882 err = KErrUnexpectedValue; |
|
883 } |
|
884 return err; |
|
885 } |
|
886 |
|
887 // ----------------------------------------------------------------------------- |
|
888 // CPresetUtilityTestModule::PresetChanged() |
|
889 // Returns: None |
|
890 // ----------------------------------------------------------------------------- |
|
891 void CPresetUtilityTestModule::PresetChanged |
|
892 ( MPresetUtilityObserver::TPresetChangeEvent /*aChange*/, TInt /*aIndex*/ ) |
|
893 { |
|
894 FUNC_LOG; |
|
895 } |
|
896 |
|
897 // ----------------------------------------------------------------------------- |
|
898 // CPresetUtilityTestModule::MrpeoPresetChanged() |
|
899 // Returns: None |
|
900 // ----------------------------------------------------------------------------- |
|
901 void CPresetUtilityTestModule::MrpeoPresetChanged |
|
902 ( MRadioPresetObserver::TPresetChangeEvent /*aChange*/, TInt /*aIndex*/ ) |
|
903 { |
|
904 FUNC_LOG; |
|
905 } |
|
906 |
|
907 // ----------------------------------------------------------------------------- |
|
908 // CFmPresetUtilityTestModule::SetPresetUrlL() |
|
909 // Returns: None |
|
910 // ----------------------------------------------------------------------------- |
|
911 TInt CPresetUtilityTestModule::SetPresetUrlL( CStifItemParser& aItem ) |
|
912 { |
|
913 FUNC_LOG; |
|
914 TInt ret( KErrNone ); |
|
915 TInt index; |
|
916 TPtrC urlName; |
|
917 |
|
918 // read parameters |
|
919 if ( aItem.GetNextInt(index) ) |
|
920 { |
|
921 ret = KErrBadTestParameter; |
|
922 ERROR( ret, "Missing Parameter: Preset index." ); |
|
923 } |
|
924 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
925 if ( aItem.GetNextString(urlName) ) |
|
926 { |
|
927 ret = KErrBadTestParameter; |
|
928 ERROR( ret, "Missing Parameter: URL name." ); |
|
929 } |
|
930 aItem.SetParsingType( CStifItemParser::ENormalParsing ); |
|
931 |
|
932 TFmPresetUrl presetName( urlName ); |
|
933 TRAP(ret, iRadioFmPresetUtility->SetPresetUrlL(index, urlName )); |
|
934 INFO_2("SetPresetUrlL: Index=%d, urlName=%S", index, &urlName ); |
|
935 return ret; |
|
936 } |
|
937 |
|
938 // ----------------------------------------------------------------------------- |
|
939 // CPresetUtilityTestModule::SetPresetPtyL() |
|
940 // Returns: None |
|
941 // ----------------------------------------------------------------------------- |
|
942 TInt CPresetUtilityTestModule::SetPresetPtyL( CStifItemParser& aItem ) |
|
943 { |
|
944 FUNC_LOG; |
|
945 TInt ret( KErrNone ); |
|
946 TInt index( 0 ); |
|
947 TInt PTYCode( 0 ); |
|
948 |
|
949 // read parameters |
|
950 if ( aItem.GetNextInt(index) ) |
|
951 { |
|
952 ret = KErrBadTestParameter; |
|
953 ERROR( ret, "Missing Parameter: Preset index." ); |
|
954 } |
|
955 if ( !ret && aItem.GetNextInt(PTYCode) ) |
|
956 { |
|
957 ret = KErrBadTestParameter; |
|
958 ERROR( ret, "Missing Parameter: PTYCode." ); |
|
959 } |
|
960 iRadioFmPresetUtility->SetPresetPtyL( index, PTYCode ); |
|
961 return ret; |
|
962 } |
|
963 |
|
964 // ----------------------------------------------------------------------------- |
|
965 // CPresetUtilityTestModule::SetPresetPICodeL() |
|
966 // Returns: None |
|
967 // ----------------------------------------------------------------------------- |
|
968 TInt CPresetUtilityTestModule::SetPresetPICodeL( CStifItemParser& aItem ) |
|
969 { |
|
970 FUNC_LOG; |
|
971 TInt ret( KErrNone ); |
|
972 TInt index( 0 ); |
|
973 TInt PICode( 0 ); |
|
974 |
|
975 // read parameters |
|
976 if ( aItem.GetNextInt(index) ) |
|
977 { |
|
978 ret = KErrBadTestParameter; |
|
979 ERROR( ret, "Missing Parameter: Preset index." ); |
|
980 } |
|
981 if ( !ret && aItem.GetNextInt(PICode) ) |
|
982 { |
|
983 ret = KErrBadTestParameter; |
|
984 ERROR( ret, "Missing Parameter: PICode." ); |
|
985 } |
|
986 iRadioFmPresetUtility->SetPresetPICodeL( index, PICode ); |
|
987 return ret; |
|
988 } |
|
989 |
|
990 // ----------------------------------------------------------------------------- |
|
991 // CPresetUtilityTestModule::SetPresetFavouriteInfoL() |
|
992 // Returns: None |
|
993 // ----------------------------------------------------------------------------- |
|
994 TInt CPresetUtilityTestModule::SetPresetFavouriteInfoL( CStifItemParser& aItem ) |
|
995 { |
|
996 FUNC_LOG; |
|
997 TInt ret( KErrNone ); |
|
998 TInt index( 0 ); |
|
999 TInt favouriteInt( 0 ); |
|
1000 TBool favouriteStatus( EFalse ); |
|
1001 |
|
1002 // read parameters |
|
1003 if ( aItem.GetNextInt(index) ) |
|
1004 { |
|
1005 ret = KErrBadTestParameter; |
|
1006 ERROR( ret, "Missing Parameter: Preset index." ); |
|
1007 } |
|
1008 if ( !ret && aItem.GetNextInt(favouriteInt) ) |
|
1009 { |
|
1010 ret = KErrBadTestParameter; |
|
1011 ERROR( ret, "Missing Parameter: favouriteInt." ); |
|
1012 } |
|
1013 if ( favouriteInt ) |
|
1014 { |
|
1015 favouriteStatus = ETrue; |
|
1016 } |
|
1017 iRadioFmPresetUtility->SetPresetFavouriteInfoL( index, favouriteStatus ); |
|
1018 return ret; |
|
1019 } |
|
1020 |
|
1021 // ----------------------------------------------------------------------------- |
|
1022 // CPresetUtilityTestModule::SetPresetUserRenameInfoL() |
|
1023 // Returns: None |
|
1024 // ----------------------------------------------------------------------------- |
|
1025 TInt CPresetUtilityTestModule::SetPresetUserRenameInfoL( CStifItemParser& aItem ) |
|
1026 { |
|
1027 FUNC_LOG; |
|
1028 TInt ret( KErrNone ); |
|
1029 TInt index( 0 ); |
|
1030 TInt renameInt( 0 ); |
|
1031 TBool renameStatus( EFalse ); |
|
1032 |
|
1033 // read parameters |
|
1034 if ( aItem.GetNextInt(index) ) |
|
1035 { |
|
1036 ret = KErrBadTestParameter; |
|
1037 ERROR( ret, "Missing Parameter: Preset index." ); |
|
1038 } |
|
1039 if ( !ret && aItem.GetNextInt(renameInt) ) |
|
1040 { |
|
1041 ret = KErrBadTestParameter; |
|
1042 ERROR( ret, "Missing Parameter: renameInt." ); |
|
1043 } |
|
1044 if ( renameInt ) |
|
1045 { |
|
1046 renameStatus = ETrue; |
|
1047 } |
|
1048 iRadioFmPresetUtility->SetPresetUserRenameInfoL ( index, renameStatus ); |
|
1049 return ret; |
|
1050 } |
|
1051 |
|
1052 // ----------------------------------------------------------------------------- |
|
1053 // CPresetUtilityTestModule::GetPresetUrlL() |
|
1054 // Returns: None |
|
1055 // ----------------------------------------------------------------------------- |
|
1056 TInt CPresetUtilityTestModule::GetPresetUrlL( CStifItemParser& aItem ) |
|
1057 { |
|
1058 FUNC_LOG; |
|
1059 TInt ret( KErrNone ); |
|
1060 TInt index; |
|
1061 TPtrC expectedUrlName; |
|
1062 |
|
1063 // read parameters |
|
1064 if ( aItem.GetNextInt(index) ) |
|
1065 { |
|
1066 ret = KErrBadTestParameter; |
|
1067 ERROR( ret, "Missing Parameter: Preset index." ); |
|
1068 } |
|
1069 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
1070 if ( aItem.GetNextString(expectedUrlName) ) |
|
1071 { |
|
1072 ret = KErrBadTestParameter; |
|
1073 ERROR( ret, "Missing Parameter: Expected preset name." ); |
|
1074 } |
|
1075 TPtrC stifScriptEmptyString( KStifScriptEmptyString ); |
|
1076 if ( !stifScriptEmptyString.Compare( expectedUrlName ) ) |
|
1077 { |
|
1078 TPtrC emptyString( KEmptyString ); |
|
1079 expectedUrlName.Set(emptyString); |
|
1080 } |
|
1081 INFO_1( "ExpectedUrlName=%S.", &expectedUrlName ); |
|
1082 |
|
1083 TFmPresetUrl urlName; |
|
1084 TRAP(ret, iRadioFmPresetUtility->GetPresetUrlL(index,urlName)); |
|
1085 INFO_2( "GetPresetUrlL Index=%d, urlName=%S", index, &urlName ); |
|
1086 if ( !ret ) |
|
1087 { |
|
1088 // Verification |
|
1089 if ( urlName != expectedUrlName ) |
|
1090 { |
|
1091 INFO_2( "Failed: urlName=%S, expectedUrlName=%S.", &urlName, &expectedUrlName ); |
|
1092 ret = KErrUnexpectedValue; |
|
1093 } |
|
1094 } |
|
1095 return ret; |
|
1096 } |
|
1097 |
|
1098 // ----------------------------------------------------------------------------- |
|
1099 // CPresetUtilityTestModule::GetPresetPtyL() |
|
1100 // Returns: None |
|
1101 // ----------------------------------------------------------------------------- |
|
1102 TInt CPresetUtilityTestModule::GetPresetPtyL( CStifItemParser& aItem ) |
|
1103 { |
|
1104 FUNC_LOG; |
|
1105 TInt ret( KErrNone ); |
|
1106 TInt index( 0 ); |
|
1107 TUint expectedPTYCode( 0 ); |
|
1108 TUint PTYCode( 0 ); |
|
1109 |
|
1110 // read parameters |
|
1111 if ( aItem.GetNextInt(index) ) |
|
1112 { |
|
1113 ret = KErrBadTestParameter; |
|
1114 ERROR( ret, "Missing Parameter: Preset index." ); |
|
1115 } |
|
1116 if ( !ret && aItem.GetNextInt(expectedPTYCode) ) |
|
1117 { |
|
1118 ret = KErrBadTestParameter; |
|
1119 ERROR( ret, "Missing Parameter: expectedPTYCode." ); |
|
1120 } |
|
1121 if ( !ret ) |
|
1122 { |
|
1123 INFO_1( "GetPresetPTYCodeL=%d.", expectedPTYCode ); |
|
1124 TRAP( ret, iRadioFmPresetUtility->GetPresetPtyL( index, PTYCode ) ); |
|
1125 if ( PTYCode != expectedPTYCode ) |
|
1126 { |
|
1127 INFO_2( "Failed: PTYCode=%d, expectedPTYCode=%d.", PTYCode, expectedPTYCode ); |
|
1128 ret = KErrUnexpectedValue; |
|
1129 } |
|
1130 } |
|
1131 return ret; |
|
1132 } |
|
1133 |
|
1134 // ----------------------------------------------------------------------------- |
|
1135 // CPresetUtilityTestModule::GetPresetPICodeL() |
|
1136 // Returns: None |
|
1137 // ----------------------------------------------------------------------------- |
|
1138 TInt CPresetUtilityTestModule::GetPresetPICodeL( CStifItemParser& aItem ) |
|
1139 { |
|
1140 FUNC_LOG; |
|
1141 TInt ret( KErrNone ); |
|
1142 TInt index( 0 ); |
|
1143 TUint expectedPICode( 0 ); |
|
1144 TUint PICode( 0 ); |
|
1145 |
|
1146 // read parameters |
|
1147 if ( aItem.GetNextInt(index) ) |
|
1148 { |
|
1149 ret = KErrBadTestParameter; |
|
1150 ERROR( ret, "Missing Parameter: Preset index." ); |
|
1151 } |
|
1152 if ( !ret && aItem.GetNextInt(expectedPICode) ) |
|
1153 { |
|
1154 ret = KErrBadTestParameter; |
|
1155 ERROR( ret, "Missing Parameter: expectedPICode." ); |
|
1156 } |
|
1157 if ( !ret ) |
|
1158 { |
|
1159 INFO_1( "GetPresetPICodeL=%d.", expectedPICode ); |
|
1160 TRAP( ret, iRadioFmPresetUtility->GetPresetPICodeL( index, PICode ) ); |
|
1161 if ( PICode != expectedPICode ) |
|
1162 { |
|
1163 INFO_2( "Failed: PICode=%d, expectedPICode=%d.", PICode, expectedPICode ); |
|
1164 ret = KErrUnexpectedValue; |
|
1165 } |
|
1166 } |
|
1167 return ret; |
|
1168 } |
|
1169 |
|
1170 // ----------------------------------------------------------------------------- |
|
1171 // CPresetUtilityTestModule::GetPresetFavouriteInfoL() |
|
1172 // Returns: None |
|
1173 // ----------------------------------------------------------------------------- |
|
1174 TInt CPresetUtilityTestModule::GetPresetFavouriteInfoL( CStifItemParser& aItem ) |
|
1175 { |
|
1176 FUNC_LOG; |
|
1177 TInt ret( KErrNone ); |
|
1178 TInt index( 0 ); |
|
1179 TInt expectedFavourite( 0 ); |
|
1180 TBool favouriteStatus( EFalse ); |
|
1181 |
|
1182 // read parameters |
|
1183 if ( aItem.GetNextInt(index) ) |
|
1184 { |
|
1185 ret = KErrBadTestParameter; |
|
1186 ERROR( ret, "Missing Parameter: Preset index." ); |
|
1187 } |
|
1188 if ( !ret && aItem.GetNextInt(expectedFavourite) ) |
|
1189 { |
|
1190 ret = KErrBadTestParameter; |
|
1191 ERROR( ret, "Missing Parameter: expectedFavourite." ); |
|
1192 } |
|
1193 if ( !ret ) |
|
1194 { |
|
1195 INFO_1( "GetPresetFavouriteInfoL=%d.", expectedFavourite ); |
|
1196 TRAP( ret, iRadioFmPresetUtility->GetPresetFavouriteInfoL( index, favouriteStatus ) ); |
|
1197 if ( !( ( favouriteStatus && expectedFavourite ) || |
|
1198 ( !favouriteStatus && !expectedFavourite ) ) ) |
|
1199 { |
|
1200 INFO_2( "Failed: favouriteStatus=%d, expectedFavourite=%d.", favouriteStatus, expectedFavourite ); |
|
1201 ret = KErrUnexpectedValue; |
|
1202 } |
|
1203 } |
|
1204 return ret; |
|
1205 } |
|
1206 |
|
1207 // ----------------------------------------------------------------------------- |
|
1208 // CPresetUtilityTestModule::GetPresetUserRenameInfoL() |
|
1209 // Returns: None |
|
1210 // ----------------------------------------------------------------------------- |
|
1211 TInt CPresetUtilityTestModule::GetPresetUserRenameInfoL( CStifItemParser& aItem ) |
|
1212 { |
|
1213 FUNC_LOG; |
|
1214 TInt ret( KErrNone ); |
|
1215 TInt index( 0 ); |
|
1216 TInt expectedRename( 0 ); |
|
1217 TBool renameStatus( EFalse ); |
|
1218 |
|
1219 // read parameters |
|
1220 if ( aItem.GetNextInt(index) ) |
|
1221 { |
|
1222 ret = KErrBadTestParameter; |
|
1223 ERROR( ret, "Missing Parameter: Preset index." ); |
|
1224 } |
|
1225 if ( !ret && aItem.GetNextInt(expectedRename) ) |
|
1226 { |
|
1227 ret = KErrBadTestParameter; |
|
1228 ERROR( ret, "Missing Parameter: expectedRename." ); |
|
1229 } |
|
1230 if ( !ret ) |
|
1231 { |
|
1232 INFO_1( "GetPresetUserRenameInfoL=%d.", expectedRename ); |
|
1233 TRAP( ret, iRadioFmPresetUtility->GetPresetUserRenameInfoL( index, renameStatus ) ); |
|
1234 if ( !( ( renameStatus && expectedRename ) || |
|
1235 ( !renameStatus && !expectedRename ) ) ) |
|
1236 { |
|
1237 INFO_2( "Failed: renameStatus=%d, expectedRename=%d.", renameStatus, expectedRename ); |
|
1238 ret = KErrUnexpectedValue; |
|
1239 } |
|
1240 } |
|
1241 |
|
1242 return ret; |
|
1243 } |
|
1244 |
|
1245 // ----------------------------------------------------------------------------- |
|
1246 // CPresetUtilityTestModule::SetFavorite() |
|
1247 // Returns: None |
|
1248 // ----------------------------------------------------------------------------- |
|
1249 TInt CPresetUtilityTestModule::SetFavorite( CStifItemParser& aItem ) |
|
1250 { |
|
1251 FUNC_LOG; |
|
1252 TInt ret( KErrNone ); |
|
1253 TBool favoriteStatus( EFalse ); |
|
1254 if ( !ret && aItem.GetNextInt(favoriteStatus) ) |
|
1255 { |
|
1256 ret = KErrBadTestParameter; |
|
1257 ERROR( ret, "Missing Parameter: favoriteStatus." ); |
|
1258 } |
|
1259 iPreset->SetFavorite( favoriteStatus ); |
|
1260 return ret; |
|
1261 } |
|
1262 |
|
1263 // ----------------------------------------------------------------------------- |
|
1264 // CPresetUtilityTestModule::Favorite() |
|
1265 // Returns: None |
|
1266 // ----------------------------------------------------------------------------- |
|
1267 TInt CPresetUtilityTestModule::Favorite( CStifItemParser& aItem ) |
|
1268 { |
|
1269 FUNC_LOG; |
|
1270 TInt ret( KErrNone ); |
|
1271 TInt expectedFavorite( 0 ); |
|
1272 TBool favoriteStatus( EFalse ); |
|
1273 if ( !ret && aItem.GetNextInt(expectedFavorite) ) |
|
1274 { |
|
1275 ret = KErrBadTestParameter; |
|
1276 ERROR( ret, "Missing Parameter: expectedFavorite." ); |
|
1277 } |
|
1278 favoriteStatus = iPreset->Favorite(); |
|
1279 if ( !( ( favoriteStatus && expectedFavorite ) || |
|
1280 ( !favoriteStatus && !expectedFavorite ) ) ) |
|
1281 { |
|
1282 INFO_2( "Failed: favoriteStatus=%d, expectedFavorite=%d.", favoriteStatus, expectedFavorite ); |
|
1283 ret = KErrUnexpectedValue; |
|
1284 } |
|
1285 return ret; |
|
1286 } |
|
1287 |
|
1288 // ----------------------------------------------------------------------------- |
|
1289 // CPresetUtilityTestModule::SetLocalStation() |
|
1290 // Returns: None |
|
1291 // ----------------------------------------------------------------------------- |
|
1292 TInt CPresetUtilityTestModule::SetLocalStation( CStifItemParser& aItem ) |
|
1293 { |
|
1294 FUNC_LOG; |
|
1295 TInt ret( KErrNone ); |
|
1296 TBool localStationStatus( EFalse ); |
|
1297 if ( !ret && aItem.GetNextInt(localStationStatus) ) |
|
1298 { |
|
1299 ret = KErrBadTestParameter; |
|
1300 ERROR( ret, "Missing Parameter: localStationStatus." ); |
|
1301 } |
|
1302 iPreset->SetLocalStation( localStationStatus ); |
|
1303 return ret; |
|
1304 } |
|
1305 |
|
1306 // ----------------------------------------------------------------------------- |
|
1307 // CPresetUtilityTestModule::LocalStation() |
|
1308 // Returns: None |
|
1309 // ----------------------------------------------------------------------------- |
|
1310 TInt CPresetUtilityTestModule::LocalStation( CStifItemParser& aItem ) |
|
1311 { |
|
1312 FUNC_LOG; |
|
1313 TInt ret( KErrNone ); |
|
1314 TInt expectedLocalStationStatus( 0 ); |
|
1315 TBool localStationStatus( EFalse ); |
|
1316 if ( !ret && aItem.GetNextInt(expectedLocalStationStatus) ) |
|
1317 { |
|
1318 ret = KErrBadTestParameter; |
|
1319 ERROR( ret, "Missing Parameter: expectedLocalStationStatus." ); |
|
1320 } |
|
1321 localStationStatus = iPreset->LocalStation(); |
|
1322 if ( !( ( localStationStatus && expectedLocalStationStatus ) || |
|
1323 ( !localStationStatus && !expectedLocalStationStatus ) ) ) |
|
1324 { |
|
1325 INFO_2( "Failed: localStationStatus=%d, expectedLocalStationStatus=%d.", localStationStatus, expectedLocalStationStatus ); |
|
1326 ret = KErrUnexpectedValue; |
|
1327 } |
|
1328 return ret; |
|
1329 } |
|
1330 |
|
1331 |
|
1332 // ----------------------------------------------------------------------------- |
|
1333 // CPresetUtilityTestModule::SetRenamedByUser() |
|
1334 // Returns: None |
|
1335 // ----------------------------------------------------------------------------- |
|
1336 TInt CPresetUtilityTestModule::SetRenamedByUser( CStifItemParser& aItem ) |
|
1337 { |
|
1338 FUNC_LOG; |
|
1339 TInt ret( KErrNone ); |
|
1340 TBool renameStatus( EFalse ); |
|
1341 if ( !ret && aItem.GetNextInt(renameStatus) ) |
|
1342 { |
|
1343 ret = KErrBadTestParameter; |
|
1344 ERROR( ret, "Missing Parameter: renameStatus." ); |
|
1345 } |
|
1346 iPreset->SetRenamedByUser( renameStatus ); |
|
1347 return ret; |
|
1348 } |
|
1349 |
|
1350 // ----------------------------------------------------------------------------- |
|
1351 // CPresetUtilityTestModule::RenamedByUser() |
|
1352 // Returns: None |
|
1353 // ----------------------------------------------------------------------------- |
|
1354 TInt CPresetUtilityTestModule::RenamedByUser( CStifItemParser& aItem ) |
|
1355 { |
|
1356 FUNC_LOG; |
|
1357 TInt ret( KErrNone ); |
|
1358 TInt expectedRename( 0 ); |
|
1359 TBool renameStatus( EFalse ); |
|
1360 if ( !ret && aItem.GetNextInt(expectedRename) ) |
|
1361 { |
|
1362 ret = KErrBadTestParameter; |
|
1363 ERROR( ret, "Missing Parameter: expectedRename." ); |
|
1364 } |
|
1365 renameStatus = iPreset->RenamedByUser(); |
|
1366 if ( !( ( renameStatus && expectedRename ) || |
|
1367 ( !renameStatus && !expectedRename ) ) ) |
|
1368 { |
|
1369 INFO_2( "Failed: renameStatus=%d, expectedRename=%d.", renameStatus, expectedRename ); |
|
1370 ret = KErrUnexpectedValue; |
|
1371 } |
|
1372 return ret; |
|
1373 } |
|
1374 |
|
1375 // ----------------------------------------------------------------------------- |
|
1376 // CPresetUtilityTestModule::SetGenre() |
|
1377 // Returns: None |
|
1378 // ----------------------------------------------------------------------------- |
|
1379 TInt CPresetUtilityTestModule::SetGenre( CStifItemParser& aItem ) |
|
1380 { |
|
1381 FUNC_LOG; |
|
1382 TInt ret( KErrNone ); |
|
1383 TInt genre( 0 ); |
|
1384 if ( !ret && aItem.GetNextInt(genre) ) |
|
1385 { |
|
1386 ret = KErrBadTestParameter; |
|
1387 ERROR( ret, "Missing Parameter: genre." ); |
|
1388 } |
|
1389 iPreset->SetGenre( genre ); |
|
1390 return ret; |
|
1391 } |
|
1392 |
|
1393 // ----------------------------------------------------------------------------- |
|
1394 // CPresetUtilityTestModule::Genre() |
|
1395 // Returns: None |
|
1396 // ----------------------------------------------------------------------------- |
|
1397 TInt CPresetUtilityTestModule::Genre( CStifItemParser& aItem ) |
|
1398 { |
|
1399 FUNC_LOG; |
|
1400 TInt ret( KErrNone ); |
|
1401 TInt expectedGenre( 0 ); |
|
1402 TInt genre( 0 ); |
|
1403 if ( !ret && aItem.GetNextInt(expectedGenre) ) |
|
1404 { |
|
1405 ret = KErrBadTestParameter; |
|
1406 ERROR( ret, "Missing Parameter: expectedGenre." ); |
|
1407 } |
|
1408 genre = iPreset->Genre(); |
|
1409 if ( genre != expectedGenre ) |
|
1410 { |
|
1411 INFO_2( "Failed: genre=%d, expectedGenre=%d.", genre, expectedGenre ); |
|
1412 ret = KErrUnexpectedValue; |
|
1413 } |
|
1414 return ret; |
|
1415 } |
|
1416 |
|
1417 // ----------------------------------------------------------------------------- |
|
1418 // CPresetUtilityTestModule::SetPiCode() |
|
1419 // Returns: None |
|
1420 // ----------------------------------------------------------------------------- |
|
1421 TInt CPresetUtilityTestModule::SetPiCode( CStifItemParser& aItem ) |
|
1422 { |
|
1423 FUNC_LOG; |
|
1424 TInt ret( KErrNone ); |
|
1425 TInt piCode( 0 ); |
|
1426 if ( !ret && aItem.GetNextInt(piCode) ) |
|
1427 { |
|
1428 ret = KErrBadTestParameter; |
|
1429 ERROR( ret, "Missing Parameter: piCode." ); |
|
1430 } |
|
1431 iPreset->SetPiCode( piCode ); |
|
1432 return ret; |
|
1433 } |
|
1434 |
|
1435 // ----------------------------------------------------------------------------- |
|
1436 // CPresetUtilityTestModule::PiCode() |
|
1437 // Returns: None |
|
1438 // ----------------------------------------------------------------------------- |
|
1439 TInt CPresetUtilityTestModule::PiCode( CStifItemParser& aItem ) |
|
1440 { |
|
1441 FUNC_LOG; |
|
1442 TInt ret( KErrNone ); |
|
1443 TInt expectedPiCode( 0 ); |
|
1444 TInt piCode( 0 ); |
|
1445 if ( !ret && aItem.GetNextInt(expectedPiCode) ) |
|
1446 { |
|
1447 ret = KErrBadTestParameter; |
|
1448 ERROR( ret, "Missing Parameter: expectedPiCode." ); |
|
1449 } |
|
1450 piCode = iPreset->PiCode(); |
|
1451 if ( piCode != expectedPiCode ) |
|
1452 { |
|
1453 INFO_2( "Failed: piCode=%d, expectedPiCode=%d.", piCode, expectedPiCode ); |
|
1454 ret = KErrUnexpectedValue; |
|
1455 } |
|
1456 return ret; |
|
1457 } |
|
1458 |
|
1459 // ----------------------------------------------------------------------------- |
|
1460 // CPresetUtilityTestModuleModule::?member_function |
|
1461 // ?implementation_description |
|
1462 // (other items were commented in a header). |
|
1463 // ----------------------------------------------------------------------------- |
|
1464 // |
|
1465 /* |
|
1466 TInt CPresetUtilityTestModule::?member_function( |
|
1467 CItemParser& aItem ) |
|
1468 { |
|
1469 FUNC_LOG; |
|
1470 |
|
1471 ?code |
|
1472 |
|
1473 } |
|
1474 */ |
|
1475 |
|
1476 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
1477 // None |
|
1478 |
|
1479 // [End of File] - Do not remove |