Commit b22a2ef3 authored by Liviu Tinta's avatar Liviu Tinta Committed by Chromium LUCI CQ

Implement RequestToLockMouse in HeadlessWebContentsImpl::Delegate

There are a few wpt pointerlock tests that fail under the new wpt try
bots.

The wpt try bots are running wpt run in headless mode.
Turns out that, when running wpt tests in headless mode with the wpt
runner,the code is reaching this line in
WebContentsImpl::RequestToLockMouse [1].
The problem here is that delegate_->RequestToLockMouse is actually
the empty implementation from WebContentsDelegate::RequestToLockMouse.
This is why the WebContents::GotResponseToLockMouseRequest is never
called.
The expectation for WebContentsDelegate::RequestToLockMouse is to call
WebContents::GotResponseToLockMouseRequest like other code paths.

The culprit is HeadlessWebContentsImpl:Delegate, which inherits the
empty implementation of WebContentsDelegate::RequestToLockMouse.

When running the wpt tests without --headless the delegate is an
instance of Browser class.

Implement HeadlessWebContentsImpl:Delegate::RequestToLockMouse similar
to what we do for content shell.

[1] https://www.google.com/url?q=https://source.chromium.org/chromium/chromium/src/%2B/master:content/browser/web_contents/web_contents_impl.cc;drc%3D3fab4813ccc76de821bb74b441ff491afc8a7a6f;l%3D3402&sa=D&source=calendar&ust=1608479687279000&usg=AOvVaw2Q3jZFrFsbSnQd8osPwpOU

TEST=external/wpt/pointerevents/pointerlock/pointerevent_getCoalescedEvents_when_pointerlocked.html,external/wpt/pointerevents/pointerlock/pointerevent_coordinates_when_locked.html,external/wpt/pointerevents/pointerlock/pointerevent_getCoalescedEvents_when_pointerlocked.html,external/wpt/pointerevents/pointerlock/pointerevent_movementxy_with_pointerlock.html,external/wpt/pointerevents/pointerlock/pointerevent_pointerlock_after_pointercapture.html,external/wpt/pointerevents/pointerlock/pointerevent_pointermove_in_pointerlock.html,external/wpt/pointerevents/pointerlock/pointerevent_pointermove_on_chorded_mouse_button_when_locked.html

Bug: 1127055
Change-Id: Ic1da165fed1dc1902c5e8c0dbb5f7cfc7513ee30
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2594009Reviewed-by: default avatarMustaq Ahmed <mustaq@chromium.org>
Reviewed-by: default avatarPeter Kvitek <kvitekp@chromium.org>
Commit-Queue: Liviu Tinta <liviutinta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841490}
parent 62a79f61
......@@ -177,6 +177,13 @@ class HeadlessWebContentsImpl::Delegate : public content::WebContentsDelegate {
->block_new_web_contents();
}
void RequestToLockMouse(content::WebContents* web_contents,
bool user_gesture,
bool last_unlocked_by_target) override {
web_contents->GotResponseToLockMouseRequest(
blink::mojom::PointerLockResult::kSuccess);
}
private:
HeadlessBrowserImpl* browser() { return headless_web_contents_->browser(); }
......
[pointerevent_coordinates_when_locked.html]
expected: TIMEOUT
[mouse Test pointerevent coordinates when pointer is locked]
expected: NOTRUN
[pointerevent_getCoalescedEvents_when_pointerlocked.html]
[mouse pointermove getCoalescedEvents when lock test]
expected: FAIL
[pointerevent_movementxy_with_pointerlock.html]
expected: TIMEOUT
[mouse pointerevent movementX/Y with pointerlock test]
expected: TIMEOUT
message: Test timed out
[pointerevent_pointerlock_after_pointercapture.html]
[mouse no pointercapture while pointerlock]
expected: FAIL
[pointerevent_pointermove_in_pointerlock.html]
expected: TIMEOUT
[pointermove event received]
expected: NOTRUN
[pointermove event received inner frame]
expected: NOTRUN
[pointerevent_pointermove_on_chorded_mouse_button_when_locked.html]
expected: TIMEOUT
[pointer locked pointermove events received for button state changes]
expected: NOTRUN
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment