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 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 | 10 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 int destroyed_requests() const { return destroyed_requests_; } | 266 int destroyed_requests() const { return destroyed_requests_; } |
267 int completed_requests() const { return completed_requests_; } | 267 int completed_requests() const { return completed_requests_; } |
268 int canceled_requests() const { return canceled_requests_; } | 268 int canceled_requests() const { return canceled_requests_; } |
269 int blocked_get_cookies_count() const { return blocked_get_cookies_count_; } | 269 int blocked_get_cookies_count() const { return blocked_get_cookies_count_; } |
270 int blocked_set_cookie_count() const { return blocked_set_cookie_count_; } | 270 int blocked_set_cookie_count() const { return blocked_set_cookie_count_; } |
271 int set_cookie_count() const { return set_cookie_count_; } | 271 int set_cookie_count() const { return set_cookie_count_; } |
272 | 272 |
273 void set_can_access_files(bool val) { can_access_files_ = val; } | 273 void set_can_access_files(bool val) { can_access_files_ = val; } |
274 bool can_access_files() const { return can_access_files_; } | 274 bool can_access_files() const { return can_access_files_; } |
275 | 275 |
276 void set_first_party_only_cookies_enabled(bool val) { | 276 void set_experimental_cookie_features_enabled(bool val) { |
277 first_party_only_cookies_enabled_ = val; | 277 experimental_cookie_features_enabled_ = val; |
278 } | 278 } |
279 | 279 |
280 void set_cancel_request_with_policy_violating_referrer(bool val) { | 280 void set_cancel_request_with_policy_violating_referrer(bool val) { |
281 cancel_request_with_policy_violating_referrer_ = val; | 281 cancel_request_with_policy_violating_referrer_ = val; |
282 } | 282 } |
283 | 283 |
284 int observed_before_proxy_headers_sent_callbacks() const { | 284 int observed_before_proxy_headers_sent_callbacks() const { |
285 return observed_before_proxy_headers_sent_callbacks_; | 285 return observed_before_proxy_headers_sent_callbacks_; |
286 } | 286 } |
287 int before_send_headers_count() const { return before_send_headers_count_; } | 287 int before_send_headers_count() const { return before_send_headers_count_; } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 const AuthChallengeInfo& auth_info, | 333 const AuthChallengeInfo& auth_info, |
334 const AuthCallback& callback, | 334 const AuthCallback& callback, |
335 AuthCredentials* credentials) override; | 335 AuthCredentials* credentials) override; |
336 bool OnCanGetCookies(const URLRequest& request, | 336 bool OnCanGetCookies(const URLRequest& request, |
337 const CookieList& cookie_list) override; | 337 const CookieList& cookie_list) override; |
338 bool OnCanSetCookie(const URLRequest& request, | 338 bool OnCanSetCookie(const URLRequest& request, |
339 const std::string& cookie_line, | 339 const std::string& cookie_line, |
340 CookieOptions* options) override; | 340 CookieOptions* options) override; |
341 bool OnCanAccessFile(const URLRequest& request, | 341 bool OnCanAccessFile(const URLRequest& request, |
342 const base::FilePath& path) const override; | 342 const base::FilePath& path) const override; |
343 bool OnFirstPartyOnlyCookieExperimentEnabled() const override; | 343 bool OnAreExperimentalCookieFeaturesEnabled() const override; |
344 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 344 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
345 const URLRequest& request, | 345 const URLRequest& request, |
346 const GURL& target_url, | 346 const GURL& target_url, |
347 const GURL& referrer_url) const override; | 347 const GURL& referrer_url) const override; |
348 | 348 |
349 void InitRequestStatesIfNew(int request_id); | 349 void InitRequestStatesIfNew(int request_id); |
350 | 350 |
351 GURL redirect_on_headers_received_url_; | 351 GURL redirect_on_headers_received_url_; |
352 // URL marked as safe for redirection at the onHeadersReceived stage. | 352 // URL marked as safe for redirection at the onHeadersReceived stage. |
353 GURL allowed_unsafe_redirect_url_; | 353 GURL allowed_unsafe_redirect_url_; |
(...skipping 26 matching lines...) Expand all Loading... |
380 // functions were called. | 380 // functions were called. |
381 std::map<int, std::string> event_order_; | 381 std::map<int, std::string> event_order_; |
382 | 382 |
383 LoadTimingInfo load_timing_info_before_redirect_; | 383 LoadTimingInfo load_timing_info_before_redirect_; |
384 bool has_load_timing_info_before_redirect_; | 384 bool has_load_timing_info_before_redirect_; |
385 | 385 |
386 LoadTimingInfo load_timing_info_before_auth_; | 386 LoadTimingInfo load_timing_info_before_auth_; |
387 bool has_load_timing_info_before_auth_; | 387 bool has_load_timing_info_before_auth_; |
388 | 388 |
389 bool can_access_files_; // true by default | 389 bool can_access_files_; // true by default |
390 bool first_party_only_cookies_enabled_; // false by default | 390 bool experimental_cookie_features_enabled_; // false by default |
391 bool cancel_request_with_policy_violating_referrer_; // false by default | 391 bool cancel_request_with_policy_violating_referrer_; // false by default |
392 bool will_be_intercepted_on_next_error_; | 392 bool will_be_intercepted_on_next_error_; |
393 }; | 393 }; |
394 | 394 |
395 //----------------------------------------------------------------------------- | 395 //----------------------------------------------------------------------------- |
396 | 396 |
397 // A simple ProtocolHandler that returns a pre-built URLRequestJob only once. | 397 // A simple ProtocolHandler that returns a pre-built URLRequestJob only once. |
398 class TestJobInterceptor : public URLRequestJobFactory::ProtocolHandler { | 398 class TestJobInterceptor : public URLRequestJobFactory::ProtocolHandler { |
399 public: | 399 public: |
400 TestJobInterceptor(); | 400 TestJobInterceptor(); |
401 | 401 |
402 URLRequestJob* MaybeCreateJob( | 402 URLRequestJob* MaybeCreateJob( |
403 URLRequest* request, | 403 URLRequest* request, |
404 NetworkDelegate* network_delegate) const override; | 404 NetworkDelegate* network_delegate) const override; |
405 void set_main_intercept_job(URLRequestJob* job); | 405 void set_main_intercept_job(URLRequestJob* job); |
406 | 406 |
407 private: | 407 private: |
408 mutable URLRequestJob* main_intercept_job_; | 408 mutable URLRequestJob* main_intercept_job_; |
409 }; | 409 }; |
410 | 410 |
411 } // namespace net | 411 } // namespace net |
412 | 412 |
413 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ | 413 #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ |
OLD | NEW |