Back out 6a5dcf166f09 (bug 836072) for build bustage

CLOSED TREE
This commit is contained in:
Phil Ringnalda 2013-02-07 21:35:08 -08:00
Родитель e3038bac91
Коммит 396989e0d1
2 изменённых файлов: 0 добавлений и 96 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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;
}