OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 20 matching lines...) Expand all Loading... |
31 #include "net/disk_cache/disk_cache.h" | 31 #include "net/disk_cache/disk_cache.h" |
32 #include "net/ftp/ftp_network_layer.h" | 32 #include "net/ftp/ftp_network_layer.h" |
33 #include "net/http/http_auth_handler_factory.h" | 33 #include "net/http/http_auth_handler_factory.h" |
34 #include "net/http/http_cache.h" | 34 #include "net/http/http_cache.h" |
35 #include "net/http/http_network_layer.h" | 35 #include "net/http/http_network_layer.h" |
36 #include "net/proxy/proxy_service.h" | 36 #include "net/proxy/proxy_service.h" |
37 #include "net/url_request/url_request.h" | 37 #include "net/url_request/url_request.h" |
38 #include "net/url_request/url_request_context.h" | 38 #include "net/url_request/url_request_context.h" |
39 #include "net/url_request/url_request_context_getter.h" | 39 #include "net/url_request/url_request_context_getter.h" |
40 #include "net/url_request/url_request_context_storage.h" | 40 #include "net/url_request/url_request_context_storage.h" |
| 41 #include "net/url_request/url_request_throttler_manager.h" |
41 | 42 |
42 using base::TimeDelta; | 43 using base::TimeDelta; |
43 | 44 |
44 //----------------------------------------------------------------------------- | 45 //----------------------------------------------------------------------------- |
45 | 46 |
46 class TestURLRequestContext : public net::URLRequestContext { | 47 class TestURLRequestContext : public net::URLRequestContext { |
47 public: | 48 public: |
48 TestURLRequestContext(); | 49 TestURLRequestContext(); |
49 // Default constructor like TestURLRequestContext() but does not call | 50 // Default constructor like TestURLRequestContext() but does not call |
50 // Init() in case |delay_initialization| is true. This allows modifying the | 51 // Init() in case |delay_initialization| is true. This allows modifying the |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 95 |
95 class TestURLRequest : public net::URLRequest { | 96 class TestURLRequest : public net::URLRequest { |
96 public: | 97 public: |
97 TestURLRequest(const GURL& url, Delegate* delegate); | 98 TestURLRequest(const GURL& url, Delegate* delegate); |
98 virtual ~TestURLRequest(); | 99 virtual ~TestURLRequest(); |
99 | 100 |
100 private: | 101 private: |
101 const scoped_ptr<net::URLRequestContext> context_; | 102 const scoped_ptr<net::URLRequestContext> context_; |
102 }; | 103 }; |
103 | 104 |
| 105 |
| 106 // An URLRequestThrottlerManagerDelegate that always allows rejecting requests. |
| 107 class TestURLRequestThrottlerManagerDelegate |
| 108 : public net::URLRequestThrottlerManagerDelegate { |
| 109 public: |
| 110 virtual bool MayRejectRequest(net::URLRequest* request) OVERRIDE; |
| 111 }; |
| 112 |
104 //----------------------------------------------------------------------------- | 113 //----------------------------------------------------------------------------- |
105 | 114 |
106 class TestDelegate : public net::URLRequest::Delegate { | 115 class TestDelegate : public net::URLRequest::Delegate { |
107 public: | 116 public: |
108 TestDelegate(); | 117 TestDelegate(); |
109 virtual ~TestDelegate(); | 118 virtual ~TestDelegate(); |
110 | 119 |
111 void set_cancel_in_received_redirect(bool val) { cancel_in_rr_ = val; } | 120 void set_cancel_in_received_redirect(bool val) { cancel_in_rr_ = val; } |
112 void set_cancel_in_response_started(bool val) { cancel_in_rs_ = val; } | 121 void set_cancel_in_response_started(bool val) { cancel_in_rs_ = val; } |
113 void set_cancel_in_received_data(bool val) { cancel_in_rd_ = val; } | 122 void set_cancel_in_received_data(bool val) { cancel_in_rd_ = val; } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 296 |
288 private: | 297 private: |
289 static std::string value_; | 298 static std::string value_; |
290 const std::string old_value_; | 299 const std::string old_value_; |
291 const std::string new_value_; | 300 const std::string new_value_; |
292 | 301 |
293 DISALLOW_COPY_AND_ASSIGN(ScopedCustomUrlRequestTestHttpHost); | 302 DISALLOW_COPY_AND_ASSIGN(ScopedCustomUrlRequestTestHttpHost); |
294 }; | 303 }; |
295 | 304 |
296 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 305 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
OLD | NEW |