Closed Bug 1140293 Opened 9 years ago Closed 9 years ago

Fix tests that depend on synchronous scrolling

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: dvander, Assigned: dvander)

References

Details

Attachments

(9 files, 1 obsolete file)

(deleted), patch
masayuki
: review+
Details | Diff | Splinter Review
(deleted), patch
mstange
: review+
Details | Diff | Splinter Review
(deleted), patch
kip
: review+
Details | Diff | Splinter Review
(deleted), patch
mstange
: review+
Details | Diff | Splinter Review
(deleted), patch
mstange
: review+
Details | Diff | Splinter Review
(deleted), patch
mstange
: review+
Details | Diff | Splinter Review
(deleted), patch
masayuki
: review+
Details | Diff | Splinter Review
(deleted), patch
mstange
: review+
Details | Diff | Splinter Review
(deleted), patch
mstange
: review+
Details | Diff | Splinter Review
nsIDOMWindowUtils::sendWheelEvent will become asynchronous once we turn on APZ. This breaks tests that use synthesizeWheel(). There aren't many so I'll fix them one by one here.
Attached patch fix test_bug574663.html (deleted) — Splinter Review
The new pattern is:
 1) Wait for wheel events to dispatch.
 2) Wait one frame to make sure all dispatch is done, for synchronous configurations.
 3) Advance the refresh driver to complete the scrolls.
 4) Wait for all paints to flush.

This seems to work on every pairing of e10s/non-e10s apz/no-apz. The other tests shouldn't be as complicated since they operate all in the same window.
Attachment #8573772 - Flags: review?(masayuki)
Attached patch fix test_bug784410.html (obsolete) (deleted) — Splinter Review
Attachment #8574198 - Flags: review?(mstange)
Attached patch fix test_bug784410.html (deleted) — Splinter Review
correct patch
Attachment #8574198 - Attachment is obsolete: true
Attachment #8574198 - Flags: review?(mstange)
Attachment #8574200 - Flags: review?(mstange)
Attachment #8574200 - Flags: review?(mstange) → review+
Comment on attachment 8573772 [details] [diff] [review]
fix test_bug574663.html

Looks good to me. Although, I hope this will be included by EventUtils.js for simpler tests.
Attachment #8573772 - Flags: review?(masayuki) → review+
Attachment #8574907 - Attachment description: bug1140293-part3.patch → disable test_scroll_behavior.html w/ apz
Comment on attachment 8574907 [details] [diff] [review]
disable test_scroll_behavior.html w/ apz

Review of attachment 8574907 [details] [diff] [review]:
-----------------------------------------------------------------

This looks good.  As per our IRC conversation, we don't need to disable this test for e10s, just for APZ.
Attachment #8574907 - Flags: review?(kgilbert) → review+
Comment on attachment 8575539 [details] [diff] [review]
fix test_mousescroll.xul

Review of attachment 8575539 [details] [diff] [review]:
-----------------------------------------------------------------

::: testing/mochitest/tests/SimpleTest/EventUtils.js
@@ +460,5 @@
> +
> +    // Wait one frame since the wheel event has not caused a refresh observer
> +    // to be added yet.
> +    setTimeout(function() {
> +      utils.advanceTimeAndRefresh(1000);

Should this also be calling restoreNormalRefresh after it's done? Or are all callers already controlling the refresh driver?
Attachment #8575539 - Flags: review?(mstange) → review+
Attachment #8574200 - Attachment description: fix test_bug574663.html → fix test_bug784410.html
Attached patch fix test_bug478536.xul (deleted) — Splinter Review
Attachment #8582812 - Flags: review?(mstange)
The SendWheelEvent() change was needed because the overflowDeltaX/Y values cannot be computed synchronously (at least, not accurately) with APZ. I'm not sure where this is used other than swipe gestures, which we already know will need special handling in APZ.
Attachment #8582937 - Flags: review?(masayuki)
Comment on attachment 8582937 [details] [diff] [review]
fix test_wheel_default_action.html

>+function sendWheelAndWait(x, y, event, callback)

nit: aX, aY, aEvent, aCallback

>-            synthesizeKey("0", { accelKey: true });
>             onZoomReset(aCallback);
>+            synthesizeKey("0", { accelKey: true });

Why do you need this change? if this is intentional change, r=masayuki.
Attachment #8582937 - Flags: review?(masayuki) → review+
Attachment #8582809 - Flags: review?(mstange) → review+
Attachment #8582812 - Flags: review?(mstange) → review+
Take two: fixed refresh-driver-left-in-test-mode failures, I hope.

remote:   https://hg.mozilla.org/integration/mozilla-inbound/rev/1158acbea753
sorry had to back this out for frequent test failures on windows m-oth tests like https://treeherder.mozilla.org/logviewer.html#?job_id=8590707&repo=mozilla-inbound
Flags: needinfo?(dvander)
pushing everything but the window_wheeltransaction.xul changes this time, since that has intermittent failures still.

remote:   https://hg.mozilla.org/integration/mozilla-inbound/rev/53b89bca0788
Flags: needinfo?(dvander)
Attached patch Fix test_bug946632.html (deleted) — Splinter Review
Another test fix. The reset/prepare split is to force a layers update, which implicitly ends the wheel transaction. (Without APZ, frame reconstruction implicitly ends the wheel transaction instead.)

This also fixes a bug where calling restoreNormalRefresh() after the window closes can crash. (Which can happen because sendWheelAndPaint calls it in a callback.)
Attachment #8592443 - Flags: review?(mstange)
Comment on attachment 8592443 [details] [diff] [review]
Fix test_bug946632.html

(In reply to David Anderson [:dvander] from comment #19)
> Created attachment 8592443 [details] [diff] [review]
> Fix test_bug946632.html
> 
> Another test fix. The reset/prepare split is to force a layers update, which
> implicitly ends the wheel transaction.

What is a layers update? Just a regular layer transaction? Does that mean that when you scroll while a main thread animation is running anywhere on the page, the transaction is reset on every frame of that animation?
Attachment #8592443 - Flags: review?(mstange) → review+
(In reply to Markus Stange [:mstange] from comment #20)
> Comment on attachment 8592443 [details] [diff] [review]
> Fix test_bug946632.html
> 
> (In reply to David Anderson [:dvander] from comment #19)
> > Created attachment 8592443 [details] [diff] [review]
> > Fix test_bug946632.html
> > 
> > Another test fix. The reset/prepare split is to force a layers update, which
> > implicitly ends the wheel transaction.
> 
> What is a layers update? Just a regular layer transaction? Does that mean
> that when you scroll while a main thread animation is running anywhere on
> the page, the transaction is reset on every frame of that animation?

Sorry, should have been more clear: the test sets display='none' and then display=''. This rebuilds the frame tree, which implicitly ends the wheel transaction (which holds an nsWeakFrame). To get the same behavior with APZ, we have to make sure a paint is flushed in between the two style changes, so APZ gets at least one layer transaction that doesn't have the frame anymore.
Attached patch Fix test_wheeltransaction.xul (deleted) — Splinter Review
sendWheelAndPaint is unreliable when tests want to listen for "scroll" instead of when all paints are flushed. Since they don't occur at the same time, normal refresh can be restored randomly as we're initiating a new wheel event sequence.

Simple fix is to make the callback optional, and then don't restore the refresh driver if it's not there.

This gets test_wheeltransaction.xul working again.
Attachment #8593574 - Flags: review?(mstange)
Attachment #8593574 - Flags: review?(mstange) → review+
https://hg.mozilla.org/mozilla-central/rev/f06affb13067
https://hg.mozilla.org/mozilla-central/rev/8f8472c61480
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: