[go: up one dir, main page]

Page MenuHomePhabricator

Bug 2055366 - Keep the transient user activation alive in the user gesture navigation tests. r?#geckoview-reviewers
ClosedPublic

Authored by RyanVM on Fri, Sep 18, 8:17 PM.
Referenced Files
Unknown Object (File)
Thu, Oct 15, 4:07 PM
Unknown Object (File)
Fri, Oct 2, 11:16 AM
Unknown Object (File)
Fri, Oct 2, 8:11 AM
Unknown Object (File)
Fri, Oct 2, 8:11 AM
Unknown Object (File)
Fri, Oct 2, 8:11 AM
Unknown Object (File)
Fri, Oct 2, 8:11 AM
Unknown Object (File)
Fri, Oct 2, 4:23 AM
Unknown Object (File)
Fri, Oct 2, 4:23 AM

Details

Summary

GeckoViewNavigation.onLocationChange and LoadURIDelegate report hasUserGesture from the document's transient
user activation at the time they run, and that activation expires after dom.user_activation.transient.timeout
(5 s). When the tapped page takes longer than that to commit its navigation on a slow emulator the flag reads
false. Raising the timeout for these two tests keeps them from depending on load speed.

Diff Detail

Event Timeline

phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: secure-revision.

(Reviewing Diff 1381930)

Summarization

Intent

The changes aim to fix an intermittent test failure in NavigationDelegateTest#locationReplaceOnUserGesture (and the related userGesture test). The root cause is a race condition: the tests simulate a user tap to trigger a navigation, and then check that the navigation reports hasUserGesture as true. However, hasUserGesture is derived from the document's transient user activation, which expires after a default timeout of 5 seconds (dom.user_activation.transient.timeout). On slow emulators, the navigation may take longer than 5 seconds to commit, causing the transient user activation to expire before GeckoViewNavigation.onLocationChange reads it, resulting in hasUserGesture being false and the test failing intermittently.

Solution

The fix adds a call to sessionRule.setPrefsUntilTestEnd at the beginning of both the userGesture and locationReplaceOnUserGesture tests, setting the dom.user_activation.transient.timeout preference to 60000 milliseconds (60 seconds). This greatly extends the window during which the transient user activation remains valid, ensuring that even on slow test environments the activation will not expire before the navigation commits and the hasUserGesture flag is read. The preference is scoped to the duration of each test, so it does not affect other tests. The commit message also notes that whether the user gesture flag should be captured at navigation start time (rather than at commit time) is a separate API design question.


Automated review completed with no comments.
RyanVM edited the summary of this revision. (Show Details)
ohall added a subscriber: ohall.

Thanks for working on this one and the earlier discussion on Slack about it!

This revision is now accepted and ready to land.Mon, Sep 21, 12:34 PM