diff -r 62e6d990246c -r 809df41c314e usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbtimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usbengines/usbotgwatcher/tsrc/UsbOtgWatcherTest/src/mockcusbtimer.cpp Wed Aug 18 10:48:20 2010 +0300 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include + +#include "stifassertmacros.h" + +#include "mockcusbtimer.h" + +#include "debug.h" + +CUsbTimer::CUsbTimer(MUsbTimerObserver& aObserver, TUsbTimerId aTimerId) : + iObserver(&aObserver), + iActive(EFalse), + iTimerId(aTimerId) + { + } + +CUsbTimer::~CUsbTimer() + { + LOG( ( "[USBOTGWATCHER]\tMockCUsbTimer::~CUsbTimer" ) ); + } + +void CUsbTimer::ConstructL() + { + } + +CUsbTimer* CUsbTimer::NewL(MUsbTimerObserver& anObserver, TUsbTimerId aTimerId) + { + LOG( ( "[USBOTGWATCHER]\tMockCUsbTimer::NewL" ) ); + + CUsbTimer* self = new ( ELeave ) CUsbTimer(anObserver, aTimerId); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); // pop self + return self; + } + +void CUsbTimer::After(TInt aMilliseconds) + { + LOG1 ( "[USBOTGWATCHER]\tMockCUsbTimer::After aMilliseconds %d", aMilliseconds); + iActive = ETrue; + } + +void CUsbTimer::Cancel() + { + } + +TBool CUsbTimer::IsActive() + { + return iActive; + } + +void CUsbTimer::TriggerTimerElapsedL() + { + //STIF_ASSERT_NOT_NULL(iObserver); + LOG1( "[USBOTGWATCHER]\tMockCUsbTimer::TriggerTimerElapsedL iObserver: %d", (iObserver ? 1 : 0 )); + LOG1( "[USBOTGWATCHER]\tMockCUsbTimer::TriggerTimerElapsedL iTimerId: %d", (iTimerId ? 1 : 0 )); + + iObserver->TimerElapsedL(iTimerId); + LOG( ( "[USBOTGWATCHER]\tMockCUsbTimer::TriggerTimerElapsedL" ) ); + iActive = EFalse; + }