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 <mdaaudiosampleplayer.h>
|
|
32 |
//#include <MdaAudioSampleEditor.h>
|
|
33 |
//#include <MdaAudioTonePlayer.h>
|
|
34 |
|
|
35 |
// Test system includes
|
|
36 |
#include <testframework.h>
|
|
37 |
|
|
38 |
// Specific includes for this test suite
|
|
39 |
#include "TestStepUnitMMFAudClient.h"
|
|
40 |
#include "TestSuiteUnitMMFAudClient.h"
|
|
41 |
|
|
42 |
// Specific includes for these test steps
|
|
43 |
#include "TestStepPlayerNew.h"
|
|
44 |
|
|
45 |
#include "mmfclientaudioplayer.h"
|
|
46 |
|
|
47 |
// --------------------------------------------
|
|
48 |
|
|
49 |
/**
|
|
50 |
*
|
|
51 |
* Static constructor for CTestStepPlayerNewFilePlayer.
|
|
52 |
*
|
|
53 |
*
|
|
54 |
* @return "CTestStepPlayerNewFilePlayer*"
|
|
55 |
* The constructed CTestStepPlayerNewFilePlayer
|
|
56 |
*
|
|
57 |
* @xxxx
|
|
58 |
*
|
|
59 |
*/
|
|
60 |
CTestStepPlayerNewFilePlayer* CTestStepPlayerNewFilePlayer::NewL()
|
|
61 |
{
|
|
62 |
CTestStepPlayerNewFilePlayer* self = new(ELeave) CTestStepPlayerNewFilePlayer;
|
|
63 |
return self;
|
|
64 |
}
|
|
65 |
|
|
66 |
/**
|
|
67 |
*
|
|
68 |
* Test step constructor.
|
|
69 |
* Each test step initialises its own name.
|
|
70 |
*
|
|
71 |
* @xxxx
|
|
72 |
*
|
|
73 |
*/
|
|
74 |
CTestStepPlayerNewFilePlayer::CTestStepPlayerNewFilePlayer()
|
|
75 |
{
|
|
76 |
iTestStepResult = EPass;
|
|
77 |
// store the name of this test case
|
|
78 |
// this is the name that is used by the script file
|
|
79 |
iTestStepName = _L("MM-MMF-ACLNT-U-0001-CP");
|
|
80 |
}
|
|
81 |
|
|
82 |
/**
|
|
83 |
*
|
|
84 |
* Test step destructor.
|
|
85 |
*
|
|
86 |
* @xxxx
|
|
87 |
*
|
|
88 |
*/
|
|
89 |
CTestStepPlayerNewFilePlayer::~CTestStepPlayerNewFilePlayer()
|
|
90 |
{
|
|
91 |
}
|
|
92 |
/**
|
|
93 |
* Implementation of the MMdaAudioPlayerCallback interface functions
|
|
94 |
**/
|
|
95 |
void CTestStepPlayerNewFilePlayer::MapcInitComplete(TInt aError,
|
|
96 |
const TTimeIntervalMicroSeconds &/*aDuration*/)
|
|
97 |
{
|
|
98 |
iError = aError;
|
|
99 |
CActiveScheduler::Stop();
|
|
100 |
}
|
|
101 |
|
|
102 |
void CTestStepPlayerNewFilePlayer::MapcPlayComplete(TInt aError)
|
|
103 |
{
|
|
104 |
iError = aError;
|
|
105 |
CActiveScheduler::Stop();
|
|
106 |
}
|
|
107 |
|
|
108 |
/**
|
|
109 |
*
|
|
110 |
* Do the test step.
|
|
111 |
* Each test step must supply an implementation for DoTestStepL.
|
|
112 |
*
|
|
113 |
* @return "TVerdict"
|
|
114 |
* The result of the test step
|
|
115 |
*
|
|
116 |
* @xxxx
|
|
117 |
*
|
|
118 |
*/
|
|
119 |
TVerdict CTestStepPlayerNewFilePlayer::DoTestStepL()
|
|
120 |
{
|
|
121 |
__MM_HEAP_MARK;
|
|
122 |
// Printing to the console and log file
|
|
123 |
INFO_PRINTF1(_L("MM-MMF-ACLNT-U-0001-CP"));
|
|
124 |
INFO_PRINTF1(_L("this test is opening a sound file with NewFilePlayerL()"));
|
|
125 |
|
|
126 |
iError = KErrNone; //KErrTimedOut;
|
|
127 |
|
|
128 |
iRes = &iFileName;
|
|
129 |
if(!GetStringFromConfig(_L("SectionOne"), _L("AudioPlayFName1"), iFileName))
|
|
130 |
{
|
|
131 |
//INFO_PRINTF2(_L("file name %s not found..."), fileptr);
|
|
132 |
return EInconclusive;
|
|
133 |
}
|
|
134 |
|
|
135 |
CMMFMdaAudioPlayerUtility* player = CMMFMdaAudioPlayerUtility::NewFilePlayerL(iFileName, *this);
|
|
136 |
CleanupStack::PushL(player);
|
|
137 |
|
|
138 |
CActiveScheduler::Start();
|
|
139 |
User::After(500000);
|
|
140 |
|
|
141 |
TInt err1 = KErrNone;
|
|
142 |
TInt err2 = KErrNone;
|
|
143 |
TInt state = 0;
|
|
144 |
TMMFMessageDestination* srcHandle = NULL;
|
|
145 |
err1 = GetAudPlayerState(player, state);
|
|
146 |
err2 = GetAudPlayerSourceHandle(player, srcHandle);
|
|
147 |
if ( err1 != KErrNone ||
|
|
148 |
err2 != KErrNone ||
|
|
149 |
&srcHandle == NULL ||
|
|
150 |
state != CMMFMdaAudioPlayerUtility::EStopped ||
|
|
151 |
player->Duration() == TTimeIntervalMicroSeconds(0) || // we know the duration of the file is more than 0
|
|
152 |
iError != KErrNone)
|
|
153 |
iTestStepResult = EFail;
|
|
154 |
|
|
155 |
CleanupStack::PopAndDestroy(player);
|
|
156 |
|
|
157 |
__MM_HEAP_MARKEND;
|
|
158 |
|
|
159 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
160 |
// test steps return a result
|
|
161 |
return iTestStepResult;
|
|
162 |
}
|
|
163 |
|