Bug 1506155 [wpt PR 14005] - [Picture-in-Picture] Move mediastream test to wpt., a=testonly
authorFrançois Beaufort <beaufort.francois@gmail.com>
Thu, 15 Nov 2018 10:15:04 +0000
changeset 503420 3a19e3b216540bee96046d51972ccefbf914fc59
parent 503419 83659439ad427fc9de071023c21c2788730ed1e2
child 503421 3c52e2cd8b4878b4485ff69c5a8522faff5b889f
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1506155, 14005, 1329141, 607837
milestone65.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 1506155 [wpt PR 14005] - [Picture-in-Picture] Move mediastream test to wpt., a=testonly Automatic update from web-platform-tests[Picture-in-Picture] Move mediastream test to wpt. Change-Id: I6edc955ecd0d7f821d642bab0f66a6f25882c098 Reviewed-on: https://chromium-review.googlesource.com/c/1329141 Reviewed-by: Mounir Lamouri <mlamouri@chromium.org> Commit-Queue: Fran├žois Beaufort <beaufort.francois@gmail.com> Cr-Commit-Position: refs/heads/master@{#607837} -- wpt-commits: 53ef64dc2983dce0efe37016cdaee3b3ad279305 wpt-pr: 14005
testing/web-platform/tests/picture-in-picture/mediastream.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/picture-in-picture/mediastream.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<title>Test mediastream video in Picture-in-Picture</title>
+<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 => {
+  const canvas = document.createElement('canvas');
+  const video = document.createElement('video');
+  const mediastreamVideoLoadedPromise = new Promise((resolve, reject) => {
+    video.autoplay = true;
+    video.srcObject = canvas.captureStream(60 /* fps */);
+    video.onloadedmetadata = () => {
+      resolve(video);
+    };
+    video.onerror = error => {
+      reject(error);
+    };
+  });
+  await mediastreamVideoLoadedPromise;
+
+  return requestPictureInPictureWithTrustedClick(video)
+  .then(pipWindow => {
+    assert_not_equals(pipWindow.width, 0);
+    assert_not_equals(pipWindow.height, 0);
+  });
+}, 'request Picture-in-Picture resolves on user click with Picture-in-Picture window');
+</script>