First public contribution.
2 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
3 // All rights reserved.
4 // This component and the accompanying materials are made available
5 // under the terms of "Eclipse Public License v1.0"
6 // which accompanies this distribution, and is available
7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 // Initial Contributors:
10 // Nokia Corporation - initial contribution.
15 // This program is designed the test of the MMF_VCLNT.
20 @file TSI_MMFVCLNT.cpp
23 #include "TSI_MMFVCLNT.h"
26 TInt CVideoCallbackHandler::ID()
31 void CVideoCallbackHandler::MvpuoOpenComplete(TInt aError)
33 iMchObserver->MchoComplete(ID(),aError);
36 void CVideoCallbackHandler::MvpuoFrameReady(CFbsBitmap& /*aFrame*/)
38 iMchObserver->MchoComplete(ID(),0);
41 void CVideoCallbackHandler::MvpuoPlayComplete(TInt aError)
43 iMchObserver->MchoComplete(ID(),aError);
46 CVideoRecorderCallbackHandler::CVideoRecorderCallbackHandler(const TInt aID, MCallbackHandlerObserver* aMchObserver)
47 : iMchObserver(aMchObserver)
51 TInt CVideoRecorderCallbackHandler::ID()
56 void CVideoRecorderCallbackHandler::MvruoOpenComplete(TInt aError)
58 iMchObserver->MchoComplete(ID(),aError);
61 void CVideoRecorderCallbackHandler::MvruoRecordComplete(TInt aError)
63 iMchObserver->MchoComplete(ID(),aError);
69 void CTestMmfVclntStep::WaitWithTimeout(TRequestStatus& aStatus, TInt aNumberOfMicroSeconds)
71 TRequestStatus timerStatus;
74 timer.After(timerStatus,aNumberOfMicroSeconds);
76 User::WaitForRequest(aStatus, timerStatus);
77 if (timerStatus == KRequestPending)
80 User::WaitForRequest(timerStatus);
84 INFO_PRINTF1(_L("Time is over!!!")) ;
90 * Time comparison utility function
92 * @param "const TUint aActual"
93 * The actual timer value produced
94 * @param "const TUint aExpected"
95 * Expected timer value
96 * @param "const TUint aDeviation"
97 * Allowed deviation of the expected value
98 * from the actual value.
100 * Did actual timed value fall within deviation limits
102 TBool CTestMmfVclntStep::TimeComparison(const TUint aActual, const TUint aExpected, const TUint aDeviation)
104 // save unnessary conditions
105 if(aActual == aExpected)
108 // Prevent unsigned wrapping errors
110 if(aActual > aExpected)
111 difference = aActual - aExpected;
113 difference = aExpected - aActual;
116 if(difference < aDeviation)
122 * Test Preample routines.
124 * Creates our own Active Scheduler.
127 * Did Preamble complete.
129 TVerdict CTestMmfVclntStep::DoTestStepPreambleL()
131 iActiveScheduler = new(ELeave) CActiveScheduler;
132 CActiveScheduler::Install(iActiveScheduler);
138 * Test Postample routines.
140 * Destroys our Active Scheduler.
143 * Did Postamble complete.
145 TVerdict CTestMmfVclntStep::DoTestStepPostambleL()
147 delete iActiveScheduler;
148 iActiveScheduler = NULL;
158 * CTestMMFVCLNTStep Implementation
160 CTestMmfVclntStep::CTestMmfVclntStep()
161 :iActiveScheduler( NULL )
164 CTestMmfVclntStep::~CTestMmfVclntStep()
168 void CTestMmfVclntStep::InitWservL()
170 TInt err = iWs.Connect();
173 // Access violation if ws is null
174 INFO_PRINTF1(_L("Cannot test, no window server available"));
178 iScreen = new (ELeave) CWsScreenDevice(iWs); // make device for this session
179 User::LeaveIfError(iScreen->Construct()); // and complete its construction
181 RWindowGroup rootWindow = RWindowGroup(iWs);
182 User::LeaveIfError(rootWindow.Construct((TUint32)this, ETrue));
184 iWindow = new(ELeave) RWindow(iWs);
185 User::LeaveIfError(((RWindow*)iWindow)->Construct(rootWindow,((TUint32)(this)) + 1));
186 iWindow->SetExtent(TPoint(0,0), TSize(100,100));
187 iWindow->SetVisible(ETrue);