Bug 1634611 [wpt PR 23354] - Fugu: Add a permission for Screen Enumeration & Window Placement, a=testonly
authorMike Wasserman <msw@chromium.org>
Wed, 13 May 2020 09:48:34 +0000
changeset 531160 2445588003cd7c824255b3747dda2deb12c57b63
parent 531159 ebe0ad4219a29fb5227bf51f27c4b8972961335a
child 531161 c18ec8257b9f3c61a2ce538734b91dd3b2d6e847
push id37435
push userapavel@mozilla.com
push dateWed, 20 May 2020 15:28:23 +0000
treeherdermozilla-central@5415da14ec9a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1634611, 23354, 994889, 897300, 2173342, 766929
milestone78.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 1634611 [wpt PR 23354] - Fugu: Add a permission for Screen Enumeration & Window Placement, a=testonly Automatic update from web-platform-tests Fugu: Add a permission for Screen Enumeration & Window Placement Add WINDOW_PLACEMENT content setting and permission enum values. Use this to gate access to the window.getScreens() experimental API. Wire up the permission request dialog and the page info bubble entry. Add WPT testdriver permission request support; test with granted&denied. Make RenderFrameHostImpl own ScreenEnumerationImpl; adjust bindings. (supports requesting permission for a given host and its origin) Limits getScreens() to Window contexts; which seems okay. Add UX&Privacy-chosen strings + sha hashes for translation screenshots. Test michaelwasserman.github.io/window-placement-demo with: chrome://flags#enable-experimental-web-platform-features OR $ chrome --enable-experimental-web-platform-features Bug: 994889, 897300 Test: Window Placement setting and permissions work for getScreens(). Change-Id: Iac38133c966d20d9a04c80d999091df16f9fd5c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2173342 Commit-Queue: Michael Wasserman <msw@chromium.org> Reviewed-by: Kamila Hasanbega <hkamila@chromium.org> Reviewed-by: Mounir Lamouri <mlamouri@chromium.org> Reviewed-by: Ken Buchanan <kenrb@chromium.org> Reviewed-by: John Abd-El-Malek <jam@chromium.org> Reviewed-by: Balazs Engedy <engedy@chromium.org> Cr-Commit-Position: refs/heads/master@{#766929} -- wpt-commits: 00b32d5054a9b61a451b7b99ae9c064935b770c6 wpt-pr: 23354
testing/web-platform/tests/screen_enumeration/getScreens.tentative.https.window.js
--- a/testing/web-platform/tests/screen_enumeration/getScreens.tentative.https.window.js
+++ b/testing/web-platform/tests/screen_enumeration/getScreens.tentative.https.window.js
@@ -1,16 +1,19 @@
 // META: global=window,dedicatedworker,sharedworker,serviceworker
+// META: script=/resources/testdriver.js
+// META: script=/resources/testdriver-vendor.js
 'use strict';
 
 promise_test(async testCase => {
   assert_equals(typeof self.getScreens, 'function');
 }, 'self.getScreens is present');
 
 promise_test(async testCase => {
+  await test_driver.set_permission({name: 'window-placement'}, 'granted');
   const screens = await self.getScreens();
   assert_greater_than(screens.length, 0);
 
   assert_equals(typeof screens[0].availWidth, 'number');
   assert_equals(typeof screens[0].availHeight, 'number');
   assert_equals(typeof screens[0].width, 'number');
   assert_equals(typeof screens[0].height, 'number');
   assert_equals(typeof screens[0].colorDepth, 'number');
@@ -22,9 +25,15 @@ promise_test(async testCase => {
   assert_equals(typeof screens[0].top, 'number');
   assert_equals(typeof screens[0].orientation, 'object');
 
   assert_equals(typeof screens[0].primary, 'boolean');
   assert_equals(typeof screens[0].internal, 'boolean');
   assert_equals(typeof screens[0].scaleFactor, 'number');
   assert_equals(typeof screens[0].id, 'string');
   assert_equals(typeof screens[0].touchSupport, 'boolean');
-}, 'self.getScreens returns at least 1 Screen');
+}, 'self.getScreens returns at least 1 Screen with permission granted');
+
+promise_test(async testCase => {
+  await test_driver.set_permission({name: 'window-placement'}, 'denied');
+  const screens = await self.getScreens();
+  assert_equals(screens.length, 0);
+}, 'self.getScreens returns no Screen objects with permission denied');