Wait correctly for BG tasks in passwords_settings_egtest.mm
The passwords settings EG test uses PasswordStore. PasswordStore works on a background task runner, and the test needs to ensure that it waits until PasswordStore is finished. Unfortunately, the test currently attempts to do this with [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; As the name suggests, this waits for the UI thread, not for the background task runner. There is no synchronisation with the password store currently and the tests pass just by luck. Indeed, test configurations are possible to write where PasswordStore is not done on time and the test fails. Therefore this CL replaces the waiting for UI thread with a combination of posting tasks to PasswordStore and using WaitUntilConditionOrTimeout to check their completion. The timeout selected is 1 second. Using the pre-defined value kSpinDelaySeconds turned out to be too short. The CL not only replaces GREYUIThreadExecutor with the new synchronisation, it also checks the state of the PasswordStore in more detail. Furthermore, it also adds synchronisation with PasswordStore after the password list view loads, because that view also depends on the response from PasswordStore. Bug: 744058 Change-Id: I1a86c0cdfa9b60a609505005b7d2df5e1896dd54 Reviewed-on: https://chromium-review.googlesource.com/573540 Commit-Queue: Vaclav Brozek <vabr@chromium.org> Reviewed-by:Sylvain Defresne <sdefresne@chromium.org> Cr-Commit-Position: refs/heads/master@{#488199}
Showing
Please register or sign in to comment