1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/OpenFileByHandle8801.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,89 @@
1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include "TestPlayerUtils.h"
1.20 +#include "OpenFileByHandle8801.h"
1.21 +
1.22 +#include <caf/caf.h>
1.23 +
1.24 +CTestMmfAclntOpenFile8801::CTestMmfAclntOpenFile8801(const TDesC& aTestName, const TDesC& aSectName)
1.25 + : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName)
1.26 + {}
1.27 +
1.28 +CTestMmfAclntOpenFile8801* CTestMmfAclntOpenFile8801::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.29 + {
1.30 + CTestMmfAclntOpenFile8801* self = new (ELeave) CTestMmfAclntOpenFile8801(aTestName, aSectName);
1.31 + return self;
1.32 + }
1.33 +
1.34 +/**
1.35 + * Open new file.
1.36 + */
1.37 +TVerdict CTestMmfAclntOpenFile8801::DoTestL(CMdaAudioPlayerUtility* aPlayer)
1.38 + {
1.39 + return( PerformTestL( aPlayer ) );
1.40 + }
1.41 +
1.42 +TVerdict CTestMmfAclntOpenFile8801::PerformTestL(CMdaAudioPlayerUtility* aPlayer)
1.43 + {
1.44 + INFO_PRINTF1( _L("TestPlayerUtils : OpenFileL(RFile&)/Play"));
1.45 +
1.46 + TVerdict ret = EFail;
1.47 + iError = KErrTimedOut;
1.48 +
1.49 + RFs fs;
1.50 +
1.51 + User::LeaveIfError(fs.Connect());
1.52 + CleanupClosePushL(fs);
1.53 + User::LeaveIfError(fs.ShareProtected());
1.54 +
1.55 + TBuf<KSizeBuf> filename;
1.56 + TPtrC filename1;
1.57 + RFile file;
1.58 +
1.59 + if(!GetStringFromConfig(_L("SectionOne"), _L("inputTextFile"), filename1))
1.60 + {
1.61 + return EInconclusive;
1.62 + }
1.63 + GetDriveName(filename);
1.64 + filename.Append(filename1);
1.65 +
1.66 + User::LeaveIfError( file.Open( fs, filename, EFileRead ) );
1.67 + CleanupClosePushL(file);
1.68 +
1.69 + aPlayer->Close(); // close previous file opened by test framework
1.70 +
1.71 + TInt error = KErrNone;
1.72 + TRAP(error,aPlayer->OpenFileL(file));
1.73 + CActiveScheduler::Start();
1.74 + aPlayer->Play();
1.75 + CActiveScheduler::Start();
1.76 +
1.77 + CleanupStack::PopAndDestroy(2, &fs);
1.78 +
1.79 + // check OpenFile errors
1.80 + if(error == KErrNone)
1.81 + {
1.82 + ret = EPass;
1.83 + }
1.84 +
1.85 + if( iError != KErrNotReady )
1.86 + {
1.87 + // unexpected error
1.88 + ret = EFail;
1.89 + }
1.90 +
1.91 + return ret;
1.92 + }