Commit 43a5bd0c authored by John Budorick's avatar John Budorick Committed by Commit Bot

weblayer: check all previous navigations in BrowserFragmentLifecycleTests.

waitForTabToFinishRestore currently checks whether there's *exactly one*
existing navigation entry that matches the expected url. If it doesn't,
they wait for *any* subsequent navigation that matches the expected url.
Tab restoration appears to trigger navigations to about:blank and then
the expected url; if we check after both navigations have been received,
we'll wind up waiting on the latch until it times out.

This CL updates waitForTabToFinishRestore to check for any previous or
future navigation entry that matches the expected url, which should
avoid that race.

Bug: 1060317
Change-Id: I6fa584ff4537af74ee1ceafdfca57fdc6485fa84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2097246Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749039}
parent 850eab05
...@@ -94,11 +94,11 @@ public class BrowserFragmentLifecycleTest { ...@@ -94,11 +94,11 @@ public class BrowserFragmentLifecycleTest {
TestThreadUtils.runOnUiThreadBlocking(() -> { TestThreadUtils.runOnUiThreadBlocking(() -> {
// It's possible the NavigationController hasn't loaded yet, handle either scenario. // It's possible the NavigationController hasn't loaded yet, handle either scenario.
NavigationController navigationController = tab.getNavigationController(); NavigationController navigationController = tab.getNavigationController();
if (navigationController.getNavigationListSize() == 1 for (int i = 0; i < navigationController.getNavigationListSize(); ++i) {
&& navigationController.getNavigationEntryDisplayUri(0).equals( if (navigationController.getNavigationEntryDisplayUri(i).equals(Uri.parse(url))) {
Uri.parse(url))) { latch.countDown();
latch.countDown(); return;
return; }
} }
navigationController.registerNavigationCallback(new NavigationCallback() { navigationController.registerNavigationCallback(new NavigationCallback() {
@Override @Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment