From 396989e0d12dc5521a21661cd60a18999f62cece Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Thu, 7 Feb 2013 21:35:08 -0800 Subject: [PATCH] Back out 6a5dcf166f09 (bug 836072) for build bustage CLOSED TREE --- content/media/AudioEventTimeline.h | 61 ------------------- .../compiledtest/TestAudioEventTimeline.cpp | 35 ----------- 2 files changed, 96 deletions(-) diff --git a/content/media/AudioEventTimeline.h b/content/media/AudioEventTimeline.h index a3c6354f6519..4b49ebf9becd 100644 --- a/content/media/AudioEventTimeline.h +++ b/content/media/AudioEventTimeline.h @@ -294,47 +294,6 @@ public: } private: - const Event* GetPreviousEvent(double aTime) const - { - const Event* previous = nullptr; - const Event* next = nullptr; - - bool bailOut = false; - for (unsigned i = 0; !bailOut && i < mEvents.Length(); ++i) { - switch (mEvents[i].mType) { - case Event::SetValue: - case Event::SetTarget: - case Event::LinearRamp: - case Event::ExponentialRamp: - if (aTime == mEvents[i].mTime) { - // Find the last event with the same time - do { - ++i; - } while (i < mEvents.Length() && - aTime == mEvents[i].mTime); - return &mEvents[i - 1]; - } - previous = next; - next = &mEvents[i]; - if (aTime < mEvents[i].mTime) { - bailOut = true; - } - break; - case Event::SetValueCurve: - // TODO: implement - break; - default: - MOZ_ASSERT(false, "unreached"); - } - } - // Handle the case where the time is past all of the events - if (!bailOut) { - previous = next; - } - - return previous; - } - void InsertEvent(const Event& aEvent, ErrorResult& aRv) { if (!aEvent.IsValid()) { @@ -365,26 +324,6 @@ private: } } - // Make sure that invalid values are not used for exponential curves - if (aEvent.mType == Event::ExponentialRamp) { - if (aEvent.mValue <= 0.f) { - aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR); - return; - } - const Event* previousEvent = GetPreviousEvent(aEvent.mTime); - if (previousEvent) { - if (previousEvent->mValue <= 0.f) { - aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR); - return; - } - } else { - if (mValue <= 0.f) { - aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR); - return; - } - } - } - for (unsigned i = 0; i < mEvents.Length(); ++i) { if (aEvent.mTime == mEvents[i].mTime) { if (aEvent.mType == mEvents[i].mType) { diff --git a/content/media/webaudio/compiledtest/TestAudioEventTimeline.cpp b/content/media/webaudio/compiledtest/TestAudioEventTimeline.cpp index b3b3399baaa3..24fb976e759a 100644 --- a/content/media/webaudio/compiledtest/TestAudioEventTimeline.cpp +++ b/content/media/webaudio/compiledtest/TestAudioEventTimeline.cpp @@ -70,12 +70,6 @@ public: return mRv; } - ErrorResultMock& operator=(nsresult aRv) - { - mRv = aRv; - return *this; - } - private: nsresult mRv; }; @@ -160,8 +154,6 @@ void TestInvalidEvents() is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned"); timeline.ExponentialRampToValueAtTime(-Infinity, 0.4, rv); is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned"); - timeline.ExponentialRampToValueAtTime(0, 0.5, rv); - is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned"); timeline.SetTargetAtTime(NaN, 0.4, 1.0, rv); is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned"); timeline.SetTargetAtTime(Infinity, 0.4, 1.0, rv); @@ -324,32 +316,6 @@ void TestSetTargetZeroTimeConstant() is(timeline.GetValueAtTime(10.f), 20.f, "Should get the correct value with timeConstant == 0"); } -void TestExponentialInvalidPreviousZeroValue() -{ - Timeline timeline(0.f); - - ErrorResultMock rv; - - timeline.ExponentialRampToValueAtTime(1.f, 1.0, rv); - is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned"); - timeline.SetValue(1.f); - rv = NS_OK; - timeline.ExponentialRampToValueAtTime(1.f, 1.0, rv); - is(rv, NS_OK, "Should succeed this time"); - timeline.CancelScheduledValues(0.0); - is(timeline.GetEventCount(), 0, "Should have no events scheduled"); - rv = NS_OK; - timeline.SetValueAtTime(0.f, 0.5, rv); - is(rv, NS_OK, "Should succeed"); - timeline.ExponentialRampToValueAtTime(1.f, 1.0, rv); - is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned"); - timeline.CancelScheduledValues(0.0); - is(timeline.GetEventCount(), 0, "Should have no events scheduled"); - rv = NS_OK; - timeline.ExponentialRampToValueAtTime(1.f, 1.0, rv); - is(rv, NS_OK, "Should succeed this time"); -} - int main() { ScopedXPCOM xpcom("TestAudioEventTimeline"); @@ -371,7 +337,6 @@ int main() TestLinearRampAtSameTime(); TestExponentialRampAtSameTime(); TestSetTargetZeroTimeConstant(); - TestExponentialInvalidPreviousZeroValue(); return gFailCount > 0; }