Bug 1498058 [wpt PR 13361] - Fix media element field behavior when playing MediaStreams, a=testonly
authorGuido Urdaneta <guidou@chromium.org>
Sat, 13 Oct 2018 19:30:50 +0000
changeset 496872 233aa69683c689c63bfbf37ff7db1ad7bb37290e
parent 496871 a3897f2c7cfdefc175f15219b9111700c01478bf
child 496873 1c6be9d4a3698eeaeb056c611b196d7d8bcc5f45
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1498058, 13361, 892114, 1261445, 598566
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 1498058 [wpt PR 13361] - Fix media element field behavior when playing MediaStreams, a=testonly Automatic update from web-platform-testsFix media element field behavior when playing MediaStreams Set operations for the preload, defaultPlaybackRate and playbackRate fields should be ignored when the media element is playing a MediaStream. In addition, the preload field must always return "none", and defaultPlaybackRate and playbackRate must both return 1. See https://w3c.github.io/mediacapture-main/#mediastreams-in-media-elements Bug: 892114 Change-Id: Id50e557056b9501330bb753535e2cbdb80fc4667 Reviewed-on: https://chromium-review.googlesource.com/c/1261445 Commit-Queue: Guido Urdaneta <guidou@chromium.org> Reviewed-by: Mounir Lamouri <mlamouri@chromium.org> Cr-Commit-Position: refs/heads/master@{#598566} -- wpt-commits: 245cb5053c3a6152a0dd374d684d09a169dc18fe wpt-pr: 13361
--- a/testing/web-platform/tests/mediacapture-streams/MediaStream-MediaElement-srcObject.https.html
+++ b/testing/web-platform/tests/mediacapture-streams/MediaStream-MediaElement-srcObject.https.html
@@ -23,25 +23,36 @@ const vid = document.getElementById("vid
 promise_test(async t => {
   const wait = ms => new Promise(r => t.step_timeout(r, ms));
   const timeout = (promise, time, msg) =>
     Promise.race([promise, wait(time).then(() => Promise.reject(new Error(msg)))]);
   const stream = await timeout(navigator.mediaDevices.getUserMedia({video: true}), 10000, "getUserMedia timeout");
   t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
+  vid.defaultPlaybackRate = 0.4;
+  vid.playbackRate = 0.4;
+  vid.preload = "metadata";
   vid.srcObject = stream;
+  vid.onratechange = t.unreached_func('ratechange event must not be fired');
   assert_true(!vid.seeking, "A MediaStream is not seekable");
   assert_equals(vid.seekable.length, 0, "A MediaStream is not seekable");
   assert_equals(vid.defaultPlaybackRate, 1, "playback rate is always 1");
+  vid.defaultPlaybackRate = 0.5;
+  assert_equals(vid.defaultPlaybackRate, 1, "Setting defaultPlaybackRate must be ignored");
   assert_equals(vid.playbackRate, 1, "playback rate is always 1");
+  vid.playbackRate = 0.5;
+  assert_equals(vid.playbackRate, 1, "Setting playbackRate must be ignored");
   assert_equals(vid.buffered.length, 0, "A MediaStream cannot be preloaded.  Therefore, there is no buffered timeranges");
   assert_equals(vid.readyState, vid.HAVE_NOTHING, "readyState is HAVE_NOTHING initially");
   assert_equals(vid.duration, NaN, "A MediaStream does not have any duration initially.");
+  assert_equals(vid.preload, "none", "preload must always be none");
+  vid.preload = "metadata";
+  assert_equals(vid.preload, "none", "Setting preload must be ignored");
   const haveLoadedData = new Promise(r => vid.addEventListener("loadeddata", r, {once: true}));
   await new Promise(r => vid.addEventListener("timeupdate", r, {once: true}));
   assert_equals(vid.played.length, 1, "A MediaStream's timeline always consists of a single range");
   assert_equals(vid.played.start(0), 0, "A MediaStream's timeline always starts at zero");
   assert_equals(vid.played.end(0), vid.currentTime, "A MediaStream's end MUST return the last known currentTime, says mediacapture-main");
   assert_equals(vid.duration, Infinity, "A MediaStream does not have a pre-defined duration. ");