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}
diff --git a/window-placement/META.yml b/window-placement/META.yml
new file mode 100644
index 0000000..2c6d60f
--- /dev/null
+++ b/window-placement/META.yml
@@ -0,0 +1,4 @@
+spec: https://w3c.github.io/window-placement/
+suggested_reviewers:
+ - michaelwasserman
+ - bradtriebwasser
diff --git a/window-placement/README.md b/window-placement/README.md
new file mode 100644
index 0000000..2a7df11
--- /dev/null
+++ b/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).
diff --git a/window-placement/multi-screen-window-open-manual.tentative.https.html b/window-placement/multi-screen-window-open.tentative.https.html
similarity index 97%
rename from window-placement/multi-screen-window-open-manual.tentative.https.html
rename to window-placement/multi-screen-window-open.tentative.https.html
index f6e61e1..00c00d9 100644
--- a/window-placement/multi-screen-window-open-manual.tentative.https.html
+++ b/window-placement/multi-screen-window-open.tentative.https.html
@@ -13,11 +13,11 @@
<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/testdriver.js"></script>
-<script src="/resources/testdriver-vendor.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>
'use strict';
let popups = [];
@@ -44,10 +44,10 @@
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));
}