Skip to content

Commit

Permalink
WebDriver based WPT for the 'onmove' handler
Browse files Browse the repository at this point in the history
This CL defines a new WPT to verify the 'onmove' event handler is
triggered using the Set / Get Window Rect WebDriver command. This way
we ensure that the codepath that emits the event is executed, instead
of using the eventSender to emit a fake event.

Additionally, the CL implements the testdriver-vendor.js support for
these commands.

Bug: 1466855
Change-Id: Iabdd655c06af1eb5979a02a02b3a0fd978b2f6e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5201474
Commit-Queue: Javier Fernandez <[email protected]>
Reviewed-by: Stefan Zager <[email protected]>
Reviewed-by: Sonja Laurila <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1251765}
  • Loading branch information
javifernandez authored and chromium-wpt-export-bot committed Jan 24, 2024
1 parent 785113a commit f48dea8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<title>Window Object 'onmove'</title>
<link rel="author" title="Javier Fernandez" href="mailto:[email protected]">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#handler-window-onmove">
<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>
promise_test((t) => {
var expectedRect = {'x': 100, 'y': 200};
return new Promise(resolve => {
window.addEventListener("move", resolve);
test_driver.set_window_rect(expectedRect);
}).then(event => {
return test_driver.get_window_rect()
.then(rect => {
assert_equals(rect.x, expectedRect.x, "The window rect X is correct.")
assert_equals(rect.y, expectedRect.y, "The window rect Y is correct.")
});
});
}, "Window move event");
</script>

0 comments on commit f48dea8

Please sign in to comment.