First public contribution.
1 // Copyright (c) 2004-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 "TestPlayerUtils.h"
17 #include "OpenFileByHandle7803.h"
21 CTestMmfAclntOpenFile7803::CTestMmfAclntOpenFile7803(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName)
22 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName), iKeyName(aKeyName)
25 CTestMmfAclntOpenFile7803* CTestMmfAclntOpenFile7803::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName)
27 CTestMmfAclntOpenFile7803* self = new (ELeave) CTestMmfAclntOpenFile7803(aTestName, aSectName, aKeyName);
34 TVerdict CTestMmfAclntOpenFile7803::DoTestL(CMdaAudioPlayerUtility* aPlayer)
36 return( PerformTestL( aPlayer ) );
39 TVerdict CTestMmfAclntOpenFile7803::PerformTestL(CMdaAudioPlayerUtility* aPlayer)
46 // read optional test specific parameters
47 iSkipShareProtected = iExpectToFail = EFalse;
48 iExpectedError = KErrNone;
49 // read the parameters, if any missing just ignore
50 GetBoolFromConfig(iDefaultParamSet, _L("SkipShareProtected"), iSkipShareProtected);
51 GetBoolFromConfig(iDefaultParamSet, _L("ExpectToFail"), iExpectToFail);
52 GetIntFromConfig(iDefaultParamSet, _L("ExpectedError"), iExpectedError);
54 User::LeaveIfError(fs.Connect());
55 CleanupClosePushL(fs);
56 if (!iSkipShareProtected)
58 User::LeaveIfError(fs.ShareProtected());
61 // get second file name
62 TBuf<KSizeBuf> filename2;
65 if(!GetStringFromConfig(iSectName, iKeyName, filename))
70 GetDriveName(filename2);
71 filename2.Append(filename);
74 User::LeaveIfError( file.Open( fs, filename2, EFileRead ) );
75 CleanupClosePushL(file);
78 aPlayer->OpenFileL(file);
79 // wait for open to complete
80 CActiveScheduler::Start();
82 INFO_PRINTF2( _L("OpenFileL completed with error %d"), iError);
84 if( iError != KErrNone )
86 if (iExpectToFail && iError == iExpectedError)
88 INFO_PRINTF2( _L("Error matches expected %d"), iExpectedError);
91 else if (iExpectToFail)
93 INFO_PRINTF2( _L("Error does not match %d"), iExpectedError);
98 INFO_PRINTF1( _L("No error was expected"));
105 CActiveScheduler::Start();
107 if( iError != KErrNone )
112 User::After(1000000);
117 CleanupStack::PopAndDestroy(2, &fs);