Commit 0485e8ec authored by engedy's avatar engedy Committed by Commit bot

Make SubresourceFilterBrowserTest.FailedProvisionalLoadInMainframe non-flaky.

When a provisional load fails with no server-supplied error page, Chrome's own
navigation error page is shown. This also triggers a background request to load
navigation corrections (aka. Link Doctor). Once the results are back, there is
a navigation to a second error page with the suggestions.

Thes CL makes the SubresourceFilterBrowserTest.FailedProvisionalLoadInMainframe
expect and wait for this second navigation. Otherwise the completion of loading
the Link Doctor error page would be at race with that of subsequent navigations
initiated in the test, leading to flakiness.

BUG=637415,700514

Review-Url: https://codereview.chromium.org/2754173003
Cr-Commit-Position: refs/heads/master@{#457796}
parent 7ad66d24
...@@ -523,13 +523,7 @@ IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest, ...@@ -523,13 +523,7 @@ IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest,
FailedProvisionalLoadInMainframe) { FailedProvisionalLoadInMainframe) {
GURL url_with_activation_but_dns_error( GURL url_with_activation_but_dns_error(
"http://host-with-dns-lookup-failure/"); "http://host-with-dns-lookup-failure/");
// The /echo handler returns a 404 with a non-empty response body (containing GURL url_with_activation_but_not_existent(GetTestUrl("non-existent.html"));
// the text 'Echo`). The latter is important to suppress showing Chrome's own
// navigation error page, in which case a background request is started to
// load navigation corrections (aka. Link Doctor), and once the results are
// back, there is a navigation to a second error page with the suggestions,
// which makes WaitForLoadStop() in the second NavigateToURL() below racey.
GURL url_with_activation_but_not_existent(GetTestUrl("/echo?status=404"));
GURL url_without_activation(GetTestUrl(kTestFrameSetPath)); GURL url_without_activation(GetTestUrl(kTestFrameSetPath));
ConfigureAsPhishingURL(url_with_activation_but_dns_error); ConfigureAsPhishingURL(url_with_activation_but_dns_error);
...@@ -545,7 +539,13 @@ IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest, ...@@ -545,7 +539,13 @@ IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest,
url_with_activation_but_not_existent}) { url_with_activation_but_not_existent}) {
SCOPED_TRACE(url_with_activation); SCOPED_TRACE(url_with_activation);
ui_test_utils::NavigateToURL(browser(), url_with_activation); // In either test case, there is no server-supplied error page, so Chrome's
// own navigation error page is shown. This also triggers a background
// request to load navigation corrections (aka. Link Doctor), and once the
// results are back, there is a navigation to a second error page with the
// suggestions. Hence the wait for two navigations in a row.
ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
browser(), url_with_activation, 2);
ui_test_utils::NavigateToURL(browser(), url_without_activation); ui_test_utils::NavigateToURL(browser(), url_without_activation);
ASSERT_NO_FATAL_FAILURE(ExpectParsedScriptElementLoadedStatusInFrames( ASSERT_NO_FATAL_FAILURE(ExpectParsedScriptElementLoadedStatusInFrames(
kSubframeNames, kExpectScriptInFrameToLoad)); kSubframeNames, kExpectScriptInFrameToLoad));
......
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