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 "TestPlayer.h"
17 #include "OpenFileByHandle1011.h"
24 CTestMmfVclntOpenFile1011::CTestMmfVclntOpenFile1011(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName,const TBool aRec)
27 // store the name of this test case
28 // this is the name that is used by the script file
29 // Each test step initialises it's own name
30 iTestStepName = aTestName;
31 iSectName = aSectName;
35 CTestMmfVclntOpenFile1011* CTestMmfVclntOpenFile1011::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aRec)
37 CTestMmfVclntOpenFile1011* self = new (ELeave) CTestMmfVclntOpenFile1011(aTestName,aSectName,aKeyName,aRec);
41 CTestMmfVclntOpenFile1011* CTestMmfVclntOpenFile1011::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aRec)
43 CTestMmfVclntOpenFile1011* self = CTestMmfVclntOpenFile1011::NewL(aTestName,aSectName,aKeyName,aRec);
44 CleanupStack::PushL(self);
48 void CTestMmfVclntOpenFile1011::MvruoOpenComplete(TInt aError)
51 INFO_PRINTF1(_L("Open complete callback"));
52 CActiveScheduler::Stop();
55 void CTestMmfVclntOpenFile1011::MvruoRecordComplete(TInt aError)
58 INFO_PRINTF1(_L("Record complete callback"));
59 CActiveScheduler::Stop();
62 void CTestMmfVclntOpenFile1011::MvruoPrepareComplete(TInt aError)
65 INFO_PRINTF1(_L("Prepare complete callback"));
66 CActiveScheduler::Stop();
69 void CTestMmfVclntOpenFile1011::MvruoEvent(const TMMFEvent& /*aEvent*/)
74 * Load and initialise an audio file.
76 #define KInvalidControllerUid 0xA0A0A0A0
78 TVerdict CTestMmfVclntOpenFile1011::DoTestStepL()
82 INFO_PRINTF1(_L("Test : Video Recorder - OpenFileL(RFile&)"));
87 User::LeaveIfError(fs.Connect());
88 CleanupClosePushL(fs);
89 User::LeaveIfError(fs.ShareProtected());
91 iError = KErrTimedOut;
94 if(!GetStringFromConfig(iSectName,iKeyName,filename))
99 User::LeaveIfError(file.Replace(fs,filename,EFileWrite));
100 CleanupClosePushL(file);
102 CVideoRecorderUtility* rec = CVideoRecorderUtility::NewL(*this);
103 CleanupStack::PushL(rec);
105 const TUid KVidTstControllerUid = {KInvalidControllerUid};
106 TRAP(iError,rec->OpenFileL(file,
108 /*KNullUid*/ KVidTstControllerUid,
109 KUidMdaBmpClipFormat ));
111 if(iError == KErrNone)
113 INFO_PRINTF1(_L("CVideoRecorderUtility: Open file"));
114 // Wait for initialisation callback
115 CActiveScheduler::Start();
118 // Controller not found
119 if(iError == KErrNotFound)
124 if(iError == KErrNotSupported)
130 if ((iError == KErrNone) && (rec != NULL))
133 CActiveScheduler::Start();
134 if(iError != KErrNone)
136 INFO_PRINTF2(_L("Prepare callback : error %d"), iError);
142 iError = KErrTimedOut;
144 INFO_PRINTF1(_L("CVideoRecorderUtility: Record"));
145 // Wait for init callback
146 CActiveScheduler::Start();
147 if(iError == KErrNone)
162 INFO_PRINTF1(_L("CVideoRecorderUtility: Destroy"));
163 CleanupStack::PopAndDestroy(3, &fs);
165 User::After(KOneSecond); // wait for deletion to shut down devsound
166 if(iError != KErrNone && ret != EPass)
168 ERR_PRINTF2( _L("CVideoRecorderUtility reported error %d"),iError );