Commit 028a4fd0 authored by John Abd-El-Malek's avatar John Abd-El-Malek Committed by Commit Bot

Make some NavigationHandle getters available earlier now that PlzNavigate is the only path.

Bug: 683402
Change-Id: I8e7ed0ddf13f43e81006c2bffefee0a577113207
Reviewed-on: https://chromium-review.googlesource.com/849664
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarCamille Lamy <clamy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#527012}
parent 3f6772c1
......@@ -76,10 +76,7 @@ class ExtensionNavigationThrottleUnitTest
content::NavigationHandle::CreateNavigationHandleForTesting(
extension_url, host);
EXPECT_EQ(expected_will_start_result,
handle->CallWillStartRequestForTesting(
/*is_post=*/false, content::Referrer(),
/*has_user_gesture=*/false, ui::PAGE_TRANSITION_LINK,
/*is_external_protocol=*/false))
handle->CallWillStartRequestForTesting())
<< extension_url;
// Reset the handle for a second subtest: server redirect to
......@@ -96,10 +93,7 @@ class ExtensionNavigationThrottleUnitTest
? NavigationThrottle::PROCEED
: NavigationThrottle::CANCEL;
EXPECT_EQ(NavigationThrottle::PROCEED,
handle->CallWillStartRequestForTesting(
/*is_post=*/false, content::Referrer(),
/*has_user_gesture=*/false, ui::PAGE_TRANSITION_LINK,
/*is_external_protocol=*/false))
handle->CallWillStartRequestForTesting())
<< http_url;
EXPECT_EQ(expected_will_redirect_result,
handle->CallWillRedirectRequestForTesting(
......
......@@ -44,10 +44,7 @@ TEST_F(DelayNavigationThrottleTest, BasicDelay) {
EXPECT_FALSE(mock_time_task_runner->HasPendingTask());
EXPECT_EQ(content::NavigationThrottle::DEFER,
test_handle->CallWillStartRequestForTesting(
false /* is_post */, content::Referrer(),
false /* has_user_gesture */, ui::PAGE_TRANSITION_LINK,
false /* is_external_protocol */));
test_handle->CallWillStartRequestForTesting());
// There may be other throttles that DEFER and post async tasks to the UI
// thread. Allow them to run to completion, so our throttle is guaranteed to
......
......@@ -104,10 +104,10 @@ TEST_F(FlashDownloadInterceptionTest, NavigationThrottleCancelsNavigation) {
std::unique_ptr<NavigationHandle> handle =
NavigationHandle::CreateNavigationHandleForTesting(
GURL("https://get.adobe.com/flashplayer"), main_rfh());
GURL("https://get.adobe.com/flashplayer"), main_rfh(), false, net::OK,
false, true);
handle->CallWillStartRequestForTesting(true, content::Referrer(), true,
ui::PAGE_TRANSITION_LINK, false);
handle->CallWillStartRequestForTesting();
std::unique_ptr<NavigationThrottle> throttle =
FlashDownloadInterception::MaybeCreateThrottleFor(handle.get());
EXPECT_NE(nullptr, throttle);
......
......@@ -232,9 +232,7 @@ class ChromePasswordProtectionServiceTest
if (throttle)
test_handle->RegisterThrottleForTesting(std::move(throttle));
return test_handle->CallWillStartRequestForTesting(
/*is_post=*/false, content::Referrer(), /*has_user_gesture=*/false,
ui::PAGE_TRANSITION_LINK, /*is_external_protocol=*/false);
return test_handle->CallWillStartRequestForTesting();
}
int GetSizeofUnhandledSyncPasswordReuses() {
......
......@@ -62,28 +62,26 @@ class InterceptNavigationThrottleTest
NavigationThrottle::ThrottleCheckResult
SimulateWillStart(const GURL& url, const GURL& sanitized_url, bool is_post) {
std::unique_ptr<content::NavigationHandle> test_handle =
content::NavigationHandle::CreateNavigationHandleForTesting(url,
main_rfh());
content::NavigationHandle::CreateNavigationHandleForTesting(
url, main_rfh(), false, net::OK, false, is_post);
test_handle->RegisterThrottleForTesting(
base::MakeUnique<InterceptNavigationThrottle>(
test_handle.get(),
base::Bind(&MockInterceptCallbackReceiver::ShouldIgnoreNavigation,
base::Unretained(mock_callback_receiver_.get()))));
return test_handle->CallWillStartRequestForTesting(
is_post, content::Referrer(), false, ui::PAGE_TRANSITION_LINK, false);
return test_handle->CallWillStartRequestForTesting();
}
NavigationThrottle::ThrottleCheckResult Simulate302() {
std::unique_ptr<content::NavigationHandle> test_handle =
content::NavigationHandle::CreateNavigationHandleForTesting(
GURL(kTestUrl), main_rfh());
GURL(kTestUrl), main_rfh(), false, net::OK, false, true);
test_handle->RegisterThrottleForTesting(
base::MakeUnique<InterceptNavigationThrottle>(
test_handle.get(),
base::Bind(&MockInterceptCallbackReceiver::ShouldIgnoreNavigation,
base::Unretained(mock_callback_receiver_.get()))));
test_handle->CallWillStartRequestForTesting(
true, content::Referrer(), false, ui::PAGE_TRANSITION_LINK, false);
test_handle->CallWillStartRequestForTesting();
return test_handle->CallWillRedirectRequestForTesting(GURL(kTestUrl), false,
GURL(), false);
}
......
......@@ -41,15 +41,20 @@ void InterstitialPageNavigatorImpl::DidStartProvisionalLoad(
DCHECK(!render_frame_host->navigation_handle());
render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create(
url, redirect_chain, render_frame_host->frame_tree_node(),
false, /* is_renderer_initiated */
false, /* is_same_document */
navigation_start, /* navigation_state */
0, /* pending_nav_entry_id */
false, /* started_in_context_menu */
CSPDisposition::CHECK, /* should_check_main_world_csp */
false, /* is_form_submission */
base::nullopt /* suggested_filename */
));
false, /* is_renderer_initiated */
false, /* is_same_document */
navigation_start, /* navigation_state */
0, /* pending_nav_entry_id */
false, /* started_in_context_menu */
CSPDisposition::CHECK, /* should_check_main_world_csp */
false, /* is_form_submission */
base::nullopt, /* suggested_filename */
std::string(), /* method */
nullptr, /* resource_request_body */
content::Referrer(), false, /* has_user_gesture */
ui::PAGE_TRANSITION_LINK, false, /* is_external_protocol */
REQUEST_CONTEXT_TYPE_UNSPECIFIED,
blink::WebMixedContentContextType::kBlockable));
}
void InterstitialPageNavigatorImpl::DidNavigate(
......
......@@ -71,12 +71,22 @@ std::unique_ptr<NavigationHandleImpl> NavigationHandleImpl::Create(
bool started_from_context_menu,
CSPDisposition should_check_main_world_csp,
bool is_form_submission,
const base::Optional<std::string>& suggested_filename) {
const base::Optional<std::string>& suggested_filename,
const std::string& method,
scoped_refptr<content::ResourceRequestBody> resource_request_body,
const Referrer& sanitized_referrer,
bool has_user_gesture,
ui::PageTransition transition,
bool is_external_protocol,
RequestContextType request_context_type,
blink::WebMixedContentContextType mixed_content_context_type) {
return std::unique_ptr<NavigationHandleImpl>(new NavigationHandleImpl(
url, redirect_chain, frame_tree_node, is_renderer_initiated,
is_same_document, navigation_start, pending_nav_entry_id,
started_from_context_menu, should_check_main_world_csp,
is_form_submission, suggested_filename));
is_form_submission, suggested_filename, method, resource_request_body,
sanitized_referrer, has_user_gesture, transition, is_external_protocol,
request_context_type, mixed_content_context_type));
}
NavigationHandleImpl::NavigationHandleImpl(
......@@ -90,11 +100,19 @@ NavigationHandleImpl::NavigationHandleImpl(
bool started_from_context_menu,
CSPDisposition should_check_main_world_csp,
bool is_form_submission,
const base::Optional<std::string>& suggested_filename)
const base::Optional<std::string>& suggested_filename,
const std::string& method,
scoped_refptr<content::ResourceRequestBody> resource_request_body,
const Referrer& sanitized_referrer,
bool has_user_gesture,
ui::PageTransition transition,
bool is_external_protocol,
RequestContextType request_context_type,
blink::WebMixedContentContextType mixed_content_context_type)
: url_(url),
has_user_gesture_(false),
transition_(ui::PAGE_TRANSITION_LINK),
is_external_protocol_(false),
has_user_gesture_(has_user_gesture),
transition_(transition),
is_external_protocol_(is_external_protocol),
net_error_code_(net::OK),
render_frame_host_(nullptr),
is_renderer_initiated_(is_renderer_initiated),
......@@ -105,15 +123,15 @@ NavigationHandleImpl::NavigationHandleImpl(
subframe_entry_committed_(false),
connection_info_(net::HttpResponseInfo::CONNECTION_INFO_UNKNOWN),
original_url_(url),
method_(method),
state_(INITIAL),
is_transferring_(false),
frame_tree_node_(frame_tree_node),
next_index_(0),
navigation_start_(navigation_start),
pending_nav_entry_id_(pending_nav_entry_id),
request_context_type_(REQUEST_CONTEXT_TYPE_UNSPECIFIED),
mixed_content_context_type_(
blink::WebMixedContentContextType::kBlockable),
request_context_type_(request_context_type),
mixed_content_context_type_(mixed_content_context_type),
navigation_id_(CreateUniqueHandleID()),
should_replace_current_entry_(false),
redirect_chain_(redirect_chain),
......@@ -144,6 +162,23 @@ NavigationHandleImpl::NavigationHandleImpl(
starting_site_instance_ =
frame_tree_node_->current_frame_host()->GetSiteInstance();
if (method != "POST")
DCHECK(!resource_request_body);
// Update the navigation parameters.
if (method_ == "POST")
resource_request_body_ = resource_request_body;
// Mirrors the logic in RenderFrameImpl::SendDidCommitProvisionalLoad.
if (transition_ & ui::PAGE_TRANSITION_CLIENT_REDIRECT) {
// If the page contained a client redirect (meta refresh,
// document.location), set the referrer appropriately.
sanitized_referrer_ =
Referrer(redirect_chain_[0], sanitized_referrer.policy);
} else {
sanitized_referrer_ = sanitized_referrer;
}
// Try to match this with a pending NavigationEntry if possible. Note that
// the NavigationController itself may be gone if this is a navigation inside
// an interstitial and the interstitial is asynchronously deleting itself due
......@@ -261,39 +296,27 @@ const base::TimeTicks& NavigationHandleImpl::NavigationStart() {
}
bool NavigationHandleImpl::IsPost() {
CHECK_NE(INITIAL, state_)
<< "This accessor should not be called before the request is started.";
return method_ == "POST";
}
const scoped_refptr<ResourceRequestBody>&
NavigationHandleImpl::GetResourceRequestBody() {
CHECK_NE(INITIAL, state_)
<< "This accessor should not be called before the request is started.";
return resource_request_body_;
}
const Referrer& NavigationHandleImpl::GetReferrer() {
CHECK_NE(INITIAL, state_)
<< "This accessor should not be called before the request is started.";
return sanitized_referrer_;
}
bool NavigationHandleImpl::HasUserGesture() {
CHECK_NE(INITIAL, state_)
<< "This accessor should not be called before the request is started.";
return has_user_gesture_;
}
ui::PageTransition NavigationHandleImpl::GetPageTransition() {
CHECK_NE(INITIAL, state_)
<< "This accessor should not be called before the request is started.";
return transition_;
}
bool NavigationHandleImpl::IsExternalProtocol() {
CHECK_NE(INITIAL, state_)
<< "This accessor should not be called before the request is started.";
return is_external_protocol_;
}
......@@ -382,29 +405,9 @@ void NavigationHandleImpl::RegisterThrottleForTesting(
}
NavigationThrottle::ThrottleCheckResult
NavigationHandleImpl::CallWillStartRequestForTesting(
bool is_post,
const Referrer& sanitized_referrer,
bool has_user_gesture,
ui::PageTransition transition,
bool is_external_protocol) {
NavigationHandleImpl::CallWillStartRequestForTesting() {
NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER;
scoped_refptr<ResourceRequestBody> resource_request_body;
std::string method = "GET";
if (is_post) {
method = "POST";
std::string body = "test=body";
resource_request_body = new ResourceRequestBody();
resource_request_body->AppendBytes(body.data(), body.size());
}
WillStartRequest(method, resource_request_body, sanitized_referrer,
has_user_gesture, transition, is_external_protocol,
REQUEST_CONTEXT_TYPE_LOCATION,
blink::WebMixedContentContextType::kBlockable,
base::Bind(&UpdateThrottleCheckResult, &result));
WillStartRequest(base::Bind(&UpdateThrottleCheckResult, &result));
// Reset the callback to ensure it will not be called later.
complete_callback_.Reset();
......@@ -538,14 +541,6 @@ void NavigationHandleImpl::InitAppCacheHandle(
}
void NavigationHandleImpl::WillStartRequest(
const std::string& method,
scoped_refptr<content::ResourceRequestBody> resource_request_body,
const Referrer& sanitized_referrer,
bool has_user_gesture,
ui::PageTransition transition,
bool is_external_protocol,
RequestContextType request_context_type,
blink::WebMixedContentContextType mixed_content_context_type,
const ThrottleChecksFinishedCallback& callback) {
TRACE_EVENT_ASYNC_STEP_INTO0("navigation", "NavigationHandle", this,
"WillStartRequest");
......@@ -556,27 +551,6 @@ void NavigationHandleImpl::WillStartRequest(
return;
}
if (method != "POST")
DCHECK(!resource_request_body);
// Update the navigation parameters.
method_ = method;
if (method_ == "POST")
resource_request_body_ = resource_request_body;
has_user_gesture_ = has_user_gesture;
transition_ = transition;
// Mirrors the logic in RenderFrameImpl::SendDidCommitProvisionalLoad.
if (transition_ & ui::PAGE_TRANSITION_CLIENT_REDIRECT) {
// If the page contained a client redirect (meta refresh,
// document.location), set the referrer appropriately.
sanitized_referrer_ =
Referrer(redirect_chain_[0], sanitized_referrer.policy);
} else {
sanitized_referrer_ = sanitized_referrer;
}
is_external_protocol_ = is_external_protocol;
request_context_type_ = request_context_type;
mixed_content_context_type_ = mixed_content_context_type;
state_ = WILL_SEND_REQUEST;
complete_callback_ = callback;
......
......@@ -67,7 +67,19 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
bool started_from_context_menu,
CSPDisposition should_check_main_world_csp,
bool is_form_submission,
const base::Optional<std::string>& suggested_filename);
const base::Optional<std::string>& suggested_filename,
const std::string& method = std::string(),
scoped_refptr<content::ResourceRequestBody> resource_request_body =
nullptr,
const Referrer& sanitized_referrer = content::Referrer(),
bool has_user_gesture = false,
ui::PageTransition transition = ui::PAGE_TRANSITION_LINK,
bool is_external_protocol = false,
RequestContextType request_context_type =
REQUEST_CONTEXT_TYPE_UNSPECIFIED,
blink::WebMixedContentContextType mixed_content_context_type =
blink::WebMixedContentContextType::kBlockable);
~NavigationHandleImpl() override;
// Used to track the state the navigation is currently in.
......@@ -120,12 +132,8 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
const net::SSLInfo& GetSSLInfo() override;
void RegisterThrottleForTesting(
std::unique_ptr<NavigationThrottle> navigation_throttle) override;
NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting(
bool is_post,
const Referrer& sanitized_referrer,
bool has_user_gesture,
ui::PageTransition transition,
bool is_external_protocol) override;
NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting()
override;
NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting(
const GURL& new_url,
bool new_method_is_post,
......@@ -227,16 +235,7 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
// Called when the URLRequest will start in the network stack. |callback|
// will be called when all throttle checks have completed. This will allow
// the caller to cancel the navigation or let it proceed.
void WillStartRequest(
const std::string& method,
scoped_refptr<content::ResourceRequestBody> resource_request_body,
const Referrer& sanitized_referrer,
bool has_user_gesture,
ui::PageTransition transition,
bool is_external_protocol,
RequestContextType request_context_type,
blink::WebMixedContentContextType mixed_content_context_type,
const ThrottleChecksFinishedCallback& callback);
void WillStartRequest(const ThrottleChecksFinishedCallback& callback);
// Updates the state of the navigation handle after encountering a server
// redirect.
......@@ -370,17 +369,26 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
private:
friend class NavigationHandleImplTest;
NavigationHandleImpl(const GURL& url,
const std::vector<GURL>& redirect_chain,
FrameTreeNode* frame_tree_node,
bool is_renderer_initiated,
bool is_same_document,
const base::TimeTicks& navigation_start,
int pending_nav_entry_id,
bool started_from_context_menu,
CSPDisposition should_check_main_world_csp,
bool is_form_submission,
const base::Optional<std::string>& suggested_filename);
NavigationHandleImpl(
const GURL& url,
const std::vector<GURL>& redirect_chain,
FrameTreeNode* frame_tree_node,
bool is_renderer_initiated,
bool is_same_document,
const base::TimeTicks& navigation_start,
int pending_nav_entry_id,
bool started_from_context_menu,
CSPDisposition should_check_main_world_csp,
bool is_form_submission,
const base::Optional<std::string>& suggested_filename,
const std::string& method,
scoped_refptr<content::ResourceRequestBody> resource_request_body,
const Referrer& sanitized_referrer,
bool has_user_gesture,
ui::PageTransition transition,
bool is_external_protocol,
RequestContextType request_context_type,
blink::WebMixedContentContextType mixed_content_context_type);
NavigationThrottle::ThrottleCheckResult CheckWillStartRequest();
NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest();
......
......@@ -84,8 +84,6 @@ class NavigationHandleImplTest : public RenderViewHostImplTestHarness {
void SetUp() override {
RenderViewHostImplTestHarness::SetUp();
CreateNavigationHandle();
EXPECT_EQ(REQUEST_CONTEXT_TYPE_UNSPECIFIED,
test_handle_->request_context_type_);
contents()->GetMainFrame()->InitializeRenderFrameIfNeeded();
}
......@@ -113,9 +111,6 @@ class NavigationHandleImplTest : public RenderViewHostImplTestHarness {
// It's safe to use base::Unretained since the NavigationHandle is owned by
// the NavigationHandleImplTest.
test_handle_->WillStartRequest(
"GET", nullptr, Referrer(), false, ui::PAGE_TRANSITION_LINK, false,
REQUEST_CONTEXT_TYPE_LOCATION,
blink::WebMixedContentContextType::kBlockable,
base::Bind(&NavigationHandleImplTest::UpdateThrottleCheckResult,
base::Unretained(this)));
}
......@@ -263,7 +258,14 @@ class NavigationHandleImplTest : public RenderViewHostImplTestHarness {
false, // started_from_context_menu
CSPDisposition::CHECK, // should_check_main_world_csp
false, // is_form_submission
base::nullopt); // suggested_filename
base::nullopt, // suggested_filename
"GET",
nullptr, // resource_request_body
Referrer(),
false, // has_user_gesture
ui::PAGE_TRANSITION_LINK,
false, // is_external_protocol
REQUEST_CONTEXT_TYPE_LOCATION);
}
private:
......
......@@ -498,15 +498,7 @@ void NavigationRequest::BeginNavigation() {
// the NavigationHandle where the callback will be stored.
// TODO(clamy): pass the method to the NavigationHandle instead of a
// boolean.
bool is_external_protocol =
!GetContentClient()->browser()->IsHandledURL(common_params_.url);
navigation_handle_->WillStartRequest(
common_params_.method, common_params_.post_data,
Referrer::SanitizeForRequest(common_params_.url,
common_params_.referrer),
common_params_.has_user_gesture, common_params_.transition,
is_external_protocol, begin_params_->request_context_type,
begin_params_->mixed_content_context_type,
base::Bind(&NavigationRequest::OnStartChecksComplete,
base::Unretained(this)));
return;
......@@ -546,6 +538,8 @@ void NavigationRequest::CreateNavigationHandle() {
redirect_chain.push_back(begin_params_->client_side_redirect_url);
redirect_chain.push_back(common_params_.url);
bool is_external_protocol =
!GetContentClient()->browser()->IsHandledURL(common_params_.url);
std::unique_ptr<NavigationHandleImpl> navigation_handle =
NavigationHandleImpl::Create(
common_params_.url, redirect_chain, frame_tree_node_,
......@@ -555,7 +549,13 @@ void NavigationRequest::CreateNavigationHandle() {
common_params_.navigation_start, nav_entry_id_,
common_params_.started_from_context_menu,
common_params_.should_check_main_world_csp,
begin_params_->is_form_submission, begin_params_->suggested_filename);
begin_params_->is_form_submission, begin_params_->suggested_filename,
common_params_.method, common_params_.post_data,
Referrer::SanitizeForRequest(common_params_.url,
common_params_.referrer),
common_params_.has_user_gesture, common_params_.transition,
is_external_protocol, begin_params_->request_context_type,
begin_params_->mixed_content_context_type);
if (!frame_tree_node->navigation_request()) {
// A callback could have cancelled this request synchronously in which case
......
......@@ -27,9 +27,20 @@ NavigationHandle::CreateNavigationHandleForTesting(
RenderFrameHost* render_frame_host,
bool committed,
net::Error error,
bool is_same_document) {
bool is_same_document,
bool is_post,
ui::PageTransition transition) {
RenderFrameHostImpl* rfhi =
static_cast<RenderFrameHostImpl*>(render_frame_host);
scoped_refptr<ResourceRequestBody> resource_request_body;
std::string method = "GET";
if (is_post) {
method = "POST";
std::string body = "test=body";
resource_request_body = new ResourceRequestBody();
resource_request_body->AppendBytes(body.data(), body.size());
}
std::unique_ptr<NavigationHandleImpl> handle_impl =
NavigationHandleImpl::Create(
url, std::vector<GURL>(), rfhi->frame_tree_node(),
......@@ -38,7 +49,10 @@ NavigationHandle::CreateNavigationHandleForTesting(
false, // started_from_context_menu
CSPDisposition::CHECK, // should_check_main_world_csp
false, // is_form_submission
base::nullopt); // suggested_filename
base::nullopt, // suggested_filename
method, resource_request_body, Referrer(),
false, // has_user_gesture
transition);
handle_impl->set_render_frame_host(rfhi);
if (error != net::OK)
handle_impl->set_net_error_code(error);
......
......@@ -121,13 +121,6 @@ class CONTENT_EXPORT NavigationHandle {
// Used for specifying a base URL for pages loaded via data URLs.
virtual const GURL& GetBaseURLForDataURL() = 0;
// Parameters available at network request start time ------------------------
//
// The following parameters are only available when the network request is
// made for the navigation (or at commit time if no network request is made).
// This corresponds to NavigationThrottle::WillSendRequest. They should not
// be queried before that.
// Whether the navigation is done using HTTP POST method. This may change
// during the navigation (e.g. after encountering a server redirect).
//
......@@ -269,7 +262,9 @@ class CONTENT_EXPORT NavigationHandle {
RenderFrameHost* render_frame_host,
bool committed = false,
net::Error error = net::OK,
bool is_same_document = false);
bool is_same_document = false,
bool is_post = false,
ui::PageTransition transition = ui::PAGE_TRANSITION_LINK);
// Registers a NavigationThrottle for tests. The throttle can
// modify the request, pause the request or cancel the request. This will
......@@ -283,11 +278,7 @@ class CONTENT_EXPORT NavigationHandle {
// Simulates the network request starting.
virtual NavigationThrottle::ThrottleCheckResult
CallWillStartRequestForTesting(bool is_post,
const Referrer& sanitized_referrer,
bool has_user_gesture,
ui::PageTransition transition,
bool is_external_protocol) = 0;
CallWillStartRequestForTesting() = 0;
// Simulates the network request being redirected.
virtual NavigationThrottle::ThrottleCheckResult
......
......@@ -169,7 +169,6 @@ void TestRenderFrameHost::SimulateNavigationStart(const GURL& url) {
OnDidStartLoading(true);
OnDidStartProvisionalLoad(url, std::vector<GURL>(), base::TimeTicks::Now());
SimulateWillStartRequest(ui::PAGE_TRANSITION_LINK);
}
void TestRenderFrameHost::SimulateRedirect(const GURL& new_url) {
......@@ -386,7 +385,6 @@ void TestRenderFrameHost::SendNavigateWithParameters(
GURL url_copy(url);
OnDidStartProvisionalLoad(url_copy, std::vector<GURL>(),
base::TimeTicks::Now());
SimulateWillStartRequest(transition);
FrameHostMsg_DidCommitProvisionalLoad_Params params;
params.nav_entry_id = nav_entry_id;
......@@ -607,17 +605,6 @@ TestRenderFrameHost::CreateWebBluetoothServiceForTesting() {
return service;
}
void TestRenderFrameHost::SimulateWillStartRequest(
ui::PageTransition transition) {
// PlzNavigate: NavigationHandle::WillStartRequest has already been called at
// this point.
if (!navigation_handle() || IsBrowserSideNavigationEnabled())
return;
navigation_handle()->CallWillStartRequestForTesting(
false /* is_post */, Referrer(GURL(), blink::kWebReferrerPolicyDefault),
true /* user_gesture */, transition, false /* is_external_protocol */);
}
void TestRenderFrameHost::SendFramePolicy(
blink::WebSandboxFlags sandbox_flags,
const blink::ParsedFeaturePolicy& declared_policy) {
......
......@@ -209,8 +209,6 @@ class TestRenderFrameHost : public RenderFrameHostImpl,
// Computes the page ID for a pending navigation in this RenderFrameHost;
int32_t ComputeNextPageID();
void SimulateWillStartRequest(ui::PageTransition transition);
// RenderFrameHostImpl:
mojom::FrameNavigationControl* GetNavigationControl() override;
......
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