Bug 1497422 [wpt PR 13429] - [Picture-in-Picture] Use mp3/mp4 audio/video when appropriate in tests., a=testonly
authorFrançois Beaufort <beaufort.francois@gmail.com>
Thu, 11 Oct 2018 10:04:10 +0000
changeset 489298 6867ffea8e8058b9ed7503c38a13eabc56bf3204
parent 489297 b7ab99069b378041a5d7ba300e298d5a0755007b
child 489299 693b05802d989054d34e7ede25ae2f3b0443007d
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewerstestonly
bugs1497422, 13429, 1269862, 598458
milestone64.0a1
Bug 1497422 [wpt PR 13429] - [Picture-in-Picture] Use mp3/mp4 audio/video when appropriate in tests., a=testonly Automatic update from web-platform-tests[Picture-in-Picture] Use mp3/mp4 audio/video when appropriate in tests. This makes sures Picture-in-Picture tests use media elements that can load properly in Safari as ogv and oga files are not supported. Change-Id: I372f7d28f181b5a1fce0ad5807e9112dbbcd4fd9 Reviewed-on: https://chromium-review.googlesource.com/c/1269862 Reviewed-by: Mounir Lamouri <mlamouri@chromium.org> Commit-Queue: Fran├žois Beaufort <beaufort.francois@gmail.com> Cr-Commit-Position: refs/heads/master@{#598458} -- wpt-commits: 2ac8a23714d941c1a544f2b897a3c77f65425ae9 wpt-pr: 13429
testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html
testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy-attribute.https.sub.html
testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy.https.sub.html
testing/web-platform/tests/feature-policy/picture-in-picture-default-feature-policy.https.sub.html
testing/web-platform/tests/feature-policy/picture-in-picture-disabled-by-feature-policy.https.sub.html
testing/web-platform/tests/feature-policy/reporting/picture-in-picture-reporting.html
testing/web-platform/tests/feature-policy/resources/feature-policy-picture-in-picture.html
testing/web-platform/tests/feature-policy/resources/picture-in-picture.js
testing/web-platform/tests/picture-in-picture/disable-picture-in-picture.html
testing/web-platform/tests/picture-in-picture/enter-picture-in-picture.html
testing/web-platform/tests/picture-in-picture/exit-picture-in-picture.html
testing/web-platform/tests/picture-in-picture/idlharness.window.js
testing/web-platform/tests/picture-in-picture/leave-picture-in-picture.html
testing/web-platform/tests/picture-in-picture/picture-in-picture-element.html
testing/web-platform/tests/picture-in-picture/picture-in-picture-window.html
testing/web-platform/tests/picture-in-picture/request-picture-in-picture-twice.html
testing/web-platform/tests/picture-in-picture/request-picture-in-picture.html
testing/web-platform/tests/picture-in-picture/resources/picture-in-picture-helpers.js
testing/web-platform/tests/picture-in-picture/shadow-dom.html
--- a/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html
+++ b/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <body>
+  <script src=/common/media.js></script>
   <script src=/resources/testharness.js></script>
   <script src=/resources/testharnessreport.js></script>
   <script src=/resources/testdriver.js></script>
   <script src=/resources/testdriver-vendor.js></script>
   <script src=/feature-policy/resources/featurepolicy.js></script>
   <script src=/feature-policy/resources/picture-in-picture.js></script>
   <script>
   'use strict';
--- a/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy-attribute.https.sub.html
+++ b/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy-attribute.https.sub.html
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <body>
+  <script src=/common/media.js></script>
   <script src=/resources/testharness.js></script>
   <script src=/resources/testharnessreport.js></script>
   <script src=/resources/testdriver.js></script>
   <script src=/resources/testdriver-vendor.js></script>
   <script src=/feature-policy/resources/featurepolicy.js></script>
   <script src=/feature-policy/resources/picture-in-picture.js></script>
   <script>
   'use strict';
--- a/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy.https.sub.html
+++ b/testing/web-platform/tests/feature-policy/picture-in-picture-allowed-by-feature-policy.https.sub.html
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <body>
+  <script src=/common/media.js></script>
   <script src=/resources/testharness.js></script>
   <script src=/resources/testharnessreport.js></script>
   <script src=/resources/testdriver.js></script>
   <script src=/resources/testdriver-vendor.js></script>
   <script src=/feature-policy/resources/featurepolicy.js></script>
   <script src=/feature-policy/resources/picture-in-picture.js></script>
   <script>
   'use strict';
--- a/testing/web-platform/tests/feature-policy/picture-in-picture-default-feature-policy.https.sub.html
+++ b/testing/web-platform/tests/feature-policy/picture-in-picture-default-feature-policy.https.sub.html
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <body>
+  <script src=/common/media.js></script>
   <script src=/resources/testharness.js></script>
   <script src=/resources/testharnessreport.js></script>
   <script src=/resources/testdriver.js></script>
   <script src=/resources/testdriver-vendor.js></script>
   <script src=/feature-policy/resources/featurepolicy.js></script>
   <script src=/feature-policy/resources/picture-in-picture.js></script>
   <script>
   'use strict';
--- a/testing/web-platform/tests/feature-policy/picture-in-picture-disabled-by-feature-policy.https.sub.html
+++ b/testing/web-platform/tests/feature-policy/picture-in-picture-disabled-by-feature-policy.https.sub.html
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <body>
+  <script src=/common/media.js></script>
   <script src=/resources/testharness.js></script>
   <script src=/resources/testharnessreport.js></script>
   <script src=/resources/testdriver.js></script>
   <script src=/resources/testdriver-vendor.js></script>
   <script src=/feature-policy/resources/featurepolicy.js></script>
   <script src=/feature-policy/resources/picture-in-picture.js></script>
   <script>
   'use strict';
--- a/testing/web-platform/tests/feature-policy/reporting/picture-in-picture-reporting.html
+++ b/testing/web-platform/tests/feature-policy/reporting/picture-in-picture-reporting.html
@@ -1,11 +1,12 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <script src='/common/media.js'></script>
     <script src='/resources/testharness.js'></script>
     <script src='/resources/testharnessreport.js'></script>
     <script src="/resources/testdriver.js"></script>
     <script src="/resources/testdriver-vendor.js"></script>
   </head>
   <body>
     <script>
 const check_report_format = (reports, observer) => {
@@ -16,17 +17,17 @@ const check_report_format = (reports, ob
   assert_equals(report.body.sourceFile, document.location.href);
   assert_equals(typeof report.body.message, "string");
   assert_equals(typeof report.body.lineNumber, "number");
   assert_equals(typeof report.body.columnNumber, "number");
 };
 
 const loadVideo = () => new Promise(resolve => {
     const video = document.createElement('video');
-    video.src = '/media/movie_5.ogv';
+    video.src = getVideoURI('/media/movie_5');
     video.addEventListener('loadedmetadata', () => {
       resolve(video);
     }, { once: true });
 });
 
 promise_test(async (t) => {
   const report = new Promise(resolve => {
     new ReportingObserver((reports, observer) => resolve([reports, observer]),
--- a/testing/web-platform/tests/feature-policy/resources/feature-policy-picture-in-picture.html
+++ b/testing/web-platform/tests/feature-policy/resources/feature-policy-picture-in-picture.html
@@ -1,8 +1,9 @@
+<script src=/common/media.js></script>
 <script src=/feature-policy/resources/picture-in-picture.js></script>
 <script>
 'use strict';
 
 window.addEventListener('load', () => {
   isPictureInPictureAllowed().then(result => {
     window.parent.postMessage({ enabled: result }, '*');
   });
--- a/testing/web-platform/tests/feature-policy/resources/picture-in-picture.js
+++ b/testing/web-platform/tests/feature-policy/resources/picture-in-picture.js
@@ -1,15 +1,15 @@
 function isPictureInPictureAllowed() {
   if (!('pictureInPictureEnabled' in document))
     return Promise.resolve(false);
 
   return new Promise(resolve => {
     let video = document.createElement('video');
-    video.src = '/media/movie_5.ogv';
+    video.src = getVideoURI('/media/movie_5');
     video.onloadedmetadata = () => {
       video.requestPictureInPicture()
       .then(() => resolve(document.pictureInPictureEnabled))
       .catch(e => {
         if (e.name == 'NotAllowedError')
           resolve(document.pictureInPictureEnabled);
         else
           resolve(false);
--- a/testing/web-platform/tests/picture-in-picture/disable-picture-in-picture.html
+++ b/testing/web-platform/tests/picture-in-picture/disable-picture-in-picture.html
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <title>Test disable Picture-in-Picture</title>
+<script src="/common/media.js"></script>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="/resources/testdriver.js"></script>
 <script src="/resources/testdriver-vendor.js"></script>
 <script src="resources/picture-in-picture-helpers.js"></script>
 <body></body>
 <script>
 test(t => {
--- a/testing/web-platform/tests/picture-in-picture/enter-picture-in-picture.html
+++ b/testing/web-platform/tests/picture-in-picture/enter-picture-in-picture.html
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <title>Test enterpictureinpicture event</title>
+<script src="/common/media.js"></script>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="/resources/testdriver.js"></script>
 <script src="/resources/testdriver-vendor.js"></script>
 <script src="resources/picture-in-picture-helpers.js"></script>
 <body></body>
 <script>
 promise_test(async t => {
--- a/testing/web-platform/tests/picture-in-picture/exit-picture-in-picture.html
+++ b/testing/web-platform/tests/picture-in-picture/exit-picture-in-picture.html
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <title>Test exit Picture-in-Picture</title>
+<script src="/common/media.js"></script>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="/resources/testdriver.js"></script>
 <script src="/resources/testdriver-vendor.js"></script>
 <script src="resources/picture-in-picture-helpers.js"></script>
 <body></body>
 <script>
 promise_test(async t => {
--- a/testing/web-platform/tests/picture-in-picture/idlharness.window.js
+++ b/testing/web-platform/tests/picture-in-picture/idlharness.window.js
@@ -1,8 +1,9 @@
+// META: script=/common/media.js
 // META: script=/resources/WebIDLParser.js
 // META: script=/resources/idlharness.js
 // META: script=/resources/testdriver.js
 // META: script=/resources/testdriver-vendor.js
 // META: script=resources/picture-in-picture-helpers.js
 
 'use strict';
 
--- a/testing/web-platform/tests/picture-in-picture/leave-picture-in-picture.html
+++ b/testing/web-platform/tests/picture-in-picture/leave-picture-in-picture.html
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <title>Test leavepictureinpicture event</title>
+<script src="/common/media.js"></script>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="/resources/testdriver.js"></script>
 <script src="/resources/testdriver-vendor.js"></script>
 <script src="resources/picture-in-picture-helpers.js"></script>
 <body></body>
 <script>
 promise_test(async t => {
--- a/testing/web-platform/tests/picture-in-picture/picture-in-picture-element.html
+++ b/testing/web-platform/tests/picture-in-picture/picture-in-picture-element.html
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <title>Test Picture-in-Picture element</title>
+<script src="/common/media.js"></script>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="/resources/testdriver.js"></script>
 <script src="/resources/testdriver-vendor.js"></script>
 <script src="resources/picture-in-picture-helpers.js"></script>
 <body></body>
 <script>
 promise_test(async t => {
--- a/testing/web-platform/tests/picture-in-picture/picture-in-picture-window.html
+++ b/testing/web-platform/tests/picture-in-picture/picture-in-picture-window.html
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <title>Test Picture-in-Picture window</title>
+<script src="/common/media.js"></script>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="/resources/testdriver.js"></script>
 <script src="/resources/testdriver-vendor.js"></script>
 <script src="resources/picture-in-picture-helpers.js"></script>
 <body></body>
 <script>
 promise_test(async t => {
--- a/testing/web-platform/tests/picture-in-picture/request-picture-in-picture-twice.html
+++ b/testing/web-platform/tests/picture-in-picture/request-picture-in-picture-twice.html
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <title>Test request Picture-in-Picture on two videos</title>
+<script src="/common/media.js"></script>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="/resources/testdriver.js"></script>
 <script src="/resources/testdriver-vendor.js"></script>
 <script src="resources/picture-in-picture-helpers.js"></script>
 <body></body>
 <script>
 promise_test(async t => {
--- a/testing/web-platform/tests/picture-in-picture/request-picture-in-picture.html
+++ b/testing/web-platform/tests/picture-in-picture/request-picture-in-picture.html
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <title>Test request Picture-in-Picture</title>
+<script src="/common/media.js"></script>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="/resources/testdriver.js"></script>
 <script src="/resources/testdriver-vendor.js"></script>
 <script src="resources/picture-in-picture-helpers.js"></script>
 <body></body>
 <script>
 promise_test(async t => {
@@ -16,17 +17,17 @@ promise_test(t => {
   const video = document.createElement('video');
   return promise_rejects(t, 'InvalidStateError',
       requestPictureInPictureWithTrustedClick(video));
 }, 'request Picture-in-Picture requires loaded metadata for the video element');
 
 promise_test(async t => {
   const video = document.createElement('video');
   await new Promise(resolve => {
-    video.src = '/media/sound_5.oga';
+    video.src = getAudioURI('/media/sound_5');
     video.onloadeddata = resolve;
   }).then(() => {
     return promise_rejects(t, 'InvalidStateError',
       requestPictureInPictureWithTrustedClick(video));
   })
 }, 'request Picture-in-Picture requires video track for the video element');
 
 promise_test(async t => {
--- a/testing/web-platform/tests/picture-in-picture/resources/picture-in-picture-helpers.js
+++ b/testing/web-platform/tests/picture-in-picture/resources/picture-in-picture-helpers.js
@@ -3,17 +3,17 @@ if (!('pictureInPictureEnabled' in docum
     return Promise.reject('Picture-in-Picture API is not available');
   }
 }
 
 function loadVideo(activeDocument, sourceUrl) {
   return new Promise((resolve, reject) => {
     const document = activeDocument || window.document;
     const video = document.createElement('video');
-    video.src = sourceUrl || '/media/movie_5.ogv';
+    video.src = sourceUrl || getVideoURI('/media/movie_5');
     video.onloadedmetadata = () => { resolve(video); };
     video.onerror = error => { reject(error); };
   });
 }
 
 // Calls requestPictureInPicture() in a context that's 'allowed to request PiP'.
 async function requestPictureInPictureWithTrustedClick(videoElement) {
   await test_driver.bless('request Picture-in-Picture');
--- a/testing/web-platform/tests/picture-in-picture/shadow-dom.html
+++ b/testing/web-platform/tests/picture-in-picture/shadow-dom.html
@@ -1,16 +1,17 @@
 <!DOCTYPE html>
 <title>Test for pictureInPictureElement adjustment for Shadow DOM</title>
-<script src='/resources/testharness.js'></script>
-<script src='/resources/testharnessreport.js'></script>
+<script src="/common/media.js"></script>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
 <script src="/resources/testdriver.js"></script>
 <script src="/resources/testdriver-vendor.js"></script>
 <script src="resources/picture-in-picture-helpers.js"></script>
-<script src='../shadow-dom/resources/shadow-dom.js'></script>
+<script src="../shadow-dom/resources/shadow-dom.js"></script>
 <body>
 <div id='host'>
   <template data-mode='open' id='root'>
     <slot></slot>
   </template>
   <div id='host2'>
     <template data-mode='open' id='root2'>
       <div id='host3'>
@@ -40,22 +41,22 @@ promise_test(async t => {
   assert_equals(document.pictureInPictureElement, null);
   assert_equals(ids.root.pictureInPictureElement, null);
   assert_equals(ids.root2.pictureInPictureElement, null);
   assert_equals(ids.root3.pictureInPictureElement, null);
   assert_equals(ids.root4.pictureInPictureElement, null);
   assert_equals(ids.root5.pictureInPictureElement, null);
 
   await new Promise(resolve => {
-    ids.video.src = '/media/movie_5.ogv';
+    ids.video.src = getVideoURI('/media/movie_5');
     ids.video.onloadeddata = resolve;
   })
   .then(() => requestPictureInPictureWithTrustedClick(ids.video))
   .then(() => {
     assert_equals(document.pictureInPictureElement, ids.host2);
     assert_equals(ids.root.pictureInPictureElement, null);
     assert_equals(ids.root2.pictureInPictureElement, ids.host3);
     assert_equals(ids.root3.pictureInPictureElement, ids.video);
     assert_equals(ids.root4.pictureInPictureElement, null);
     assert_equals(ids.root5.pictureInPictureElement, null);
   })
 });
-</script>
\ No newline at end of file
+</script>