| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 using base::TimeDelta; | 41 using base::TimeDelta; |
| 42 | 42 |
| 43 //----------------------------------------------------------------------------- | 43 //----------------------------------------------------------------------------- |
| 44 | 44 |
| 45 class TestCookiePolicy : public net::CookiePolicy { | 45 class TestCookiePolicy : public net::CookiePolicy { |
| 46 public: | 46 public: |
| 47 enum Options { | 47 enum Options { |
| 48 NO_GET_COOKIES = 1 << 0, | 48 NO_GET_COOKIES = 1 << 0, |
| 49 NO_SET_COOKIE = 1 << 1, | 49 NO_SET_COOKIE = 1 << 1, |
| 50 ASYNC = 1 << 2, | 50 FORCE_SESSION = 1 << 2, |
| 51 FORCE_SESSION = 1 << 3, | |
| 52 }; | 51 }; |
| 53 | 52 |
| 54 explicit TestCookiePolicy(int options_bit_mask); | 53 explicit TestCookiePolicy(int options_bit_mask); |
| 55 virtual ~TestCookiePolicy(); | 54 virtual ~TestCookiePolicy(); |
| 56 | 55 |
| 57 // net::CookiePolicy: | 56 // net::CookiePolicy: |
| 58 virtual int CanGetCookies(const GURL& url, const GURL& first_party, | 57 virtual int CanGetCookies(const GURL& url, const GURL& first_party) const; |
| 59 net::CompletionCallback* callback); | 58 virtual int CanSetCookie(const GURL& url, |
| 60 virtual int CanSetCookie(const GURL& url, const GURL& first_party, | 59 const GURL& first_party, |
| 61 const std::string& cookie_line, | 60 const std::string& cookie_line) const; |
| 62 net::CompletionCallback* callback); | |
| 63 | 61 |
| 64 private: | 62 private: |
| 65 void DoGetCookiesPolicy(const GURL& url, const GURL& first_party); | |
| 66 void DoSetCookiePolicy(const GURL& url, const GURL& first_party, | |
| 67 const std::string& cookie_line); | |
| 68 | |
| 69 ScopedRunnableMethodFactory<TestCookiePolicy> method_factory_; | |
| 70 int options_; | 63 int options_; |
| 71 net::CompletionCallback* callback_; | |
| 72 }; | 64 }; |
| 73 | 65 |
| 74 //----------------------------------------------------------------------------- | 66 //----------------------------------------------------------------------------- |
| 75 | 67 |
| 76 class TestURLRequestContext : public net::URLRequestContext { | 68 class TestURLRequestContext : public net::URLRequestContext { |
| 77 public: | 69 public: |
| 78 TestURLRequestContext(); | 70 TestURLRequestContext(); |
| 79 explicit TestURLRequestContext(const std::string& proxy); | 71 explicit TestURLRequestContext(const std::string& proxy); |
| 80 TestURLRequestContext(const std::string& proxy, | 72 TestURLRequestContext(const std::string& proxy, |
| 81 net::HostResolver* host_resolver); | 73 net::HostResolver* host_resolver); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); | 202 virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); |
| 211 virtual void OnURLRequestDestroyed(net::URLRequest* request); | 203 virtual void OnURLRequestDestroyed(net::URLRequest* request); |
| 212 virtual net::URLRequestJob* OnMaybeCreateURLRequestJob( | 204 virtual net::URLRequestJob* OnMaybeCreateURLRequestJob( |
| 213 net::URLRequest* request); | 205 net::URLRequest* request); |
| 214 | 206 |
| 215 int last_os_error_; | 207 int last_os_error_; |
| 216 int error_count_; | 208 int error_count_; |
| 217 }; | 209 }; |
| 218 | 210 |
| 219 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 211 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
| OLD | NEW |