|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "TestPlayerUtils.h" |
|
17 #include "OpenFileByHandle7804.h" |
|
18 |
|
19 #include <caf/caf.h> |
|
20 |
|
21 CTestMmfAclntOpenFile7804::CTestMmfAclntOpenFile7804(const TDesC& aTestName, const TDesC& aSectName) |
|
22 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName) |
|
23 {} |
|
24 |
|
25 CTestMmfAclntOpenFile7804* CTestMmfAclntOpenFile7804::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
26 { |
|
27 CTestMmfAclntOpenFile7804* self = new (ELeave) CTestMmfAclntOpenFile7804(aTestName, aSectName); |
|
28 return self; |
|
29 } |
|
30 |
|
31 /** |
|
32 * Open new file. |
|
33 */ |
|
34 TVerdict CTestMmfAclntOpenFile7804::DoTestL(CMdaAudioPlayerUtility* aPlayer) |
|
35 { |
|
36 return( PerformTestL( aPlayer ) ); |
|
37 } |
|
38 |
|
39 TVerdict CTestMmfAclntOpenFile7804::PerformTestL(CMdaAudioPlayerUtility* aPlayer) |
|
40 { |
|
41 INFO_PRINTF1( _L("TestPlayerUtils : OpenFileL(RFile&)/Play")); |
|
42 |
|
43 TVerdict ret = EFail; |
|
44 iError = KErrNone; |
|
45 |
|
46 RFs fs; |
|
47 |
|
48 User::LeaveIfError(fs.Connect()); |
|
49 CleanupClosePushL(fs); |
|
50 User::LeaveIfError(fs.ShareProtected()); |
|
51 |
|
52 TBuf<KSizeBuf> filename; |
|
53 TPtrC filename1; |
|
54 RFile file; |
|
55 |
|
56 if(!GetStringFromConfig(_L("SectionOne"), _L("PCMU16BE"), filename1)) |
|
57 { |
|
58 return EInconclusive; |
|
59 } |
|
60 |
|
61 GetDriveName(filename); |
|
62 filename.Append(filename1); |
|
63 |
|
64 User::LeaveIfError( file.Open( fs, filename, EFileRead ) ); |
|
65 CleanupClosePushL(file); |
|
66 |
|
67 aPlayer->OpenFileL(file); |
|
68 CActiveScheduler::Start(); |
|
69 |
|
70 if (iError == KErrNone) |
|
71 { |
|
72 aPlayer->Play(); |
|
73 CActiveScheduler::Start(); |
|
74 } |
|
75 |
|
76 if (iError == KErrNone) |
|
77 { |
|
78 ret = EPass; |
|
79 } |
|
80 |
|
81 aPlayer->Close(); |
|
82 CleanupStack::PopAndDestroy(2, &fs); |
|
83 |
|
84 return ret; |
|
85 } |