| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_UNITTEST_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 | 10 |
| 11 #include <sstream> | 11 #include <sstream> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
| 16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
| 19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 20 #include "base/process_util.h" | 20 #include "base/process_util.h" |
| 21 #include "base/string16.h" |
| 21 #include "base/thread.h" | 22 #include "base/thread.h" |
| 22 #include "base/time.h" | 23 #include "base/time.h" |
| 23 #include "base/utf_string_conversions.h" | 24 #include "base/utf_string_conversions.h" |
| 24 #include "base/waitable_event.h" | 25 #include "base/waitable_event.h" |
| 25 #include "net/base/cookie_monster.h" | 26 #include "net/base/cookie_monster.h" |
| 26 #include "net/base/cookie_policy.h" | 27 #include "net/base/cookie_policy.h" |
| 27 #include "net/base/host_resolver.h" | 28 #include "net/base/host_resolver.h" |
| 28 #include "net/base/io_buffer.h" | 29 #include "net/base/io_buffer.h" |
| 29 #include "net/base/net_errors.h" | 30 #include "net/base/net_errors.h" |
| 30 #include "net/base/ssl_config_service_defaults.h" | 31 #include "net/base/ssl_config_service_defaults.h" |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 cancel_in_getcookiesblocked_ = val; | 340 cancel_in_getcookiesblocked_ = val; |
| 340 } | 341 } |
| 341 void set_cancel_in_set_cookie_blocked(bool val) { | 342 void set_cancel_in_set_cookie_blocked(bool val) { |
| 342 cancel_in_setcookieblocked_ = val; | 343 cancel_in_setcookieblocked_ = val; |
| 343 } | 344 } |
| 344 void set_quit_on_complete(bool val) { quit_on_complete_ = val; } | 345 void set_quit_on_complete(bool val) { quit_on_complete_ = val; } |
| 345 void set_quit_on_redirect(bool val) { quit_on_redirect_ = val; } | 346 void set_quit_on_redirect(bool val) { quit_on_redirect_ = val; } |
| 346 void set_allow_certificate_errors(bool val) { | 347 void set_allow_certificate_errors(bool val) { |
| 347 allow_certificate_errors_ = val; | 348 allow_certificate_errors_ = val; |
| 348 } | 349 } |
| 349 void set_username(const std::wstring& u) { username_ = u; } | 350 void set_username(const string16& u) { username_ = u; } |
| 350 void set_password(const std::wstring& p) { password_ = p; } | 351 void set_password(const string16& p) { password_ = p; } |
| 351 | 352 |
| 352 // query state | 353 // query state |
| 353 const std::string& data_received() const { return data_received_; } | 354 const std::string& data_received() const { return data_received_; } |
| 354 int bytes_received() const { return static_cast<int>(data_received_.size()); } | 355 int bytes_received() const { return static_cast<int>(data_received_.size()); } |
| 355 int response_started_count() const { return response_started_count_; } | 356 int response_started_count() const { return response_started_count_; } |
| 356 int received_redirect_count() const { return received_redirect_count_; } | 357 int received_redirect_count() const { return received_redirect_count_; } |
| 357 int blocked_get_cookies_count() const { return blocked_get_cookies_count_; } | 358 int blocked_get_cookies_count() const { return blocked_get_cookies_count_; } |
| 358 int blocked_set_cookie_count() const { return blocked_set_cookie_count_; } | 359 int blocked_set_cookie_count() const { return blocked_set_cookie_count_; } |
| 359 int set_cookie_count() const { return set_cookie_count_; } | 360 int set_cookie_count() const { return set_cookie_count_; } |
| 360 bool received_data_before_response() const { | 361 bool received_data_before_response() const { |
| 361 return received_data_before_response_; | 362 return received_data_before_response_; |
| 362 } | 363 } |
| 363 bool request_failed() const { return request_failed_; } | 364 bool request_failed() const { return request_failed_; } |
| 364 bool have_certificate_errors() const { return have_certificate_errors_; } | 365 bool have_certificate_errors() const { return have_certificate_errors_; } |
| 365 | 366 |
| 366 private: | 367 private: |
| 367 static const int kBufferSize = 4096; | 368 static const int kBufferSize = 4096; |
| 368 // options for controlling behavior | 369 // options for controlling behavior |
| 369 bool cancel_in_rr_; | 370 bool cancel_in_rr_; |
| 370 bool cancel_in_rs_; | 371 bool cancel_in_rs_; |
| 371 bool cancel_in_rd_; | 372 bool cancel_in_rd_; |
| 372 bool cancel_in_rd_pending_; | 373 bool cancel_in_rd_pending_; |
| 373 bool cancel_in_getcookiesblocked_; | 374 bool cancel_in_getcookiesblocked_; |
| 374 bool cancel_in_setcookieblocked_; | 375 bool cancel_in_setcookieblocked_; |
| 375 bool quit_on_complete_; | 376 bool quit_on_complete_; |
| 376 bool quit_on_redirect_; | 377 bool quit_on_redirect_; |
| 377 bool allow_certificate_errors_; | 378 bool allow_certificate_errors_; |
| 378 | 379 |
| 379 std::wstring username_; | 380 string16 username_; |
| 380 std::wstring password_; | 381 string16 password_; |
| 381 | 382 |
| 382 // tracks status of callbacks | 383 // tracks status of callbacks |
| 383 int response_started_count_; | 384 int response_started_count_; |
| 384 int received_bytes_count_; | 385 int received_bytes_count_; |
| 385 int received_redirect_count_; | 386 int received_redirect_count_; |
| 386 int blocked_get_cookies_count_; | 387 int blocked_get_cookies_count_; |
| 387 int blocked_set_cookie_count_; | 388 int blocked_set_cookie_count_; |
| 388 int set_cookie_count_; | 389 int set_cookie_count_; |
| 389 bool received_data_before_response_; | 390 bool received_data_before_response_; |
| 390 bool request_failed_; | 391 bool request_failed_; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 return NULL; | 604 return NULL; |
| 604 } | 605 } |
| 605 return test_server; | 606 return test_server; |
| 606 } | 607 } |
| 607 | 608 |
| 608 private: | 609 private: |
| 609 ~FTPTestServer() {} | 610 ~FTPTestServer() {} |
| 610 }; | 611 }; |
| 611 | 612 |
| 612 #endif // NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ | 613 #endif // NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
| OLD | NEW |