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 "OpenFileByHandle1511.h"
24 CTestMmfVclntOpenFile1511::CTestMmfVclntOpenFile1511(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 CTestMmfVclntOpenFile1511* CTestMmfVclntOpenFile1511::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aRec)
37 CTestMmfVclntOpenFile1511* self = new (ELeave) CTestMmfVclntOpenFile1511(aTestName,aSectName,aKeyName,aRec);
41 CTestMmfVclntOpenFile1511* CTestMmfVclntOpenFile1511::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aRec)
43 CTestMmfVclntOpenFile1511* self = CTestMmfVclntOpenFile1511::NewL(aTestName,aSectName,aKeyName,aRec);
44 CleanupStack::PushL(self);
48 void CTestMmfVclntOpenFile1511::MvruoOpenComplete(TInt aError)
51 INFO_PRINTF1(_L("Open complete callback"));
52 CActiveScheduler::Stop();
55 void CTestMmfVclntOpenFile1511::MvruoRecordComplete(TInt aError)
58 INFO_PRINTF1(_L("Record complete callback"));
59 CActiveScheduler::Stop();
62 void CTestMmfVclntOpenFile1511::MvruoPrepareComplete(TInt aError)
65 INFO_PRINTF1(_L("Prepare complete callback"));
66 CActiveScheduler::Stop();
69 void CTestMmfVclntOpenFile1511::MvruoEvent(const TMMFEvent& /*aEvent*/)
74 * Load and initialise an audio file.
76 TVerdict CTestMmfVclntOpenFile1511::DoTestStepL()
78 return( PerformTestStepL() );
81 #define KMmfInvalidVideoTestControllerUid 0xA0A0A0A0
83 TVerdict CTestMmfVclntOpenFile1511::PerformTestStepL()
87 INFO_PRINTF1(_L("Test : Video Recorder - OpenFileL(RFile&)"));
92 User::LeaveIfError(fs.Connect());
93 CleanupClosePushL(fs);
94 User::LeaveIfError(fs.ShareProtected());
96 iError = KErrTimedOut;
99 if(!GetStringFromConfig(iSectName,iKeyName,filename))
101 return EInconclusive;
104 User::LeaveIfError(file.Replace(fs,filename,EFileWrite));
105 CleanupClosePushL(file);
107 CVideoRecorderUtility* rec = CVideoRecorderUtility::NewL(*this);
108 CleanupStack::PushL(rec);
110 const TUid KVidTstControllerUid = {KMmfInvalidVideoTestControllerUid};
111 TRAP(iError,rec->OpenFileL(file,
113 KVidTstControllerUid,
114 KUidMdaBmpClipFormat,
116 KMMFFourCCCodeNULL));
118 if(iError == KErrNone)
120 INFO_PRINTF1(_L("CVideoRecorderUtility: Open file"));
121 // Wait for initialisation callback
122 CActiveScheduler::Start();
125 // controller with supplied UID should not be found
126 if(iError == KErrNotFound)
132 if ((iError == KErrNone) && (rec != NULL))
135 CActiveScheduler::Start();
136 if(iError != KErrNone)
138 INFO_PRINTF2(_L("Prepare callback : error %d"), iError);
144 iError = KErrTimedOut;
146 INFO_PRINTF1(_L("CVideoRecorderUtility: Record"));
147 // Wait for init callback
148 CActiveScheduler::Start();
149 if(iError == KErrNone)
160 INFO_PRINTF1(_L("CVideoRecorderUtility: Destroy"));
161 User::After(KOneSecond); // wait for deletion to shut down devsound
162 if(iError != KErrNone)
164 ERR_PRINTF2( _L("CVideoRecorderUtility reported error %d"),iError );
167 CleanupStack::PopAndDestroy(3, &fs);