| Index: net/url_request/url_request_test_util.cc
|
| ===================================================================
|
| --- net/url_request/url_request_test_util.cc (revision 84789)
|
| +++ net/url_request/url_request_test_util.cc (working copy)
|
| @@ -11,32 +11,6 @@
|
| #include "net/base/host_port_pair.h"
|
| #include "net/http/http_network_session.h"
|
|
|
| -TestCookiePolicy::TestCookiePolicy(int options_bit_mask)
|
| - : options_(options_bit_mask) {
|
| -}
|
| -
|
| -TestCookiePolicy::~TestCookiePolicy() {}
|
| -
|
| -int TestCookiePolicy::CanGetCookies(const GURL& url,
|
| - const GURL& first_party) const {
|
| - if (options_ & NO_GET_COOKIES)
|
| - return net::ERR_ACCESS_DENIED;
|
| -
|
| - return net::OK;
|
| -}
|
| -
|
| -int TestCookiePolicy::CanSetCookie(const GURL& url,
|
| - const GURL& first_party,
|
| - const std::string& cookie_line) const {
|
| - if (options_ & NO_SET_COOKIE)
|
| - return net::ERR_ACCESS_DENIED;
|
| -
|
| - if (options_ & FORCE_SESSION)
|
| - return net::OK_FOR_SESSION_ONLY;
|
| -
|
| - return net::OK;
|
| -}
|
| -
|
| TestURLRequestContext::TestURLRequestContext()
|
| : ALLOW_THIS_IN_INITIALIZER_LIST(context_storage_(this)) {
|
| context_storage_.set_host_resolver(
|
| @@ -113,6 +87,7 @@
|
| 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),
|
| @@ -161,26 +136,40 @@
|
| request->Cancel();
|
| }
|
|
|
| -void TestDelegate::OnGetCookies(net::URLRequest* request,
|
| - bool blocked_by_policy) {
|
| - if (blocked_by_policy) {
|
| +bool TestDelegate::CanGetCookies(net::URLRequest* request) {
|
| + bool allow = true;
|
| + if (cookie_options_bit_mask_ & NO_GET_COOKIES)
|
| + allow = false;
|
| +
|
| + if (!allow) {
|
| blocked_get_cookies_count_++;
|
| if (cancel_in_getcookiesblocked_)
|
| request->Cancel();
|
| }
|
| +
|
| + return allow;
|
| }
|
|
|
| -void TestDelegate::OnSetCookie(net::URLRequest* request,
|
| - const std::string& cookie_line,
|
| - const net::CookieOptions& options,
|
| - bool blocked_by_policy) {
|
| - if (blocked_by_policy) {
|
| +bool TestDelegate::CanSetCookie(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_++;
|
| if (cancel_in_setcookieblocked_)
|
| request->Cancel();
|
| } else {
|
| set_cookie_count_++;
|
| }
|
| +
|
| + return allow;
|
| }
|
|
|
| void TestDelegate::OnResponseStarted(net::URLRequest* request) {
|
|
|