Bug 1461028 [wpt PR 10970] - [MSE] Stop firing 'stalled' event., a=testonly
authorchcunningham <chcunningham@chromium.org>
Wed, 06 Jun 2018 16:24:45 +0000
changeset 422199 6489b0fa1d0384b2b8ca8b8e297a769fa3b0ff33
parent 422198 6e557626edd0235fd17e45705cf04d8f26d119f4
child 422200 40b0534b922cef4f2efd867f172c6f536df28041
push id34122
push userebalazs@mozilla.com
push dateMon, 11 Jun 2018 09:37:00 +0000
treeherdermozilla-central@9941eb8c3b29 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1461028, 10970, 517240, 836951, 982564, 562371
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1461028 [wpt PR 10970] - [MSE] Stop firing 'stalled' event., a=testonly Automatic update from web-platform-tests[MSE] Stop firing 'stalled' event. See Intent to Deprecate https://groups.google.com/a/chromium.org/d/msg/blink-dev/x54XtrTyOP8/4-5QZlZzDAAJ MSE's resource is considered 'local' (we don't manage the donwload - the app does), so the HTML5 spec text around firing 'stalled' does not apply. See discussion in https://crbug.com/517240 No change to 'stalled' event for 'remote' (src="somefile.webm") resources. This CL also stops delaying the 'load' event for deferred media player Load() execution. Load() may be deferred for an arbitrary number of seconds, so we should not hold up the window's 'load' event. Prior to this change, 'stalled' was serving the unintended roll of unblocking the the 'load' event for deferred load()s that took > 3 seconds. With stall now removed for MSE, this weird behavior was uncovered and remedied. Bug: 517240, 836951 Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: I97f2bf972c79582d038e1215f5d630042656bd1c Reviewed-on: https://chromium-review.googlesource.com/982564 Commit-Queue: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Reviewed-by: Mounir Lamouri <mlamouri@chromium.org> Reviewed-by: Avi Drissman <avi@chromium.org> Reviewed-by: Luke Halliwell <halliwell@chromium.org> Reviewed-by: Dale Curtis <dalecurtis@chromium.org> Reviewed-by: Matthew Wolenetz <wolenetz@chromium.org> Cr-Commit-Position: refs/heads/master@{#562371} -- wpt-commits: bf7e0602947d303a798f09e5b6bbc60b5a4e305d wpt-pr: 10970
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/media-source/mediasource-append-buffer.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -581988,17 +581988,17 @@
    "ce791120236e6304b41ba3c085a8f9164f6da4ca",
    "testharness"
   ],
   "media-source/mediasource-addsourcebuffer.html": [
    "34ba3bf54e410c5e5396ef69f256c1e3853dfe17",
    "testharness"
   ],
   "media-source/mediasource-append-buffer.html": [
-   "fed1254d64c59b625af9745bbffcf5788ac5906e",
+   "a29b47e56f3f3b963063ff2a8e9d41c05299e024",
    "testharness"
   ],
   "media-source/mediasource-appendbuffer-quota-exceeded.html": [
    "1d98e36fdc1d93444b5a9809774ed0ce58b8680b",
    "testharness"
   ],
   "media-source/mediasource-appendwindow.html": [
    "5a39b4e58a18a4d878e6b710e4506262c2335519",
--- a/testing/web-platform/tests/media-source/mediasource-append-buffer.html
+++ b/testing/web-platform/tests/media-source/mediasource-append-buffer.html
@@ -581,11 +581,42 @@
               mediaSource.removeSourceBuffer(sourceBuffer);
 
               assert_throws( { name: "InvalidStateError"} ,
                   function() { sourceBuffer.appendBuffer(mediaData); },
                   "appendBuffer() throws an exception when called after removeSourceBuffer().");
               test.done();
           }, "Test appending after removeSourceBuffer().");
 
+          mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+          {
+              // Media elements using MSE should not fire the stalled event. See discussion at
+              // https://github.com/w3c/media-source/issues/88#issuecomment-374406928
+              mediaElement.addEventListener("stalled", test.unreached_func("Unexpected 'stalled' event."));
+
+              // Prime the media element with initial appends.
+              var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
+              var mediaSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[0]);
+              test.expectEvent(sourceBuffer, "updateend", "initSegment append ended.");
+              sourceBuffer.appendBuffer(initSegment);
+              test.waitForExpectedEvents(function()
+              {
+                  assert_equals(mediaSource.readyState, "open", "readyState is open after init segment appended.");
+                  test.expectEvent(sourceBuffer, "updateend", "mediaSegment append ended.");
+                  sourceBuffer.appendBuffer(mediaSegment);
+              });
+
+              // Verify state and wait for the 'stalled' event.
+              test.waitForExpectedEvents(function()
+              {
+                  assert_equals(sourceBuffer.buffered.length, 1, "sourceBuffer has a buffered range");
+                  assert_equals(mediaSource.readyState, "open", "readyState is open after media segment appended.");
+
+                  // Set timeout to 4 seconds. This creates an opportunity for UAs to _improperly_ fire the stalled event.
+                  // For media elements doing progressive download (not MSE), stalled is thrown after ~3 seconds of the
+                  // download failing to progress.
+                  test.step_timeout(function() { test.done(); }, 4000);
+              });
+          }, "Test slow appending does not trigger stalled events.");
+
         </script>
     </body>
 </html>