Bug 1421091 - Rename the test so that it can be run using a gtest filter. r?jya draft
authorPaul Adenot <paul@paul.cx>
Fri, 13 Jul 2018 15:04:34 +0200
changeset 817813 de4a87be9a56b2a9dbf4cf4b393b8ad9b12db7d3
parent 817812 a2ae07f5128ea5934abf048aca03f97620d1591d
push id116168
push userpaul@paul.cx
push dateFri, 13 Jul 2018 13:16:43 +0000
reviewersjya
bugs1421091
milestone63.0a1
Bug 1421091 - Rename the test so that it can be run using a gtest filter. r?jya MozReview-Commit-ID: 9pcjSWfh4kp
dom/media/webaudio/gtest/TestAudioEventTimeline.cpp
testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-channels.html
--- a/dom/media/webaudio/gtest/TestAudioEventTimeline.cpp
+++ b/dom/media/webaudio/gtest/TestAudioEventTimeline.cpp
@@ -88,17 +88,17 @@ public:
   }
 
 private:
   nsresult mRv;
 };
 
 typedef AudioEventTimeline Timeline;
 
-TEST(AudioEventTimeline, SpecExample)
+TEST(TestAudioEventTimeline, SpecExample)
 {
   // First, run the basic tests
   Timeline timeline(10.0f);
   is(timeline.Value(), 10.0f, "Correct default value returned");
 
   ErrorResultMock rv;
 
   uint32_t curveLength = 44100;
@@ -149,17 +149,17 @@ TEST(AudioEventTimeline, SpecExample)
   is(timeline.GetValueAtTime(0.65), (0.75f * powf(0.05f / 0.75f, 0.5f)), "Correct value");
   is(timeline.GetValueAtTime(0.7), 0.0f, "Correct value");
   is(timeline.GetValueAtTime(0.85), 1.0f, "Correct value");
   is(timeline.GetValueAtTime(1.0), curve[curveLength - 1], "Correct value");
 
   delete[] curve;
 }
 
-TEST(AudioEventTimeline, InvalidEvents)
+TEST(TestAudioEventTimeline, InvalidEvents)
 {
   static_assert(numeric_limits<float>::has_quiet_NaN, "Platform must have a quiet NaN");
   const float NaN = numeric_limits<float>::quiet_NaN();
   const float Infinity = numeric_limits<float>::infinity();
   Timeline timeline(10.0f);
 
   float curve[] = { -1.0f, 0.0f, 1.0f };
 
@@ -208,17 +208,17 @@ TEST(AudioEventTimeline, InvalidEvents)
   timeline.SetValueCurveAtTime(curve, ArrayLength(curve), 1.0, NaN, rv);
   is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
   timeline.SetValueCurveAtTime(curve, ArrayLength(curve), 1.0, Infinity, rv);
   is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
   timeline.SetValueCurveAtTime(curve, ArrayLength(curve), 1.0, -Infinity, rv);
   is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
 }
 
-TEST(AudioEventTimeline, EventReplacement)
+TEST(TestAudioEventTimeline, EventReplacement)
 {
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   is(timeline.GetEventCount(), 0u, "No events yet");
   timeline.SetValueAtTime(10.0f, 0.1, rv);
   is(timeline.GetEventCount(), 1u, "One event scheduled now");
@@ -227,17 +227,17 @@ TEST(AudioEventTimeline, EventReplacemen
   is(timeline.GetEventCount(), 1u, "Event should be replaced");
   is(timeline.GetValueAtTime(0.1), 20.0f, "The first event should be overwritten");
   timeline.LinearRampToValueAtTime(30.0f, 0.1, rv);
   is(rv, NS_OK, "Event scheduling should be successful");
   is(timeline.GetEventCount(), 2u, "Different event type should be appended");
   is(timeline.GetValueAtTime(0.1), 30.0f, "The first event should be overwritten");
 }
 
-TEST(AudioEventTimeline, EventRemoval)
+TEST(TestAudioEventTimeline, EventRemoval)
 {
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   timeline.SetValueAtTime(10.0f, 0.1, rv);
   timeline.SetValueAtTime(15.0f, 0.15, rv);
   timeline.SetValueAtTime(20.0f, 0.2, rv);
@@ -248,77 +248,77 @@ TEST(AudioEventTimeline, EventRemoval)
   timeline.CancelScheduledValues(0.3);
   is(timeline.GetEventCount(), 3u, "Should successfully delete one event");
   timeline.CancelScheduledValues(0.12);
   is(timeline.GetEventCount(), 1u, "Should successfully delete two events");
   timeline.CancelAllEvents();
   ok(timeline.HasSimpleValue(), "No event should remain scheduled");
 }
 
-TEST(AudioEventTimeline, BeforeFirstEventSetValue)
+TEST(TestAudioEventTimeline, BeforeFirstEventSetValue)
 {
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   timeline.SetValueAtTime(20.0f, 1.0, rv);
   is(timeline.GetValueAtTime(0.5), 10.0f, "Retrun the default value before the first event");
 }
 
-TEST(AudioEventTimeline, BeforeFirstEventSetTarget)
+TEST(TestAudioEventTimeline, BeforeFirstEventSetTarget)
 {
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   timeline.SetTargetAtTime(20.0f, 1.0, 5.0, rv);
   is(timeline.GetValueAtTime(0.5), 10.0f, "Retrun the default value before the first event");
 }
 
-TEST(AudioEventTimeline, BeforeFirstEventLinearRamp)
+TEST(TestAudioEventTimeline, BeforeFirstEventLinearRamp)
 {
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   timeline.LinearRampToValueAtTime(20.0f, 1.0, rv);
   is(timeline.GetValueAtTime(0.5), 10.0f, "Retrun the default value before the first event");
 }
 
-TEST(AudioEventTimeline, BeforeFirstEventExponentialRamp)
+TEST(TestAudioEventTimeline, BeforeFirstEventExponentialRamp)
 {
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   timeline.ExponentialRampToValueAtTime(20.0f, 1.0, rv);
   is(timeline.GetValueAtTime(0.5), 10.0f, "Retrun the default value before the first event");
 }
 
-TEST(AudioEventTimeline, AfterLastValueEvent)
+TEST(TestAudioEventTimeline, AfterLastValueEvent)
 {
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   timeline.SetValueAtTime(20.0f, 1.0, rv);
   is(timeline.GetValueAtTime(1.5), 20.0f, "Return the last value after the last SetValue event");
 }
 
-TEST(AudioEventTimeline, AfterLastTargetValueEvent)
+TEST(TestAudioEventTimeline, AfterLastTargetValueEvent)
 {
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   timeline.SetTargetAtTime(20.0f, 1.0, 5.0, rv);
   is(timeline.GetValueAtTime(10.), (20.f + (10.f - 20.f) * expf(-9.0f / 5.0f)), "Return the value after the last SetTarget event based on the curve");
 }
 
-TEST(AudioEventTimeline, AfterLastTargetValueEventWithValueSet)
+TEST(TestAudioEventTimeline, AfterLastTargetValueEventWithValueSet)
 {
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   timeline.SetValue(50.f);
   timeline.SetTargetAtTime(20.0f, 1.0, 5.0, rv);
 
@@ -328,85 +328,85 @@ TEST(AudioEventTimeline, AfterLastTarget
   // previous times.
   for (double i = 0.0; i < 9.99; i+=0.01) {
     timeline.GetValueAtTime(i);
   }
 
   is(timeline.GetValueAtTime(10.), (20.f + (50.f - 20.f) * expf(-9.0f / 5.0f)), "Return the value after SetValue and the last SetTarget event based on the curve");
 }
 
-TEST(AudioEventTimeline, Value)
+TEST(TestAudioEventTimeline, Value)
 {
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   is(timeline.Value(), 10.0f, "value should initially match the default value");
   timeline.SetValue(20.0f);
   is(timeline.Value(), 20.0f, "Should be able to set the value");
   timeline.SetValueAtTime(20.0f, 1.0, rv);
   // TODO: The following check needs to change when we compute the value based on the current time of the context
   is(timeline.Value(), 20.0f, "TODO...");
   timeline.SetValue(30.0f);
   is(timeline.Value(), 20.0f, "Should not be able to set the value");
 }
 
-TEST(AudioEventTimeline, LinearRampAtZero)
+TEST(TestAudioEventTimeline, LinearRampAtZero)
 {
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   timeline.LinearRampToValueAtTime(20.0f, 0.0, rv);
   is(timeline.GetValueAtTime(0.0), 20.0f, "Should get the correct value when t0 == t1 == 0");
 }
 
-TEST(AudioEventTimeline, ExponentialRampAtZero)
+TEST(TestAudioEventTimeline, ExponentialRampAtZero)
 {
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   timeline.ExponentialRampToValueAtTime(20.0f, 0.0, rv);
   is(timeline.GetValueAtTime(0.0), 20.0f, "Should get the correct value when t0 == t1 == 0");
 }
 
-TEST(AudioEventTimeline, LinearRampAtSameTime)
+TEST(TestAudioEventTimeline, LinearRampAtSameTime)
 {
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   timeline.SetValueAtTime(5.0f, 1.0, rv);
   timeline.LinearRampToValueAtTime(20.0f, 1.0, rv);
   is(timeline.GetValueAtTime(1.0), 20.0f, "Should get the correct value when t0 == t1");
 }
 
-TEST(AudioEventTimeline, ExponentialRampAtSameTime)
+TEST(TestAudioEventTimeline, ExponentialRampAtSameTime)
 {
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   timeline.SetValueAtTime(5.0f, 1.0, rv);
   timeline.ExponentialRampToValueAtTime(20.0f, 1.0, rv);
   is(timeline.GetValueAtTime(1.0), 20.0f, "Should get the correct value when t0 == t1");
 }
 
-TEST(AudioEventTimeline, SetTargetZeroTimeConstant)
+TEST(TestAudioEventTimeline, SetTargetZeroTimeConstant)
 {
   Timeline timeline(10.0f);
 
   ErrorResultMock rv;
 
   timeline.SetTargetAtTime(20.0f, 1.0, 0.0, rv);
   is(timeline.GetValueAtTime(1.0), 20.0f, "Should get the correct value when t0 == t1");
 }
 
-TEST(AudioEventTimeline, ExponentialInvalidPreviousZeroValue)
+TEST(TestAudioEventTimeline, ExponentialInvalidPreviousZeroValue)
 {
   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);
@@ -422,17 +422,17 @@ TEST(AudioEventTimeline, ExponentialInva
   is(rv, NS_ERROR_DOM_SYNTAX_ERR, "Correct error code returned");
   timeline.CancelScheduledValues(0.0);
   is(timeline.GetEventCount(), 0u, "Should have no events scheduled");
   rv = NS_OK;
   timeline.ExponentialRampToValueAtTime(1.f, 1.0, rv);
   is(rv, NS_OK, "Should succeed this time");
 }
 
-TEST(AudioEventTimeline, SettingValueCurveTwice)
+TEST(TestAudioEventTimeline, SettingValueCurveTwice)
 {
   Timeline timeline(0.f);
   float curve[] = { -1.0f, 0.0f, 1.0f };
 
   ErrorResultMock rv;
 
   timeline.SetValueCurveAtTime(curve, ArrayLength(curve), 0.0f, 0.3f, rv);
   timeline.SetValueCurveAtTime(curve, ArrayLength(curve), 0.0f, 0.3f, rv);
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-channels.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/audiobuffersource-channels.html
@@ -23,17 +23,17 @@
           },
           function(task, should) {
             context = new AudioContext();
             source = context.createBufferSource();
 
             // Make sure we can't set to something which isn't an AudioBuffer.
             should(function() {
               source.buffer = 57;
-            }, 'source.buffer = 57').throw('TypeError');
+            }, 'source.buffer = 57').throw(TypeError);
 
             // It's ok to set the buffer to null.
             should(function() {
               source.buffer = null;
             }, 'source.buffer = null').notThrow();
 
             // Set the buffer to a valid AudioBuffer
             let buffer =
@@ -42,28 +42,28 @@
             should(function() {
               source.buffer = buffer;
             }, 'source.buffer = buffer').notThrow();
 
             // The buffer has been set; we can't set it again.
             should(function() {
               source.buffer =
                   new AudioBuffer({length: 128, sampleRate: context.sampleRate})
-            }, 'source.buffer = new buffer').throw('InvalidStateError');
+            }, 'source.buffer = new buffer').throw(InvalidStateError);
 
             // The buffer has been set; it's ok to set it to null.
             should(function() {
               source.buffer = null;
             }, 'source.buffer = null again').notThrow();
 
             // The buffer was already set (and set to null).  Can't set it
             // again.
             should(function() {
               source.buffer = buffer;
-            }, 'source.buffer = buffer again').throw('InvalidStateError');
+            }, 'source.buffer = buffer again').throw(InvalidStateError);
 
             // But setting to null is ok.
             should(function() {
             }, 'source.buffer = null after setting to null').notThrow();
 
             // Check that mono buffer can be set.
             should(function() {
               let monoBuffer =