First public contribution.
2 // Copyright (c) 2002-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".
9 // Initial Contributors:
10 // Nokia Corporation - initial contribution.
15 // TestCapabilities.CPP
16 // This program is designed the test of the MMF_ACLNT.
21 @file TestPlayerUtils.cpp
24 #include <simulprocclient.h>
25 #include "TestPlayerCaps.h"
26 #include "TestPlayerCaps0012.h"
33 CTestMmfAclntCaps0012::CTestMmfAclntCaps0012(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName)
35 // store the name of this test case
36 // this is the name that is used by the script file
37 // Each test step initialises it's own name
38 iTestStepName = aTestName;
39 iSectName = aSectName;
43 CTestMmfAclntCaps0012* CTestMmfAclntCaps0012::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName)
45 CTestMmfAclntCaps0012* self = new (ELeave) CTestMmfAclntCaps0012(aTestName, aSectName, aKeyName);
49 CTestMmfAclntCaps0012* CTestMmfAclntCaps0012::NewLC(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName)
51 CTestMmfAclntCaps0012* self = NewL(aTestName, aSectName, aKeyName);
52 CleanupStack::PushL(self);
56 void CTestMmfAclntCaps0012::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/)
58 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Init Complete"));
62 void CTestMmfAclntCaps0012::MapcPlayComplete(TInt aError)
64 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Play Complete"));
70 /** Load and initialise an audio file.
72 TVerdict CTestMmfAclntCaps0012::DoTestStepL( void )
74 INFO_PRINTF1( _L("TestPlayerUtils : Caps"));
77 iServerMonitor = CServerMonitor::NewL(this);
79 // Start Server to play back from another process
81 User::LeaveIfError(server.Connect(_L("CapTestServer")));
82 CleanupClosePushL(server);
84 RTestSession session1;
85 User::LeaveIfError(session1.Open(server,_L("CapTestStep0012")));
86 TRequestStatus* status = &iServerMonitor->ActiveStatus();
87 // Start Server playback. The RunL of the CServerMonitor class will be called by the server when
88 // playback has started
89 session1.StartProcessing(*status);
90 // Begin activescheduler loop. This will only exit when the whole test is complete
91 CActiveScheduler::Start();
93 // The test is complete. Now shut down the server and get any errors /messages from the server
95 TVerdict verdict = session1.EndProcessingAndReturnResult(message);
99 copymess.Copy(message);
100 INFO_PRINTF2(_L("end processing and return result: %S"),©mess);
102 CleanupStack::PopAndDestroy(&server);
106 void CTestMmfAclntCaps0012::CreatePlayer()
108 // Get the test filename from the configuration file
109 TBuf<KSizeBuf> filename;
111 if(!GetStringFromConfig(iSectName,iKeyName,filename1))
114 CActiveScheduler::Stop();
116 GetDriveName(filename);
117 filename.Append(filename1);
119 iPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(filename, *this, EMdaPriorityNormal);
122 void CTestMmfAclntCaps0012::BeginPlayback()
128 void CTestMmfAclntCaps0012::DoProcess(TInt aError)
130 if (aError == KErrNone)
132 InternalState nextState = iState;
135 case EWaitingForServer:
137 nextState = EInitPlayer;
141 nextState = EPlaying;
145 CActiveScheduler::Stop();
153 INFO_PRINTF2(_L("Unexpected failure in test, error code %d"), aError);
154 CActiveScheduler::Stop();
158 CTestMmfAclntCaps0012::CServerMonitor::CServerMonitor(CTestMmfAclntCaps0012* aParent)
159 :CActive(EPriorityNormal), iParent(aParent)
164 CTestMmfAclntCaps0012::CServerMonitor* CTestMmfAclntCaps0012::CServerMonitor::NewL(CTestMmfAclntCaps0012* aParent)
166 CServerMonitor* self = new (ELeave) CServerMonitor(aParent);
167 CleanupStack::PushL(self);
169 CleanupStack::Pop(self);
173 void CTestMmfAclntCaps0012::CServerMonitor::ConstructL()
175 CActiveScheduler::Add(this);
178 void CTestMmfAclntCaps0012::CServerMonitor::DoCancel()
183 void CTestMmfAclntCaps0012::CServerMonitor::RunL()
185 // start the client state machine
186 iParent->DoProcess(iStatus.Int());
189 TRequestStatus& CTestMmfAclntCaps0012::CServerMonitor::ActiveStatus()
196 CTestMmfAclntCaps0012::~CTestMmfAclntCaps0012()
200 void CTestMmfAclntCaps0012::Close()
203 delete iServerMonitor;