Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // This program is designed the test of the MMF_ACLNT.
19 @file OpenFileByHandle_PlayTone.cpp
22 #include "OpenFileByHandle_PlayTone.h"
24 //const TInt KHeapSizeToneTestEKA2 = 128000; // Heapsize for tone tests on EKA2
26 //------------------------------------------------------------------
31 CTestMmfAclntOpenToneFile::CTestMmfAclntOpenToneFile(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName)
32 : CTestMmfAclntTone(aTestName)
34 // store the name of this test case
35 // this is the name that is used by the script file
36 // Each test step initialises it's own name
37 iSectName = aSectName;
41 CTestMmfAclntOpenToneFile* CTestMmfAclntOpenToneFile::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName)
43 CTestMmfAclntOpenToneFile* self = new (ELeave) CTestMmfAclntOpenToneFile(aTestName,aSectName,aKeyName);
47 TVerdict CTestMmfAclntOpenToneFile::DoTestStepPreambleL()
50 if(!GetStringFromConfig(iSectName, iKeyName, filename))
55 // Create a sequence file
60 CleanupClosePushL(fs);
61 #ifdef __IPC_V2_PRESENT__
62 User::LeaveIfError(fs.ShareAuto());
64 User::LeaveIfError(fs.Share(RSessionBase::EExplicitAttach));
67 User::LeaveIfError(file.Replace(fs,filename,EFileWrite));
68 CleanupClosePushL(file);
69 User::LeaveIfError(file.Write(KFixedSequenceData()));
70 User::LeaveIfError(file.Size(length));
71 CleanupStack::PopAndDestroy(2, &fs);
73 return CTestMmfAclntStep::DoTestStepPreambleL();
79 TVerdict CTestMmfAclntOpenToneFile::DoTestStepL( void )
81 INFO_PRINTF1( _L("TestTone : Play File"));
87 User::LeaveIfError(fs.Connect());
88 CleanupClosePushL(fs);
89 User::LeaveIfError(fs.ShareProtected());
92 if(!GetStringFromConfig(iSectName, iKeyName, filename))
97 iError = KErrTimedOut;
98 // perform test using this file
99 CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
100 CleanupStack::PushL(toneUtil);
103 User::LeaveIfError( file.Open( fs, filename, EFileRead | EFileShareAny ) );
104 CleanupClosePushL(file);
106 toneUtil->PrepareToPlayFileSequence(file);
107 CleanupStack::PopAndDestroy(&file);
110 INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
111 CActiveScheduler::Start();
113 User::LeaveIfError( file.Open( fs, filename, EFileRead | EFileShareAny ) );
114 CleanupClosePushL(file);
116 toneUtil->PrepareToPlayFileSequence(file);
118 INFO_PRINTF1( _L("re-initialise CMdaAudioToneUtility"));
119 CActiveScheduler::Start();
121 if(iError == KErrNone)
123 ret = DoTestL(toneUtil);
128 ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
131 CleanupStack::PopAndDestroy(3, &fs);