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 CTestStepPlayerNew.
|
|
52 |
*
|
|
53 |
*
|
|
54 |
* @return "CTestStepPlayerNew*"
|
|
55 |
* The constructed CTestStepPlayerNew
|
|
56 |
*
|
|
57 |
* @xxxx
|
|
58 |
*
|
|
59 |
*/
|
|
60 |
CTestStepPlayerNew* CTestStepPlayerNew::NewL()
|
|
61 |
{
|
|
62 |
CTestStepPlayerNew* self = new(ELeave) CTestStepPlayerNew;
|
|
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 |
CTestStepPlayerNew::CTestStepPlayerNew()
|
|
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-0002-CP");
|
|
80 |
}
|
|
81 |
|
|
82 |
/**
|
|
83 |
*
|
|
84 |
* Test step destructor.
|
|
85 |
*
|
|
86 |
* @xxxx
|
|
87 |
*
|
|
88 |
*/
|
|
89 |
CTestStepPlayerNew::~CTestStepPlayerNew()
|
|
90 |
{
|
|
91 |
}
|
|
92 |
/**
|
|
93 |
* Implementation of the MMdaAudioPlayerCallback interface functions
|
|
94 |
**/
|
|
95 |
void CTestStepPlayerNew::MapcInitComplete(TInt aError,
|
|
96 |
const TTimeIntervalMicroSeconds &/*aDuration*/)
|
|
97 |
{
|
|
98 |
iError = aError;
|
|
99 |
CActiveScheduler::Stop();
|
|
100 |
}
|
|
101 |
|
|
102 |
void CTestStepPlayerNew::MapcPlayComplete(TInt /*aError*/)
|
|
103 |
{
|
|
104 |
// not used in this test
|
|
105 |
}
|
|
106 |
|
|
107 |
/**
|
|
108 |
*
|
|
109 |
* Do the test step.
|
|
110 |
* Each test step must supply an implementation for DoTestStepL.
|
|
111 |
*
|
|
112 |
* @return "TVerdict"
|
|
113 |
* The result of the test step
|
|
114 |
*
|
|
115 |
* @xxxx
|
|
116 |
*
|
|
117 |
*/
|
|
118 |
TVerdict CTestStepPlayerNew::DoTestStepL()
|
|
119 |
{
|
|
120 |
__MM_HEAP_MARK;
|
|
121 |
// Printing to the console and log file
|
|
122 |
INFO_PRINTF1(_L("MM-MMF-ACLNT-U-0002-CP"));
|
|
123 |
INFO_PRINTF1(_L("this test is iniatilising a CMdaAudioPlayerUtility object with NewL()"));
|
|
124 |
|
|
125 |
iError = KErrNone; //KErrTimedOut;
|
|
126 |
|
|
127 |
CMMFMdaAudioPlayerUtility* player = CMMFMdaAudioPlayerUtility::NewL(*this);
|
|
128 |
CleanupStack::PushL(player);
|
|
129 |
|
|
130 |
TInt err1 = KErrNone;
|
|
131 |
TInt err2 = KErrNone;
|
|
132 |
TInt state = 0;
|
|
133 |
TMMFMessageDestination* srcHandle = NULL;
|
|
134 |
err1 = GetAudPlayerState(player, state);
|
|
135 |
err2 = GetAudPlayerSourceHandle(player, srcHandle);
|
|
136 |
if ( err1 != KErrNone ||
|
|
137 |
err2 != KErrNone ||
|
|
138 |
&srcHandle == NULL ||
|
|
139 |
state != CMMFMdaAudioPlayerUtility::EStopped ||
|
|
140 |
iError != KErrNone)
|
|
141 |
iTestStepResult = EFail;
|
|
142 |
|
|
143 |
CleanupStack::PopAndDestroy(1, player);
|
|
144 |
|
|
145 |
__MM_HEAP_MARKEND;
|
|
146 |
|
|
147 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
148 |
// test steps return a result
|
|
149 |
return iTestStepResult;
|
|
150 |
}
|
|
151 |
|