• John Delaney's avatar
    Fix racy NavigationBrowserTest usage of TestNavigationObserver · 107a4008
    John Delaney authored
    What:
    Replace usage of ShellAddedObserver + TestNavigationObserver with
    TestNavigationObserver::StartWatchingNewWebContents().
    
    Why:
    Tests are flaking from calls to TestNavigationObserver::Wait()
    hanging.
    
    The existing solution assumes that the test will setup the
    TestNavigationObserver before the newly opened WebContents starts the
    navigation.
    
    However this isn't necessarily true, as we aren't registering the
    TestNavigationObserver in the same callstack in which the web contents
    is created.
    
    Bug: 1166341
    Change-Id: Id2b5f36158f86377b3881e54d793c27af718cb1e
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2627757Reviewed-by: default avatarCharlie Reis <creis@chromium.org>
    Commit-Queue: Charlie Reis <creis@chromium.org>
    Commit-Queue: John Delaney <johnidel@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#843300}
    107a4008
navigation_browsertest.cc 171 KB