Bug 148326 - Improve how UI events are dispatched by WebKitTestRunner
Summary: Improve how UI events are dispatched by WebKitTestRunner
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords:
Depends on: 148155 148470
Blocks: 148709
  Show dependency treegraph
 
Reported: 2015-08-21 13:27 PDT by Alexey Proskuryakov
Modified: 2015-09-02 08:59 PDT (History)
7 users (show)

See Also:


Attachments
proposed patch (177.66 KB, patch)
2015-08-21 14:10 PDT, Alexey Proskuryakov
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2015-08-21 13:27:47 PDT
WebKitTestRunner uses a strange mix of synchronous and asynchronous events to simulate keyboard and mouse. WebKit2 has entire separate code paths to support that.

All this makes writing tests difficult, as WebKitTestRunner is difficult to predict, and this obviously reduces test coverage, as we test a custom code path.

Here is what the upcoming patch does:

- When testRunner is used to send a sync event (like a keyDown), the connection goes into a state where all the events become synchronous in both directions. So it's in a way like the current KeyEventSyncForTesting, but it guarantees that all other events that UI process sends at the same time get delivered in correct order.

This is not ideal, because even though page level code in WK2 is now the same, we make it work in a different way. In an ideal world, we would make all the tests that use keyboard and mouse events asynchronous - but I don't think that it's doable in practice.

A good thing is that all these tests just worked in the new mode, which means that it's quite close to real life code path, after all.

- When testRunner is used to send a scroll event, it's now fully asynchronous. Scrolling is always asynchronous in WK2, and so were most tests, but we used to have a strange mix of sync and async behaviors. It should all be more straightforward now.
Comment 1 Alexey Proskuryakov 2015-08-21 14:10:03 PDT
Created attachment 259655 [details]
proposed patch
Comment 2 Anders Carlsson 2015-08-21 14:43:14 PDT
Comment on attachment 259655 [details]
proposed patch

View in context: https://bugs.webkit.org/attachment.cgi?id=259655&action=review

> Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.h:91
> +    void allowFullySynchronousModeForTesting() { m_fullySynchronousModeIsAllowedForTesting = true; }

This should be a getter/setter pair.

> Source/WebKit2/UIProcess/API/C/WKContextConfigurationRef.h:58
> +WK_EXPORT void WKContextConfigurationAllowFullySynchronousModeForTesting(WKContextConfigurationRef configuration);

Please add a getter/setter for this to match all the other WKContextConfiguration functions.
Comment 3 Alexey Proskuryakov 2015-08-21 16:12:52 PDT
Committed <https://trac.webkit.org/r188793>.
Comment 4 Alexey Proskuryakov 2015-08-22 12:33:09 PDT
Follow-up scrolling test tweak in r188827. It was flaky on some machines, randomly not scrolling where it should have, so I nudged some distances. Let's see if it helps.
Comment 5 Daniel Bates 2015-09-02 08:58:55 PDT
(In reply to comment #3)
> Committed <https://trac.webkit.org/r188793>.

Following this change, the tests fast/events/wheelevent-{basic, mousewheel-interaction}.html began to timeout in iOS Simulator WebKit Test Runner. See bug #148709.