Bug 1769661 [wpt PR 34086] - Fix window-placement test to work with automation and add some documentation., a=testonly draft
authorBrad Triebwasser <btriebw@chromium.org>
Wed, 18 May 2022 03:35:20 +0000
changeset 4382082 374c79fc380221933e498e05c90f9b20b5765b82
parent 4382081 27020d4c191ae963e942228246a35a8e09004abc
child 4382083 f397c79f08e10c7126f5b2793da4fe38d52ed345
push id813421
push userwptsync@mozilla.com
push dateSat, 21 May 2022 07:18:06 +0000
treeherdertry@315667acc575 [default view] [failures only]
reviewerstestonly
bugs1769661, 34086, 1323361, 3648377, 1004343
milestone102.0a1
Bug 1769661 [wpt PR 34086] - Fix window-placement test to work with automation and add some documentation., a=testonly Automatic update from web-platform-tests Fix window-placement test to work with automation and add some documentation. Adds META and README file under web platform window-placement tests. Also fixes multi-screen-window-open test to work as an automated test via 'wpt run' (removes '-manual' in the filename and rearranges <script> tags to fix test_driver). Also fixes a boundary condition in one of the assertions to support popup.screenX == screen.availLeft and popup.screenY == screen.availTop. Bug: 1323361 Change-Id: I277ba8a2edf8b72bb5a26140e5066ba9a9d666b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3648377 Reviewed-by: Mike Wasserman <msw@chromium.org> Commit-Queue: Brad Triebwasser <btriebw@chromium.org> Cr-Commit-Position: refs/heads/main@{#1004343} -- wpt-commits: cb74477e54c1e29e670be53c67c84edcb7a5ed39 wpt-pr: 34086
testing/web-platform/tests/window-placement/META.yml
testing/web-platform/tests/window-placement/README.md
testing/web-platform/tests/window-placement/multi-screen-window-open-manual.tentative.https.html
testing/web-platform/tests/window-placement/multi-screen-window-open.tentative.https.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/window-placement/META.yml
@@ -0,0 +1,4 @@
+spec: https://w3c.github.io/window-placement/
+suggested_reviewers:
+  - michaelwasserman
+  - bradtriebwasser
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/window-placement/README.md
@@ -0,0 +1,5 @@
+# Window Placement Testing
+
+[Window Placement Specification](https://w3c.github.io/window-placement/)
+
+The tests in this directory require at least 2 displays on the host machine to yield meaningful results. A well-supported configuration is 2 displays at 1920x1080 resolution arranged horizonally (primary on the left, secondary on the right).
rename from testing/web-platform/tests/window-placement/multi-screen-window-open-manual.tentative.https.html
rename to testing/web-platform/tests/window-placement/multi-screen-window-open.tentative.https.html
--- a/testing/web-platform/tests/window-placement/multi-screen-window-open-manual.tentative.https.html
+++ b/testing/web-platform/tests/window-placement/multi-screen-window-open.tentative.https.html
@@ -8,21 +8,21 @@
 <link rel="help" href="https://webscreens.github.io/window-placement/">
 This test uses multi-screen details to open a popup window on each screen.<br>
 It runs automated or manually with `wpt serve` and a compatible browser.<br><br>
 <button id="setUpButton">Request screen details</button>
 <ul id="popupButtons"></ul>
 <button id="cleanUpButton">Close any open popups</button><br>
 <input id="autoCleanUp" type="checkbox" checked=true>Auto-close popups</input>
 <ul id="logger"></ul>
-<p>
+<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/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
+
 <script>
 'use strict';
 let popups = [];
 
 function log(str) {
   const entry = document.createElement('li');
   entry.innerHTML = str;
   logger.appendChild(entry);
@@ -39,20 +39,20 @@ function checkPopupPlacement(popup, x, y
   // the origin of content viewport; in that case, estimate window coordinates
   // by subtracing estimated frame insets (top-heavy, horizontally centered).
   // Synchronous estimated placements may be clamped to the current screen.
   const error = 10;
   const dX = popup.screenX - x - (popup.outerWidth - popup.innerWidth) / 2;
   const dY = popup.screenY - y - (popup.outerHeight - popup.innerHeight);
 
   assert_true(!popup.screenX || popup.screenX == x || Math.abs(dX) <= error ||
-              (allowSameScreenClamping && popup.screenX > screen.availLeft &&
+              (allowSameScreenClamping && popup.screenX >= screen.availLeft &&
                popup.screenX < screen.availLeft + screen.availWidth));
   assert_true(!popup.screenY || popup.screenY == y || Math.abs(dY) <= error ||
-              (allowSameScreenClamping && popup.screenY > screen.availTop &&
+              (allowSameScreenClamping && popup.screenY >= screen.availTop &&
                popup.screenY < screen.availTop + screen.availHeight));
 }
 
 async function testPopupOnScreen(popupTest, screen) {
   // Show a popup child window on the associated screen.
   const left = screen.availLeft + Math.floor(screen.availWidth / 2) - 150;
   const top = screen.availTop + Math.floor(screen.availHeight / 2) - 50;
   log(`Opening a popup on '${screen.label}' at (${left}, ${top})`);