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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "content/public/common/browser_side_navigation_policy.h" | 52 #include "content/public/common/browser_side_navigation_policy.h" |
53 #include "content/public/common/child_process_host.h" | 53 #include "content/public/common/child_process_host.h" |
54 #include "content/public/common/content_features.h" | 54 #include "content/public/common/content_features.h" |
55 #include "content/public/common/process_type.h" | 55 #include "content/public/common/process_type.h" |
56 #include "content/public/common/resource_response.h" | 56 #include "content/public/common/resource_response.h" |
57 #include "content/public/test/test_browser_context.h" | 57 #include "content/public/test/test_browser_context.h" |
58 #include "content/public/test/test_browser_thread_bundle.h" | 58 #include "content/public/test/test_browser_thread_bundle.h" |
59 #include "content/public/test/test_renderer_host.h" | 59 #include "content/public/test/test_renderer_host.h" |
60 #include "content/test/test_content_browser_client.h" | 60 #include "content/test/test_content_browser_client.h" |
61 #include "content/test/test_navigation_url_loader_delegate.h" | 61 #include "content/test/test_navigation_url_loader_delegate.h" |
| 62 #include "net/base/chunked_upload_data_stream.h" |
62 #include "net/base/elements_upload_data_stream.h" | 63 #include "net/base/elements_upload_data_stream.h" |
63 #include "net/base/load_flags.h" | 64 #include "net/base/load_flags.h" |
64 #include "net/base/net_errors.h" | 65 #include "net/base/net_errors.h" |
65 #include "net/base/request_priority.h" | 66 #include "net/base/request_priority.h" |
66 #include "net/base/upload_bytes_element_reader.h" | 67 #include "net/base/upload_bytes_element_reader.h" |
67 #include "net/http/http_util.h" | 68 #include "net/http/http_util.h" |
68 #include "net/test/cert_test_util.h" | 69 #include "net/test/cert_test_util.h" |
69 #include "net/test/test_data_directory.h" | 70 #include "net/test/test_data_directory.h" |
70 #include "net/test/url_request/url_request_failed_job.h" | 71 #include "net/test/url_request/url_request_failed_job.h" |
71 #include "net/url_request/url_request.h" | 72 #include "net/url_request/url_request.h" |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 } | 497 } |
497 }; | 498 }; |
498 | 499 |
499 // URLRequestJob used to test GetLoadInfoForAllRoutes. The LoadState and | 500 // URLRequestJob used to test GetLoadInfoForAllRoutes. The LoadState and |
500 // UploadProgress values are set for the jobs at the time of creation, and | 501 // UploadProgress values are set for the jobs at the time of creation, and |
501 // the jobs will never actually do anything. | 502 // the jobs will never actually do anything. |
502 class URLRequestLoadInfoJob : public net::URLRequestJob { | 503 class URLRequestLoadInfoJob : public net::URLRequestJob { |
503 public: | 504 public: |
504 URLRequestLoadInfoJob(net::URLRequest* request, | 505 URLRequestLoadInfoJob(net::URLRequest* request, |
505 net::NetworkDelegate* network_delegate, | 506 net::NetworkDelegate* network_delegate, |
506 const net::LoadState& load_state, | 507 const net::LoadState& load_state) |
507 const net::UploadProgress& upload_progress) | |
508 : net::URLRequestJob(request, network_delegate), | 508 : net::URLRequestJob(request, network_delegate), |
509 load_state_(load_state), | 509 load_state_(load_state) {} |
510 upload_progress_(upload_progress) {} | |
511 | 510 |
512 // net::URLRequestJob implementation: | 511 // net::URLRequestJob implementation: |
513 void Start() override {} | 512 void Start() override {} |
514 net::LoadState GetLoadState() const override { return load_state_; } | 513 net::LoadState GetLoadState() const override { return load_state_; } |
515 net::UploadProgress GetUploadProgress() const override { | |
516 return upload_progress_; | |
517 } | |
518 | 514 |
519 private: | 515 private: |
520 ~URLRequestLoadInfoJob() override {} | 516 ~URLRequestLoadInfoJob() override {} |
521 | 517 |
522 // big-job:substring,N | 518 // big-job:substring,N |
523 static bool ParseURL(const GURL& url, std::string* text, int* count) { | 519 static bool ParseURL(const GURL& url, std::string* text, int* count) { |
524 std::vector<std::string> parts = base::SplitString( | 520 std::vector<std::string> parts = base::SplitString( |
525 url.path(), ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 521 url.path(), ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
526 | 522 |
527 if (parts.size() != 2) | 523 if (parts.size() != 2) |
528 return false; | 524 return false; |
529 | 525 |
530 *text = parts[0]; | 526 *text = parts[0]; |
531 return base::StringToInt(parts[1], count); | 527 return base::StringToInt(parts[1], count); |
532 } | 528 } |
533 | 529 |
534 const net::LoadState load_state_; | 530 const net::LoadState load_state_; |
535 const net::UploadProgress upload_progress_; | |
536 }; | 531 }; |
537 | 532 |
538 class ResourceDispatcherHostTest; | 533 class ResourceDispatcherHostTest; |
539 | 534 |
540 class TestURLRequestJobFactory : public net::URLRequestJobFactory { | 535 class TestURLRequestJobFactory : public net::URLRequestJobFactory { |
541 public: | 536 public: |
542 explicit TestURLRequestJobFactory(ResourceDispatcherHostTest* test_fixture) | 537 explicit TestURLRequestJobFactory(ResourceDispatcherHostTest* test_fixture) |
543 : test_fixture_(test_fixture), | 538 : test_fixture_(test_fixture), |
544 hang_after_start_(false), | 539 hang_after_start_(false), |
545 delay_start_(false), | 540 delay_start_(false), |
(...skipping 3277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3823 return nullptr; | 3818 return nullptr; |
3824 } | 3819 } |
3825 | 3820 |
3826 INSTANTIATE_TEST_CASE_P( | 3821 INSTANTIATE_TEST_CASE_P( |
3827 ResourceDispatcherHostTests, | 3822 ResourceDispatcherHostTests, |
3828 ResourceDispatcherHostTest, | 3823 ResourceDispatcherHostTest, |
3829 testing::Values(TestConfig::kDefault, | 3824 testing::Values(TestConfig::kDefault, |
3830 TestConfig::kOptimizeIPCForSmallResourceEnabled)); | 3825 TestConfig::kOptimizeIPCForSmallResourceEnabled)); |
3831 | 3826 |
3832 } // namespace content | 3827 } // namespace content |
OLD | NEW |