Commit 3373f61a authored by Charles Harrison's avatar Charles Harrison Committed by Commit Bot

Remove NavigationSimulator::SetOnDeferCallback

This is no longer being used.

Bug: None
Change-Id: I2c6167ed35fcd42cb0f111836ae8ee26f7c5fc92
Reviewed-on: https://chromium-review.googlesource.com/961815Reviewed-by: default avatarCamille Lamy <clamy@chromium.org>
Commit-Queue: Charlie Harrison <csharrison@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543370}
parent ad1de109
......@@ -570,11 +570,6 @@ void NavigationHandleImpl::RegisterSubresourceOverride(
request->RegisterSubresourceOverride(std::move(transferrable_loader));
}
void NavigationHandleImpl::SetOnDeferCallbackForTesting(
const base::Closure& on_defer_callback) {
on_defer_callback_for_testing_ = on_defer_callback;
}
const GlobalRequestID& NavigationHandleImpl::GetGlobalRequestID() {
DCHECK(state_ >= WILL_PROCESS_RESPONSE);
return request_id_;
......@@ -632,11 +627,8 @@ void NavigationHandleImpl::WillStartRequest(
navigation_ui_data_ = GetDelegate()->GetNavigationUIData(this);
// Notify each throttle of the request.
base::Closure on_defer_callback_copy = on_defer_callback_for_testing_;
NavigationThrottle::ThrottleCheckResult result = CheckWillStartRequest();
if (result.action() == NavigationThrottle::DEFER) {
if (!on_defer_callback_copy.is_null())
on_defer_callback_copy.Run();
// DO NOT ADD CODE: the NavigationHandle might have been destroyed during
// one of the NavigationThrottle checks.
return;
......@@ -709,11 +701,8 @@ void NavigationHandleImpl::WillRedirectRequest(
}
// Notify each throttle of the request.
base::Closure on_defer_callback_copy = on_defer_callback_for_testing_;
NavigationThrottle::ThrottleCheckResult result = CheckWillRedirectRequest();
if (result.action() == NavigationThrottle::DEFER) {
if (!on_defer_callback_copy.is_null())
on_defer_callback_copy.Run();
// DO NOT ADD CODE: the NavigationHandle might have been destroyed during
// one of the NavigationThrottle checks.
return;
......@@ -736,11 +725,8 @@ void NavigationHandleImpl::WillFailRequest(
state_ = WILL_FAIL_REQUEST;
// Notify each throttle of the request.
base::Closure on_defer_callback_copy = on_defer_callback_for_testing_;
NavigationThrottle::ThrottleCheckResult result = CheckWillFailRequest();
if (result.action() == NavigationThrottle::DEFER) {
if (!on_defer_callback_copy.is_null())
on_defer_callback_copy.Run();
// DO NOT ADD CODE: the NavigationHandle might have been destroyed during
// one of the NavigationThrottle checks.
return;
......@@ -779,11 +765,8 @@ void NavigationHandleImpl::WillProcessResponse(
complete_callback_ = callback;
// Notify each throttle of the response.
base::Closure on_defer_callback_copy = on_defer_callback_for_testing_;
NavigationThrottle::ThrottleCheckResult result = CheckWillProcessResponse();
if (result.action() == NavigationThrottle::DEFER) {
if (!on_defer_callback_copy.is_null())
on_defer_callback_copy.Run();
// DO NOT ADD CODE: the NavigationHandle might have been destroyed during
// one of the NavigationThrottle checks.
return;
......@@ -1131,12 +1114,9 @@ void NavigationHandleImpl::ResumeInternal() {
"Resume");
NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER;
base::Closure on_defer_callback_copy = on_defer_callback_for_testing_;
if (state_ == DEFERRING_START) {
result = CheckWillStartRequest();
if (result.action() == NavigationThrottle::DEFER) {
if (!on_defer_callback_copy.is_null())
on_defer_callback_copy.Run();
// DO NOT ADD CODE: the NavigationHandle might have been destroyed during
// one of the NavigationThrottle checks.
return;
......@@ -1144,8 +1124,6 @@ void NavigationHandleImpl::ResumeInternal() {
} else if (state_ == DEFERRING_REDIRECT) {
result = CheckWillRedirectRequest();
if (result.action() == NavigationThrottle::DEFER) {
if (!on_defer_callback_copy.is_null())
on_defer_callback_copy.Run();
// DO NOT ADD CODE: the NavigationHandle might have been destroyed during
// one of the NavigationThrottle checks.
return;
......@@ -1153,8 +1131,6 @@ void NavigationHandleImpl::ResumeInternal() {
} else if (state_ == DEFERRING_FAILURE) {
result = CheckWillFailRequest();
if (result.action() == NavigationThrottle::DEFER) {
if (!on_defer_callback_copy.is_null())
on_defer_callback_copy.Run();
// DO NOT ADD CODE: the NavigationHandle might have been destroyed during
// one of the NavigationThrottle checks.
return;
......@@ -1162,8 +1138,6 @@ void NavigationHandleImpl::ResumeInternal() {
} else {
result = CheckWillProcessResponse();
if (result.action() == NavigationThrottle::DEFER) {
if (!on_defer_callback_copy.is_null())
on_defer_callback_copy.Run();
// DO NOT ADD CODE: the NavigationHandle might have been destroyed during
// one of the NavigationThrottle checks.
return;
......
......@@ -173,7 +173,6 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
// Used in tests.
State state_for_testing() const { return state_; }
void SetOnDeferCallbackForTesting(const base::Closure& on_defer_callback);
// The NavigatorDelegate to notify/query for various navigation events.
// Normally this is the WebContents, except if this NavigationHandle was
......@@ -569,10 +568,6 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
// in it.
int expected_render_process_host_id_;
// Used in tests. Called when the navigation is deferred by one of the
// NavigationThrottles.
base::Closure on_defer_callback_for_testing_;
// If this navigation was triggered by an anchor element with a download
// attribute, the |suggested_filename_| contains the attribute's (possibly
// empty) value.
......
......@@ -674,20 +674,6 @@ content::GlobalRequestID NavigationSimulator::GetGlobalRequestID() const {
return request_id_;
}
void NavigationSimulator::SetOnDeferCallback(
const base::Closure& on_defer_callback) {
CHECK_LT(state_, FINISHED)
<< "The callback should not be set after the navigation has finished";
if (handle_) {
handle_->SetOnDeferCallbackForTesting(on_defer_callback);
return;
}
// If there is no NavigationHandle for the navigation yet, store the callback
// until one has been created.
on_defer_callback_ = on_defer_callback;
}
void NavigationSimulator::DidStartNavigation(
NavigationHandle* navigation_handle) {
// Check if this navigation is the one we're simulating.
......@@ -717,12 +703,6 @@ void NavigationSimulator::DidStartNavigation(
base::Bind(&NavigationSimulator::OnWillProcessResponse,
weak_factory_.GetWeakPtr())));
// Pass the |on_defer_callback_| if it was registered.
if (!on_defer_callback_.is_null()) {
handle->SetOnDeferCallbackForTesting(on_defer_callback_);
on_defer_callback_.Reset();
}
PrepareCompleteCallbackOnHandle();
}
......
......@@ -257,23 +257,6 @@ class NavigationSimulator : public WebContentsObserver {
// callback.
content::GlobalRequestID GetGlobalRequestID() const;
// Allows the user of the NavigationSimulator to specify a callback that will
// be called if the navigation is deferred by a NavigationThrottle. This is
// used for testing deferring NavigationThrottles.
//
// Example usage:
// void CheckThrottleStateAndResume() {
// // Do some testing here.
// deferring_navigation_throttle->Resume();
// }
// unique_ptr<NavigationSimulator> simulator =
// NavigationSimulator::CreateRendererInitiated(
// original_url, render_frame_host);
// simulator->SetOnDeferCallback(base::Bind(&CheckThrottleStateAndResume));
// simulator->Start();
// simulator->Commit();
void SetOnDeferCallback(const base::Closure& on_defer_callback);
private:
NavigationSimulator(const GURL& original_url,
bool browser_initiated,
......@@ -381,10 +364,6 @@ class NavigationSimulator : public WebContentsObserver {
// Closure that is set when WaitForThrottleChecksComplete is called.
base::Closure throttle_checks_wait_closure_;
// Temporarily holds a closure that will be called on navigation deferral
// until the NavigationHandle for this navigation has been created.
base::Closure on_defer_callback_;
base::WeakPtrFactory<NavigationSimulator> weak_factory_;
};
......
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