| 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 #include <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "content/public/test/test_browser_thread_bundle.h" | 38 #include "content/public/test/test_browser_thread_bundle.h" |
| 39 #include "content/test/test_content_browser_client.h" | 39 #include "content/test/test_content_browser_client.h" |
| 40 #include "net/base/net_errors.h" | 40 #include "net/base/net_errors.h" |
| 41 #include "net/base/request_priority.h" | 41 #include "net/base/request_priority.h" |
| 42 #include "net/base/upload_bytes_element_reader.h" | 42 #include "net/base/upload_bytes_element_reader.h" |
| 43 #include "net/base/upload_data_stream.h" | 43 #include "net/base/upload_data_stream.h" |
| 44 #include "net/http/http_util.h" | 44 #include "net/http/http_util.h" |
| 45 #include "net/url_request/url_request.h" | 45 #include "net/url_request/url_request.h" |
| 46 #include "net/url_request/url_request_context.h" | 46 #include "net/url_request/url_request_context.h" |
| 47 #include "net/url_request/url_request_job.h" | 47 #include "net/url_request/url_request_job.h" |
| 48 #include "net/url_request/url_request_job_factory.h" |
| 48 #include "net/url_request/url_request_simple_job.h" | 49 #include "net/url_request/url_request_simple_job.h" |
| 49 #include "net/url_request/url_request_test_job.h" | 50 #include "net/url_request/url_request_test_job.h" |
| 50 #include "net/url_request/url_request_test_util.h" | 51 #include "net/url_request/url_request_test_util.h" |
| 51 #include "testing/gtest/include/gtest/gtest.h" | 52 #include "testing/gtest/include/gtest/gtest.h" |
| 52 #include "webkit/common/appcache/appcache_interfaces.h" | 53 #include "webkit/common/appcache/appcache_interfaces.h" |
| 53 #include "webkit/common/blob/shareable_file_reference.h" | 54 #include "webkit/common/blob/shareable_file_reference.h" |
| 54 | 55 |
| 55 // TODO(eroman): Write unit tests for SafeBrowsing that exercise | 56 // TODO(eroman): Write unit tests for SafeBrowsing that exercise |
| 56 // SafeBrowsingResourceHandler. | 57 // SafeBrowsingResourceHandler. |
| 57 | 58 |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 base::SplitString(url.path(), ',', &parts); | 454 base::SplitString(url.path(), ',', &parts); |
| 454 | 455 |
| 455 if (parts.size() != 2) | 456 if (parts.size() != 2) |
| 456 return false; | 457 return false; |
| 457 | 458 |
| 458 *text = parts[0]; | 459 *text = parts[0]; |
| 459 return base::StringToInt(parts[1], count); | 460 return base::StringToInt(parts[1], count); |
| 460 } | 461 } |
| 461 }; | 462 }; |
| 462 | 463 |
| 464 class ResourceDispatcherHostTest; |
| 465 |
| 463 class TestURLRequestJobFactory : public net::URLRequestJobFactory { | 466 class TestURLRequestJobFactory : public net::URLRequestJobFactory { |
| 464 public: | 467 public: |
| 465 explicit TestURLRequestJobFactory(ResourceDispatcherHostTest* test_fixture) : | 468 explicit TestURLRequestJobFactory(ResourceDispatcherHostTest* test_fixture) |
| 466 test_fixture_(test_fixture), | 469 : test_fixture_(test_fixture), |
| 467 delay_start_(false), | 470 delay_start_(false), |
| 468 delay_complete_(false), | 471 delay_complete_(false), |
| 469 network_start_notification_(false), | 472 network_start_notification_(false), |
| 470 url_request_jobs_created_count_(0) { | 473 url_request_jobs_created_count_(0) { |
| 471 } | 474 } |
| 472 | 475 |
| 473 void HandleScheme(const std::string& scheme) { | 476 void HandleScheme(const std::string& scheme) { |
| 474 supported_schemes_.insert(scheme); | 477 supported_schemes_.insert(scheme); |
| 475 } | 478 } |
| 476 | 479 |
| 477 int url_request_jobs_created_count() const { | 480 int url_request_jobs_created_count() const { |
| 478 return url_request_jobs_created_count_; | 481 return url_request_jobs_created_count_; |
| 479 } | 482 } |
| 480 | 483 |
| (...skipping 2437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2918 } else { | 2921 } else { |
| 2919 return new net::URLRequestTestJob( | 2922 return new net::URLRequestTestJob( |
| 2920 request, network_delegate, | 2923 request, network_delegate, |
| 2921 test_fixture_->response_headers_, test_fixture_->response_data_, | 2924 test_fixture_->response_headers_, test_fixture_->response_data_, |
| 2922 false); | 2925 false); |
| 2923 } | 2926 } |
| 2924 } | 2927 } |
| 2925 } | 2928 } |
| 2926 | 2929 |
| 2927 } // namespace content | 2930 } // namespace content |
| OLD | NEW |