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 |
11 #include <map> | 11 #include <map> |
12 #include <string> | 12 #include <string> |
13 | 13 |
| 14 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
16 #include "base/process_util.h" | 17 #include "base/process_util.h" |
17 #include "base/string_util.h" | 18 #include "base/string_util.h" |
18 #include "base/string16.h" | 19 #include "base/string16.h" |
19 #include "base/time.h" | 20 #include "base/time.h" |
20 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
21 #include "googleurl/src/url_util.h" | 22 #include "googleurl/src/url_util.h" |
22 #include "net/base/cert_verifier.h" | 23 #include "net/base/cert_verifier.h" |
23 #include "net/base/cookie_monster.h" | 24 #include "net/base/cookie_monster.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // OnBeforeURLRequest is always called before OnBeforeSendHeaders). | 236 // OnBeforeURLRequest is always called before OnBeforeSendHeaders). |
236 // This bit-set indicates for each request id (key) what events may be sent | 237 // This bit-set indicates for each request id (key) what events may be sent |
237 // next. | 238 // next. |
238 std::map<int, int> next_states_; | 239 std::map<int, int> next_states_; |
239 | 240 |
240 // A log that records for each request id (key) the order in which On... | 241 // A log that records for each request id (key) the order in which On... |
241 // functions were called. | 242 // functions were called. |
242 std::map<int, std::string> event_order_; | 243 std::map<int, std::string> event_order_; |
243 }; | 244 }; |
244 | 245 |
| 246 // Overrides the host used by the LocalHttpTestServer in |
| 247 // url_request_unittest.cc . This is used by the chrome_frame_net_tests due to |
| 248 // a mysterious bug when tests execute over the loopback adapter. See |
| 249 // http://crbug.com/114369 . |
| 250 class ScopedCustomUrlRequestTestHttpHost { |
| 251 public: |
| 252 // Sets the host name to be used. The previous hostname will be stored and |
| 253 // restored upon destruction. Note that if the lifetimes of two or more |
| 254 // instances of this class overlap, they must be strictly nested. |
| 255 explicit ScopedCustomUrlRequestTestHttpHost(const std::string& new_value); |
| 256 |
| 257 ~ScopedCustomUrlRequestTestHttpHost(); |
| 258 |
| 259 // Returns the current value to be used by HTTP tests in |
| 260 // url_request_unittest.cc . |
| 261 static const std::string& value(); |
| 262 |
| 263 private: |
| 264 static std::string value_; |
| 265 const std::string old_value_; |
| 266 const std::string new_value_; |
| 267 |
| 268 DISALLOW_COPY_AND_ASSIGN(ScopedCustomUrlRequestTestHttpHost); |
| 269 }; |
| 270 |
245 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 271 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
OLD | NEW |