Commit ef5ca9c1 authored by Alex Moshchuk's avatar Alex Moshchuk Committed by Commit Bot

Enforce WARN_UNUSED_RESULT on NavigateToURL().

This CL will force all future tests that rely on
content::NavigateToURL() to check its return value and ensure that the
navigation behaves as intended.  All existing tests have already been
converted to validate the return value.

Bug: 425335
Change-Id: I8c7c47a19b9b7beed5546dbe6f38b2dde1aed437
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1820319Reviewed-by: default avatarŁukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699882}
parent 25bf20c0
......@@ -70,18 +70,21 @@ GURL GetTestUrl(const char* dir, const char* file);
// |url|. This is a browser-initiated navigation that simulates a user typing
// |url| into the address bar.
//
// TODO(alexmos): any tests that use this function and expect successful
// navigations should do EXPECT_TRUE(NavigateToURL()).
bool NavigateToURL(Shell* window, const GURL& url);
// Tests should ensure that NavigateToURL succeeds. If the URL that will
// eventually commit is different from |url|, such as with redirects, use the
// version below which also takes the expected commit URL. If the navigation
// will not result in a commit, such as a download or a 204 response, use
// NavigateToURLAndExpectNoCommit() instead.
WARN_UNUSED_RESULT bool NavigateToURL(Shell* window, const GURL& url);
// Same as above, but takes in an additional URL, |expected_commit_url|, to
// which the navigation should eventually commit. This is useful for cases
// like redirects, where navigation starts on one URL but ends up committing a
// different URL. This function will return true if navigating to |url|
// results in a successful commit to |expected_commit_url|.
bool NavigateToURL(Shell* window,
const GURL& url,
const GURL& expected_commit_url);
WARN_UNUSED_RESULT bool NavigateToURL(Shell* window,
const GURL& url,
const GURL& expected_commit_url);
// Perform a renderer-initiated navigation of |window| to |url|, blocking
// until the navigation finishes. The navigation is done by assigning
......
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