|
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 "OpenFileByHandle7901.h" |
|
18 |
|
19 #include <caf/caf.h> |
|
20 |
|
21 CTestMmfAclntOpenFile7901::CTestMmfAclntOpenFile7901(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative) |
|
22 :CTestMmfAclntRecord(aTestName, aSectName, aNegative) |
|
23 { |
|
24 } |
|
25 |
|
26 CTestMmfAclntOpenFile7901* CTestMmfAclntOpenFile7901::NewL(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative) |
|
27 { |
|
28 CTestMmfAclntOpenFile7901* self = new (ELeave) CTestMmfAclntOpenFile7901(aTestName, aSectName, aNegative); |
|
29 return self; |
|
30 } |
|
31 |
|
32 |
|
33 /** |
|
34 * Open new file. |
|
35 */ |
|
36 TVerdict CTestMmfAclntOpenFile7901::DoTestL(CMdaAudioRecorderUtility* aPlayer) |
|
37 { |
|
38 INFO_PRINTF1( _L("TestPlayerUtils : OpenFileL(RFile&)/Play")); |
|
39 |
|
40 TVerdict ret = EFail; |
|
41 iError = KErrTimedOut; |
|
42 |
|
43 RFs fs; |
|
44 |
|
45 User::LeaveIfError(fs.Connect()); |
|
46 CleanupClosePushL(fs); |
|
47 User::LeaveIfError(fs.ShareProtected()); |
|
48 |
|
49 TBuf<KSizeBuf> filename; |
|
50 TPtrC filename1; |
|
51 RFile file; |
|
52 |
|
53 if(!GetStringFromConfig(_L("SectionOne"), _L("PCM16"), filename1)) |
|
54 { |
|
55 return EInconclusive; |
|
56 } |
|
57 |
|
58 GetDriveName(filename); |
|
59 filename.Append(filename1); |
|
60 |
|
61 // open file for play |
|
62 User::LeaveIfError( file.Open( fs, filename, EFileRead ) ); |
|
63 CleanupClosePushL(file); |
|
64 |
|
65 TInt error = KErrNone; |
|
66 TRAP(error,aPlayer->OpenFileL(file)); |
|
67 CActiveScheduler::Start(); |
|
68 aPlayer->Close(); |
|
69 file.Close(); |
|
70 |
|
71 // open file again for play |
|
72 User::LeaveIfError( file.Open( fs, filename, EFileRead ) ); |
|
73 |
|
74 error = KErrNone; |
|
75 TRAP(error,aPlayer->OpenFileL(file)); |
|
76 CActiveScheduler::Start(); |
|
77 aPlayer->Close(); |
|
78 |
|
79 CleanupStack::PopAndDestroy(2, &fs); |
|
80 |
|
81 if(error == KErrNone) |
|
82 { |
|
83 ret = EPass; |
|
84 } |
|
85 |
|
86 return ret; |
|
87 } |