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 "TestRecord.h"
17 #include "OpenFileByHandle0523.h"
24 CTestMmfVclntOpenFile0523::CTestMmfVclntOpenFile0523(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 CTestMmfVclntOpenFile0523* CTestMmfVclntOpenFile0523::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aRec)
37 CTestMmfVclntOpenFile0523* self = new (ELeave) CTestMmfVclntOpenFile0523(aTestName,aSectName,aKeyName,aRec);
41 CTestMmfVclntOpenFile0523* CTestMmfVclntOpenFile0523::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aRec)
43 CTestMmfVclntOpenFile0523* self = CTestMmfVclntOpenFile0523::NewL(aTestName,aSectName,aKeyName,aRec);
44 CleanupStack::PushL(self);
48 void CTestMmfVclntOpenFile0523::MvruoOpenComplete(TInt aError)
51 INFO_PRINTF1(_L("Open complete callback"));
52 CActiveScheduler::Stop();
55 void CTestMmfVclntOpenFile0523::MvruoRecordComplete(TInt aError)
58 INFO_PRINTF1(_L("Record complete callback"));
59 CActiveScheduler::Stop();
62 void CTestMmfVclntOpenFile0523::MvruoPrepareComplete(TInt aError)
65 INFO_PRINTF1(_L("Prepare complete callback"));
66 CActiveScheduler::Stop();
69 void CTestMmfVclntOpenFile0523::MvruoEvent(const TMMFEvent& /*aEvent*/)
74 * Load and initialise an audio file.
76 TVerdict CTestMmfVclntOpenFile0523::DoTestStepL()
78 return( PerformTestStepL() );
81 TVerdict CTestMmfVclntOpenFile0523::PerformTestStepL()
85 INFO_PRINTF1(_L("Test : Video Recorder - OpenFileL(RFile&)"));
90 User::LeaveIfError(fs.Connect());
91 CleanupClosePushL(fs);
92 User::LeaveIfError(fs.ShareProtected());
94 iError = KErrTimedOut;
97 if(!GetStringFromConfig(iSectName,iKeyName,filename))
102 User::LeaveIfError(file.Replace(fs,filename,EFileWrite));
103 CleanupClosePushL(file);
105 CVideoRecorderUtility* rec = CVideoRecorderUtility::NewL(*this);
106 CleanupStack::PushL(rec);
108 const TUid KVidTstControllerUid = {KMmfVideoTestControllerUid};
109 TRAP(iError,rec->OpenFileL(file,
111 KVidTstControllerUid,
112 KUidMdaBmpClipFormat,
114 KMMFFourCCCodeNULL));
116 if(iError == KErrNone)
118 INFO_PRINTF1(_L("CVideoRecorderUtility: Open file"));
119 // Wait for initialisation callback
120 CActiveScheduler::Start();
123 if(iError == KErrNotSupported)
129 if ((iError == KErrNone) && (rec != NULL))
132 CActiveScheduler::Start();
133 if(iError != KErrNone)
135 INFO_PRINTF2(_L("Prepare callback : error %d"), iError);
136 return EInconclusive;
141 iError = KErrTimedOut;
143 INFO_PRINTF1(_L("CVideoRecorderUtility: Record"));
144 // Wait for init callback
145 CActiveScheduler::Start();
146 if(iError == KErrNone)
159 INFO_PRINTF1(_L("CVideoRecorderUtility: Destroy"));
160 User::After(KOneSecond); // wait for deletion to shut down devsound
161 if(iError != KErrNone)
163 ERR_PRINTF2( _L("CVideoRecorderUtility failed with error %d"),iError );
166 CleanupStack::PopAndDestroy(3,&fs);