0

Fix remaining NavigateToURL expectations in content_browsertests.

This is hopefully the last step before finally adding
WARN_UNUSED_RESULT to NavigateToURL().

Apart from adding straightforward expectations for regular and redirect
cases, this fixes a couple more bugs:

- AppendingFrameInWebUIDoesNotCrash was broken on Android, because it
  used chrome://tracing, which doesn't exist on Android.

- A couple of tests in WebContentsImplBrowserTest (e.g.,
  ChangeDisplayMode) were navigating to about://blank (instead of
  about:blank), which results in an error rather than a blank page.

Bug: 425335
Change-Id: Id80040de9c3383c517f2df95b819f314e6b29f30
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1819852
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699854}
This commit is contained in:
Alex Moshchuk
2019-09-25 17:40:01 +00:00
committed by Commit Bot
parent 16498df87a
commit aeb20fe347
50 changed files with 286 additions and 237 deletions
content
browser
renderer
test
zygote

@ -54,7 +54,7 @@ class AXPlatformNodeTextProviderWinBrowserTest : public ContentBrowserTest {
AccessibilityNotificationWaiter waiter(shell()->web_contents(),
accessibility_mode,
ax::mojom::Event::kLoadComplete);
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
waiter.WaitForNotification();
}

@ -725,7 +725,7 @@ IN_PROC_BROWSER_TEST_F(CrossPlatformAccessibilityBrowserTest,
"<time></time>"
"<div role='contentinfo' aria-label='contentinfo'></div>");
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
waiter.WaitForNotification();
BrowserAccessibility* root = GetManager()->GetRoot();

@ -1083,13 +1083,13 @@ IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest,
BackForwardCacheImpl::TEST_ASSUMES_NO_CACHING);
// Navigate to a page that would normally be cacheable.
NavigateToURL(shell(),
embedded_test_server()->GetURL("a.com", "/title1.html"));
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL("a.com", "/title1.html")));
RenderFrameDeletedObserver delete_observer_rfh_a(current_frame_host());
// Navigate away.
NavigateToURL(shell(),
embedded_test_server()->GetURL("b.com", "/title1.html"));
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL("b.com", "/title1.html")));
// The page should be deleted (not cached).
delete_observer_rfh_a.WaitUntilDeleted();

@ -40,7 +40,7 @@ class BlobUrlBrowserTest : public ContentBrowserTest {
IN_PROC_BROWSER_TEST_F(BlobUrlBrowserTest, LinkToUniqueOriginBlob) {
// Use a data URL to obtain a test page in a unique origin. The page
// contains a link to a "blob:null/SOME-GUID-STRING" URL.
NavigateToURL(
EXPECT_TRUE(NavigateToURL(
shell(),
GURL("data:text/html,<body><script>"
"var link = document.body.appendChild(document.createElement('a'));"
@ -48,7 +48,7 @@ IN_PROC_BROWSER_TEST_F(BlobUrlBrowserTest, LinkToUniqueOriginBlob) {
"link.href = URL.createObjectURL(new Blob(['potato']));"
"link.target = '_blank';"
"link.id = 'click_me';"
"</script></body>"));
"</script></body>")));
// Click the link.
ShellAddedObserver new_shell_observer;
@ -75,7 +75,7 @@ IN_PROC_BROWSER_TEST_F(BlobUrlBrowserTest, LinkToSameOriginBlob) {
// Using an http page, click a link that opens a popup to a same-origin blob.
GURL url = embedded_test_server()->GetURL("chromium.org", "/title1.html");
url::Origin origin = url::Origin::Create(url);
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
ShellAddedObserver new_shell_observer;
EXPECT_TRUE(ExecuteScript(
@ -108,7 +108,7 @@ IN_PROC_BROWSER_TEST_F(BlobUrlBrowserTest, LinkToSameOriginBlobWithAuthority) {
// that has a spoofy authority section applied. This should be blocked.
GURL url = embedded_test_server()->GetURL("chromium.org", "/title1.html");
url::Origin origin = url::Origin::Create(url);
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
ShellAddedObserver new_shell_observer;
EXPECT_TRUE(ExecuteScript(
@ -146,7 +146,7 @@ IN_PROC_BROWSER_TEST_F(BlobUrlBrowserTest, ReplaceStateToAddAuthorityToBlob) {
// an authority to the inner URL, which would be spoofy.
GURL url = embedded_test_server()->GetURL("chromium.org", "/title1.html");
url::Origin origin = url::Origin::Create(url);
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
ShellAddedObserver new_shell_observer;
EXPECT_TRUE(ExecuteScript(

@ -368,7 +368,8 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
AddQuery(&urls[0], "redirect", urls[1].spec());
// Navigate to the first url of the redirect chain.
NavigateToURL(shell(), urls[0]);
EXPECT_TRUE(
NavigateToURL(shell(), urls[0], urls[2] /* expected_commit_url */));
// We reached the end of the redirect chain.
EXPECT_EQ(urls[2], shell()->web_contents()->GetURL());
@ -425,7 +426,7 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
"\" />"
"</body></html>";
AddQuery(&page_with_image, "html", content_with_image);
NavigateToURL(shell(), page_with_image);
EXPECT_TRUE(NavigateToURL(shell(), page_with_image));
delegate()->VerifyAndClearExpectations();
}
@ -438,7 +439,7 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest, InsecureNavigation) {
AddQuery(&url, "header", kClearCookiesHeader);
ASSERT_FALSE(url.SchemeIsCryptographic());
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
// We do not expect any calls to have been made.
delegate()->VerifyAndClearExpectations();
@ -493,10 +494,10 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTestWithAutoupgradesDisabled,
AddQuery(&secure_page, "html", content_with_insecure_image);
// Insecure resource on an insecure page does not execute Clear-Site-Data.
NavigateToURL(shell(), insecure_page);
EXPECT_TRUE(NavigateToURL(shell(), insecure_page));
// Insecure resource on a secure page does not execute Clear-Site-Data.
NavigateToURL(shell(), secure_page);
EXPECT_TRUE(NavigateToURL(shell(), secure_page));
// We do not expect any calls to have been made.
delegate()->VerifyAndClearExpectations();
@ -511,13 +512,13 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTestWithAutoupgradesDisabled,
// Secure resource on an insecure page does execute Clear-Site-Data.
delegate()->ExpectClearSiteDataCookiesCall(url::Origin::Create(secure_image));
NavigateToURL(shell(), secure_page);
EXPECT_TRUE(NavigateToURL(shell(), secure_page));
delegate()->VerifyAndClearExpectations();
// Secure resource on a secure page does execute Clear-Site-Data.
delegate()->ExpectClearSiteDataCookiesCall(url::Origin::Create(secure_image));
NavigateToURL(shell(), secure_page);
EXPECT_TRUE(NavigateToURL(shell(), secure_page));
delegate()->VerifyAndClearExpectations();
}
@ -534,7 +535,7 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest, ServiceWorker) {
// the page title.
GURL url = origin1;
AddQuery(&url, "file", "worker_setup.html");
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
WaitForTitle(shell(), "service worker is ready");
// The service worker will now serve a page containing several images, which
@ -567,7 +568,7 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest, ServiceWorker) {
AddQuery(&url, "origin2", origin2.spec());
AddQuery(&url, "origin3", origin3.spec());
AddQuery(&url, "origin4", origin4.spec());
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
WaitForTitle(shell(), "done");
delegate()->VerifyAndClearExpectations();
}
@ -632,7 +633,7 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest, MAYBE_Credentials) {
if (test_case.should_run)
delegate()->ExpectClearSiteDataCookiesCall(url::Origin::Create(resource));
NavigateToURL(shell(), page);
EXPECT_TRUE(NavigateToURL(shell(), page));
WaitForTitle(shell(), "done");
delegate()->VerifyAndClearExpectations();
}
@ -675,7 +676,7 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest, CredentialsOnRedirect) {
GURL page = https_server()->GetURL("origin1.com", "/");
AddQuery(&page, "html", content);
NavigateToURL(shell(), page);
EXPECT_TRUE(NavigateToURL(shell(), page));
WaitForTitle(shell(), "done");
delegate()->VerifyAndClearExpectations();
}
@ -707,7 +708,7 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest, Types) {
url::Origin::Create(url), test_case.remove_cookies,
test_case.remove_storage, test_case.remove_cache);
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
delegate()->VerifyAndClearExpectations();
}
@ -728,7 +729,7 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
// Let Clear-Site-Data delete the "cookies" of "origin1.com".
GURL url = https_server()->GetURL("origin1.com", "/clear-site-data");
AddQuery(&url, "header", kClearCookiesHeader);
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
// Only the "origin2.com" eTLD now has cookies.
cookies = GetCookies();
@ -759,7 +760,7 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
// of the scope.
GURL url = server->GetURL("origin1.com", "/anything-in-the-scope");
AddQuery(&url, "header", "\"storage\"");
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
service_workers =
browsing_data_browsertest_utils::GetServiceWorkers(partition);
EXPECT_EQ(2u, service_workers.size());
@ -770,7 +771,7 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
// The header will be respected and the worker deleted.
url = server->GetURL("origin1.com", "/resource");
AddQuery(&url, "header", "\"storage\"");
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
// Only "origin2.com" now has a service worker.
service_workers =
@ -810,7 +811,7 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
// Let Clear-Site-Data delete the "cache" of HTTPS host 2.
GURL url = GetURLForHTTPSHost2("/clear-site-data");
AddQuery(&url, "header", "\"cache\"");
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
// Only HTTPS host 1 now has cache entries.
EXPECT_TRUE(TestCacheEntry(url1));
@ -834,7 +835,7 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
ClearSiteDataDuringServiceWorkerInstall) {
GURL url = embedded_test_server()->GetURL("127.0.0.1", "/");
AddQuery(&url, "file", "worker_test.html");
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
delegate()->ExpectClearSiteDataCall(url::Origin::Create(url), false, true,
false);
SetClearSiteDataHeader("\"storage\"");
@ -849,7 +850,7 @@ IN_PROC_BROWSER_TEST_F(ClearSiteDataHandlerBrowserTest,
ClearSiteDataDuringServiceWorkerUpdate) {
GURL url = embedded_test_server()->GetURL("127.0.0.1", "/");
AddQuery(&url, "file", "worker_test.html");
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
// Install a service worker.
EXPECT_TRUE(RunScriptAndGetBool("installServiceWorker()"));
delegate()->VerifyAndClearExpectations();

@ -50,7 +50,7 @@ IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak) {
GURL url = GetTestUrl("", "simple_page.html");
auto* policy = ChildProcessSecurityPolicyImpl::GetInstance();
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
{
base::AutoLock lock(policy->lock_);
EXPECT_EQ(RenderProcessHostImpl::IsSpareProcessKeptAtAllTimes() ? 2u : 1u,

@ -31,7 +31,7 @@ class DatabaseTest : public ContentBrowserTest {
}
void Navigate(Shell* shell) {
NavigateToURL(shell, GetTestUrl("", "simple_database.html"));
EXPECT_TRUE(NavigateToURL(shell, GetTestUrl("", "simple_database.html")));
}
void CreateTable(Shell* shell) {

@ -2408,9 +2408,9 @@ IN_PROC_BROWSER_TEST_F(DevToolsDownloadContentTest, MAYBE_MultiDownload) {
// Allow the first request to finish.
std::unique_ptr<DownloadTestObserver> observer2(CreateWaiter(shell(), 1));
NavigateToURL(shell(),
embedded_test_server()->GetURL(
content::SlowDownloadHttpResponse::kFinishDownloadUrl));
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL(
content::SlowDownloadHttpResponse::kFinishDownloadUrl)));
observer2->WaitForFinished(); // Wait for the third request.
EXPECT_EQ(
1u, observer2->NumDownloadsSeenInState(download::DownloadItem::COMPLETE));

@ -69,7 +69,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessDevToolsBrowserTest,
MAYBE_CrossSiteIframeAgentHost) {
DevToolsAgentHost::List list;
GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html"));
NavigateToURL(shell(), main_url);
EXPECT_TRUE(NavigateToURL(shell(), main_url));
// It is safe to obtain the root frame tree node here, as it doesn't change.
FrameTreeNode* root =
@ -140,7 +140,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessDevToolsBrowserTest,
IN_PROC_BROWSER_TEST_F(SitePerProcessDevToolsBrowserTest, AgentHostForFrames) {
GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html"));
NavigateToURL(shell(), main_url);
EXPECT_TRUE(NavigateToURL(shell(), main_url));
scoped_refptr<DevToolsAgentHost> page_agent =
DevToolsAgentHost::GetOrCreateFor(shell()->web_contents());
@ -179,7 +179,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessDevToolsBrowserTest, AgentHostForFrames) {
IN_PROC_BROWSER_TEST_F(SitePerProcessDevToolsBrowserTest,
AgentHostForPageEqualsOneForMainFrame) {
GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html"));
NavigateToURL(shell(), main_url);
EXPECT_TRUE(NavigateToURL(shell(), main_url));
// It is safe to obtain the root frame tree node here, as it doesn't change.
FrameTreeNode* root =

@ -150,7 +150,7 @@ IN_PROC_BROWSER_TEST_F(DoNotTrackTest, Redirect) {
return;
// We don't check the result NavigateToURL as it returns true only if the
// final URL is equal to the passed URL.
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url, final_url /* expected_commit_url */));
ExpectPageTextEq("1");
}
@ -175,8 +175,8 @@ IN_PROC_BROWSER_TEST_F(DoNotTrackTest, Worker) {
ASSERT_TRUE(embedded_test_server()->Start());
if (!EnableDoNotTrack())
return;
NavigateToURL(shell(),
GetURL("/workers/create_worker.html?worker_url=/capture"));
EXPECT_TRUE(NavigateToURL(
shell(), GetURL("/workers/create_worker.html?worker_url=/capture")));
loop.Run();
EXPECT_TRUE(header_map.find("DNT") != header_map.end());
@ -206,9 +206,9 @@ IN_PROC_BROWSER_TEST_F(DoNotTrackTest, MAYBE_SharedWorker) {
ASSERT_TRUE(embedded_test_server()->Start());
if (!EnableDoNotTrack())
return;
NavigateToURL(
EXPECT_TRUE(NavigateToURL(
shell(),
GetURL("/workers/create_shared_worker.html?worker_url=/capture"));
GetURL("/workers/create_shared_worker.html?worker_url=/capture")));
loop.Run();
EXPECT_TRUE(header_map.find("DNT") != header_map.end());
@ -231,7 +231,8 @@ IN_PROC_BROWSER_TEST_F(DoNotTrackTest, ServiceWorker_Register) {
ASSERT_TRUE(embedded_test_server()->Start());
if (!EnableDoNotTrack())
return;
NavigateToURL(shell(), GetURL("/service_worker/create_service_worker.html"));
EXPECT_TRUE(NavigateToURL(
shell(), GetURL("/service_worker/create_service_worker.html")));
EXPECT_EQ("DONE", EvalJs(shell(), "register('/capture');"));
loop.Run();
@ -260,7 +261,8 @@ IN_PROC_BROWSER_TEST_F(DoNotTrackTest, ServiceWorker_Update) {
// Register a service worker, trigger update, then wait until the handler sees
// the second request.
NavigateToURL(shell(), GetURL("/service_worker/create_service_worker.html"));
EXPECT_TRUE(NavigateToURL(
shell(), GetURL("/service_worker/create_service_worker.html")));
EXPECT_EQ("DONE", EvalJs(shell(), "register('/capture');"));
EXPECT_EQ("DONE", EvalJs(shell(), "update();"));
loop.Run();
@ -279,7 +281,8 @@ IN_PROC_BROWSER_TEST_F(DoNotTrackTest, FetchFromWorker) {
ASSERT_TRUE(embedded_test_server()->Start());
if (!EnableDoNotTrack())
return;
NavigateToURL(shell(), GetURL("/workers/fetch_from_worker.html"));
EXPECT_TRUE(
NavigateToURL(shell(), GetURL("/workers/fetch_from_worker.html")));
EXPECT_EQ("1", EvalJs(shell(), "fetch_from_worker('/echoheader?DNT');"));
}
@ -296,7 +299,8 @@ IN_PROC_BROWSER_TEST_F(DoNotTrackTest, MAYBE_FetchFromSharedWorker) {
ASSERT_TRUE(embedded_test_server()->Start());
if (!EnableDoNotTrack())
return;
NavigateToURL(shell(), GetURL("/workers/fetch_from_shared_worker.html"));
EXPECT_TRUE(
NavigateToURL(shell(), GetURL("/workers/fetch_from_shared_worker.html")));
EXPECT_EQ("1",
EvalJs(shell(), "fetch_from_shared_worker('/echoheader?DNT');"));
@ -307,8 +311,8 @@ IN_PROC_BROWSER_TEST_F(DoNotTrackTest, FetchFromServiceWorker) {
ASSERT_TRUE(embedded_test_server()->Start());
if (!EnableDoNotTrack())
return;
NavigateToURL(shell(),
GetURL("/service_worker/fetch_from_service_worker.html"));
EXPECT_TRUE(NavigateToURL(
shell(), GetURL("/service_worker/fetch_from_service_worker.html")));
EXPECT_EQ("ready", EvalJs(shell(), "setup();"));
EXPECT_EQ("1",

@ -23,7 +23,7 @@ IN_PROC_BROWSER_TEST_F(FileAPIBrowserTest, FileInputChooserParams) {
EXPECT_TRUE(base::PathService::Get(base::DIR_TEMP, &file));
file = file.AppendASCII("bar");
NavigateToURL(shell(), GetTestUrl(".", "file_input.html"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl(".", "file_input.html")));
// Click on the <input type=file> element to launch the file upload picker.
{

@ -60,7 +60,8 @@ class FindRequestManagerTest : public ContentBrowserTest,
// Navigates to |url| and waits for it to finish loading.
void LoadAndWait(const std::string& url) {
TestNavigationObserver navigation_observer(contents());
NavigateToURL(shell(), embedded_test_server()->GetURL("a.com", url));
EXPECT_TRUE(
NavigateToURL(shell(), embedded_test_server()->GetURL("a.com", url)));
ASSERT_TRUE(navigation_observer.last_navigation_succeeded());
}
@ -429,7 +430,7 @@ IN_PROC_BROWSER_TEST_P(FindRequestManagerTest, DISABLED_AddFrame) {
// matches.
IN_PROC_BROWSER_TEST_F(FindRequestManagerTest, MAYBE(AddFrameAfterNoMatches)) {
TestNavigationObserver navigation_observer(contents());
NavigateToURL(shell(), GURL("about:blank"));
EXPECT_TRUE(NavigateToURL(shell(), GURL("about:blank")));
EXPECT_TRUE(navigation_observer.last_navigation_succeeded());
auto default_options = blink::mojom::FindOptions::New();
@ -622,7 +623,7 @@ IN_PROC_BROWSER_TEST_F(FindRequestManagerTest, DetachFrameWithMatch) {
IN_PROC_BROWSER_TEST_F(FindRequestManagerTest, MAYBE(FindInPage_Issue644448)) {
TestNavigationObserver navigation_observer(contents());
NavigateToURL(shell(), GURL("about:blank"));
EXPECT_TRUE(NavigateToURL(shell(), GURL("about:blank")));
EXPECT_TRUE(navigation_observer.last_navigation_succeeded());
auto default_options = blink::mojom::FindOptions::New();

@ -150,7 +150,8 @@ class FontUniqueNameBrowserTest : public DevToolsProtocolTest {
ASSERT_TRUE(embedded_test_server()->Start());
TestNavigationObserver navigation_observer(
static_cast<WebContentsImpl*>(shell()->web_contents()));
NavigateToURL(shell(), embedded_test_server()->GetURL("a.com", url));
EXPECT_TRUE(
NavigateToURL(shell(), embedded_test_server()->GetURL("a.com", url)));
ASSERT_TRUE(navigation_observer.last_navigation_succeeded());
}

@ -252,9 +252,9 @@ IN_PROC_BROWSER_TEST_F(RenderFrameMessageFilterBrowserTest, SameSiteCookies) {
std::string a_hostname = "localhost";
std::string b_hostname = "127.0.0.1";
GURL url = a_server.GetURL(a_hostname, cookies_to_set);
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
url = b_server.GetURL(b_hostname, cookies_to_set);
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
// TODO(crbug.com/984685): Make it less painful to set up https cross-site
// iframe tests.
std::string a_hostname_and_port =

@ -65,7 +65,7 @@ class HidTest : public ContentBrowserTest {
} // namespace
IN_PROC_BROWSER_TEST_F(HidTest, GetDevices) {
NavigateToURL(shell(), GetTestUrl(nullptr, "simple_page.html"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl(nullptr, "simple_page.html")));
// Three devices are added but only two will have permission granted.
for (int i = 0; i < 3; i++) {
@ -86,7 +86,7 @@ IN_PROC_BROWSER_TEST_F(HidTest, GetDevices) {
}
IN_PROC_BROWSER_TEST_F(HidTest, RequestDevice) {
NavigateToURL(shell(), GetTestUrl(nullptr, "simple_page.html"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl(nullptr, "simple_page.html")));
EXPECT_CALL(delegate(), CanRequestDevicePermission(_, _))
.WillOnce(Return(true));
@ -104,7 +104,7 @@ IN_PROC_BROWSER_TEST_F(HidTest, RequestDevice) {
}
IN_PROC_BROWSER_TEST_F(HidTest, DisallowRequestDevice) {
NavigateToURL(shell(), GetTestUrl(nullptr, "simple_page.html"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl(nullptr, "simple_page.html")));
EXPECT_CALL(delegate(), CanRequestDevicePermission(_, _))
.WillOnce(Return(false));

@ -45,7 +45,7 @@ class IdleTest : public ContentBrowserTest {
} // namespace
IN_PROC_BROWSER_TEST_F(IdleTest, Start) {
NavigateToURL(shell(), GetTestUrl(nullptr, "simple_page.html"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl(nullptr, "simple_page.html")));
auto mock_time_provider = std::make_unique<NiceMock<MockIdleTimeProvider>>();
auto* rph = static_cast<RenderProcessHostImpl*>(

@ -133,7 +133,7 @@ class IndexedDBBrowserTest : public ContentBrowserTest,
base::string16 expected_title16(ASCIIToUTF16(expected_string));
TitleWatcher title_watcher(shell->web_contents(), expected_title16);
NavigateToURL(shell, url);
EXPECT_TRUE(NavigateToURL(shell, url));
EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle());
}
@ -1021,7 +1021,7 @@ IN_PROC_BROWSER_TEST_F(
// Start on a different URL to force a new renderer process.
Shell* new_shell = CreateBrowser();
NavigateToURL(new_shell, GURL(url::kAboutBlankURL));
EXPECT_TRUE(NavigateToURL(new_shell, GURL(url::kAboutBlankURL)));
NavigateAndWaitForTitle(new_shell, "version_change_blocked.html", "#tab2",
"setVersion(3) blocked");

@ -2712,8 +2712,9 @@ IN_PROC_BROWSER_TEST_F(MediaSessionImplBrowserTest,
#endif
IN_PROC_BROWSER_TEST_F(MediaSessionImplBrowserTest,
MAYBE_PositionStateRouteWithOnePlayer) {
NavigateToURL(shell(), embedded_test_server()->GetURL(
"example.com", "/media/session/position.html"));
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL("example.com",
"/media/session/position.html")));
auto* main_frame = shell()->web_contents()->GetMainFrame();
const base::TimeDelta duration = base::TimeDelta::FromMilliseconds(6060);

@ -354,7 +354,7 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest, BrowserInitiatedNavigations) {
{
TestNavigationObserver observer(shell()->web_contents());
GURL url(embedded_test_server()->GetURL("/title1.html"));
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
EXPECT_EQ(url, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
EXPECT_FALSE(observer.last_initiator_origin().has_value());
@ -370,7 +370,7 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest, BrowserInitiatedNavigations) {
{
TestNavigationObserver observer(shell()->web_contents());
GURL url(embedded_test_server()->GetURL("/title2.html"));
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
EXPECT_EQ(url, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
EXPECT_FALSE(observer.last_initiator_origin().has_value());
@ -386,7 +386,7 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest, BrowserInitiatedNavigations) {
{
TestNavigationObserver observer(shell()->web_contents());
GURL url = embedded_test_server()->GetURL("foo.com", "/title3.html");
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
EXPECT_EQ(url, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
EXPECT_FALSE(observer.last_initiator_origin().has_value());
@ -406,7 +406,7 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest,
{
TestNavigationObserver observer(shell()->web_contents());
GURL url(embedded_test_server()->GetURL("/simple_links.html"));
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
EXPECT_EQ(url, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
EXPECT_FALSE(observer.last_initiator_origin().has_value());
@ -448,7 +448,7 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest,
{
TestNavigationObserver observer(shell()->web_contents());
GURL url(embedded_test_server()->GetURL("/simple_links.html"));
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
EXPECT_EQ(url, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
}
@ -506,7 +506,7 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest, FailedNavigation) {
{
TestNavigationObserver observer(shell()->web_contents());
GURL url(embedded_test_server()->GetURL("/title1.html"));
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
EXPECT_EQ(url, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
}
@ -517,7 +517,7 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest, FailedNavigation) {
GURL error_url(embedded_test_server()->GetURL("/close-socket"));
base::PostTask(FROM_HERE, {BrowserThread::IO},
base::BindOnce(&net::URLRequestFailedJob::AddUrlHandler));
NavigateToURL(shell(), error_url);
EXPECT_FALSE(NavigateToURL(shell(), error_url));
EXPECT_EQ(error_url, observer.last_navigation_url());
NavigationEntry* entry =
shell()->web_contents()->GetController().GetLastCommittedEntry();
@ -532,7 +532,7 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest,
GURL url(embedded_test_server()->GetURL("/title1.html"));
GURL view_source_url(content::kViewSourceScheme + std::string(":") +
url.spec());
NavigateToURL(shell(), view_source_url);
EXPECT_TRUE(NavigateToURL(shell(), view_source_url));
EXPECT_EQ(url, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
}
@ -542,7 +542,7 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest,
ViewSourceNavigation_RendererInitiated) {
TestNavigationObserver observer(shell()->web_contents());
GURL kUrl(embedded_test_server()->GetURL("/simple_links.html"));
NavigateToURL(shell(), kUrl);
EXPECT_TRUE(NavigateToURL(shell(), kUrl));
EXPECT_EQ(kUrl, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
@ -572,7 +572,7 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest,
GoogleChromeNavigation_RendererInitiated) {
TestNavigationObserver observer(shell()->web_contents());
GURL kUrl(embedded_test_server()->GetURL("/simple_links.html"));
NavigateToURL(shell(), kUrl);
EXPECT_TRUE(NavigateToURL(shell(), kUrl));
EXPECT_EQ(kUrl, observer.last_navigation_url());
EXPECT_TRUE(observer.last_navigation_succeeded());
@ -898,8 +898,8 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest, BackFollowedByReload) {
// First, make two history entries.
GURL url1(embedded_test_server()->GetURL("/title1.html"));
GURL url2(embedded_test_server()->GetURL("/title2.html"));
NavigateToURL(shell(), url1);
NavigateToURL(shell(), url2);
EXPECT_TRUE(NavigateToURL(shell(), url1));
EXPECT_TRUE(NavigateToURL(shell(), url2));
// Then execute a back navigation in Javascript followed by a reload.
TestNavigationObserver navigation_observer(shell()->web_contents());
@ -1084,7 +1084,7 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest, RendererNavigationInitiator) {
url::Origin starting_page_origin;
starting_page_origin = starting_page_origin.Create(starting_page);
NavigateToURL(shell(), starting_page);
EXPECT_TRUE(NavigateToURL(shell(), starting_page));
GURL url(embedded_test_server()->GetURL("/title2.html"));
@ -1101,7 +1101,7 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest, RendererNavigationInitiator) {
// navigated by Javascript from some starting page to another page.
IN_PROC_BROWSER_TEST_P(NavigationBrowserTest, SubFrameJsNavigationInitiator) {
GURL starting_page(embedded_test_server()->GetURL("/frame_tree/top.html"));
NavigateToURL(shell(), starting_page);
EXPECT_TRUE(NavigateToURL(shell(), starting_page));
// It is safe to obtain the root frame tree node here, as it doesn't change.
FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
@ -1142,7 +1142,7 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest,
// Go to a page on a.com with an iframe that is on b.com
GURL starting_page(embedded_test_server()->GetURL(
"a.com", "/cross_site_iframe_factory.html?a(b)"));
NavigateToURL(shell(), starting_page);
EXPECT_TRUE(NavigateToURL(shell(), starting_page));
// It is safe to obtain the root frame tree node here, as it doesn't change.
FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
@ -1254,7 +1254,7 @@ IN_PROC_BROWSER_TEST_P(NavigationBaseBrowserTest,
EXPECT_TRUE(embedded_test_server()->Start());
GURL url(embedded_test_server()->GetURL("/title1.html"));
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
DOMMessageQueue dom_message_queue(WebContents::FromRenderFrameHost(
shell()->web_contents()->GetMainFrame()));
@ -1729,7 +1729,8 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest, OpenerNavigation_DownloadPolicy) {
->GetBrowserContext()
->GetDownloadManagerDelegate());
delegate->SetDownloadBehaviorForTesting(download_dir.GetPath());
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));
EXPECT_TRUE(
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")));
WebContents* opener = shell()->web_contents();
// Open a popup.
@ -1771,8 +1772,8 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest,
->GetBrowserContext()
->GetDownloadManagerDelegate());
delegate->SetDownloadBehaviorForTesting(download_dir.GetPath());
NavigateToURL(shell(),
embedded_test_server()->GetURL("a.com", "/title1.html"));
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL("a.com", "/title1.html")));
WebContents* opener = shell()->web_contents();
// Open a popup.
@ -1814,7 +1815,7 @@ IN_PROC_BROWSER_TEST_P(NavigationDownloadBrowserTest,
ASSERT_TRUE(embedded_test_server()->Start());
GURL url(embedded_test_server()->GetURL("/title1.html"));
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
// Block every iframe in WillProcessResponse.
content::TestNavigationThrottleInserter throttle_inserter(
@ -2141,7 +2142,7 @@ IN_PROC_BROWSER_TEST_P(NavigationBrowserTest, BlockedSrcDocRendererInitiated) {
// browser process. It means RenderFrameHostImpl::BeginNavigation() is called.
IN_PROC_BROWSER_TEST_P(NavigationBrowserTest, AboutSrcDocUsesBeginNavigation) {
GURL url(embedded_test_server()->GetURL("/title1.html"));
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
// If DidStartNavigation is called before DidCommitProvisionalLoad, then it
// means the navigation was driven by the browser process, otherwise by the

@ -91,7 +91,8 @@ class AcceptHeaderTest : public ContentBrowserTest {
};
IN_PROC_BROWSER_TEST_F(AcceptHeaderTest, Check) {
NavigateToURL(shell(), embedded_test_server()->GetURL("/accept-header.html"));
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL("/accept-header.html")));
// ResourceType::kMainFrame
EXPECT_EQ(

@ -177,7 +177,7 @@ IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, VerifyNetworkStateInitialized) {
net::NetworkChangeNotifier::DisableForTest disable_for_test;
MockNetworkChangeNotifierWifi mock_notifier;
NavigateToURL(shell(), content::GetTestUrl("", "net_info.html"));
EXPECT_TRUE(NavigateToURL(shell(), content::GetTestUrl("", "net_info.html")));
EXPECT_TRUE(RunScriptExtractBool("getOnLine()"));
EXPECT_EQ("wifi", RunScriptExtractString("getType()"));
EXPECT_EQ(net::NetworkChangeNotifier::GetMaxBandwidthMbpsForConnectionSubtype(
@ -188,7 +188,7 @@ IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, VerifyNetworkStateInitialized) {
// Make sure that type changes in the browser make their way to
// navigator.connection.type.
IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, NetworkChangePlumbsToNavigator) {
NavigateToURL(shell(), content::GetTestUrl("", "net_info.html"));
EXPECT_TRUE(NavigateToURL(shell(), content::GetTestUrl("", "net_info.html")));
SetConnectionType(net::NetworkChangeNotifier::CONNECTION_WIFI,
net::NetworkChangeNotifier::SUBTYPE_WIFI_N);
EXPECT_EQ("wifi", RunScriptExtractString("getType()"));
@ -207,7 +207,7 @@ IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, NetworkChangePlumbsToNavigator) {
// Make sure that type changes in the browser make their way to
// navigator.isOnline.
IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, IsOnline) {
NavigateToURL(shell(), content::GetTestUrl("", "net_info.html"));
EXPECT_TRUE(NavigateToURL(shell(), content::GetTestUrl("", "net_info.html")));
SetConnectionType(net::NetworkChangeNotifier::CONNECTION_ETHERNET,
net::NetworkChangeNotifier::SUBTYPE_GIGABIT_ETHERNET);
EXPECT_TRUE(RunScriptExtractBool("getOnLine()"));
@ -224,7 +224,7 @@ IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, IsOnline) {
IN_PROC_BROWSER_TEST_F(NetInfoBrowserTest, TwoRenderViewsInOneProcess) {
SetConnectionType(net::NetworkChangeNotifier::CONNECTION_ETHERNET,
net::NetworkChangeNotifier::SUBTYPE_GIGABIT_ETHERNET);
NavigateToURL(shell(), content::GetTestUrl("", "net_info.html"));
EXPECT_TRUE(NavigateToURL(shell(), content::GetTestUrl("", "net_info.html")));
EXPECT_TRUE(RunScriptExtractBool("getOnLine()"));
SetConnectionType(net::NetworkChangeNotifier::CONNECTION_NONE,

@ -71,7 +71,7 @@ class OriginTrialsBrowserTest : public content::ContentBrowserTest {
};
IN_PROC_BROWSER_TEST_F(OriginTrialsBrowserTest, Basic) {
NavigateToURL(shell(), GURL("https://example.test/basic.html"));
EXPECT_TRUE(NavigateToURL(shell(), GURL("https://example.test/basic.html")));
// Ensure we can invoke normalMethod(), which is only available when the
// Frobulate OT is enabled.
EXPECT_TRUE(content::ExecJs(shell()->web_contents()->GetMainFrame(),
@ -80,7 +80,7 @@ IN_PROC_BROWSER_TEST_F(OriginTrialsBrowserTest, Basic) {
IN_PROC_BROWSER_TEST_F(OriginTrialsBrowserTest,
NonNavigationTrialNotActivatedAcrossNavigations) {
NavigateToURL(shell(), GURL("https://example.test/basic.html"));
EXPECT_TRUE(NavigateToURL(shell(), GURL("https://example.test/basic.html")));
EXPECT_TRUE(content::ExecJs(shell()->web_contents()->GetMainFrame(),
"internals.originTrialsTest().normalMethod();"));
NavigateViaRenderer(shell()->web_contents(),
@ -92,7 +92,8 @@ IN_PROC_BROWSER_TEST_F(OriginTrialsBrowserTest,
}
IN_PROC_BROWSER_TEST_F(OriginTrialsBrowserTest, Navigation) {
NavigateToURL(shell(), GURL("https://example.test/navigation.html"));
EXPECT_TRUE(
NavigateToURL(shell(), GURL("https://example.test/navigation.html")));
// Ensure we can invoke navigationMethod(), which is only available when the
// FrobulateNavigation OT is enabled.
EXPECT_TRUE(
@ -102,7 +103,8 @@ IN_PROC_BROWSER_TEST_F(OriginTrialsBrowserTest, Navigation) {
IN_PROC_BROWSER_TEST_F(OriginTrialsBrowserTest,
NavigationTrialActivatedAcrossNavigations) {
NavigateToURL(shell(), GURL("https://example.test/navigation.html"));
EXPECT_TRUE(
NavigateToURL(shell(), GURL("https://example.test/navigation.html")));
EXPECT_TRUE(
content::ExecJs(shell()->web_contents()->GetMainFrame(),
"internals.originTrialsTest().navigationMethod();"));

@ -67,7 +67,7 @@ class AccessibilityTreeLinkageWinBrowserTest
};
IN_PROC_BROWSER_TEST_P(AccessibilityTreeLinkageWinBrowserTest, Linkage) {
NavigateToURL(shell(), GURL(url::kAboutBlankURL));
EXPECT_TRUE(NavigateToURL(shell(), GURL(url::kAboutBlankURL)));
GetParentWindow()->SetProperty(
aura::client::kParentNativeViewAccessibleKey,

@ -85,7 +85,7 @@ IN_PROC_BROWSER_TEST_P(DirectManipulationBrowserTest,
if (base::win::GetVersion() < base::win::Version::WIN10)
return;
NavigateToURL(shell(), GURL(url::kAboutBlankURL));
EXPECT_TRUE(NavigateToURL(shell(), GURL(url::kAboutBlankURL)));
LegacyRenderWidgetHostHWND* lrwhh = GetLegacyRenderWidgetHostHWND();
ASSERT_TRUE(lrwhh);
@ -137,7 +137,7 @@ IN_PROC_BROWSER_TEST_P(DirectManipulationBrowserTest, EventConvert) {
if (base::win::GetVersion() < base::win::Version::WIN10)
return;
NavigateToURL(shell(), GURL(url::kAboutBlankURL));
EXPECT_TRUE(NavigateToURL(shell(), GURL(url::kAboutBlankURL)));
LegacyRenderWidgetHostHWND* lrwhh = GetLegacyRenderWidgetHostHWND();
ASSERT_TRUE(lrwhh);

@ -80,7 +80,7 @@ class RenderWidgetHostViewAuraBrowserTest : public ContentBrowserTest {
#if defined(OS_CHROMEOS)
IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewAuraBrowserTest,
StaleFrameContentOnEvictionNormal) {
NavigateToURL(shell(), GURL(kMinimalPageDataURL));
EXPECT_TRUE(NavigateToURL(shell(), GURL(kMinimalPageDataURL)));
// Make sure the renderer submits at least one frame before hiding it.
RenderFrameSubmissionObserver submission_observer(shell()->web_contents());
@ -121,7 +121,7 @@ IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewAuraBrowserTest,
IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewAuraBrowserTest,
StaleFrameContentOnEvictionRejected) {
NavigateToURL(shell(), GURL(kMinimalPageDataURL));
EXPECT_TRUE(NavigateToURL(shell(), GURL(kMinimalPageDataURL)));
// Wait for first frame activation when a surface is embedded.
while (!GetDelegatedFrameHost()->HasSavedFrame())
@ -161,7 +161,7 @@ IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewAuraBrowserTest,
IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewAuraBrowserTest,
StaleFrameContentOnEvictionNone) {
NavigateToURL(shell(), GURL(kMinimalPageDataURL));
EXPECT_TRUE(NavigateToURL(shell(), GURL(kMinimalPageDataURL)));
// Wait for first frame activation when a surface is embedded.
while (!GetDelegatedFrameHost()->HasSavedFrame())

@ -64,7 +64,7 @@ class SerialTest : public ContentBrowserTest {
} // namespace
IN_PROC_BROWSER_TEST_F(SerialTest, GetPorts) {
NavigateToURL(shell(), GetTestUrl(nullptr, "simple_page.html"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl(nullptr, "simple_page.html")));
// Three ports are added but only two will have permission granted.
for (size_t i = 0; i < 3; i++) {
@ -84,7 +84,7 @@ IN_PROC_BROWSER_TEST_F(SerialTest, GetPorts) {
}
IN_PROC_BROWSER_TEST_F(SerialTest, RequestPort) {
NavigateToURL(shell(), GetTestUrl(nullptr, "simple_page.html"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl(nullptr, "simple_page.html")));
EXPECT_CALL(delegate(), CanRequestPortPermission).WillOnce(Return(true));
@ -101,7 +101,7 @@ IN_PROC_BROWSER_TEST_F(SerialTest, RequestPort) {
}
IN_PROC_BROWSER_TEST_F(SerialTest, DisallowRequestPort) {
NavigateToURL(shell(), GetTestUrl(nullptr, "simple_page.html"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl(nullptr, "simple_page.html")));
EXPECT_CALL(delegate(), CanRequestPortPermission(_)).WillOnce(Return(false));
EXPECT_CALL(delegate(), RunChooserInternal).Times(Exactly(0));

@ -64,7 +64,7 @@ class ShapeDetectionBrowserTest
const GURL html_url(
embedded_test_server()->GetURL(kShapeDetectionTestHtml));
const GURL image_url(embedded_test_server()->GetURL(image_path));
NavigateToURL(shell(), html_url);
EXPECT_TRUE(NavigateToURL(shell(), html_url));
const std::string js_command = "detectShapesOnImageUrl('" + detector_name +
"', '" + image_url.spec() + "')";
std::string response_string;

@ -2919,7 +2919,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, RemoveFocusFromKilledFrame) {
GURL main_url(embedded_test_server()->GetURL(
"foo.com", "/cross_site_iframe_factory.html?foo.com(bar.com)"));
NavigateToURL(shell(), main_url);
EXPECT_TRUE(NavigateToURL(shell(), main_url));
// It is safe to obtain the root frame tree node here, as it doesn't change.
FrameTreeNode* root = web_contents()->GetFrameTree()->root();

@ -97,7 +97,7 @@ class SmsBrowserTest : public ContentBrowserTest {
IN_PROC_BROWSER_TEST_F(SmsBrowserTest, Receive) {
GURL url = GetTestUrl(nullptr, "simple_page.html");
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
shell()->web_contents()->SetDelegate(&delegate_);
@ -139,7 +139,7 @@ IN_PROC_BROWSER_TEST_F(SmsBrowserTest, Receive) {
IN_PROC_BROWSER_TEST_F(SmsBrowserTest, AtMostOnePendingSmsRequest) {
GURL url = GetTestUrl(nullptr, "simple_page.html");
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
shell()->web_contents()->SetDelegate(&delegate_);
@ -194,7 +194,7 @@ IN_PROC_BROWSER_TEST_F(SmsBrowserTest, AtMostOnePendingSmsRequest) {
IN_PROC_BROWSER_TEST_F(SmsBrowserTest, Reload) {
GURL url = GetTestUrl(nullptr, "simple_page.html");
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
auto* provider = new NiceMock<MockSmsProvider>();
BrowserMainLoop::GetInstance()->SetSmsProviderForTesting(
@ -227,7 +227,7 @@ IN_PROC_BROWSER_TEST_F(SmsBrowserTest, Reload) {
ukm_loop.QuitClosure());
// Reload the page.
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
ukm_loop.Run();
@ -238,7 +238,7 @@ IN_PROC_BROWSER_TEST_F(SmsBrowserTest, Reload) {
IN_PROC_BROWSER_TEST_F(SmsBrowserTest, Close) {
GURL url = GetTestUrl(nullptr, "simple_page.html");
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
auto* provider = new NiceMock<MockSmsProvider>();
BrowserMainLoop::GetInstance()->SetSmsProviderForTesting(
@ -278,8 +278,8 @@ IN_PROC_BROWSER_TEST_F(SmsBrowserTest, TwoTabsSameOrigin) {
GURL url = GetTestUrl(nullptr, "simple_page.html");
NavigateToURL(tab1, url);
NavigateToURL(tab2, url);
EXPECT_TRUE(NavigateToURL(tab1, url));
EXPECT_TRUE(NavigateToURL(tab2, url));
std::string script = R"(
navigator.sms.receive().then(({content}) => {
@ -394,8 +394,8 @@ IN_PROC_BROWSER_TEST_F(SmsBrowserTest, TwoTabsDifferentOrigin) {
GURL url1 = https_server.GetURL("a.com", "/simple_page.html");
GURL url2 = https_server.GetURL("b.com", "/simple_page.html");
NavigateToURL(tab1, url1);
NavigateToURL(tab2, url2);
EXPECT_TRUE(NavigateToURL(tab1, url1));
EXPECT_TRUE(NavigateToURL(tab2, url2));
std::string script = R"(
navigator.sms.receive().then(({content}) => {
@ -471,7 +471,7 @@ IN_PROC_BROWSER_TEST_F(SmsBrowserTest, TwoTabsDifferentOrigin) {
IN_PROC_BROWSER_TEST_F(SmsBrowserTest, SmsReceivedAfterTabIsClosed) {
GURL url = GetTestUrl(nullptr, "simple_page.html");
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
auto* provider = new NiceMock<MockSmsProvider>();
BrowserMainLoop::GetInstance()->SetSmsProviderForTesting(
@ -502,7 +502,7 @@ IN_PROC_BROWSER_TEST_F(SmsBrowserTest, SmsReceivedAfterTabIsClosed) {
IN_PROC_BROWSER_TEST_F(SmsBrowserTest, Cancels) {
GURL url = GetTestUrl(nullptr, "simple_page.html");
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
auto* provider = new NiceMock<MockSmsProvider>();
BrowserMainLoop::GetInstance()->SetSmsProviderForTesting(

@ -90,8 +90,8 @@ class SnapshotBrowserTest : public ContentBrowserTest {
&SnapshotBrowserTest::HandleRequest, base::Unretained(this)));
ASSERT_TRUE(embedded_test_server()->Start());
ASSERT_NO_FATAL_FAILURE(content::NavigateToURL(
shell(), embedded_test_server()->GetURL("/test")));
ASSERT_TRUE(
NavigateToURL(shell(), embedded_test_server()->GetURL("/test")));
}
std::unique_ptr<net::test_server::HttpResponse> HandleRequest(

@ -671,7 +671,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest,
background_tracing_helper.WaitForScenarioActivated();
NavigateToURL(shell(), GetTestUrl("", "about:blank"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl("", "about:blank")));
TestTriggerHelper trigger_helper;
BackgroundTracingManager::GetInstance()->TriggerNamedEvent(

@ -166,7 +166,7 @@ class MemoryTracingTest : public ContentBrowserTest {
}
void Navigate(Shell* shell) {
NavigateToURL(shell, GetTestUrl("", "title1.html"));
EXPECT_TRUE(NavigateToURL(shell, GetTestUrl("", "title1.html")));
}
MOCK_METHOD2(OnMemoryDumpDone, void(uint32_t request_index, bool successful));

@ -69,7 +69,7 @@ class CommandlineStartupTracingTest : public ContentBrowserTest {
};
IN_PROC_BROWSER_TEST_F(CommandlineStartupTracingTest, TestStartupTracing) {
NavigateToURL(shell(), GetTestUrl("", "title1.html"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl("", "title1.html")));
WaitForCondition(base::BindRepeating([]() {
return !TracingController::GetInstance()->IsTracing();
}),
@ -143,7 +143,7 @@ IN_PROC_BROWSER_TEST_F(StartupTracingInProcessTest, TestFilledStartupBuffer) {
config, wait_for_tracing.QuitClosure());
wait_for_tracing.Run();
NavigateToURL(shell(), GetTestUrl("", "title1.html"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl("", "title1.html")));
base::RunLoop wait_for_stop;
TracingControllerImpl::GetInstance()->StopTracing(
@ -183,7 +183,7 @@ class BackgroundStartupTracingTest : public ContentBrowserTest {
#define MAYBE_TestStartupTracing TestStartupTracing
#endif
IN_PROC_BROWSER_TEST_F(BackgroundStartupTracingTest, MAYBE_TestStartupTracing) {
NavigateToURL(shell(), GetTestUrl("", "title1.html"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl("", "title1.html")));
EXPECT_FALSE(tracing::TraceStartupConfig::GetInstance()->IsEnabled());
EXPECT_FALSE(TracingController::GetInstance()->IsTracing());

@ -92,8 +92,8 @@ IN_PROC_BROWSER_TEST_F(OpenedByDOMTest, NormalWindow) {
// list has only one element. Navigate a bit so the second condition is false.
GURL url1 = embedded_test_server()->GetURL("/site_isolation/blank.html?1");
GURL url2 = embedded_test_server()->GetURL("/site_isolation/blank.html?2");
NavigateToURL(shell(), url1);
NavigateToURL(shell(), url2);
EXPECT_TRUE(NavigateToURL(shell(), url1));
EXPECT_TRUE(NavigateToURL(shell(), url2));
// This window was not opened by DOM, so close does not reach the browser
// process.
@ -108,10 +108,10 @@ IN_PROC_BROWSER_TEST_F(OpenedByDOMTest, Popup) {
GURL url1 = embedded_test_server()->GetURL("/site_isolation/blank.html?1");
GURL url2 = embedded_test_server()->GetURL("/site_isolation/blank.html?2");
GURL url3 = embedded_test_server()->GetURL("/site_isolation/blank.html?3");
NavigateToURL(shell(), url1);
EXPECT_TRUE(NavigateToURL(shell(), url1));
Shell* popup = OpenWindowFromJavaScript(shell(), url2);
NavigateToURL(popup, url3);
EXPECT_TRUE(NavigateToURL(popup, url3));
EXPECT_TRUE(AttemptCloseFromJavaScript(popup->web_contents()));
}
@ -130,10 +130,10 @@ IN_PROC_BROWSER_TEST_F(OpenedByDOMTest, CrossProcessPopup) {
GURL url3 = embedded_test_server()->GetURL("/site_isolation/blank.html?3");
url3 = url3.ReplaceComponents(replace_host);
NavigateToURL(shell(), url1);
EXPECT_TRUE(NavigateToURL(shell(), url1));
Shell* popup = OpenWindowFromJavaScript(shell(), url2);
NavigateToURL(popup, url3);
EXPECT_TRUE(NavigateToURL(popup, url3));
EXPECT_TRUE(AttemptCloseFromJavaScript(popup->web_contents()));
}

@ -91,7 +91,7 @@ void ResizeWebContentsView(Shell* shell, const gfx::Size& size,
// If |set_start_page| is true, start with blank page to make sure resize
// takes effect.
if (set_start_page)
NavigateToURL(shell, GURL("about://blank"));
EXPECT_TRUE(NavigateToURL(shell, GURL(url::kAboutBlankURL)));
#else
static_cast<WebContentsImpl*>(shell->web_contents())->GetView()->
SizeContents(size);
@ -276,7 +276,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, DidStopLoadingDetails) {
LoadStopNotificationObserver load_observer(
&shell()->web_contents()->GetController());
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));
EXPECT_TRUE(
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")));
load_observer.Wait();
EXPECT_EQ("/title1.html", load_observer.url_.path());
@ -302,7 +303,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
// We will hear a DidStopLoading from the first load as the new load
// is started.
NavigateOnCommitObserver commit_observer(shell(), url2);
NavigateToURL(shell(), url1);
EXPECT_TRUE(NavigateToURL(shell(), url1));
load_observer.Wait();
EXPECT_EQ(url1, load_observer.url_);
@ -406,7 +407,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
ClearNonVisiblePendingOnFail) {
ASSERT_TRUE(embedded_test_server()->Start());
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));
EXPECT_TRUE(
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")));
// Navigate to an invalid URL and make sure it doesn't leave a pending entry.
LoadStopNotificationObserver load_observer1(
@ -448,7 +450,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
// When no size is set, RenderWidgetHostView adopts the size of
// WebContentsView.
NavigateToURL(shell(), embedded_test_server()->GetURL("/title2.html"));
EXPECT_TRUE(
NavigateToURL(shell(), embedded_test_server()->GetURL("/title2.html")));
EXPECT_EQ(shell()->web_contents()->GetContainerBounds().size(),
shell()->web_contents()->GetRenderWidgetHostView()->GetViewBounds().
size());
@ -459,7 +462,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
gfx::Size size_insets(10, 15);
ResizeWebContentsView(shell(), size, true);
delegate->set_size_insets(size_insets);
NavigateToURL(shell(), https_server.GetURL("/"));
EXPECT_TRUE(NavigateToURL(shell(), https_server.GetURL("/")));
size.Enlarge(size_insets.width(), size_insets.height());
EXPECT_EQ(size,
shell()->web_contents()->GetRenderWidgetHostView()->GetViewBounds().
@ -484,7 +487,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
ResizeWebContentsView(shell(), init_size, true);
delegate->set_size_insets(size_insets);
RenderViewSizeObserver observer(shell(), new_size);
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));
EXPECT_TRUE(
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")));
// RenderWidgetHostView is created at specified size.
init_size.Enlarge(size_insets.width(), size_insets.height());
EXPECT_EQ(init_size, observer.rwhv_create_size());
@ -507,7 +511,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, SetTitleOnUnload) {
"data:text/html,"
"<title>A</title>"
"<body onunload=\"document.title = 'B'\"></body>");
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
ASSERT_EQ(1, shell()->web_contents()->GetController().GetEntryCount());
NavigationEntryImpl* entry1 = NavigationEntryImpl::FromNavigationEntry(
shell()->web_contents()->GetController().GetLastCommittedEntry());
@ -517,7 +521,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, SetTitleOnUnload) {
// Force a process switch by going to a privileged page.
GURL web_ui_page(std::string(kChromeUIScheme) + "://" +
std::string(kChromeUIGpuHost));
NavigateToURL(shell(), web_ui_page);
EXPECT_TRUE(NavigateToURL(shell(), web_ui_page));
NavigationEntryImpl* entry2 = NavigationEntryImpl::FromNavigationEntry(
shell()->web_contents()->GetController().GetLastCommittedEntry());
SiteInstance* site_instance2 = entry2->site_instance();
@ -530,8 +534,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, SetTitleOnUnload) {
IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, OpenURLSubframe) {
// Navigate to a page with frames and grab a subframe's FrameTreeNode ID.
ASSERT_TRUE(embedded_test_server()->Start());
NavigateToURL(shell(),
embedded_test_server()->GetURL("/frame_tree/top.html"));
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL("/frame_tree/top.html")));
WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell()->web_contents());
FrameTreeNode* root = wc->GetFrameTree()->root();
ASSERT_EQ(3UL, root->child_count());
@ -556,11 +560,11 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, OpenURLSubframe) {
IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
AppendingFrameInWebUIDoesNotCrash) {
const GURL kWebUIUrl(GetWebUIURL("tracing"));
const GURL kWebUIUrl(GetWebUIURL("gpu"));
const char kJSCodeForAppendingFrame[] =
"document.body.appendChild(document.createElement('iframe'));";
NavigateToURL(shell(), kWebUIUrl);
EXPECT_TRUE(NavigateToURL(shell(), kWebUIUrl));
EXPECT_TRUE(content::ExecuteScript(shell(), kJSCodeForAppendingFrame));
}
@ -606,12 +610,12 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
// Navigate to the initial URL and capture the RenderFrameHost for later
// comparison.
NavigateToURL(shell(), initial_url);
EXPECT_TRUE(NavigateToURL(shell(), initial_url));
RenderFrameHost* orig_rfh = shell()->web_contents()->GetMainFrame();
// Install the observer and navigate cross-site.
RenderFrameCreatedObserver observer(shell());
NavigateToURL(shell(), cross_site_url);
EXPECT_TRUE(NavigateToURL(shell(), cross_site_url));
// The observer should've seen a RenderFrameCreated call for the new frame
// and not the old one.
@ -630,7 +634,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
&shell()->web_contents()->GetController());
TitleWatcher title_watcher(shell()->web_contents(),
base::ASCIIToUTF16("pushState"));
NavigateToURL(shell(), embedded_test_server()->GetURL("/push_state.html"));
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL("/push_state.html")));
load_observer.Wait();
base::string16 title = title_watcher.WaitAndGetTitle();
ASSERT_EQ(title, base::ASCIIToUTF16("pushState"));
@ -650,8 +655,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
RenderViewCreatedForChildWindow) {
ASSERT_TRUE(embedded_test_server()->Start());
NavigateToURL(shell(),
embedded_test_server()->GetURL("/title1.html"));
EXPECT_TRUE(
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")));
WebContentsAddedObserver new_web_contents_observer;
ASSERT_TRUE(ExecuteScript(shell(),
@ -813,7 +818,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ResourceLoadComplete) {
// Load a page with an image and an image.
GURL page_url(embedded_test_server()->GetURL("/page_with_iframe.html"));
base::TimeTicks before = base::TimeTicks::Now();
NavigateToURL(shell(), page_url);
EXPECT_TRUE(NavigateToURL(shell(), page_url));
base::TimeTicks after = base::TimeTicks::Now();
ASSERT_EQ(3U, observer.resource_load_infos().size());
SCOPE_TRACED(observer.CheckResourceLoaded(
@ -841,7 +846,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
GURL page_url(
embedded_test_server()->GetURL("/page_with_cached_subresource.html"));
base::TimeTicks before = base::TimeTicks::Now();
NavigateToURL(shell(), page_url);
EXPECT_TRUE(NavigateToURL(shell(), page_url));
base::TimeTicks after = base::TimeTicks::Now();
GURL resource_url = embedded_test_server()->GetURL("/cachetime");
@ -864,7 +869,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
// Loading again should serve the request out of the in-memory cache.
before = base::TimeTicks::Now();
NavigateToURL(shell(), page_url);
EXPECT_TRUE(NavigateToURL(shell(), page_url));
after = base::TimeTicks::Now();
ASSERT_EQ(1U, observer.resource_load_infos().size());
SCOPE_TRACED(observer.CheckResourceLoaded(
@ -878,11 +883,11 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
// Kill the renderer process so when the navigate again, it will be a fresh
// renderer with an empty in-memory cache.
ScopedAllowRendererCrashes scoped_allow_renderer_crashes(shell());
NavigateToURL(shell(), GetWebUIURL("crash"));
EXPECT_FALSE(NavigateToURL(shell(), GetWebUIURL("crash")));
// Reload that URL, the subresource should be served from the network cache.
before = base::TimeTicks::Now();
NavigateToURL(shell(), page_url);
EXPECT_TRUE(NavigateToURL(shell(), page_url));
after = base::TimeTicks::Now();
ASSERT_EQ(2U, observer.resource_load_infos().size());
SCOPE_TRACED(observer.CheckResourceLoaded(
@ -1093,6 +1098,16 @@ class WebContentsSplitCacheBrowserTest : public WebContentsImplBrowserTest {
bool NavigationResourceCached(const GURL& url,
const GURL& sub_frame,
bool subframe_navigation_resource_cached) {
return NavigationResourceCached(url, url, sub_frame,
subframe_navigation_resource_cached);
}
// Same as above, but allows explicitly specifying the expected commit URL
// for the navigation to |url|, in case it differs.
bool NavigationResourceCached(const GURL& url,
const GURL& expected_commit_url,
const GURL& sub_frame,
bool subframe_navigation_resource_cached) {
// Do a cross-process navigation to clear the in-memory cache.
// We assume that we don't start this call from "chrome://gpu", as
// otherwise it won't be a cross-process navigation. We are relying
@ -1102,7 +1117,7 @@ class WebContentsSplitCacheBrowserTest : public WebContentsImplBrowserTest {
// Observe network requests.
ResourceLoadObserver observer(shell());
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url, expected_commit_url));
RenderFrameHostImpl* main_frame = static_cast<RenderFrameHostImpl*>(
shell()->web_contents()->GetMainFrame());
@ -1442,7 +1457,8 @@ IN_PROC_BROWSER_TEST_P(WebContentsSplitCacheBrowserTestEnabled,
// Navigate to a.com/redirect_to_d which redirects to d.com/title1.html.
EXPECT_FALSE(NavigationResourceCached(GenURL("a.com", "/redirect_to_d"),
GURL(), false));
GenURL("d.com", "/title1.html"), GURL(),
false));
// Navigate to d.com directly. The main resource should be cached due to the
// earlier redirected navigation.
@ -1631,8 +1647,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
ResourceLoadCompleteFromLocalResource) {
ResourceLoadObserver observer(shell());
ASSERT_TRUE(embedded_test_server()->Start());
NavigateToURL(shell(),
GURL(embedded_test_server()->GetURL("/page_with_image.html")));
EXPECT_TRUE(NavigateToURL(
shell(), GURL(embedded_test_server()->GetURL("/page_with_image.html"))));
ASSERT_EQ(2U, observer.resource_load_infos().size());
EXPECT_TRUE(
observer.resource_load_infos()[0]->network_info->network_accessed);
@ -1640,7 +1656,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
observer.resource_load_infos()[1]->network_info->network_accessed);
observer.Reset();
NavigateToURL(shell(), GetWebUIURL("gpu"));
EXPECT_TRUE(NavigateToURL(shell(), GetWebUIURL("gpu")));
ASSERT_LE(1U, observer.resource_load_infos().size());
for (const mojom::ResourceLoadInfoPtr& resource_load_info :
observer.resource_load_infos()) {
@ -1657,7 +1673,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
embedded_test_server()->GetURL("/page_with_image_redirect.html"));
GURL page_original_url(embedded_test_server()->GetURL(
"/server-redirect?" + page_destination_url.spec()));
NavigateToURL(shell(), page_original_url);
EXPECT_TRUE(NavigateToURL(shell(), page_original_url,
page_destination_url /* expected_commit_url */));
ASSERT_EQ(2U, observer.resource_load_infos().size());
const mojom::ResourceLoadInfoPtr& page_load_info =
@ -1683,7 +1700,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
GURL image_url(embedded_test_server()->GetURL("/blank.jpg"));
// Load the page without errors.
NavigateToURL(shell(), page_url);
EXPECT_TRUE(NavigateToURL(shell(), page_url));
ASSERT_EQ(2U, observer.resource_load_infos().size());
EXPECT_EQ(net::OK, observer.resource_load_infos()[0]->net_error);
EXPECT_EQ(net::OK, observer.resource_load_infos()[1]->net_error);
@ -1701,7 +1718,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
return true;
},
image_url));
NavigateToURL(shell(), page_url);
EXPECT_TRUE(NavigateToURL(shell(), page_url));
ASSERT_EQ(2U, observer.resource_load_infos().size());
EXPECT_EQ(net::OK, observer.resource_load_infos()[0]->net_error);
EXPECT_EQ(net::ERR_ADDRESS_UNREACHABLE,
@ -1714,7 +1731,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
ASSERT_TRUE(embedded_test_server()->Start());
GURL cacheable_url(embedded_test_server()->GetURL("/set-header"));
NavigateToURL(shell(), cacheable_url);
EXPECT_TRUE(NavigateToURL(shell(), cacheable_url));
ASSERT_EQ(1U, observer.resource_load_infos().size());
EXPECT_FALSE(
observer.resource_load_infos()[0]->network_info->always_access_network);
@ -1724,7 +1741,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
"cache-control: no-cache", "cache-control: no-store", "pragma: no-cache"};
for (const std::string& header : headers) {
GURL no_cache_url(embedded_test_server()->GetURL("/set-header?" + header));
NavigateToURL(shell(), no_cache_url);
EXPECT_TRUE(NavigateToURL(shell(), no_cache_url));
ASSERT_EQ(1U, observer.resource_load_infos().size());
EXPECT_TRUE(
observer.resource_load_infos()[0]->network_info->always_access_network);
@ -1743,7 +1760,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
GURL start_url(embedded_test_server()->GetURL("/server-redirect?" +
intermediate_url.spec()));
NavigateToURL(shell(), start_url);
EXPECT_TRUE(
NavigateToURL(shell(), start_url, target_url /* expected_commit_url */));
ASSERT_EQ(1U, observer.resource_load_infos().size());
EXPECT_EQ(target_url, observer.resource_load_infos()[0]->url);
@ -1773,7 +1791,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
ASSERT_TRUE(embedded_test_server()->Start());
GURL url(embedded_test_server()->GetURL("/page_with_image.html"));
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
ASSERT_EQ(2U, observer.resource_load_infos().size());
EXPECT_EQ(url, observer.resource_load_infos()[0]->url);
EXPECT_TRUE(observer.resource_is_associated_with_main_frame()[0]);
@ -1782,7 +1800,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
// Load that same page inside an iframe.
GURL data_url("data:text/html,<iframe src='" + url.spec() + "'></iframe>");
NavigateToURL(shell(), data_url);
EXPECT_TRUE(NavigateToURL(shell(), data_url));
ASSERT_EQ(3U, observer.resource_load_infos().size());
EXPECT_EQ(data_url, observer.resource_load_infos()[0]->url);
EXPECT_EQ(url, observer.resource_load_infos()[1]->url);
@ -1832,7 +1850,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, LoadProgress) {
std::unique_ptr<LoadProgressDelegateAndObserver> delegate(
new LoadProgressDelegateAndObserver(shell()));
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));
EXPECT_TRUE(
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")));
const std::vector<double>& progresses = delegate->progresses;
// All updates should be in order ...
@ -1854,8 +1873,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, LoadProgressWithFrames) {
std::unique_ptr<LoadProgressDelegateAndObserver> delegate(
new LoadProgressDelegateAndObserver(shell()));
NavigateToURL(shell(),
embedded_test_server()->GetURL("/frame_tree/top.html"));
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL("/frame_tree/top.html")));
const std::vector<double>& progresses = delegate->progresses;
// All updates should be in order ...
@ -1879,7 +1898,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
ASSERT_TRUE(embedded_test_server()->Start());
// Start at a real page.
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));
EXPECT_TRUE(
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")));
// Simulate a navigation that has not completed.
const GURL kURL2 = embedded_test_server()->GetURL("/title2.html");
@ -1946,7 +1966,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
std::unique_ptr<FirstVisuallyNonEmptyPaintObserver> observer(
new FirstVisuallyNonEmptyPaintObserver(shell()));
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));
EXPECT_TRUE(
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")));
observer->WaitForDidFirstVisuallyNonEmptyPaint();
ASSERT_TRUE(observer->did_fist_visually_non_empty_paint_);
@ -1976,7 +1997,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ChangeDisplayMode) {
WebDisplayModeDelegate delegate(blink::kWebDisplayModeMinimalUi);
shell()->web_contents()->SetDelegate(&delegate);
NavigateToURL(shell(), GURL("about://blank"));
EXPECT_TRUE(NavigateToURL(shell(), GURL(url::kAboutBlankURL)));
ASSERT_TRUE(ExecuteScript(shell(),
"document.title = "
@ -2038,7 +2059,8 @@ class MockPageScaleObserver : public WebContentsObserver {
// a notification to the browser so that WebContentsObservers are notified.
IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ChangePageScale) {
ASSERT_TRUE(embedded_test_server()->Start());
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));
EXPECT_TRUE(
NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")));
MockPageScaleObserver observer(shell());
::testing::InSequence expect_call_sequence;
@ -2058,7 +2080,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ViewSourceDirectNavigation) {
ASSERT_TRUE(embedded_test_server()->Start());
const GURL kUrl(embedded_test_server()->GetURL("/simple_page.html"));
const GURL kViewSourceURL(kViewSourceScheme + std::string(":") + kUrl.spec());
NavigateToURL(shell(), kViewSourceURL);
EXPECT_TRUE(NavigateToURL(shell(), kViewSourceURL));
// Displayed view-source URLs don't include the scheme of the effective URL if
// the effective URL is HTTP. (e.g. view-source:example.com is displayed
// instead of view-source:http://example.com).
@ -2078,7 +2100,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
ASSERT_TRUE(embedded_test_server()->Start());
const GURL kUrl(embedded_test_server()->GetURL("/simple_page.html"));
const GURL kViewSourceURL(kViewSourceScheme + std::string(":") + kUrl.spec());
NavigateToURL(shell(), kUrl);
EXPECT_TRUE(NavigateToURL(shell(), kUrl));
auto console_delegate = std::make_unique<ConsoleObserverDelegate>(
shell()->web_contents(),
@ -2098,7 +2120,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
ASSERT_TRUE(embedded_test_server()->Start());
const GURL kUrl(embedded_test_server()->GetURL("/simple_page.html"));
const GURL kViewSourceURL(kViewSourceScheme + std::string(":") + kUrl.spec());
NavigateToURL(shell(), kUrl);
EXPECT_TRUE(NavigateToURL(shell(), kUrl));
std::unique_ptr<ConsoleObserverDelegate> console_delegate(
new ConsoleObserverDelegate(
@ -2122,8 +2144,10 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
// Test that view source mode for a webui page can be opened.
IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ViewSourceWebUI) {
const std::string kUrl = "view-source:" + GetWebUIURLString(kChromeUIGpuHost);
const GURL kGURL(kUrl);
NavigateToURL(shell(), kGURL);
// To ensure that NavigateToURL succeeds, append a slash to the view-source:
// URL, since the slash would be appended anyway as part of the navigation.
const GURL kGURL(kUrl + "/");
EXPECT_TRUE(NavigateToURL(shell(), kGURL));
EXPECT_EQ(base::ASCIIToUTF16(kUrl), shell()->web_contents()->GetTitle());
EXPECT_TRUE(shell()
->web_contents()
@ -2250,7 +2274,7 @@ void NavigateToDataURLAndCheckForTerminationDisabler(
const std::string& html,
bool expect_onunload,
bool expect_onbeforeunload) {
NavigateToURL(shell, GURL("data:text/html," + html));
EXPECT_TRUE(NavigateToURL(shell, GURL("data:text/html," + html)));
RenderFrameHostImpl* rfh =
static_cast<RenderFrameHostImpl*>(shell->web_contents()->GetMainFrame());
EXPECT_EQ(expect_onunload || expect_onbeforeunload,
@ -2457,8 +2481,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
ASSERT_TRUE(embedded_test_server()->Start());
NavigateToURL(shell(),
embedded_test_server()->GetURL("a.com", "/title1.html"));
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL("a.com", "/title1.html")));
EXPECT_TRUE(WaitForLoadStop(wc));
FrameTreeNode* root = wc->GetFrameTree()->root();
@ -2515,8 +2539,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
GURL(test_delegate.last_message()).ReplaceComponents(clear_port));
// Navigate the top frame cross-site; ensure that dialogs work.
NavigateToURL(shell(),
embedded_test_server()->GetURL("c.com", "/title3.html"));
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL("c.com", "/title3.html")));
EXPECT_TRUE(WaitForLoadStop(wc));
test_delegate.WillWaitForDialog();
EXPECT_TRUE(
@ -2826,8 +2850,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
shell()->web_contents()->SetDelegate(delegate.get());
ASSERT_TRUE(shell()->web_contents()->GetDelegate() == delegate.get());
NavigateToURL(shell(),
embedded_test_server()->GetURL("a.com", "/title1.html"));
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL("a.com", "/title1.html")));
// Try to request pointer lock. WebContentsDelegate should get a notification.
ASSERT_TRUE(ExecuteScript(shell(),
@ -2854,8 +2878,8 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
EXPECT_FALSE(delegate.get()->request_to_lock_mouse_called_);
// Force a cross-process navigation so that the RenderWidgetHost is deleted.
NavigateToURL(shell(),
embedded_test_server()->GetURL("b.com", "/title1.html"));
EXPECT_TRUE(NavigateToURL(
shell(), embedded_test_server()->GetURL("b.com", "/title1.html")));
// Make sure the WebContents cleaned up the previous pending request. A new
// request should be forwarded to the WebContentsDelegate.
@ -2874,7 +2898,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, UserAgentOverride) {
const GURL kUrl(embedded_test_server()->GetURL(kHeaderPath));
const std::string kUserAgentOverride = "foo";
NavigateToURL(shell(), kUrl);
EXPECT_TRUE(NavigateToURL(shell(), kUrl));
std::string header_value;
EXPECT_TRUE(ExecuteScriptAndExtractString(
shell()->web_contents(),
@ -2883,7 +2907,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, UserAgentOverride) {
EXPECT_NE(kUserAgentOverride, header_value);
shell()->web_contents()->SetUserAgentOverride("foo", false);
NavigateToURL(shell(), kUrl);
EXPECT_TRUE(NavigateToURL(shell(), kUrl));
EXPECT_TRUE(ExecuteScriptAndExtractString(
shell()->web_contents(),
"window.domAutomationController.send(document.body.textContent);",
@ -3327,7 +3351,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, SetPageFrozen) {
EXPECT_TRUE(embedded_test_server()->Start());
GURL test_url = embedded_test_server()->GetURL("/pause_schedule_task.html");
NavigateToURL(shell(), test_url);
EXPECT_TRUE(NavigateToURL(shell(), test_url));
EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
int text_length;
@ -3728,7 +3752,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, CtrlClickSubframeLink) {
// Load a page with a subframe link.
GURL main_url(
embedded_test_server()->GetURL("/ctrl-click-subframe-link.html"));
NavigateToURL(shell(), main_url);
EXPECT_TRUE(NavigateToURL(shell(), main_url));
// Start intercepting the DidOpenRequestedURL callback.
MockDidOpenRequestedURLObserver mock_observer(shell());

@ -85,7 +85,7 @@ class WebContentsViewAuraTest : public ContentBrowserTest {
test_url = GURL(url);
else
test_url = GURL(embedded_test_server()->GetURL(url));
NavigateToURL(shell(), test_url);
EXPECT_TRUE(NavigateToURL(shell(), test_url));
frame_observer_ = std::make_unique<RenderFrameSubmissionObserver>(
shell()->web_contents());

@ -66,7 +66,7 @@ class TestFrameInterfaceBinder : public mojom::WebContentsFrameBindingSetTest {
} // namespace
IN_PROC_BROWSER_TEST_F(WebContentsBindingSetBrowserTest, OverrideForTesting) {
NavigateToURL(shell(), GURL("data:text/html,ho hum"));
EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,ho hum")));
// Ensure that we can add a WebContentsFrameBindingSet and then override its
// request handler.

@ -392,7 +392,8 @@ class WebAuthBrowserTestBase : public content::ContentBrowserTest {
new WebAuthBrowserTestContentBrowserClient(&test_state_));
old_client_ = SetBrowserClientForTesting(test_client_.get());
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title1.html"));
EXPECT_TRUE(
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title1.html")));
}
void TearDown() override {
@ -551,7 +552,8 @@ IN_PROC_BROWSER_TEST_F(WebAuthLocalClientBrowserTest,
create_callback_receiver.callback());
fake_hid_discovery->WaitForCallToStartAndSimulateSuccess();
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title2.html"));
EXPECT_TRUE(
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title2.html")));
WaitForConnectionError();
// The next active document should be able to successfully call
@ -573,7 +575,8 @@ IN_PROC_BROWSER_TEST_F(WebAuthLocalClientBrowserTest,
get_callback_receiver.callback());
fake_hid_discovery->WaitForCallToStartAndSimulateSuccess();
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title2.html"));
EXPECT_TRUE(
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title2.html")));
WaitForConnectionError();
// The next active document should be able to successfully call
@ -629,7 +632,8 @@ IN_PROC_BROWSER_TEST_F(WebAuthLocalClientBrowserTest,
if (behavior == AttestationCallbackBehavior::BEFORE_NAVIGATION) {
std::move(callback).Run(false);
}
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title2.html"));
EXPECT_TRUE(NavigateToURL(
shell(), GetHttpsURL("www.acme.com", "/title2.html")));
if (behavior == AttestationCallbackBehavior::AFTER_NAVIGATION) {
std::move(callback).Run(false);
}
@ -648,7 +652,9 @@ IN_PROC_BROWSER_TEST_F(WebAuthLocalClientBrowserTest,
ScopedNavigationCancellingThrottleInstaller navigation_canceller(
shell()->web_contents());
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title2.html"));
// This navigation should be canceled and hence should not succeed.
EXPECT_FALSE(
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title2.html")));
auto* fake_hid_discovery = discovery_factory_->ForgeNextHidDiscovery();
TestCreateCallbackReceiver create_callback_receiver;
@ -672,7 +678,8 @@ IN_PROC_BROWSER_TEST_F(WebAuthLocalClientBrowserTest,
}));
auto* fake_hid_discovery = discovery_factory_->ForgeNextHidDiscovery();
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title2.html"));
EXPECT_TRUE(
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title2.html")));
WaitForConnectionError();
// Normally, when the request is serviced, the implementation retrieves the
@ -1117,7 +1124,8 @@ IN_PROC_BROWSER_TEST_F(WebAuthJavascriptClientBrowserTest,
RequestsFromIFrames) {
static constexpr char kOuterHost[] = "acme.com";
static constexpr char kInnerHost[] = "notacme.com";
NavigateToURL(shell(), GetHttpsURL(kOuterHost, "/page_with_iframe.html"));
EXPECT_TRUE(NavigateToURL(shell(),
GetHttpsURL(kOuterHost, "/page_with_iframe.html")));
auto* virtual_device_factory = InjectVirtualFidoDeviceFactory();
static constexpr uint8_t kOuterCredentialID = 1;
@ -1193,7 +1201,8 @@ IN_PROC_BROWSER_TEST_F(WebAuthJavascriptClientBrowserTest,
return true;
});
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/page_with_iframe.html"));
EXPECT_TRUE(NavigateToURL(
shell(), GetHttpsURL("www.acme.com", "/page_with_iframe.html")));
// The plain ExecuteScriptAndExtractString cannot be used because
// NavigateIframeToURL uses it internally and they get confused about which
@ -1247,8 +1256,8 @@ IN_PROC_BROWSER_TEST_F(WebAuthJavascriptClientBrowserTest,
},
shell()->web_contents(), &prompt_callback_was_invoked, behavior);
NavigateToURL(shell(),
GetHttpsURL("www.acme.com", "/page_with_iframe.html"));
EXPECT_TRUE(NavigateToURL(
shell(), GetHttpsURL("www.acme.com", "/page_with_iframe.html")));
CreateParameters parameters;
parameters.attestation = "direct";
@ -1302,7 +1311,8 @@ IN_PROC_BROWSER_TEST_F(WebAuthJavascriptClientBrowserTest,
#if defined(OS_WIN)
IN_PROC_BROWSER_TEST_F(WebAuthJavascriptClientBrowserTest, WinMakeCredential) {
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title1.html"));
EXPECT_TRUE(
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title1.html")));
device::FakeWinWebAuthnApi fake_api;
fake_api.set_is_uvpaa(true);
@ -1319,7 +1329,8 @@ IN_PROC_BROWSER_TEST_F(WebAuthJavascriptClientBrowserTest, WinMakeCredential) {
IN_PROC_BROWSER_TEST_F(WebAuthJavascriptClientBrowserTest,
WinMakeCredentialReturnCodeFailure) {
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title1.html"));
EXPECT_TRUE(
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title1.html")));
device::FakeWinWebAuthnApi fake_api;
auto* virtual_device_factory = InjectVirtualFidoDeviceFactory();
virtual_device_factory->set_win_webauthn_api(&fake_api);
@ -1355,7 +1366,8 @@ IN_PROC_BROWSER_TEST_F(WebAuthJavascriptClientBrowserTest,
}
IN_PROC_BROWSER_TEST_F(WebAuthJavascriptClientBrowserTest, WinGetAssertion) {
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title1.html"));
EXPECT_TRUE(
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title1.html")));
device::FakeWinWebAuthnApi fake_api;
fake_api.set_hresult(S_OK);
@ -1379,7 +1391,8 @@ IN_PROC_BROWSER_TEST_F(WebAuthJavascriptClientBrowserTest, WinGetAssertion) {
IN_PROC_BROWSER_TEST_F(WebAuthJavascriptClientBrowserTest,
WinGetAssertionReturnCodeFailure) {
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title1.html"));
EXPECT_TRUE(
NavigateToURL(shell(), GetHttpsURL("www.acme.com", "/title1.html")));
device::FakeWinWebAuthnApi fake_api;
auto* virtual_device_factory = InjectVirtualFidoDeviceFactory();
virtual_device_factory->set_win_webauthn_api(&fake_api);

@ -64,7 +64,7 @@ IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, AbortOnEnd) {
URLLoaderInterceptor interceptor(base::BindRepeating(&AbortOnEndInterceptor));
GURL url = embedded_test_server()->GetURL(kAsyncScriptThatAbortsOnEndPage);
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
// If you are seeing this test fail, please strongly investigate the
// possibility that http://crbug.com/75604 and
@ -86,7 +86,7 @@ IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, XsltBadImport) {
URLLoaderInterceptor interceptor(base::BindRepeating(&AbortOnEndInterceptor));
GURL url = embedded_test_server()->GetURL(kXsltBadImportPage);
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
EXPECT_FALSE(shell()->web_contents()->IsCrashed());
}
@ -106,7 +106,7 @@ IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, PrerenderNoCrash) {
ASSERT_TRUE(embedded_test_server()->Start());
GURL url = embedded_test_server()->GetURL(kPrerenderNoCrashPage);
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
EXPECT_FALSE(shell()->web_contents()->IsCrashed());
}

@ -309,7 +309,7 @@ IN_PROC_BROWSER_TEST_F(WebUIMojoTest, EndToEndPing) {
g_got_message = false;
base::RunLoop run_loop;
factory()->set_run_loop(&run_loop);
NavigateToURL(shell(), test_url);
EXPECT_TRUE(NavigateToURL(shell(), test_url));
// RunLoop is quit when message received from page.
run_loop.Run();
EXPECT_TRUE(g_got_message);
@ -321,7 +321,7 @@ IN_PROC_BROWSER_TEST_F(WebUIMojoTest, EndToEndPing) {
g_got_message = false;
base::RunLoop other_run_loop;
factory()->set_run_loop(&other_run_loop);
NavigateToURL(other_shell, test_url);
EXPECT_TRUE(NavigateToURL(other_shell, test_url));
// RunLoop is quit when message received from page.
other_run_loop.Run();
EXPECT_TRUE(g_got_message);
@ -349,7 +349,7 @@ IN_PROC_BROWSER_TEST_F(WebUIMojoTest, EndToEndPing) {
g_got_message = false;
base::RunLoop other_run_loop;
factory()->set_run_loop(&other_run_loop);
NavigateToURL(other_shell, test_url);
EXPECT_TRUE(NavigateToURL(other_shell, test_url));
// RunLoop is quit when message received from page.
other_run_loop.Run();
EXPECT_TRUE(g_got_message);

@ -88,7 +88,7 @@ class WorkerTest : public ContentBrowserTest {
const base::string16 fail_title = base::ASCIIToUTF16("FAIL");
TitleWatcher title_watcher(window->web_contents(), ok_title);
title_watcher.AlsoWaitForTitle(fail_title);
NavigateToURL(window, url);
EXPECT_TRUE(NavigateToURL(window, url));
base::string16 final_title = title_watcher.WaitAndGetTitle();
EXPECT_EQ(expect_failure ? fail_title : ok_title, final_title);
}
@ -252,7 +252,7 @@ IN_PROC_BROWSER_TEST_F(WorkerTest, WebSocketSharedWorker) {
Shell* window = shell();
const base::string16 expected_title = base::ASCIIToUTF16("OK");
TitleWatcher title_watcher(window->web_contents(), expected_title);
NavigateToURL(window, url);
EXPECT_TRUE(NavigateToURL(window, url));
base::string16 final_title = title_watcher.WaitAndGetTitle();
EXPECT_EQ(expected_title, final_title);
}

@ -638,7 +638,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_DomSerializerTests,
GURL file_url = net::FilePathToFileURL(page_file_path);
ASSERT_TRUE(file_url.SchemeIsFile());
// Load the test file.
NavigateToURL(shell(), file_url);
EXPECT_TRUE(NavigateToURL(shell(), file_url));
PostTaskToInProcessRendererAndWait(base::BindOnce(
&MAYBE_DomSerializerTests::SerializeHTMLDOMWithDocTypeOnRenderer,
@ -654,7 +654,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_DomSerializerTests,
GURL file_url = net::FilePathToFileURL(page_file_path);
ASSERT_TRUE(file_url.SchemeIsFile());
// Load the test file.
NavigateToURL(shell(), file_url);
EXPECT_TRUE(NavigateToURL(shell(), file_url));
PostTaskToInProcessRendererAndWait(base::BindOnce(
&MAYBE_DomSerializerTests::SerializeHTMLDOMWithoutDocTypeOnRenderer,
@ -683,7 +683,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_DomSerializerTests,
ASSERT_TRUE(file_url.SchemeIsFile());
// Load the test file.
NavigateToURL(shell(), file_url);
EXPECT_TRUE(NavigateToURL(shell(), file_url));
PostTaskToInProcessRendererAndWait(base::BindOnce(
&MAYBE_DomSerializerTests::SerializeXMLDocWithBuiltInEntitiesOnRenderer,
@ -708,7 +708,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_DomSerializerTests,
ASSERT_TRUE(file_url.SchemeIsFile());
// Load the test file.
NavigateToURL(shell(), file_url);
EXPECT_TRUE(NavigateToURL(shell(), file_url));
PostTaskToInProcessRendererAndWait(base::BindOnce(
&MAYBE_DomSerializerTests::SerializeHTMLDOMWithAddingMOTWOnRenderer,
@ -733,7 +733,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_DomSerializerTests,
ASSERT_TRUE(file_url.SchemeIsFile());
// Load the test file.
NavigateToURL(shell(), file_url);
EXPECT_TRUE(NavigateToURL(shell(), file_url));
PostTaskToInProcessRendererAndWait(base::BindOnce(
&MAYBE_DomSerializerTests::SerializeHTMLDOMWithAddingMOTWOnRenderer,
@ -755,7 +755,7 @@ IN_PROC_BROWSER_TEST_F(
GURL file_url = net::FilePathToFileURL(page_file_path);
ASSERT_TRUE(file_url.SchemeIsFile());
// Load the test file.
NavigateToURL(shell(), file_url);
EXPECT_TRUE(NavigateToURL(shell(), file_url));
PostTaskToInProcessRendererAndWait(base::BindOnce(
&MAYBE_DomSerializerTests::
@ -777,7 +777,7 @@ IN_PROC_BROWSER_TEST_F(
GURL file_url = net::FilePathToFileURL(page_file_path);
ASSERT_TRUE(file_url.SchemeIsFile());
// Load the test file.
NavigateToURL(shell(), file_url);
EXPECT_TRUE(NavigateToURL(shell(), file_url));
PostTaskToInProcessRendererAndWait(base::BindOnce(
&MAYBE_DomSerializerTests::
@ -791,7 +791,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_DomSerializerTests,
// Need to spin up the renderer and also navigate to a file url so that the
// renderer code doesn't attempt a fork when it sees a load to file scheme
// from non-file scheme.
NavigateToURL(shell(), GetTestUrl(".", "simple_page.html"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl(".", "simple_page.html")));
PostTaskToInProcessRendererAndWait(base::BindOnce(
&MAYBE_DomSerializerTests::SerializeHTMLDOMWithEntitiesInTextOnRenderer,
@ -806,7 +806,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_DomSerializerTests,
// Need to spin up the renderer and also navigate to a file url so that the
// renderer code doesn't attempt a fork when it sees a load to file scheme
// from non-file scheme.
NavigateToURL(shell(), GetTestUrl(".", "simple_page.html"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl(".", "simple_page.html")));
PostTaskToInProcessRendererAndWait(
base::BindOnce(&MAYBE_DomSerializerTests::
@ -822,7 +822,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_DomSerializerTests,
base::FilePath page_file_path = GetTestFilePath(
"dom_serializer", "nonstandard_htmlentities.htm");
GURL file_url = net::FilePathToFileURL(page_file_path);
NavigateToURL(shell(), file_url);
EXPECT_TRUE(NavigateToURL(shell(), file_url));
PostTaskToInProcessRendererAndWait(
base::BindOnce(&MAYBE_DomSerializerTests::
@ -848,7 +848,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_DomSerializerTests, SerializeHTMLDOMWithBaseTag) {
GURL file_url = net::FilePathToFileURL(page_file_path);
ASSERT_TRUE(file_url.SchemeIsFile());
// Load the test file.
NavigateToURL(shell(), file_url);
EXPECT_TRUE(NavigateToURL(shell(), file_url));
PostTaskToInProcessRendererAndWait(base::BindOnce(
&MAYBE_DomSerializerTests::SerializeHTMLDOMWithBaseTagOnRenderer,
@ -861,7 +861,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_DomSerializerTests,
// Need to spin up the renderer and also navigate to a file url so that the
// renderer code doesn't attempt a fork when it sees a load to file scheme
// from non-file scheme.
NavigateToURL(shell(), GetTestUrl(".", "simple_page.html"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl(".", "simple_page.html")));
PostTaskToInProcessRendererAndWait(base::BindOnce(
&MAYBE_DomSerializerTests::SerializeHTMLDOMWithEmptyHeadOnRenderer,
@ -873,7 +873,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_DomSerializerTests,
base::FilePath page_file_path = GetTestFilePath(
"dom_serializer", "non_html_namespace.htm");
GURL file_url = net::FilePathToFileURL(page_file_path);
NavigateToURL(shell(), file_url);
EXPECT_TRUE(NavigateToURL(shell(), file_url));
PostTaskToInProcessRendererAndWait(
base::BindOnce(&MAYBE_DomSerializerTests::

@ -453,7 +453,7 @@ class RenderThreadImplGpuMemoryBufferBrowserTest
}
void SetUpOnMainThread() override {
NavigateToURL(shell(), GURL(url::kAboutBlankURL));
EXPECT_TRUE(NavigateToURL(shell(), GURL(url::kAboutBlankURL)));
PostTaskToInProcessRendererAndWait(base::BindOnce(
&RenderThreadImplGpuMemoryBufferBrowserTest::SetUpOnRenderThread,
base::Unretained(this)));

@ -42,7 +42,7 @@ class RenderThreadImplDiscardableMemoryBrowserTest : public ContentBrowserTest {
}
void SetUpOnMainThread() override {
NavigateToURL(shell(), GURL(url::kAboutBlankURL));
EXPECT_TRUE(NavigateToURL(shell(), GURL(url::kAboutBlankURL)));
PostTaskToInProcessRendererAndWait(base::BindOnce(
&RenderThreadImplDiscardableMemoryBrowserTest::SetUpOnRenderThread,
base::Unretained(this)));

@ -44,7 +44,7 @@ class SavableResourcesTest : public ContentBrowserTest {
// Convert local file path to file URL.
GURL file_url = net::FilePathToFileURL(page_file_path);
// Load the test file.
NavigateToURL(shell(), file_url);
EXPECT_TRUE(NavigateToURL(shell(), file_url));
PostTaskToInProcessRendererAndWait(base::BindOnce(
&SavableResourcesTest::CheckResources, base::Unretained(this),

@ -103,7 +103,7 @@ IN_PROC_BROWSER_TEST_F(VisualStateTest, DISABLED_CallbackDoesNotDeadlock) {
// two commits then this test will prove nothing. We could detect this
// with a high level of confidence if we used a timeout, but that's
// discouraged (see https://codereview.chromium.org/939673002).
NavigateToURL(shell(), GURL("about:blank"));
EXPECT_TRUE(NavigateToURL(shell(), GURL("about:blank")));
CommitObserver observer(RenderView::FromRoutingID(
shell()->web_contents()->GetRenderViewHost()->GetRoutingID()));

@ -30,7 +30,7 @@ IN_PROC_BROWSER_TEST_F(WebClipboardImplTest, PasteRTF) {
FrameFocusedObserver focus_observer(shell()->web_contents()->GetMainFrame());
// paste_listener.html takes RTF from the clipboard and sets the title.
NavigateToURL(shell(), GetTestUrl(".", "paste_listener.html"));
EXPECT_TRUE(NavigateToURL(shell(), GetTestUrl(".", "paste_listener.html")));
focus_observer.Wait();
const base::string16 expected_title = base::UTF8ToUTF16(rtf_content);

@ -56,7 +56,7 @@ IN_PROC_BROWSER_TEST_F(ContentBrowserTest, MANUAL_RendererCrash) {
shell()->web_contents()->GetMainFrame()->GetProcess(),
content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
NavigateToURL(shell(), GetWebUIURL("crash"));
EXPECT_FALSE(NavigateToURL(shell(), GetWebUIURL("crash")));
renderer_shutdown_observer.Wait();
EXPECT_FALSE(renderer_shutdown_observer.did_exit_normally());
@ -232,7 +232,7 @@ class ContentBrowserTestSanityTest : public ContentBrowserTest {
base::string16 expected_title(base::ASCIIToUTF16("OK"));
TitleWatcher title_watcher(shell()->web_contents(), expected_title);
NavigateToURL(shell(), url);
EXPECT_TRUE(NavigateToURL(shell(), url));
base::string16 title = title_watcher.WaitAndGetTitle();
EXPECT_EQ(expected_title, title);
}

@ -31,7 +31,7 @@ class WebUIResourceBrowserTest : public ContentBrowserTest {
ASSERT_TRUE(PathExists(file));
}
NavigateToURL(shell(), net::FilePathToFileURL(file));
EXPECT_TRUE(NavigateToURL(shell(), net::FilePathToFileURL(file)));
content::WebContents* web_contents = shell()->web_contents();
ASSERT_TRUE(web_contents);

@ -35,7 +35,7 @@ IN_PROC_BROWSER_TEST_F(LinuxZygoteBrowserTest, GetLocalTimeHasTimeZone) {
const char kTestCommand[] =
"window.domAutomationController.send(new Date().toString());";
NavigateToURL(shell(), GURL("data:text/html,start page"));
EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,start page")));
std::string result;
ASSERT_TRUE(ExecuteScriptAndExtractString(shell(), kTestCommand, &result));
std::vector<std::string> parts = base::SplitString(
@ -67,14 +67,14 @@ class LinuxZygoteDisabledBrowserTest : public ContentBrowserTest {
// Test that the renderer doesn't crash during launch if zygote is disabled.
IN_PROC_BROWSER_TEST_F(LinuxZygoteDisabledBrowserTest,
NoCrashWhenZygoteDisabled) {
NavigateToURL(shell(), GURL("data:text/html,start page"));
EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,start page")));
}
#endif
#if BUILDFLAG(USE_ZYGOTE_HANDLE)
IN_PROC_BROWSER_TEST_F(LinuxZygoteDisabledBrowserTest,
NoZygoteWhenZygoteDisabled) {
NavigateToURL(shell(), GURL("data:text/html,start page"));
EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,start page")));
EXPECT_FALSE(service_manager::ZygoteHostImpl::GetInstance()->HasZygote());
}