[Android] Change default RootSpec to focusedRoot() in ViewFinder
In ViewFinder.waitForView(), change the default RootSpec from anyRoot()
to focusedRoot() if not specified. This ensures that we are looking for
views in the currently focused window by default, which is generally
what is expected in tests.
This avoids in particular matching views in dialogs that are not yet
focused, leading to RootViewWithoutFocusException when trying to
interact immediately with those views.
Bug: 477319289, 435497083
Change-Id: I6802d97b3ed718df57a7fe1fc01d4aa1ec2205f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7572226
Reviewed-by: Wenyu Fu <wenyufu@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1584715}
CrOS-Libchrome-Original-Commit: e996b955f7f14d147b872aa16b697cdc09b4aa89
2 files changed