Commit 862c2db3 authored by Alexandr Ilin's avatar Alexandr Ilin Committed by Commit Bot

Wait for url load in HostedAppTest.ShouldShowLocationBarDangerous

This CL fixes a race condition in the
HostedAppTest.ShouldShowLocationBarDangerous test. This test sets an app,
makes all further certificate validations to fail and then navigates inside the
app to the app url. The test expects that an interstitial page will be shown
after the navigation. Hovewer, there is a small probability that the nullptr
will be returned from WebContents::GetInterstitialPage().

The reason is that another navigation is triggered when the app is created and
the test doesn't wait for this navigation to complete before setting
cert_verifier to return an error. Two navigations trying to display an
interstitial page at the same time may make this test fail.

The fix is simple, we just have to wait for the first navigation to complete
before doing anything else.

Bug: 851232
Change-Id: Ic3d55321efb23df726c8e178912704e15f3a54c8
Reviewed-on: https://chromium-review.googlesource.com/1097477Reviewed-by: default avatarGiovanni Ortuño Urquidi <ortuno@chromium.org>
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566773}
parent 07c5e52d
......@@ -771,7 +771,10 @@ IN_PROC_BROWSER_TEST_P(HostedAppTest, ShouldShowLocationBarDangerous) {
ASSERT_TRUE(https_server()->Start());
const GURL app_url = https_server()->GetURL("app.com", "/simple.html");
ui_test_utils::UrlLoadObserver url_observer(
app_url, content::NotificationService::AllSources());
SetupAppWithURL(app_url);
url_observer.Wait();
cert_verifier()->set_default_result(net::ERR_CERT_DATE_INVALID);
// When DesktopPWAWindowing is enabled, proceeding through an interstitial
......
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