os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/SDevSound/SDSCapTestServer/src/mmddteststep0036.cpp
First public contribution.
1 // Copyright (c) 2008-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "mmddteststep0036.h"
18 CSecDevSndTS0036* CSecDevSndTS0036::NewL(TThreadId aClientTid)
20 CSecDevSndTS0036* self = new (ELeave) CSecDevSndTS0036(aClientTid);
21 CleanupStack::PushL(self);
27 CSecDevSndTS0036::CSecDevSndTS0036(TThreadId aClientTid)
29 iClientTid = aClientTid;
32 void CSecDevSndTS0036::ConstructL()
36 void CSecDevSndTS0036::StartProcessing(TRequestStatus& aStatus)
40 User::After(3000000); // allow client side devsound to play for 3sec
41 if( (iVerdict = DoTestStepPreambleL() ) == EPass )
43 iVerdict = DoPlaySimpleTone();
47 CSecDevSndTS0036::~CSecDevSndTS0036()
51 /******************************************************************************
55 *****************************************************************************/
57 TVerdict CSecDevSndTS0036::DoPlaySimpleTone()
59 TInt freq = 100; // arbitrary freq
60 TTimeIntervalMicroSeconds dur(2000000); //play for 2sec
63 TInt err = iMMFDevSound->SetClientThreadInfo(iClientTid);
66 verdict = EInconclusive;
70 verdict = TestInitialize(EMMFStateTonePlaying);
73 verdict = EInconclusive;
77 TestSetPriority(KDevSoundPriorityLow);
78 TestSetVolume(iMMFDevSound->MaxVolume());
79 iExpectedValue = KErrUnderflow;
80 verdict = TestPlayTone(freq, dur);
83 if (verdict == EInconclusive)
85 User::RequestComplete(iStatus, KErrGeneral);
98 TVerdict CSecDevSndTS0036::TestPlayTone(TInt aFreq, TTimeIntervalMicroSeconds aDur)
100 iCallbackError = KErrNone;
104 TRAPD(err, iMMFDevSound->PlayToneL(aFreq, aDur));
107 iCallbackError = err;
112 // Start the active scheduler and catch the callback
113 CActiveScheduler::Start();
114 if (iCallbackError != iExpectedValue)
118 if (iCallbackArray[EToneFinished] != 1)
122 TInt tot = GetCallbackTotal();
131 /******************************************************************************
133 * DevSound mixin methods
135 *****************************************************************************/
143 void CSecDevSndTS0036::ToneFinished (TInt aError)
145 User::RequestComplete(iStatus, aError);
146 iCallbackArray[EToneFinished] ++;
147 iCallbackError = aError;
148 CActiveScheduler::Stop();