Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Side by Side Diff: net/url_request/url_request_test_util.h

Issue 572273002: Move handling of invalid referrer to the network delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 7
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 int blocked_get_cookies_count() const { return blocked_get_cookies_count_; } 262 int blocked_get_cookies_count() const { return blocked_get_cookies_count_; }
263 int blocked_set_cookie_count() const { return blocked_set_cookie_count_; } 263 int blocked_set_cookie_count() const { return blocked_set_cookie_count_; }
264 int set_cookie_count() const { return set_cookie_count_; } 264 int set_cookie_count() const { return set_cookie_count_; }
265 265
266 void set_can_access_files(bool val) { can_access_files_ = val; } 266 void set_can_access_files(bool val) { can_access_files_ = val; }
267 bool can_access_files() const { return can_access_files_; } 267 bool can_access_files() const { return can_access_files_; }
268 268
269 void set_can_throttle_requests(bool val) { can_throttle_requests_ = val; } 269 void set_can_throttle_requests(bool val) { can_throttle_requests_ = val; }
270 bool can_throttle_requests() const { return can_throttle_requests_; } 270 bool can_throttle_requests() const { return can_throttle_requests_; }
271 271
272 void set_can_correct_invalid_referrer_header(bool val) {
273 can_correct_invalid_referrer_header_ = val;
274 }
275
272 int observed_before_proxy_headers_sent_callbacks() const { 276 int observed_before_proxy_headers_sent_callbacks() const {
273 return observed_before_proxy_headers_sent_callbacks_; 277 return observed_before_proxy_headers_sent_callbacks_;
274 } 278 }
275 279
276 // Last observed proxy in proxy header sent callback. 280 // Last observed proxy in proxy header sent callback.
277 HostPortPair last_observed_proxy() { 281 HostPortPair last_observed_proxy() {
278 return last_observed_proxy_; 282 return last_observed_proxy_;
279 } 283 }
280 284
281 protected: 285 protected:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 virtual bool OnCanSetCookie(const URLRequest& request, 321 virtual bool OnCanSetCookie(const URLRequest& request,
318 const std::string& cookie_line, 322 const std::string& cookie_line,
319 CookieOptions* options) OVERRIDE; 323 CookieOptions* options) OVERRIDE;
320 virtual bool OnCanAccessFile(const URLRequest& request, 324 virtual bool OnCanAccessFile(const URLRequest& request,
321 const base::FilePath& path) const OVERRIDE; 325 const base::FilePath& path) const OVERRIDE;
322 virtual bool OnCanThrottleRequest( 326 virtual bool OnCanThrottleRequest(
323 const URLRequest& request) const OVERRIDE; 327 const URLRequest& request) const OVERRIDE;
324 virtual int OnBeforeSocketStreamConnect( 328 virtual int OnBeforeSocketStreamConnect(
325 SocketStream* stream, 329 SocketStream* stream,
326 const CompletionCallback& callback) OVERRIDE; 330 const CompletionCallback& callback) OVERRIDE;
331 virtual bool OnCanCorrectInvalidReferrerHeader(
332 const URLRequest& request,
333 const GURL& target_url,
334 const GURL& referrer_url) const OVERRIDE;
327 335
328 void InitRequestStatesIfNew(int request_id); 336 void InitRequestStatesIfNew(int request_id);
329 337
330 GURL redirect_on_headers_received_url_; 338 GURL redirect_on_headers_received_url_;
331 // URL marked as safe for redirection at the onHeadersReceived stage. 339 // URL marked as safe for redirection at the onHeadersReceived stage.
332 GURL allowed_unsafe_redirect_url_; 340 GURL allowed_unsafe_redirect_url_;
333 341
334 int last_error_; 342 int last_error_;
335 int error_count_; 343 int error_count_;
336 int created_requests_; 344 int created_requests_;
(...skipping 19 matching lines...) Expand all
356 std::map<int, std::string> event_order_; 364 std::map<int, std::string> event_order_;
357 365
358 LoadTimingInfo load_timing_info_before_redirect_; 366 LoadTimingInfo load_timing_info_before_redirect_;
359 bool has_load_timing_info_before_redirect_; 367 bool has_load_timing_info_before_redirect_;
360 368
361 LoadTimingInfo load_timing_info_before_auth_; 369 LoadTimingInfo load_timing_info_before_auth_;
362 bool has_load_timing_info_before_auth_; 370 bool has_load_timing_info_before_auth_;
363 371
364 bool can_access_files_; // true by default 372 bool can_access_files_; // true by default
365 bool can_throttle_requests_; // true by default 373 bool can_throttle_requests_; // true by default
374 bool can_correct_invalid_referrer_header_; // true by default
366 }; 375 };
367 376
368 // Overrides the host used by the LocalHttpTestServer in 377 // Overrides the host used by the LocalHttpTestServer in
369 // url_request_unittest.cc . This is used by the chrome_frame_net_tests due to 378 // url_request_unittest.cc . This is used by the chrome_frame_net_tests due to
370 // a mysterious bug when tests execute over the loopback adapter. See 379 // a mysterious bug when tests execute over the loopback adapter. See
371 // http://crbug.com/114369 . 380 // http://crbug.com/114369 .
372 class ScopedCustomUrlRequestTestHttpHost { 381 class ScopedCustomUrlRequestTestHttpHost {
373 public: 382 public:
374 // Sets the host name to be used. The previous hostname will be stored and 383 // Sets the host name to be used. The previous hostname will be stored and
375 // restored upon destruction. Note that if the lifetimes of two or more 384 // restored upon destruction. Note that if the lifetimes of two or more
(...skipping 26 matching lines...) Expand all
402 NetworkDelegate* network_delegate) const OVERRIDE; 411 NetworkDelegate* network_delegate) const OVERRIDE;
403 void set_main_intercept_job(URLRequestJob* job); 412 void set_main_intercept_job(URLRequestJob* job);
404 413
405 private: 414 private:
406 mutable URLRequestJob* main_intercept_job_; 415 mutable URLRequestJob* main_intercept_job_;
407 }; 416 };
408 417
409 } // namespace net 418 } // namespace net
410 419
411 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ 420 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698