summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxunjieli <xunjieli@chromium.org>2015-06-24 07:26:40 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-24 14:27:01 +0000
commit41edcdd7d1e8599974a8ea6a3ff1ee8678e03b43 (patch)
tree52d33ff62f70974652cd18dee5ef7f3f96f26f54
parentb28d496b5665d3947a144c52adead982123b5575 (diff)
downloadchromium_src-41edcdd7d1e8599974a8ea6a3ff1ee8678e03b43.zip
chromium_src-41edcdd7d1e8599974a8ea6a3ff1ee8678e03b43.tar.gz
chromium_src-41edcdd7d1e8599974a8ea6a3ff1ee8678e03b43.tar.bz2
Remove NetworkDelegate::OnCanThrottleRequest
This CL removes NetworkDelegate::OnCanThrottleRequest which is no longer relevant and can be deleted. TBR=startmorgan@chromium.org TBR=davidben@chromium.org BUG=500680 Review URL: https://codereview.chromium.org/1201013002 Cr-Commit-Position: refs/heads/master@{#335916}
-rw-r--r--android_webview/browser/net/aw_network_delegate.cc5
-rw-r--r--android_webview/browser/net/aw_network_delegate.h1
-rw-r--r--components/cronet/android/cronet_url_request_context_adapter.cc4
-rw-r--r--components/cronet/android/url_request_context_adapter.cc5
-rw-r--r--content/shell/browser/shell_network_delegate.cc5
-rw-r--r--content/shell/browser/shell_network_delegate.h1
-rw-r--r--ios/web/shell/shell_network_delegate.cc5
-rw-r--r--ios/web/shell/shell_network_delegate.h1
-rw-r--r--net/base/layered_network_delegate.cc10
-rw-r--r--net/base/layered_network_delegate.h3
-rw-r--r--net/base/layered_network_delegate_unittest.cc11
-rw-r--r--net/base/network_delegate.cc5
-rw-r--r--net/base/network_delegate.h6
-rw-r--r--net/base/network_delegate_impl.cc5
-rw-r--r--net/base/network_delegate_impl.h5
-rw-r--r--net/proxy/network_delegate_error_observer_unittest.cc3
-rw-r--r--net/proxy/proxy_script_fetcher_impl_unittest.cc3
-rw-r--r--net/url_request/url_request_context_builder.cc6
-rw-r--r--net/url_request/url_request_http_job.cc3
-rw-r--r--net/url_request/url_request_test_util.cc6
-rw-r--r--net/url_request/url_request_test_util.h5
-rw-r--r--net/url_request/url_request_throttler_entry.cc4
-rw-r--r--net/url_request/url_request_throttler_entry.h3
-rw-r--r--net/url_request/url_request_throttler_entry_interface.h7
-rw-r--r--net/url_request/url_request_throttler_simulation_unittest.cc4
-rw-r--r--net/url_request/url_request_throttler_unittest.cc44
26 files changed, 16 insertions, 144 deletions
diff --git a/android_webview/browser/net/aw_network_delegate.cc b/android_webview/browser/net/aw_network_delegate.cc
index 7d55045..328ddbb 100644
--- a/android_webview/browser/net/aw_network_delegate.cc
+++ b/android_webview/browser/net/aw_network_delegate.cc
@@ -117,9 +117,4 @@ bool AwNetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
return true;
}
-bool AwNetworkDelegate::OnCanThrottleRequest(
- const net::URLRequest& request) const {
- return false;
-}
-
} // namespace android_webview
diff --git a/android_webview/browser/net/aw_network_delegate.h b/android_webview/browser/net/aw_network_delegate.h
index da6723b..e7f260a 100644
--- a/android_webview/browser/net/aw_network_delegate.h
+++ b/android_webview/browser/net/aw_network_delegate.h
@@ -56,7 +56,6 @@ class AwNetworkDelegate : public net::NetworkDelegateImpl {
net::CookieOptions* options) override;
bool OnCanAccessFile(const net::URLRequest& request,
const base::FilePath& path) const override;
- bool OnCanThrottleRequest(const net::URLRequest& request) const override;
DISALLOW_COPY_AND_ASSIGN(AwNetworkDelegate);
};
diff --git a/components/cronet/android/cronet_url_request_context_adapter.cc b/components/cronet/android/cronet_url_request_context_adapter.cc
index 7cab0d9..5ece786 100644
--- a/components/cronet/android/cronet_url_request_context_adapter.cc
+++ b/components/cronet/android/cronet_url_request_context_adapter.cc
@@ -103,10 +103,6 @@ class BasicNetworkDelegate : public net::NetworkDelegateImpl {
return false;
}
- bool OnCanThrottleRequest(const net::URLRequest& request) const override {
- return false;
- }
-
DISALLOW_COPY_AND_ASSIGN(BasicNetworkDelegate);
};
diff --git a/components/cronet/android/url_request_context_adapter.cc b/components/cronet/android/url_request_context_adapter.cc
index cb24f8d..10be235 100644
--- a/components/cronet/android/url_request_context_adapter.cc
+++ b/components/cronet/android/url_request_context_adapter.cc
@@ -102,11 +102,6 @@ class BasicNetworkDelegate : public net::NetworkDelegateImpl {
return false;
}
- bool OnCanThrottleRequest(
- const net::URLRequest& request) const override {
- return false;
- }
-
DISALLOW_COPY_AND_ASSIGN(BasicNetworkDelegate);
};
diff --git a/content/shell/browser/shell_network_delegate.cc b/content/shell/browser/shell_network_delegate.cc
index 135bba3..f617df0 100644
--- a/content/shell/browser/shell_network_delegate.cc
+++ b/content/shell/browser/shell_network_delegate.cc
@@ -111,11 +111,6 @@ bool ShellNetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
return true;
}
-bool ShellNetworkDelegate::OnCanThrottleRequest(
- const net::URLRequest& request) const {
- return false;
-}
-
bool ShellNetworkDelegate::OnFirstPartyOnlyCookieExperimentEnabled() const {
return base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExperimentalWebPlatformFeatures);
diff --git a/content/shell/browser/shell_network_delegate.h b/content/shell/browser/shell_network_delegate.h
index a23f5ff..978de0a 100644
--- a/content/shell/browser/shell_network_delegate.h
+++ b/content/shell/browser/shell_network_delegate.h
@@ -53,7 +53,6 @@ class ShellNetworkDelegate : public net::NetworkDelegateImpl {
net::CookieOptions* options) override;
bool OnCanAccessFile(const net::URLRequest& request,
const base::FilePath& path) const override;
- bool OnCanThrottleRequest(const net::URLRequest& request) const override;
bool OnFirstPartyOnlyCookieExperimentEnabled() const override;
DISALLOW_COPY_AND_ASSIGN(ShellNetworkDelegate);
diff --git a/ios/web/shell/shell_network_delegate.cc b/ios/web/shell/shell_network_delegate.cc
index a973f4c..5408d4a 100644
--- a/ios/web/shell/shell_network_delegate.cc
+++ b/ios/web/shell/shell_network_delegate.cc
@@ -87,9 +87,4 @@ bool ShellNetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
return true;
}
-bool ShellNetworkDelegate::OnCanThrottleRequest(
- const net::URLRequest& request) const {
- return false;
-}
-
} // namespace web
diff --git a/ios/web/shell/shell_network_delegate.h b/ios/web/shell/shell_network_delegate.h
index 70f0f21..340a8ca 100644
--- a/ios/web/shell/shell_network_delegate.h
+++ b/ios/web/shell/shell_network_delegate.h
@@ -51,7 +51,6 @@ class ShellNetworkDelegate : public net::NetworkDelegateImpl {
net::CookieOptions* options) override;
bool OnCanAccessFile(const net::URLRequest& request,
const base::FilePath& path) const override;
- bool OnCanThrottleRequest(const net::URLRequest& request) const override;
DISALLOW_COPY_AND_ASSIGN(ShellNetworkDelegate);
};
diff --git a/net/base/layered_network_delegate.cc b/net/base/layered_network_delegate.cc
index 9fd4973..47441f5 100644
--- a/net/base/layered_network_delegate.cc
+++ b/net/base/layered_network_delegate.cc
@@ -229,16 +229,6 @@ void LayeredNetworkDelegate::OnCanAccessFileInternal(
const base::FilePath& path) const {
}
-bool LayeredNetworkDelegate::OnCanThrottleRequest(
- const URLRequest& request) const {
- OnCanThrottleRequestInternal(request);
- return nested_network_delegate_->CanThrottleRequest(request);
-}
-
-void LayeredNetworkDelegate::OnCanThrottleRequestInternal(
- const URLRequest& request) const {
-}
-
bool LayeredNetworkDelegate::OnCanEnablePrivacyMode(
const GURL& url,
const GURL& first_party_for_cookies) const {
diff --git a/net/base/layered_network_delegate.h b/net/base/layered_network_delegate.h
index 87c1d86..410dce1 100644
--- a/net/base/layered_network_delegate.h
+++ b/net/base/layered_network_delegate.h
@@ -77,7 +77,6 @@ class NET_EXPORT LayeredNetworkDelegate : public NetworkDelegate {
CookieOptions* options) final;
bool OnCanAccessFile(const URLRequest& request,
const base::FilePath& path) const final;
- bool OnCanThrottleRequest(const URLRequest& request) const final;
bool OnCanEnablePrivacyMode(const GURL& url,
const GURL& first_party_for_cookies) const final;
bool OnFirstPartyOnlyCookieExperimentEnabled() const final;
@@ -147,8 +146,6 @@ class NET_EXPORT LayeredNetworkDelegate : public NetworkDelegate {
virtual void OnCanAccessFileInternal(const URLRequest& request,
const base::FilePath& path) const;
- virtual void OnCanThrottleRequestInternal(const URLRequest& request) const;
-
virtual void OnCanEnablePrivacyModeInternal(
const GURL& url,
const GURL& first_party_for_cookies) const;
diff --git a/net/base/layered_network_delegate_unittest.cc b/net/base/layered_network_delegate_unittest.cc
index de31978..9cb77fa 100644
--- a/net/base/layered_network_delegate_unittest.cc
+++ b/net/base/layered_network_delegate_unittest.cc
@@ -136,11 +136,6 @@ class TestNetworkDelegateImpl : public NetworkDelegateImpl {
return false;
}
- bool OnCanThrottleRequest(const URLRequest& request) const override {
- IncrementAndCompareCounter("on_can_throttle_request_count");
- return false;
- }
-
bool OnCanEnablePrivacyMode(
const GURL& url,
const GURL& first_party_for_cookies) const override {
@@ -214,7 +209,6 @@ class TestLayeredNetworkDelegate : public LayeredNetworkDelegate {
EXPECT_FALSE(OnCanGetCookies(*request, CookieList()));
EXPECT_FALSE(OnCanSetCookie(*request, std::string(), NULL));
EXPECT_FALSE(OnCanAccessFile(*request, base::FilePath()));
- EXPECT_FALSE(OnCanThrottleRequest(*request));
EXPECT_FALSE(OnCanEnablePrivacyMode(GURL(), GURL()));
EXPECT_FALSE(OnCancelURLRequestWithPolicyViolatingReferrerHeader(
*request, GURL(), GURL()));
@@ -332,11 +326,6 @@ class TestLayeredNetworkDelegate : public LayeredNetworkDelegate {
EXPECT_EQ(1, (*counters_)["on_can_access_file_count"]);
}
- void OnCanThrottleRequestInternal(const URLRequest& request) const override {
- ++(*counters_)["on_can_throttle_request_count"];
- EXPECT_EQ(1, (*counters_)["on_can_throttle_request_count"]);
- }
-
void OnCanEnablePrivacyModeInternal(
const GURL& url,
const GURL& first_party_for_cookies) const override {
diff --git a/net/base/network_delegate.cc b/net/base/network_delegate.cc
index 0aaf2bd3..40eb665 100644
--- a/net/base/network_delegate.cc
+++ b/net/base/network_delegate.cc
@@ -153,11 +153,6 @@ bool NetworkDelegate::CanAccessFile(const URLRequest& request,
return OnCanAccessFile(request, path);
}
-bool NetworkDelegate::CanThrottleRequest(const URLRequest& request) const {
- DCHECK(CalledOnValidThread());
- return OnCanThrottleRequest(request);
-}
-
bool NetworkDelegate::CanEnablePrivacyMode(
const GURL& url,
const GURL& first_party_for_cookies) const {
diff --git a/net/base/network_delegate.h b/net/base/network_delegate.h
index 9ea8202..e7ee964 100644
--- a/net/base/network_delegate.h
+++ b/net/base/network_delegate.h
@@ -100,7 +100,6 @@ class NET_EXPORT NetworkDelegate : public base::NonThreadSafe {
CookieOptions* options);
bool CanAccessFile(const URLRequest& request,
const base::FilePath& path) const;
- bool CanThrottleRequest(const URLRequest& request) const;
bool CanEnablePrivacyMode(const GURL& url,
const GURL& first_party_for_cookies) const;
@@ -258,11 +257,6 @@ class NET_EXPORT NetworkDelegate : public base::NonThreadSafe {
virtual bool OnCanAccessFile(const URLRequest& request,
const base::FilePath& path) const = 0;
- // Returns true if the given request may be rejected when the
- // URLRequestThrottlerManager believes the server servicing the
- // request is overloaded or down.
- virtual bool OnCanThrottleRequest(const URLRequest& request) const = 0;
-
// Returns true if the given |url| has to be requested over connection that
// is not tracked by the server. Usually is false, unless user privacy
// settings block cookies from being get or set.
diff --git a/net/base/network_delegate_impl.cc b/net/base/network_delegate_impl.cc
index c4bdd04..542b4d0 100644
--- a/net/base/network_delegate_impl.cc
+++ b/net/base/network_delegate_impl.cc
@@ -94,11 +94,6 @@ bool NetworkDelegateImpl::OnCanAccessFile(const URLRequest& request,
return false;
}
-bool NetworkDelegateImpl::OnCanThrottleRequest(
- const URLRequest& request) const {
- return false;
-}
-
bool NetworkDelegateImpl::OnCanEnablePrivacyMode(
const GURL& url,
const GURL& first_party_for_cookies) const {
diff --git a/net/base/network_delegate_impl.h b/net/base/network_delegate_impl.h
index 8ad483e..1f1c779 100644
--- a/net/base/network_delegate_impl.h
+++ b/net/base/network_delegate_impl.h
@@ -172,11 +172,6 @@ class NET_EXPORT NetworkDelegateImpl : public NetworkDelegate {
bool OnCanAccessFile(const URLRequest& request,
const base::FilePath& path) const override;
- // Returns true if the given request may be rejected when the
- // URLRequestThrottlerManager believes the server servicing the
- // request is overloaded or down.
- bool OnCanThrottleRequest(const URLRequest& request) const override;
-
// Returns true if the given |url| has to be requested over connection that
// is not tracked by the server. Usually is false, unless user privacy
// settings block cookies from being get or set.
diff --git a/net/proxy/network_delegate_error_observer_unittest.cc b/net/proxy/network_delegate_error_observer_unittest.cc
index 2d83014..5fd4a95 100644
--- a/net/proxy/network_delegate_error_observer_unittest.cc
+++ b/net/proxy/network_delegate_error_observer_unittest.cc
@@ -76,9 +76,6 @@ class TestNetworkDelegate : public NetworkDelegateImpl {
const base::FilePath& path) const override {
return true;
}
- bool OnCanThrottleRequest(const URLRequest& request) const override {
- return false;
- }
bool got_pac_error_;
};
diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc
index 1bad70e..dd49b56 100644
--- a/net/proxy/proxy_script_fetcher_impl_unittest.cc
+++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc
@@ -178,9 +178,6 @@ class BasicNetworkDelegate : public NetworkDelegateImpl {
const base::FilePath& path) const override {
return true;
}
- bool OnCanThrottleRequest(const URLRequest& request) const override {
- return false;
- }
DISALLOW_COPY_AND_ASSIGN(BasicNetworkDelegate);
};
diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc
index fafc2111..771bc3f 100644
--- a/net/url_request/url_request_context_builder.cc
+++ b/net/url_request/url_request_context_builder.cc
@@ -120,12 +120,6 @@ class BasicNetworkDelegate : public NetworkDelegateImpl {
return true;
}
- bool OnCanThrottleRequest(const URLRequest& request) const override {
- // Returning true will only enable throttling if there's also a
- // URLRequestThrottlerManager, which there isn't, by default.
- return true;
- }
-
DISALLOW_COPY_AND_ASSIGN(BasicNetworkDelegate);
};
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index d177c21..96a6a00 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -495,8 +495,7 @@ void URLRequestHttpJob::StartTransactionInternal() {
base::Unretained(this)));
if (!throttling_entry_.get() ||
- !throttling_entry_->ShouldRejectRequest(*request_,
- network_delegate())) {
+ !throttling_entry_->ShouldRejectRequest(*request_)) {
rv = transaction_->Start(
&request_info_, start_callback_, request_->net_log());
start_time_ = base::TimeTicks::Now();
diff --git a/net/url_request/url_request_test_util.cc b/net/url_request/url_request_test_util.cc
index bbff202..49df571 100644
--- a/net/url_request/url_request_test_util.cc
+++ b/net/url_request/url_request_test_util.cc
@@ -330,7 +330,6 @@ TestNetworkDelegate::TestNetworkDelegate()
has_load_timing_info_before_redirect_(false),
has_load_timing_info_before_auth_(false),
can_access_files_(true),
- can_throttle_requests_(true),
first_party_only_cookies_enabled_(false),
cancel_request_with_policy_violating_referrer_(false),
will_be_intercepted_on_next_error_(false) {
@@ -608,11 +607,6 @@ bool TestNetworkDelegate::OnCanAccessFile(const URLRequest& request,
return can_access_files_;
}
-bool TestNetworkDelegate::OnCanThrottleRequest(
- const URLRequest& request) const {
- return can_throttle_requests_;
-}
-
bool TestNetworkDelegate::OnFirstPartyOnlyCookieExperimentEnabled() const {
return first_party_only_cookies_enabled_;
}
diff --git a/net/url_request/url_request_test_util.h b/net/url_request/url_request_test_util.h
index 48c3b7d..ffa1b1b 100644
--- a/net/url_request/url_request_test_util.h
+++ b/net/url_request/url_request_test_util.h
@@ -276,9 +276,6 @@ class TestNetworkDelegate : public NetworkDelegateImpl {
first_party_only_cookies_enabled_ = val;
}
- void set_can_throttle_requests(bool val) { can_throttle_requests_ = val; }
- bool can_throttle_requests() const { return can_throttle_requests_; }
-
void set_cancel_request_with_policy_violating_referrer(bool val) {
cancel_request_with_policy_violating_referrer_ = val;
}
@@ -335,7 +332,6 @@ class TestNetworkDelegate : public NetworkDelegateImpl {
CookieOptions* options) override;
bool OnCanAccessFile(const URLRequest& request,
const base::FilePath& path) const override;
- bool OnCanThrottleRequest(const URLRequest& request) const override;
bool OnFirstPartyOnlyCookieExperimentEnabled() const override;
bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
const URLRequest& request,
@@ -381,7 +377,6 @@ class TestNetworkDelegate : public NetworkDelegateImpl {
bool has_load_timing_info_before_auth_;
bool can_access_files_; // true by default
- bool can_throttle_requests_; // true by default
bool first_party_only_cookies_enabled_; // false by default
bool cancel_request_with_policy_violating_referrer_; // false by default
bool will_be_intercepted_on_next_error_;
diff --git a/net/url_request/url_request_throttler_entry.cc b/net/url_request/url_request_throttler_entry.cc
index 4cdcb9d..8b7aa79 100644
--- a/net/url_request/url_request_throttler_entry.cc
+++ b/net/url_request/url_request_throttler_entry.cc
@@ -147,11 +147,9 @@ void URLRequestThrottlerEntry::DetachManager() {
}
bool URLRequestThrottlerEntry::ShouldRejectRequest(
- const URLRequest& request,
- NetworkDelegate* network_delegate) const {
+ const URLRequest& request) const {
bool reject_request = false;
if (!is_backoff_disabled_ && !ExplicitUserRequest(request.load_flags()) &&
- (!network_delegate || network_delegate->CanThrottleRequest(request)) &&
GetBackoffEntry()->ShouldRejectRequest()) {
net_log_.AddEvent(
NetLog::TYPE_THROTTLING_REJECTED_REQUEST,
diff --git a/net/url_request/url_request_throttler_entry.h b/net/url_request/url_request_throttler_entry.h
index 0f385cc..264766a 100644
--- a/net/url_request/url_request_throttler_entry.h
+++ b/net/url_request/url_request_throttler_entry.h
@@ -85,8 +85,7 @@ class NET_EXPORT URLRequestThrottlerEntry
void DetachManager();
// Implementation of URLRequestThrottlerEntryInterface.
- bool ShouldRejectRequest(const URLRequest& request,
- NetworkDelegate* network_delegate) const override;
+ bool ShouldRejectRequest(const URLRequest& request) const override;
int64 ReserveSendingTimeForNextRequest(
const base::TimeTicks& earliest_time) override;
base::TimeTicks GetExponentialBackoffReleaseTime() const override;
diff --git a/net/url_request/url_request_throttler_entry_interface.h b/net/url_request/url_request_throttler_entry_interface.h
index 8487bb9..f08d352 100644
--- a/net/url_request/url_request_throttler_entry_interface.h
+++ b/net/url_request/url_request_throttler_entry_interface.h
@@ -26,14 +26,11 @@ class NET_EXPORT URLRequestThrottlerEntryInterface
// Returns true when we have encountered server errors and are doing
// exponential back-off, unless the request has load flags that mean
- // it is likely to be user-initiated, or the NetworkDelegate returns
- // false for |CanThrottleRequest(request)|.
+ // it is likely to be user-initiated.
//
// URLRequestHttpJob checks this method prior to every request; it
// cancels requests if this method returns true.
- virtual bool ShouldRejectRequest(
- const URLRequest& request,
- NetworkDelegate* network_delegate) const = 0;
+ virtual bool ShouldRejectRequest(const URLRequest& request) const = 0;
// Calculates a recommended sending time for the next request and reserves it.
// The sending time is not earlier than the current exponential back-off
diff --git a/net/url_request/url_request_throttler_simulation_unittest.cc b/net/url_request/url_request_throttler_simulation_unittest.cc
index da6afe1..808c6b5 100644
--- a/net/url_request/url_request_throttler_simulation_unittest.cc
+++ b/net/url_request/url_request_throttler_simulation_unittest.cc
@@ -423,9 +423,7 @@ class Requester : public DiscreteTimeSimulation::Actor {
if (throttler_entry_->ImplGetTimeNow() - time_of_last_attempt_ >
effective_delay) {
- if (!throttler_entry_->ShouldRejectRequest(
- server_->mock_request(),
- server_->context().network_delegate())) {
+ if (!throttler_entry_->ShouldRejectRequest(server_->mock_request())) {
int status_code = server_->HandleRequest();
throttler_entry_->UpdateWithResponse(status_code);
diff --git a/net/url_request/url_request_throttler_unittest.cc b/net/url_request/url_request_throttler_unittest.cc
index fcfe684..9fe582a 100644
--- a/net/url_request/url_request_throttler_unittest.cc
+++ b/net/url_request/url_request_throttler_unittest.cc
@@ -189,31 +189,15 @@ std::ostream& operator<<(std::ostream& out, const base::TimeTicks& time) {
return out << time.ToInternalValue();
}
-TEST_F(URLRequestThrottlerEntryTest, CanThrottleRequest) {
- TestNetworkDelegate d;
- context_.set_network_delegate(&d);
- entry_->set_exponential_backoff_release_time(
- entry_->ImplGetTimeNow() + TimeDelta::FromMilliseconds(1));
-
- d.set_can_throttle_requests(false);
- EXPECT_FALSE(entry_->ShouldRejectRequest(*request_,
- context_.network_delegate()));
- d.set_can_throttle_requests(true);
- EXPECT_TRUE(entry_->ShouldRejectRequest(*request_,
- context_.network_delegate()));
-}
-
TEST_F(URLRequestThrottlerEntryTest, InterfaceDuringExponentialBackoff) {
base::HistogramTester histogram_tester;
entry_->set_exponential_backoff_release_time(
entry_->ImplGetTimeNow() + TimeDelta::FromMilliseconds(1));
- EXPECT_TRUE(entry_->ShouldRejectRequest(*request_,
- context_.network_delegate()));
+ EXPECT_TRUE(entry_->ShouldRejectRequest(*request_));
// Also end-to-end test the load flags exceptions.
request_->SetLoadFlags(LOAD_MAYBE_USER_GESTURE);
- EXPECT_FALSE(entry_->ShouldRejectRequest(*request_,
- context_.network_delegate()));
+ EXPECT_FALSE(entry_->ShouldRejectRequest(*request_));
histogram_tester.ExpectBucketCount(kRequestThrottledHistogramName, 0, 1);
histogram_tester.ExpectBucketCount(kRequestThrottledHistogramName, 1, 1);
@@ -222,12 +206,10 @@ TEST_F(URLRequestThrottlerEntryTest, InterfaceDuringExponentialBackoff) {
TEST_F(URLRequestThrottlerEntryTest, InterfaceNotDuringExponentialBackoff) {
base::HistogramTester histogram_tester;
entry_->set_exponential_backoff_release_time(entry_->ImplGetTimeNow());
- EXPECT_FALSE(entry_->ShouldRejectRequest(*request_,
- context_.network_delegate()));
+ EXPECT_FALSE(entry_->ShouldRejectRequest(*request_));
entry_->set_exponential_backoff_release_time(
entry_->ImplGetTimeNow() - TimeDelta::FromMilliseconds(1));
- EXPECT_FALSE(entry_->ShouldRejectRequest(*request_,
- context_.network_delegate()));
+ EXPECT_FALSE(entry_->ShouldRejectRequest(*request_));
histogram_tester.ExpectBucketCount(kRequestThrottledHistogramName, 0, 2);
histogram_tester.ExpectBucketCount(kRequestThrottledHistogramName, 1, 0);
@@ -351,13 +333,11 @@ class URLRequestThrottlerManagerTest : public testing::Test {
URLRequestThrottlerEntryInterface* entry,
bool opted_out,
const URLRequest& request) {
- EXPECT_FALSE(entry->ShouldRejectRequest(request,
- context_.network_delegate()));
+ EXPECT_FALSE(entry->ShouldRejectRequest(request));
for (int i = 0; i < 10; ++i) {
entry->UpdateWithResponse(503);
}
- EXPECT_NE(opted_out, entry->ShouldRejectRequest(
- request, context_.network_delegate()));
+ EXPECT_NE(opted_out, entry->ShouldRejectRequest(request));
if (opted_out) {
// We're not mocking out GetTimeNow() in this scenario
@@ -447,13 +427,11 @@ TEST_F(URLRequestThrottlerManagerTest, LocalHostOptedOut) {
// A localhost entry should always be opted out.
scoped_refptr<URLRequestThrottlerEntryInterface> localhost_entry =
manager.RegisterRequestUrl(GURL("http://localhost/hello"));
- EXPECT_FALSE(localhost_entry->ShouldRejectRequest(
- (*request_), context_.network_delegate()));
+ EXPECT_FALSE(localhost_entry->ShouldRejectRequest(*request_));
for (int i = 0; i < 10; ++i) {
localhost_entry->UpdateWithResponse(503);
}
- EXPECT_FALSE(localhost_entry->ShouldRejectRequest(
- (*request_), context_.network_delegate()));
+ EXPECT_FALSE(localhost_entry->ShouldRejectRequest(*request_));
// We're not mocking out GetTimeNow() in this scenario
// so add a 100 ms buffer to avoid flakiness (that should always
@@ -471,8 +449,7 @@ TEST_F(URLRequestThrottlerManagerTest, ClearOnNetworkChange) {
for (int j = 0; j < 10; ++j) {
entry_before->UpdateWithResponse(503);
}
- EXPECT_TRUE(entry_before->ShouldRejectRequest(*request_,
- context_.network_delegate()));
+ EXPECT_TRUE(entry_before->ShouldRejectRequest(*request_));
switch (i) {
case 0:
@@ -491,8 +468,7 @@ TEST_F(URLRequestThrottlerManagerTest, ClearOnNetworkChange) {
scoped_refptr<URLRequestThrottlerEntryInterface> entry_after =
manager.RegisterRequestUrl(GURL("http://www.example.com/"));
- EXPECT_FALSE(entry_after->ShouldRejectRequest(
- *request_, context_.network_delegate()));
+ EXPECT_FALSE(entry_after->ShouldRejectRequest(*request_));
}
}