Index: net/url_request/url_request_test_util.cc |
diff --git a/net/url_request/url_request_test_util.cc b/net/url_request/url_request_test_util.cc |
index 2f3dd6e14c9e50527f475148b4bc23ea585ddf03..03e81403f0dc52a347b2efaa42a15dcd31bf4d69 100644 |
--- a/net/url_request/url_request_test_util.cc |
+++ b/net/url_request/url_request_test_util.cc |
@@ -172,13 +172,9 @@ TestDelegate::TestDelegate() |
quit_on_complete_(true), |
quit_on_redirect_(false), |
allow_certificate_errors_(false), |
- cookie_options_bit_mask_(0), |
response_started_count_(0), |
received_bytes_count_(0), |
received_redirect_count_(0), |
- blocked_get_cookies_count_(0), |
- blocked_set_cookie_count_(0), |
- set_cookie_count_(0), |
received_data_before_response_(false), |
request_failed_(false), |
have_certificate_errors_(false), |
@@ -225,39 +221,6 @@ void TestDelegate::OnSSLCertificateError(net::URLRequest* request, |
request->Cancel(); |
} |
-bool TestDelegate::CanGetCookies(const net::URLRequest* request, |
- const net::CookieList& cookie_list) const { |
- bool allow = true; |
- if (cookie_options_bit_mask_ & NO_GET_COOKIES) |
- allow = false; |
- |
- if (!allow) { |
- blocked_get_cookies_count_++; |
- } |
- |
- return allow; |
-} |
- |
-bool TestDelegate::CanSetCookie(const net::URLRequest* request, |
- const std::string& cookie_line, |
- net::CookieOptions* options) const { |
- bool allow = true; |
- if (cookie_options_bit_mask_ & NO_SET_COOKIE) |
- allow = false; |
- |
- if (cookie_options_bit_mask_ & FORCE_SESSION) |
- options->set_force_session(); |
- |
- |
- if (!allow) { |
- blocked_set_cookie_count_++; |
- } else { |
- set_cookie_count_++; |
- } |
- |
- return allow; |
-} |
- |
void TestDelegate::OnResponseStarted(net::URLRequest* request) { |
// It doesn't make sense for the request to have IO pending at this point. |
DCHECK(!request->status().is_io_pending()); |
@@ -323,11 +286,21 @@ void TestDelegate::OnResponseCompleted(net::URLRequest* request) { |
} |
TestNetworkDelegate::TestNetworkDelegate() |
- : last_error_(0), |
- error_count_(0), |
- created_requests_(0), |
- destroyed_requests_(0), |
- completed_requests_(0) { |
+ : last_error_(0), |
+ error_count_(0), |
+ created_requests_(0), |
+ destroyed_requests_(0), |
+ completed_requests_(0), |
+ cookie_options_bit_mask_(0), |
+ blocked_get_cookies_count_(0), |
+ blocked_set_cookie_count_(0), |
+ set_cookie_count_(0) { |
+} |
+ |
+void TestNetworkDelegate::ResetCookieCounters() { |
+ blocked_get_cookies_count_ = 0; |
+ blocked_set_cookie_count_ = 0; |
+ set_cookie_count_ = 0; |
} |
TestNetworkDelegate::~TestNetworkDelegate() { |
@@ -505,6 +478,39 @@ net::NetworkDelegate::AuthRequiredResponse TestNetworkDelegate::OnAuthRequired( |
return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; |
} |
+bool TestNetworkDelegate::OnReadingCookies(const net::URLRequest* request, |
+ const net::CookieList& cookie_list) { |
+ bool allow = true; |
+ if (cookie_options_bit_mask_ & NO_GET_COOKIES) |
+ allow = false; |
+ |
+ if (!allow) { |
+ blocked_get_cookies_count_++; |
+ } |
+ |
+ return allow; |
+} |
+ |
+bool TestNetworkDelegate::OnSettingCookie(const net::URLRequest* request, |
+ const std::string& cookie_line, |
+ net::CookieOptions* options) { |
+ bool allow = true; |
+ if (cookie_options_bit_mask_ & NO_SET_COOKIE) |
+ allow = false; |
+ |
+ if (cookie_options_bit_mask_ & FORCE_SESSION) |
+ options->set_force_session(); |
+ |
+ |
+ if (!allow) { |
+ blocked_set_cookie_count_++; |
+ } else { |
+ set_cookie_count_++; |
+ } |
+ |
+ return allow; |
+} |
+ |
// static |
std::string ScopedCustomUrlRequestTestHttpHost::value_("127.0.0.1"); |