Bug 1286810: [MSE] P6. Add webref test ensuring new spec compliance. r=gerald,f=jgraham
authorJean-Yves Avenard <jyavenard@mozilla.com>
Sat, 16 Jul 2016 13:29:33 +1000
changeset 330702 9afc48ae820f812a04d31e64986b8a246042022c
parent 330701 6cdbb75807feef48ccd71b841a79757e349f91ea
child 330703 ba2d3f87a3b9fcbd186224ab35726724cd33ff30
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1286810
milestone50.0a1
Bug 1286810: [MSE] P6. Add webref test ensuring new spec compliance. r=gerald,f=jgraham MozReview-Commit-ID: 2ZyjR2J8o3h
testing/web-platform/tests/media-source/mediasource-duration.html
--- a/testing/web-platform/tests/media-source/mediasource-duration.html
+++ b/testing/web-platform/tests/media-source/mediasource-duration.html
@@ -231,11 +231,37 @@
                   test.waitForExpectedEvents(function()
                   {
                       mediaElement.removeEventListener('durationchange', durationchangeEventHandler);
                       assert_equals(durationchangeEventCounter, expectedDurationChangeEventCount, 'durationchanges');
                       test.done();
                   });
               });
           }, 'Test setting same duration multiple times does not fire duplicate durationchange');
+
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+              assert_greater_than(segmentInfo.duration, 2, 'Sufficient test media duration');
+
+              var fullDuration = segmentInfo.duration;
+              var newDuration = fullDuration / 2;
+
+              // Append all the segments
+              test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
+              test.expectEvent(mediaElement, 'loadedmetadata', 'mediaElement');
+              sourceBuffer.appendBuffer(mediaData);
+
+              test.waitForExpectedEvents(function()
+              {
+                  assert_false(sourceBuffer.updating, "updating");
+
+                  assert_throws("InvalidStateError", function()
+                  {
+                      mediaSource.duration = newDuration;
+                  }, "duration");
+
+                  test.done();
+              });
+          }, 'Test setting the duration to less than the highest starting presentation timestamp will throw');
+
         </script>
     </body>
 </html>