Bug 1496889 [wpt PR 13403] - Minimize <video> dependency in `test_driver.bless` test, a=testonly
authorPhilip Jägenstedt <philip@foolip.org>
Thu, 11 Oct 2018 09:31:22 +0000
changeset 496766 113102643432c772f228e02246a2f7d606abe725
parent 496765 b963411533d980a9ab8115d401f44fe590c2caee
child 496767 5ea03aea88463dd69bd1dfd838b6aee1506d89dc
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)
reviewerstestonly
bugs1496889, 13403, 12621
milestone64.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 1496889 [wpt PR 13403] - Minimize <video> dependency in `test_driver.bless` test, a=testonly Automatic update from web-platform-testsMinimize <video> dependency in `test_driver.bless` test (#13403) See diagnosis of Safari Technology Preview failure: https://github.com/web-platform-tests/wpt/issues/12621#issuecomment-427525317 This test does not need to load any media resource or consider the state of the returned promise. -- wpt-commits: 21c33fe4cc3963faa4b38ab19e47660fa72c122f wpt-pr: 13403
testing/web-platform/tests/infrastructure/testdriver/bless.html
--- a/testing/web-platform/tests/infrastructure/testdriver/bless.html
+++ b/testing/web-platform/tests/infrastructure/testdriver/bless.html
@@ -13,26 +13,36 @@ promise_test(() => {
   </script>
 </head>
 <body>
 <script>
 // At the time of this writing, the only standard requirement for user
 // activation concerns the interaction between iframe elements and their parent
 // browsing contexts [1]. Because testdriver.js currently cannot operate within
 // an iframe, the standard requirement cannot be used to verify the correctness
-// of the `bless` method. Instead, rely on the non-standard restriction on
-// unattended media playback. Browsers which do not implement such a
-// restriction will pass this test spuriously.
+// of the `bless` method. Instead, rely on the optional behavior of early exit
+// and rejecting in `video.play()` if the media is not "allowed to play". [2]
+// Browsers which don't implement this will pass this test spuriously.
 //
 // [1] https://html.spec.whatwg.org/multipage/origin.html#attr-iframe-sandbox-allow-top-navigation-by-user-activation
-promise_test(() => {
+// [2] https://html.spec.whatwg.org/multipage/media.html#allowed-to-play
+promise_test(t => {
   const video = document.createElement('video');
-  video.setAttribute('src', '/media/counting.ogv');
   document.body.appendChild(video);
-  return test_driver.bless('start video playback', () => video.play())
+  t.add_cleanup(() => video.remove());
+  return test_driver.bless('start video playback', () => {
+    // `paused` changes before `play()` returns when "allowed to play", so the
+    // promise, if any, is ignored.
+    assert_true(video.paused);
+    const playPromise = video.play();
+    assert_false(video.paused);
+    if (playPromise) {
+      playPromise.catch(() => {});
+    }
+  });
 }, 'user activation');
 
 promise_test(() => {
   return test_driver.bless('demonstrates return value without action')
     .then((value) => {
       assert_equals(value, undefined);
     });
 }, 'no action function provided');