| 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 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 auto_advance_ = true; | 1135 auto_advance_ = true; |
| 1136 | 1136 |
| 1137 // Make a navigation request. | 1137 // Make a navigation request. |
| 1138 TestNavigationURLLoaderDelegate delegate; | 1138 TestNavigationURLLoaderDelegate delegate; |
| 1139 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, | 1139 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, |
| 1140 false, REQUEST_CONTEXT_TYPE_LOCATION); | 1140 false, REQUEST_CONTEXT_TYPE_LOCATION); |
| 1141 CommonNavigationParams common_params; | 1141 CommonNavigationParams common_params; |
| 1142 common_params.url = url; | 1142 common_params.url = url; |
| 1143 std::unique_ptr<NavigationRequestInfo> request_info( | 1143 std::unique_ptr<NavigationRequestInfo> request_info( |
| 1144 new NavigationRequestInfo(common_params, begin_params, url, | 1144 new NavigationRequestInfo(common_params, begin_params, url, |
| 1145 url::Origin(url), true, false, -1, | 1145 url::Origin(url), true, false, -1)); |
| 1146 scoped_refptr<ResourceRequestBody>())); | |
| 1147 std::unique_ptr<NavigationURLLoader> test_loader = | 1146 std::unique_ptr<NavigationURLLoader> test_loader = |
| 1148 NavigationURLLoader::Create(browser_context_.get(), | 1147 NavigationURLLoader::Create(browser_context_.get(), |
| 1149 std::move(request_info), nullptr, | 1148 std::move(request_info), nullptr, |
| 1150 &delegate); | 1149 &delegate); |
| 1151 | 1150 |
| 1152 // The navigation should fail with the expected error code. | 1151 // The navigation should fail with the expected error code. |
| 1153 delegate.WaitForRequestFailed(); | 1152 delegate.WaitForRequestFailed(); |
| 1154 ASSERT_EQ(expected_error_code, delegate.net_error()); | 1153 ASSERT_EQ(expected_error_code, delegate.net_error()); |
| 1155 return; | 1154 return; |
| 1156 } | 1155 } |
| (...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2602 | 2601 |
| 2603 if (IsBrowserSideNavigationEnabled()) { | 2602 if (IsBrowserSideNavigationEnabled()) { |
| 2604 // Create a NavigationRequest. | 2603 // Create a NavigationRequest. |
| 2605 TestNavigationURLLoaderDelegate delegate; | 2604 TestNavigationURLLoaderDelegate delegate; |
| 2606 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, | 2605 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, |
| 2607 false, REQUEST_CONTEXT_TYPE_LOCATION); | 2606 false, REQUEST_CONTEXT_TYPE_LOCATION); |
| 2608 CommonNavigationParams common_params; | 2607 CommonNavigationParams common_params; |
| 2609 common_params.url = download_url; | 2608 common_params.url = download_url; |
| 2610 std::unique_ptr<NavigationRequestInfo> request_info( | 2609 std::unique_ptr<NavigationRequestInfo> request_info( |
| 2611 new NavigationRequestInfo(common_params, begin_params, download_url, | 2610 new NavigationRequestInfo(common_params, begin_params, download_url, |
| 2612 url::Origin(download_url), true, false, -1, | 2611 url::Origin(download_url), true, false, -1)); |
| 2613 scoped_refptr<ResourceRequestBody>())); | |
| 2614 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create( | 2612 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create( |
| 2615 browser_context_.get(), std::move(request_info), nullptr, &delegate); | 2613 browser_context_.get(), std::move(request_info), nullptr, &delegate); |
| 2616 | 2614 |
| 2617 // Wait until a response has been received and proceed with the response. | 2615 // Wait until a response has been received and proceed with the response. |
| 2618 KickOffRequest(); | 2616 KickOffRequest(); |
| 2619 | 2617 |
| 2620 // Return some data so that the request is identified as a download | 2618 // Return some data so that the request is identified as a download |
| 2621 // and the proper resource handlers are created. | 2619 // and the proper resource handlers are created. |
| 2622 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); | 2620 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); |
| 2623 base::MessageLoop::current()->RunUntilIdle(); | 2621 base::MessageLoop::current()->RunUntilIdle(); |
| (...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3897 return nullptr; | 3895 return nullptr; |
| 3898 } | 3896 } |
| 3899 | 3897 |
| 3900 INSTANTIATE_TEST_CASE_P( | 3898 INSTANTIATE_TEST_CASE_P( |
| 3901 ResourceDispatcherHostTests, | 3899 ResourceDispatcherHostTests, |
| 3902 ResourceDispatcherHostTest, | 3900 ResourceDispatcherHostTest, |
| 3903 testing::Values(TestConfig::kDefault, | 3901 testing::Values(TestConfig::kDefault, |
| 3904 TestConfig::kOptimizeIPCForSmallResourceEnabled)); | 3902 TestConfig::kOptimizeIPCForSmallResourceEnabled)); |
| 3905 | 3903 |
| 3906 } // namespace content | 3904 } // namespace content |
| OLD | NEW |