0
|
1 |
// Copyright (c) 2002-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 |
// This file contains an example Test step implementation
|
|
15 |
// This demonstrates the various functions provided
|
|
16 |
// by the CTestStep base class which are available within
|
|
17 |
// a test step
|
|
18 |
//
|
|
19 |
//
|
|
20 |
|
|
21 |
// EPOC includes
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <e32test.h>
|
|
24 |
#include <e32keys.h>
|
|
25 |
#include <c32comm.h>
|
|
26 |
#include <f32file.h>
|
|
27 |
#include <etel.h>
|
|
28 |
#include <etelmm.h>
|
|
29 |
#include <testframework.h>
|
|
30 |
|
|
31 |
#include <mdaaudiosampleeditor.h>
|
|
32 |
|
|
33 |
// Test system includes
|
|
34 |
#include <testframework.h>
|
|
35 |
|
|
36 |
// Specific includes for this test suite
|
|
37 |
#include "TestStepUnitMMFAudClient.h"
|
|
38 |
#include "TestSuiteUnitMMFAudClient.h"
|
|
39 |
|
|
40 |
// Specific includes for these test steps
|
|
41 |
#include "TestStepConvert.h"
|
|
42 |
|
|
43 |
#include "mmfclientaudioplayer.h"
|
|
44 |
#include "../../ctlfrm/TS_Codes.h"
|
|
45 |
|
|
46 |
_LIT(KAudioControllerName,"Symbian Audio Wav Test controller");
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
//
|
|
51 |
//
|
|
52 |
// --------------------------------------------
|
|
53 |
//
|
|
54 |
/**
|
|
55 |
*
|
|
56 |
* Static constructor for CTestStepConvertGetImplementationInfo.
|
|
57 |
*
|
|
58 |
*
|
|
59 |
* @return "CTestStepConvertGetImplementationInfo*"
|
|
60 |
* The constructed CTestStepConvertGetImplementationInfo
|
|
61 |
*
|
|
62 |
* @xxxx
|
|
63 |
*
|
|
64 |
*/
|
|
65 |
CTestStepConvertGetImplementationInfo* CTestStepConvertGetImplementationInfo::NewL()
|
|
66 |
{
|
|
67 |
CTestStepConvertGetImplementationInfo* self = new(ELeave) CTestStepConvertGetImplementationInfo;
|
|
68 |
return self;
|
|
69 |
}
|
|
70 |
|
|
71 |
/**
|
|
72 |
*
|
|
73 |
* Test step constructor.
|
|
74 |
* Each test step initialises its own name.
|
|
75 |
*
|
|
76 |
* @xxxx
|
|
77 |
*
|
|
78 |
*/
|
|
79 |
CTestStepConvertGetImplementationInfo::CTestStepConvertGetImplementationInfo()
|
|
80 |
{
|
|
81 |
iTestStepResult = EPass;
|
|
82 |
// store the name of this test case
|
|
83 |
// this is the name that is used by the script file
|
|
84 |
iTestStepName = _L("MM-MMF-ACLNT-U-0571-HP");
|
|
85 |
}
|
|
86 |
|
|
87 |
/**
|
|
88 |
*
|
|
89 |
* Test step destructor.
|
|
90 |
*
|
|
91 |
* @xxxx
|
|
92 |
*
|
|
93 |
*/
|
|
94 |
CTestStepConvertGetImplementationInfo::~CTestStepConvertGetImplementationInfo()
|
|
95 |
{
|
|
96 |
}
|
|
97 |
|
|
98 |
|
|
99 |
void CTestStepConvertGetImplementationInfo::MoscoStateChangeEvent(CBase* /*aObject*/,
|
|
100 |
TInt aPreviousState,
|
|
101 |
TInt aCurrentState,
|
|
102 |
TInt aErrorcCode)
|
|
103 |
{
|
|
104 |
iError = aErrorcCode;
|
|
105 |
iHasStartedConverting = EFalse;
|
|
106 |
iHasFinishedConverting = EFalse;
|
|
107 |
if (aPreviousState == CMdaAudioClipUtility::EOpen
|
|
108 |
&& aCurrentState == CMdaAudioClipUtility::EPlaying)
|
|
109 |
iHasStartedConverting = ETrue;
|
|
110 |
if (aPreviousState == CMdaAudioClipUtility::EPlaying
|
|
111 |
&& aCurrentState == CMdaAudioClipUtility::EOpen)
|
|
112 |
iHasFinishedConverting = ETrue;
|
|
113 |
|
|
114 |
CActiveScheduler::Stop();
|
|
115 |
}
|
|
116 |
/**
|
|
117 |
*
|
|
118 |
* Test step Preamble.
|
|
119 |
*
|
|
120 |
* @xxxx
|
|
121 |
*
|
|
122 |
*/
|
|
123 |
enum TVerdict CTestStepConvertGetImplementationInfo::DoTestStepPreambleL(void)
|
|
124 |
{
|
|
125 |
enum TVerdict verdict;
|
|
126 |
// this installs the scheduler
|
|
127 |
verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();
|
|
128 |
if (verdict != EPass)
|
|
129 |
return verdict;
|
|
130 |
|
|
131 |
// Printing to the console and log file
|
|
132 |
INFO_PRINTF1(iTestStepName);
|
|
133 |
INFO_PRINTF1(_L("this is a test of CMMFMdaAudioConvertUtility::ControllerImplementationInformationL()"));
|
|
134 |
|
|
135 |
if(!GetStringFromConfig(_L("SectionOne"), _L("AudioPlayFName7"), iFileName) ||
|
|
136 |
!GetStringFromConfig(_L("SectionOne"), _L("AudioFNameToConvert"), iFileName2) )
|
|
137 |
{
|
|
138 |
//INFO_PRINTF2(_L("file name %s not found..."), fileptr);
|
|
139 |
return EInconclusive;
|
|
140 |
}
|
|
141 |
|
|
142 |
// create the Convert utility
|
|
143 |
if ( (iConvert = CMdaAudioConvertUtility::NewL(*this)) == NULL )
|
|
144 |
verdict = EInconclusive;
|
|
145 |
// create an empty target file
|
|
146 |
iFs.Connect();
|
|
147 |
if ( iFile.Replace(iFs, iFileName2, EFileWrite) )
|
|
148 |
return EInconclusive;
|
|
149 |
if ( iFile.SetSize(0) )
|
|
150 |
return EInconclusive;
|
|
151 |
iFile.Close();
|
|
152 |
iFs.Close();
|
|
153 |
|
|
154 |
// Printing to the console and log file
|
|
155 |
INFO_PRINTF1(iTestStepName);
|
|
156 |
INFO_PRINTF1(_L("CMMFMdaAudioConvertUtility::ControllerImplementationInformationL()"));
|
|
157 |
|
|
158 |
return verdict;
|
|
159 |
}
|
|
160 |
|
|
161 |
/**
|
|
162 |
*
|
|
163 |
* Test step Postamble.
|
|
164 |
*
|
|
165 |
* @xxxx
|
|
166 |
*
|
|
167 |
*/
|
|
168 |
enum TVerdict CTestStepConvertGetImplementationInfo::DoTestStepPostambleL(void)
|
|
169 |
{
|
|
170 |
//delete the output file
|
|
171 |
CFileMan* fileMan;
|
|
172 |
iFs.Connect();
|
|
173 |
fileMan = CFileMan::NewL(iFs);
|
|
174 |
fileMan->Delete(iFileName2);
|
|
175 |
iFs.Close();
|
|
176 |
delete fileMan;
|
|
177 |
fileMan = NULL;
|
|
178 |
|
|
179 |
delete iConvert;
|
|
180 |
iConvert = NULL;
|
|
181 |
//[ Destroy the scheduler ]
|
|
182 |
return CTestStepUnitMMFAudClient::DoTestStepPostambleL();
|
|
183 |
}
|
|
184 |
|
|
185 |
/**
|
|
186 |
*
|
|
187 |
* Do the test step.
|
|
188 |
* Each test step must supply an implementation for DoTestStepL.
|
|
189 |
*
|
|
190 |
* @return "TVerdict"
|
|
191 |
* The result of the test step
|
|
192 |
*
|
|
193 |
* @xxxx
|
|
194 |
*
|
|
195 |
*/
|
|
196 |
TVerdict CTestStepConvertGetImplementationInfo::DoTestStepL()
|
|
197 |
{
|
|
198 |
TInt err;
|
|
199 |
err = KErrNone;
|
|
200 |
iTestStepResult = EFail;
|
|
201 |
|
|
202 |
iConvert->OpenL(iFileName, iFileName2 );
|
|
203 |
CActiveScheduler::Start();
|
|
204 |
|
|
205 |
if (iError != KErrNone)
|
|
206 |
return EInconclusive;
|
|
207 |
|
|
208 |
const CMMFControllerImplementationInformation* info = NULL;
|
|
209 |
|
|
210 |
TRAP(err, info = &iConvert->ControllerImplementationInformationL());
|
|
211 |
if (err != KErrNone)
|
|
212 |
return EFail;
|
|
213 |
|
|
214 |
if (info->DisplayName().Compare(KAudioControllerName)!=0)
|
|
215 |
iTestStepResult = EFail;
|
|
216 |
else
|
|
217 |
iTestStepResult = EPass;
|
|
218 |
|
|
219 |
delete iConvert;
|
|
220 |
iConvert = NULL;
|
|
221 |
|
|
222 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
223 |
// test steps return a result
|
|
224 |
return iTestStepResult;
|
|
225 |
}
|
|
226 |
|
|
227 |
//
|
|
228 |
//
|
|
229 |
//
|
|
230 |
// --------------------------------------------
|
|
231 |
//
|
|
232 |
/**
|
|
233 |
*
|
|
234 |
* Static constructor for CTestStepConvertSendCustomCommandSync.
|
|
235 |
*
|
|
236 |
*
|
|
237 |
* @return "CTestStepConvertSendCustomCommandSync*"
|
|
238 |
* The constructed CTestStepConvertSendCustomCommandSync
|
|
239 |
*
|
|
240 |
* @xxxx
|
|
241 |
*
|
|
242 |
*/
|
|
243 |
CTestStepConvertSendCustomCommandSync* CTestStepConvertSendCustomCommandSync::NewL()
|
|
244 |
{
|
|
245 |
CTestStepConvertSendCustomCommandSync* self = new(ELeave) CTestStepConvertSendCustomCommandSync;
|
|
246 |
return self;
|
|
247 |
}
|
|
248 |
|
|
249 |
/**
|
|
250 |
*
|
|
251 |
* Test step constructor.
|
|
252 |
* Each test step initialises its own name.
|
|
253 |
*
|
|
254 |
* @xxxx
|
|
255 |
*
|
|
256 |
*/
|
|
257 |
CTestStepConvertSendCustomCommandSync::CTestStepConvertSendCustomCommandSync()
|
|
258 |
{
|
|
259 |
iTestStepResult = EPass;
|
|
260 |
// store the name of this test case
|
|
261 |
// this is the name that is used by the script file
|
|
262 |
iTestStepName = _L("MM-MMF-ACLNT-U-0572-HP");
|
|
263 |
}
|
|
264 |
|
|
265 |
/**
|
|
266 |
*
|
|
267 |
* Test step destructor.
|
|
268 |
*
|
|
269 |
* @xxxx
|
|
270 |
*
|
|
271 |
*/
|
|
272 |
CTestStepConvertSendCustomCommandSync::~CTestStepConvertSendCustomCommandSync()
|
|
273 |
{
|
|
274 |
}
|
|
275 |
|
|
276 |
void CTestStepConvertSendCustomCommandSync::MoscoStateChangeEvent(CBase* /*aObject*/,
|
|
277 |
TInt aPreviousState,
|
|
278 |
TInt aCurrentState,
|
|
279 |
TInt aErrorcCode)
|
|
280 |
{
|
|
281 |
iError = aErrorcCode;
|
|
282 |
iHasStartedConverting = EFalse;
|
|
283 |
iHasFinishedConverting = EFalse;
|
|
284 |
if (aPreviousState == CMdaAudioClipUtility::EOpen
|
|
285 |
&& aCurrentState == CMdaAudioClipUtility::EPlaying)
|
|
286 |
iHasStartedConverting = ETrue;
|
|
287 |
if (aPreviousState == CMdaAudioClipUtility::EPlaying
|
|
288 |
&& aCurrentState == CMdaAudioClipUtility::EOpen)
|
|
289 |
iHasFinishedConverting = ETrue;
|
|
290 |
|
|
291 |
CActiveScheduler::Stop();
|
|
292 |
}
|
|
293 |
|
|
294 |
/**
|
|
295 |
*
|
|
296 |
* Test step Preamble.
|
|
297 |
*
|
|
298 |
* @xxxx
|
|
299 |
*
|
|
300 |
*/
|
|
301 |
enum TVerdict CTestStepConvertSendCustomCommandSync::DoTestStepPreambleL(void)
|
|
302 |
{
|
|
303 |
enum TVerdict verdict;
|
|
304 |
// this installs the scheduler
|
|
305 |
verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();
|
|
306 |
if (verdict != EPass)
|
|
307 |
return verdict;
|
|
308 |
|
|
309 |
if(!GetStringFromConfig(_L("SectionOne"), _L("AudioPlayFName7"), iFileName) ||
|
|
310 |
!GetStringFromConfig(_L("SectionOne"), _L("AudioFNameToConvert"), iFileName2) )
|
|
311 |
{
|
|
312 |
//INFO_PRINTF2(_L("file name %s not found..."), fileptr);
|
|
313 |
return EInconclusive;
|
|
314 |
}
|
|
315 |
|
|
316 |
iClipLocationSrc = new TMdaFileClipLocation(iFileName);
|
|
317 |
iClipLocationTrgt = new TMdaFileClipLocation(iFileName2);
|
|
318 |
|
|
319 |
// Printing to the console and log file
|
|
320 |
INFO_PRINTF1(iTestStepName);
|
|
321 |
INFO_PRINTF1(_L("this test is a test of CMMFMdaAudioConvertUtility::CustomCommandSync()"));
|
|
322 |
|
|
323 |
return verdict;
|
|
324 |
}
|
|
325 |
|
|
326 |
/**
|
|
327 |
*
|
|
328 |
* Test step Postamble.
|
|
329 |
*
|
|
330 |
* @xxxx
|
|
331 |
*
|
|
332 |
*/
|
|
333 |
enum TVerdict CTestStepConvertSendCustomCommandSync::DoTestStepPostambleL(void)
|
|
334 |
{
|
|
335 |
//delete the output file
|
|
336 |
CFileMan* fileMan;
|
|
337 |
iFs.Connect();
|
|
338 |
fileMan = CFileMan::NewL(iFs);
|
|
339 |
fileMan->Delete(iFileName2);
|
|
340 |
iFs.Close();
|
|
341 |
delete fileMan;
|
|
342 |
fileMan = NULL;
|
|
343 |
|
|
344 |
delete iConvert;
|
|
345 |
iConvert = NULL;
|
|
346 |
//[ Destroy the scheduler ]
|
|
347 |
return CTestStepUnitMMFAudClient::DoTestStepPostambleL();
|
|
348 |
}
|
|
349 |
|
|
350 |
/**
|
|
351 |
*
|
|
352 |
* Do the test step.
|
|
353 |
* Each test step must supply an implementation for DoTestStepL.
|
|
354 |
*
|
|
355 |
* @return "TVerdict"
|
|
356 |
* The result of the test step
|
|
357 |
*
|
|
358 |
* @xxxx
|
|
359 |
*
|
|
360 |
*/
|
|
361 |
TVerdict CTestStepConvertSendCustomCommandSync::DoTestStepL()
|
|
362 |
{
|
|
363 |
TInt err;
|
|
364 |
err = KErrNone;
|
|
365 |
iTestStepResult = EFail;
|
|
366 |
|
|
367 |
iConvert = CMdaAudioConvertUtility::NewL(*this);
|
|
368 |
|
|
369 |
TRAP( err, iConvert->OpenL(iClipLocationSrc,iClipLocationTrgt,TUid::Uid(KUidTestController),KNullUid,KFourCCNULL));
|
|
370 |
if (err!=KErrNone)
|
|
371 |
return EInconclusive;
|
|
372 |
|
|
373 |
CActiveScheduler::Start();
|
|
374 |
if (iError!=KErrNone)
|
|
375 |
return EInconclusive;
|
|
376 |
|
|
377 |
TUid uid;
|
|
378 |
uid = TUid::Uid(0x101f72B4);
|
|
379 |
TMMFMessageDestinationPckg destPckg(uid);
|
|
380 |
// test without a return value
|
|
381 |
err = iConvert->CustomCommandSync(destPckg,
|
|
382 |
EMMFTestCustomCommandGeneralSynchronous,
|
|
383 |
KFirstParameter,
|
|
384 |
KSecondParameter);
|
|
385 |
|
|
386 |
if (err!=KTestCustomCommandSuccess)
|
|
387 |
return EFail;
|
|
388 |
|
|
389 |
TBuf8<256> buf;
|
|
390 |
|
|
391 |
err = iConvert->CustomCommandSync(destPckg,
|
|
392 |
EMMFTestCustomCommandGeneralSynchronousWithReturn,
|
|
393 |
KFirstParameter,
|
|
394 |
KSecondParameter,
|
|
395 |
buf);
|
|
396 |
|
|
397 |
if (err!=KTestCustomCommandSuccess)
|
|
398 |
return EFail;
|
|
399 |
|
|
400 |
if (buf.Compare(KReturnParameter)==0)
|
|
401 |
iTestStepResult = EPass;
|
|
402 |
else
|
|
403 |
iTestStepResult = EFail;
|
|
404 |
|
|
405 |
delete iConvert;
|
|
406 |
iConvert = NULL;
|
|
407 |
|
|
408 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
409 |
// test steps return a result
|
|
410 |
return iTestStepResult;
|
|
411 |
}
|
|
412 |
|
|
413 |
|
|
414 |
//
|
|
415 |
//
|
|
416 |
//
|
|
417 |
// --------------------------------------------
|
|
418 |
//
|
|
419 |
/**
|
|
420 |
*
|
|
421 |
* Static constructor for CTestStepConvertSendCustomCommandAsync.
|
|
422 |
*
|
|
423 |
*
|
|
424 |
* @return "CTestStepConvertSendCustomCommandAsync*"
|
|
425 |
* The constructed CTestStepConvertSendCustomCommandAsync
|
|
426 |
*
|
|
427 |
* @xxxx
|
|
428 |
*
|
|
429 |
*/
|
|
430 |
CTestStepConvertSendCustomCommandAsync* CTestStepConvertSendCustomCommandAsync::NewL()
|
|
431 |
{
|
|
432 |
CTestStepConvertSendCustomCommandAsync* self = new(ELeave) CTestStepConvertSendCustomCommandAsync;
|
|
433 |
return self;
|
|
434 |
}
|
|
435 |
|
|
436 |
/**
|
|
437 |
*
|
|
438 |
* Test step constructor.
|
|
439 |
* Each test step initialises its own name.
|
|
440 |
*
|
|
441 |
* @xxxx
|
|
442 |
*
|
|
443 |
*/
|
|
444 |
CTestStepConvertSendCustomCommandAsync::CTestStepConvertSendCustomCommandAsync()
|
|
445 |
{
|
|
446 |
iTestStepResult = EPass;
|
|
447 |
// store the name of this test case
|
|
448 |
// this is the name that is used by the script file
|
|
449 |
iTestStepName = _L("MM-MMF-ACLNT-U-0573-HP");
|
|
450 |
}
|
|
451 |
|
|
452 |
/**
|
|
453 |
*
|
|
454 |
* Test step destructor.
|
|
455 |
*
|
|
456 |
* @xxxx
|
|
457 |
*
|
|
458 |
*/
|
|
459 |
CTestStepConvertSendCustomCommandAsync::~CTestStepConvertSendCustomCommandAsync()
|
|
460 |
{
|
|
461 |
}
|
|
462 |
|
|
463 |
/**
|
|
464 |
*
|
|
465 |
* Test step Close
|
|
466 |
* handles all deletion
|
|
467 |
*
|
|
468 |
* @xxxx
|
|
469 |
*
|
|
470 |
*/
|
|
471 |
void CTestStepConvertSendCustomCommandAsync::Close()
|
|
472 |
{
|
|
473 |
delete iAsyncObserver;
|
|
474 |
}
|
|
475 |
|
|
476 |
|
|
477 |
void CTestStepConvertSendCustomCommandAsync::MoscoStateChangeEvent(CBase* /*aObject*/,
|
|
478 |
TInt aPreviousState,
|
|
479 |
TInt aCurrentState,
|
|
480 |
TInt aErrorcCode)
|
|
481 |
{
|
|
482 |
iError = aErrorcCode;
|
|
483 |
iHasStartedConverting = EFalse;
|
|
484 |
iHasFinishedConverting = EFalse;
|
|
485 |
if (aPreviousState == CMdaAudioClipUtility::EOpen
|
|
486 |
&& aCurrentState == CMdaAudioClipUtility::EPlaying)
|
|
487 |
iHasStartedConverting = ETrue;
|
|
488 |
if (aPreviousState == CMdaAudioClipUtility::EPlaying
|
|
489 |
&& aCurrentState == CMdaAudioClipUtility::EOpen)
|
|
490 |
iHasFinishedConverting = ETrue;
|
|
491 |
|
|
492 |
CActiveScheduler::Stop();
|
|
493 |
}
|
|
494 |
|
|
495 |
/**
|
|
496 |
*
|
|
497 |
* Test step Preamble.
|
|
498 |
*
|
|
499 |
* @xxxx
|
|
500 |
*
|
|
501 |
*/
|
|
502 |
enum TVerdict CTestStepConvertSendCustomCommandAsync::DoTestStepPreambleL(void)
|
|
503 |
{
|
|
504 |
enum TVerdict verdict;
|
|
505 |
// this installs the scheduler
|
|
506 |
verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();
|
|
507 |
if (verdict != EPass)
|
|
508 |
return verdict;
|
|
509 |
|
|
510 |
if(!GetStringFromConfig(_L("SectionOne"), _L("AudioPlayFName7"), iFileName) ||
|
|
511 |
!GetStringFromConfig(_L("SectionOne"), _L("AudioFNameToConvert"), iFileName2) )
|
|
512 |
{
|
|
513 |
//INFO_PRINTF2(_L("file name %s not found..."), fileptr);
|
|
514 |
return EInconclusive;
|
|
515 |
}
|
|
516 |
|
|
517 |
iClipLocationSrc = new TMdaFileClipLocation(iFileName);
|
|
518 |
iClipLocationTrgt = new TMdaFileClipLocation(iFileName2);
|
|
519 |
|
|
520 |
iAsyncObserver = new (ELeave) CAsyncObserver;
|
|
521 |
|
|
522 |
// Printing to the console and log file
|
|
523 |
INFO_PRINTF1(iTestStepName);
|
|
524 |
INFO_PRINTF1(_L("this test is a test of CMMFMdaAudioConvertUtility::CustomCommandAsync()"));
|
|
525 |
|
|
526 |
return verdict;
|
|
527 |
}
|
|
528 |
|
|
529 |
/**
|
|
530 |
*
|
|
531 |
* Test step Postamble.
|
|
532 |
*
|
|
533 |
* @xxxx
|
|
534 |
*
|
|
535 |
*/
|
|
536 |
enum TVerdict CTestStepConvertSendCustomCommandAsync::DoTestStepPostambleL(void)
|
|
537 |
{
|
|
538 |
delete iConvert;
|
|
539 |
iConvert = NULL;
|
|
540 |
//[ Destroy the scheduler ]
|
|
541 |
return CTestStepUnitMMFAudClient::DoTestStepPostambleL();
|
|
542 |
}
|
|
543 |
|
|
544 |
/**
|
|
545 |
*
|
|
546 |
* Do the test step.
|
|
547 |
* Each test step must supply an implementation for DoTestStepL.
|
|
548 |
*
|
|
549 |
* @return "TVerdict"
|
|
550 |
* The result of the test step
|
|
551 |
*
|
|
552 |
* @xxxx
|
|
553 |
*
|
|
554 |
*/
|
|
555 |
TVerdict CTestStepConvertSendCustomCommandAsync::DoTestStepL()
|
|
556 |
{
|
|
557 |
TInt err;
|
|
558 |
err = KErrNone;
|
|
559 |
iTestStepResult = EFail;
|
|
560 |
|
|
561 |
iConvert = CMdaAudioConvertUtility::NewL(*this);
|
|
562 |
|
|
563 |
TRAP( err, iConvert->OpenL(iClipLocationSrc,iClipLocationTrgt,TUid::Uid(KUidTestController),KNullUid,KFourCCNULL));
|
|
564 |
if (err!=KErrNone)
|
|
565 |
return EInconclusive;
|
|
566 |
|
|
567 |
CActiveScheduler::Start();
|
|
568 |
if (iError!=KErrNone)
|
|
569 |
return EInconclusive;
|
|
570 |
|
|
571 |
TUid uid;
|
|
572 |
uid = TUid::Uid(0x101f72B4);
|
|
573 |
// destinationPckg can be temporary as the asynchronous custom command returns before the temporary variable goes out of scope
|
|
574 |
TMMFMessageDestinationPckg destinationPckg(uid);
|
|
575 |
|
|
576 |
// test without a return value
|
|
577 |
iConvert->CustomCommandAsync(destinationPckg,
|
|
578 |
EMMFTestCustomCommandGeneralAsynchronous,
|
|
579 |
KFirstParameter,
|
|
580 |
KSecondParameter,
|
|
581 |
iAsyncObserver->ActiveStatus());
|
|
582 |
|
|
583 |
CActiveScheduler::Start();
|
|
584 |
if (iAsyncObserver->iStatus.Int() !=KTestCustomCommandSuccess)
|
|
585 |
return EFail;
|
|
586 |
|
|
587 |
TBuf8<256> buf;
|
|
588 |
|
|
589 |
iConvert->CustomCommandAsync(destinationPckg,
|
|
590 |
EMMFTestCustomCommandGeneralAsynchronousWithReturn,
|
|
591 |
KFirstParameter,
|
|
592 |
KSecondParameter,
|
|
593 |
buf,
|
|
594 |
iAsyncObserver->ActiveStatus());
|
|
595 |
|
|
596 |
CActiveScheduler::Start();
|
|
597 |
if (iAsyncObserver->iStatus.Int() !=KTestCustomCommandSuccess)
|
|
598 |
return EFail;
|
|
599 |
|
|
600 |
if (buf.Compare(KReturnParameter)==0)
|
|
601 |
iTestStepResult = EPass;
|
|
602 |
else
|
|
603 |
iTestStepResult = EFail;
|
|
604 |
|
|
605 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
606 |
// test steps return a result
|
|
607 |
return iTestStepResult;
|
|
608 |
}
|
|
609 |
|
|
610 |
/**
|
|
611 |
*
|
|
612 |
* Static constructor for CTestStepConvertCheckImplementationInfo.
|
|
613 |
*
|
|
614 |
*
|
|
615 |
* @return "CTestStepConvertCheckImplementationInfo*"
|
|
616 |
* The constructed CTestStepConvertCheckImplementationInfo
|
|
617 |
*
|
|
618 |
* @xxxx
|
|
619 |
*
|
|
620 |
*/
|
|
621 |
CTestStepConvertCheckImplementationInfo* CTestStepConvertCheckImplementationInfo::NewL()
|
|
622 |
{
|
|
623 |
CTestStepConvertCheckImplementationInfo* self = new(ELeave) CTestStepConvertCheckImplementationInfo;
|
|
624 |
return self;
|
|
625 |
}
|
|
626 |
|
|
627 |
|
|
628 |
/**
|
|
629 |
*
|
|
630 |
* Test step constructor.
|
|
631 |
* Each test step initialises its own name.
|
|
632 |
*
|
|
633 |
* @xxxx
|
|
634 |
*
|
|
635 |
*/
|
|
636 |
CTestStepConvertCheckImplementationInfo::CTestStepConvertCheckImplementationInfo()
|
|
637 |
{
|
|
638 |
iTestStepResult = EPass;
|
|
639 |
// store the name of this test case
|
|
640 |
// this is the name that is used by the script file
|
|
641 |
iTestStepName = _L("MM-MMF-ACLNT-U-1005-HP");
|
|
642 |
}
|
|
643 |
|
|
644 |
/**
|
|
645 |
*
|
|
646 |
* Test step destructor.
|
|
647 |
*
|
|
648 |
* @xxxx
|
|
649 |
*
|
|
650 |
*/
|
|
651 |
CTestStepConvertCheckImplementationInfo::~CTestStepConvertCheckImplementationInfo()
|
|
652 |
{
|
|
653 |
}
|
|
654 |
|
|
655 |
|
|
656 |
void CTestStepConvertCheckImplementationInfo::MoscoStateChangeEvent(CBase* /*aObject*/,
|
|
657 |
TInt aPreviousState,
|
|
658 |
TInt aCurrentState,
|
|
659 |
TInt aErrorcCode)
|
|
660 |
{
|
|
661 |
iError = aErrorcCode;
|
|
662 |
iHasStartedConverting = EFalse;
|
|
663 |
iHasFinishedConverting = EFalse;
|
|
664 |
if (aPreviousState == CMdaAudioClipUtility::EOpen
|
|
665 |
&& aCurrentState == CMdaAudioClipUtility::EPlaying)
|
|
666 |
{
|
|
667 |
iHasStartedConverting = ETrue;
|
|
668 |
}
|
|
669 |
if (aPreviousState == CMdaAudioClipUtility::EPlaying
|
|
670 |
&& aCurrentState == CMdaAudioClipUtility::EOpen)
|
|
671 |
{
|
|
672 |
iHasFinishedConverting = ETrue;
|
|
673 |
}
|
|
674 |
CActiveScheduler::Stop();
|
|
675 |
}
|
|
676 |
/**
|
|
677 |
*
|
|
678 |
* Test step Preamble.
|
|
679 |
*
|
|
680 |
* @xxxx
|
|
681 |
*
|
|
682 |
*/
|
|
683 |
TVerdict CTestStepConvertCheckImplementationInfo::DoTestStepPreambleL(void)
|
|
684 |
{
|
|
685 |
TVerdict verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();
|
|
686 |
if (verdict != EPass)
|
|
687 |
{
|
|
688 |
return verdict;
|
|
689 |
}
|
|
690 |
TInt err = KErrNone;
|
|
691 |
// Printing to the console and log file
|
|
692 |
INFO_PRINTF1(iTestStepName);
|
|
693 |
INFO_PRINTF1(_L("this is a test of CMMFMdaAudioConvertUtility::ControllerImplementationInformationL()"));
|
|
694 |
|
|
695 |
if(!GetStringFromConfig(_L("SectionOne"), _L("AudioPlayFName7"), iFileName) ||
|
|
696 |
!GetStringFromConfig(_L("SectionOne"), _L("AudioFNameToConvert"), iFileName2) )
|
|
697 |
{
|
|
698 |
return EInconclusive;
|
|
699 |
}
|
|
700 |
|
|
701 |
// create the Convert utility
|
|
702 |
if ( (iConvert = CMdaAudioConvertUtility::NewL(*this)) == NULL )
|
|
703 |
{
|
|
704 |
verdict = EInconclusive;
|
|
705 |
return verdict;
|
|
706 |
}
|
|
707 |
// create an empty target file
|
|
708 |
User::LeaveIfError(iFs.Connect());
|
|
709 |
err = iFile.Replace(iFs, iFileName2, EFileWrite);
|
|
710 |
if (err != KErrNone)
|
|
711 |
{
|
|
712 |
return EInconclusive;
|
|
713 |
}
|
|
714 |
err = iFile.SetSize(0);
|
|
715 |
if (err != KErrNone)
|
|
716 |
{
|
|
717 |
return EInconclusive;
|
|
718 |
}
|
|
719 |
iFile.Close();
|
|
720 |
iFs.Close();
|
|
721 |
|
|
722 |
// Printing to the console and log file
|
|
723 |
INFO_PRINTF1(iTestStepName);
|
|
724 |
INFO_PRINTF1(_L("CMMFMdaAudioConvertUtility::ControllerImplementationInformationL()"));
|
|
725 |
|
|
726 |
return verdict;
|
|
727 |
}
|
|
728 |
|
|
729 |
/**
|
|
730 |
*
|
|
731 |
* Test step Postamble.
|
|
732 |
*
|
|
733 |
* @xxxx
|
|
734 |
*
|
|
735 |
*/
|
|
736 |
TVerdict CTestStepConvertCheckImplementationInfo::DoTestStepPostambleL(void)
|
|
737 |
{
|
|
738 |
//delete the output file
|
|
739 |
CFileMan* fileMan;
|
|
740 |
iFs.Connect();
|
|
741 |
fileMan = CFileMan::NewL(iFs);
|
|
742 |
fileMan->Delete(iFileName2);
|
|
743 |
iFs.Close();
|
|
744 |
delete fileMan;
|
|
745 |
fileMan = NULL;
|
|
746 |
//[ Destroy the scheduler ]
|
|
747 |
return CTestStepUnitMMFAudClient::DoTestStepPostambleL();
|
|
748 |
}
|
|
749 |
|
|
750 |
/**
|
|
751 |
*
|
|
752 |
* Do the test step.
|
|
753 |
* Each test step must supply an implementation for DoTestStepL.
|
|
754 |
*
|
|
755 |
* @return "TVerdict"
|
|
756 |
* The result of the test step
|
|
757 |
*
|
|
758 |
* @xxxx
|
|
759 |
*
|
|
760 |
*/
|
|
761 |
TVerdict CTestStepConvertCheckImplementationInfo::DoTestStepL()
|
|
762 |
{
|
|
763 |
TInt err;
|
|
764 |
err = KErrNone;
|
|
765 |
iTestStepResult = EFail;
|
|
766 |
|
|
767 |
iConvert->OpenL(iFileName, iFileName2 );
|
|
768 |
CActiveScheduler::Start();
|
|
769 |
|
|
770 |
if (iError != KErrNone)
|
|
771 |
{
|
|
772 |
return EInconclusive;
|
|
773 |
}
|
|
774 |
|
|
775 |
const CMMFControllerImplementationInformation* info = NULL;
|
|
776 |
|
|
777 |
TRAP(err, info = &iConvert->ControllerImplementationInformationL());
|
|
778 |
TBuf<40> displayName;
|
|
779 |
displayName.Copy(info->DisplayName());
|
|
780 |
|
|
781 |
if (err != KErrNone)
|
|
782 |
{
|
|
783 |
return EFail;
|
|
784 |
}
|
|
785 |
|
|
786 |
iConvert->Close();
|
|
787 |
|
|
788 |
if(!GetStringFromConfig(_L("SectionOne"), _L("AudioPlayFName7"), iFileName) ||
|
|
789 |
!GetStringFromConfig(_L("SectionOne"), _L("AudioFNameToConvert"), iFileName2) )
|
|
790 |
{
|
|
791 |
return EInconclusive;
|
|
792 |
}
|
|
793 |
|
|
794 |
iClipLocationSrc = new(ELeave) TMdaFileClipLocation(iFileName);
|
|
795 |
iClipLocationDest = new(ELeave) TMdaFileClipLocation(iFileName2);
|
|
796 |
|
|
797 |
TRAP( err, iConvert->OpenL(iClipLocationSrc,iClipLocationDest,TUid::Uid(KUidTestController),KNullUid,KFourCCNULL));
|
|
798 |
if (err != KErrNone)
|
|
799 |
{
|
|
800 |
return EInconclusive;
|
|
801 |
}
|
|
802 |
|
|
803 |
CActiveScheduler::Start();
|
|
804 |
if (iError != KErrNone)
|
|
805 |
{
|
|
806 |
return EInconclusive;
|
|
807 |
}
|
|
808 |
|
|
809 |
TRAP(err, info = &iConvert->ControllerImplementationInformationL());
|
|
810 |
if (err != KErrNone)
|
|
811 |
{
|
|
812 |
return EFail;
|
|
813 |
}
|
|
814 |
|
|
815 |
if(info->DisplayName().Compare(displayName) != 0)
|
|
816 |
{
|
|
817 |
iTestStepResult = EPass;
|
|
818 |
}
|
|
819 |
else
|
|
820 |
{
|
|
821 |
iTestStepResult = EFail;
|
|
822 |
}
|
|
823 |
|
|
824 |
delete iClipLocationSrc;
|
|
825 |
iClipLocationSrc = NULL;
|
|
826 |
delete iClipLocationDest;
|
|
827 |
iClipLocationDest = NULL;
|
|
828 |
delete iConvert;
|
|
829 |
iConvert = NULL;
|
|
830 |
|
|
831 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
832 |
// test steps return a result
|
|
833 |
return iTestStepResult;
|
|
834 |
}
|
|
835 |
|
|
836 |
|