Commit bc7cfa69 authored by Arthur Hemery's avatar Arthur Hemery Committed by Commit Bot

Navigation: Removed deprecated error functions TestRenderFrameHost.

This patch removes deprecated methods
RenderFrameHostTester::SimulateNavigationError and
SimulateNavigationErrorPageCommit as well as their remaining uses
in unit tests.

Bug: 728571
Change-Id: I8f1d6b825cf80aad0680c3fd95a283897b19ebe8
Reviewed-on: https://chromium-review.googlesource.com/c/1370175Reviewed-by: default avatarCamille Lamy <clamy@chromium.org>
Commit-Queue: Arthur Hemery <ahemery@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615508}
parent 66308504
...@@ -456,13 +456,14 @@ TEST_F(NavigationControllerTestWithBrowserSideNavigation, ...@@ -456,13 +456,14 @@ TEST_F(NavigationControllerTestWithBrowserSideNavigation,
NavigateAndCommit(initial_url); NavigateAndCommit(initial_url);
// Set the pending entry as url_1 and create the NavigationHandle. // Set the pending entry as url_1 and create the NavigationHandle.
controller.LoadURL(url_1, Referrer(), ui::PAGE_TRANSITION_TYPED, auto navigation =
std::string()); NavigationSimulator::CreateBrowserInitiated(url_1, contents());
navigation->Start();
EXPECT_EQ(url_1, controller.GetVisibleEntry()->GetURL()); EXPECT_EQ(url_1, controller.GetVisibleEntry()->GetURL());
// The navigation fails and needs to show an error page. This resets the // The navigation fails and needs to show an error page. This resets the
// pending entry. // pending entry.
main_test_rfh()->SimulateNavigationError(url_1, net::ERR_TIMED_OUT); navigation->Fail(net::ERR_TIMED_OUT);
EXPECT_EQ(initial_url, controller.GetVisibleEntry()->GetURL()); EXPECT_EQ(initial_url, controller.GetVisibleEntry()->GetURL());
// A navigation to url_2 starts, creating a pending navigation entry. // A navigation to url_2 starts, creating a pending navigation entry.
......
...@@ -456,9 +456,8 @@ TEST_F(RenderProcessHostUnitTest, DISABLED_ReuseNavigationProcess) { ...@@ -456,9 +456,8 @@ TEST_F(RenderProcessHostUnitTest, DISABLED_ReuseNavigationProcess) {
// RenderProcessHost with the REUSE_PENDING_OR_COMMITTED_SITE policy should // RenderProcessHost with the REUSE_PENDING_OR_COMMITTED_SITE policy should
// return the process of the speculative RenderFrameHost. // return the process of the speculative RenderFrameHost.
navigation->Commit(); navigation->Commit();
contents()->GetController().LoadURL(kUrl2, Referrer(), navigation = NavigationSimulator::CreateBrowserInitiated(kUrl2, contents());
ui::PAGE_TRANSITION_TYPED, std::string()); navigation->Start();
main_test_rfh()->SendBeforeUnloadACK(true);
site_instance = SiteInstanceImpl::CreateForURL(browser_context(), kUrl2); site_instance = SiteInstanceImpl::CreateForURL(browser_context(), kUrl2);
site_instance->set_process_reuse_policy( site_instance->set_process_reuse_policy(
SiteInstanceImpl::ProcessReusePolicy::REUSE_PENDING_OR_COMMITTED_SITE); SiteInstanceImpl::ProcessReusePolicy::REUSE_PENDING_OR_COMMITTED_SITE);
...@@ -470,8 +469,7 @@ TEST_F(RenderProcessHostUnitTest, DISABLED_ReuseNavigationProcess) { ...@@ -470,8 +469,7 @@ TEST_F(RenderProcessHostUnitTest, DISABLED_ReuseNavigationProcess) {
// no longer return the process of the speculative RenderFrameHost. // no longer return the process of the speculative RenderFrameHost.
int speculative_process_host_id = int speculative_process_host_id =
contents()->GetPendingMainFrame()->GetProcess()->GetID(); contents()->GetPendingMainFrame()->GetProcess()->GetID();
contents()->GetPendingMainFrame()->SimulateNavigationError(kUrl2, navigation->Fail(net::ERR_ABORTED);
net::ERR_ABORTED);
site_instance = SiteInstanceImpl::CreateForURL(browser_context(), kUrl2); site_instance = SiteInstanceImpl::CreateForURL(browser_context(), kUrl2);
site_instance->set_process_reuse_policy( site_instance->set_process_reuse_policy(
SiteInstanceImpl::ProcessReusePolicy::REUSE_PENDING_OR_COMMITTED_SITE); SiteInstanceImpl::ProcessReusePolicy::REUSE_PENDING_OR_COMMITTED_SITE);
......
...@@ -183,51 +183,6 @@ void TestRenderFrameHost::SimulateNavigationCommit(const GURL& url) { ...@@ -183,51 +183,6 @@ void TestRenderFrameHost::SimulateNavigationCommit(const GURL& url) {
SendNavigateWithParams(&params, was_within_same_document); SendNavigateWithParams(&params, was_within_same_document);
} }
void TestRenderFrameHost::SimulateNavigationError(const GURL& url,
int error_code) {
if (IsBrowserSideNavigationEnabled()) {
NavigationRequest* request = frame_tree_node_->navigation_request();
CHECK(request);
// Simulate a beforeUnload ACK from the renderer if the browser is waiting
// for it. If it runs it will update the request state.
if (request->state() == NavigationRequest::WAITING_FOR_RENDERER_RESPONSE) {
static_cast<TestRenderFrameHost*>(frame_tree_node()->current_frame_host())
->SendBeforeUnloadACK(true);
}
if (!request->loader_for_testing()) {
base::RunLoop loop;
request->set_on_start_checks_complete_closure_for_testing(
loop.QuitClosure());
loop.Run();
}
TestNavigationURLLoader* url_loader =
static_cast<TestNavigationURLLoader*>(request->loader_for_testing());
CHECK(url_loader);
url_loader->SimulateError(error_code);
return;
}
FrameHostMsg_DidFailProvisionalLoadWithError_Params error_params;
error_params.error_code = error_code;
error_params.url = url;
OnDidFailProvisionalLoadWithError(error_params);
}
void TestRenderFrameHost::SimulateNavigationErrorPageCommit() {
CHECK(GetNavigationHandle());
GURL error_url = GURL(kUnreachableWebDataURL);
FrameHostMsg_DidCommitProvisionalLoad_Params params;
params.nav_entry_id = 0;
params.did_create_new_entry = true;
params.url = GetNavigationHandle()->GetURL();
params.transition = GetParent() ? ui::PAGE_TRANSITION_MANUAL_SUBFRAME
: ui::PAGE_TRANSITION_LINK;
params.url_is_unreachable = true;
params.page_state = PageState::CreateForTesting(
GetNavigationHandle()->GetURL(), false, nullptr, nullptr);
SendNavigateWithParams(&params, false /* was_within_same_document */);
}
void TestRenderFrameHost::SimulateNavigationStop() { void TestRenderFrameHost::SimulateNavigationStop() {
if (is_loading()) { if (is_loading()) {
OnDidStopLoading(); OnDidStopLoading();
......
...@@ -106,14 +106,6 @@ class TestRenderFrameHost : public RenderFrameHostImpl, ...@@ -106,14 +106,6 @@ class TestRenderFrameHost : public RenderFrameHostImpl,
service_manager::mojom::InterfaceProviderRequest request, service_manager::mojom::InterfaceProviderRequest request,
bool was_within_same_document); bool was_within_same_document);
// Simulates a navigation to |url| failing with the error code |error_code|.
// DEPRECATED: use NavigationSimulator instead.
void SimulateNavigationError(const GURL& url, int error_code);
// Simulates the commit of an error page following a navigation failure.
// DEPRECATED: use NavigationSimulator instead.
void SimulateNavigationErrorPageCommit();
// With the current navigation logic this method is a no-op. // With the current navigation logic this method is a no-op.
// Simulates a renderer-initiated navigation to |url| starting in the // Simulates a renderer-initiated navigation to |url| starting in the
// RenderFrameHost. // RenderFrameHost.
......
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