| 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 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 TestNavigationURLLoaderDelegate delegate; | 1086 TestNavigationURLLoaderDelegate delegate; |
| 1087 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, | 1087 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, |
| 1088 false, REQUEST_CONTEXT_TYPE_LOCATION); | 1088 false, REQUEST_CONTEXT_TYPE_LOCATION); |
| 1089 CommonNavigationParams common_params; | 1089 CommonNavigationParams common_params; |
| 1090 common_params.url = url; | 1090 common_params.url = url; |
| 1091 std::unique_ptr<NavigationRequestInfo> request_info( | 1091 std::unique_ptr<NavigationRequestInfo> request_info( |
| 1092 new NavigationRequestInfo(common_params, begin_params, url, | 1092 new NavigationRequestInfo(common_params, begin_params, url, |
| 1093 url::Origin(url), true, false, false, -1)); | 1093 url::Origin(url), true, false, false, -1)); |
| 1094 std::unique_ptr<NavigationURLLoader> test_loader = | 1094 std::unique_ptr<NavigationURLLoader> test_loader = |
| 1095 NavigationURLLoader::Create(browser_context_.get(), | 1095 NavigationURLLoader::Create(browser_context_.get(), |
| 1096 std::move(request_info), nullptr, | 1096 std::move(request_info), nullptr, nullptr, |
| 1097 &delegate); | 1097 &delegate); |
| 1098 | 1098 |
| 1099 // The navigation should fail with the expected error code. | 1099 // The navigation should fail with the expected error code. |
| 1100 delegate.WaitForRequestFailed(); | 1100 delegate.WaitForRequestFailed(); |
| 1101 ASSERT_EQ(expected_error_code, delegate.net_error()); | 1101 ASSERT_EQ(expected_error_code, delegate.net_error()); |
| 1102 return; | 1102 return; |
| 1103 } | 1103 } |
| 1104 | 1104 |
| 1105 MakeTestRequestWithResourceType(filter_.get(), 0, 1, url, | 1105 MakeTestRequestWithResourceType(filter_.get(), 0, 1, url, |
| 1106 RESOURCE_TYPE_MAIN_FRAME); | 1106 RESOURCE_TYPE_MAIN_FRAME); |
| (...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2573 TestNavigationURLLoaderDelegate delegate; | 2573 TestNavigationURLLoaderDelegate delegate; |
| 2574 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, | 2574 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, |
| 2575 false, REQUEST_CONTEXT_TYPE_LOCATION); | 2575 false, REQUEST_CONTEXT_TYPE_LOCATION); |
| 2576 CommonNavigationParams common_params; | 2576 CommonNavigationParams common_params; |
| 2577 common_params.url = download_url; | 2577 common_params.url = download_url; |
| 2578 std::unique_ptr<NavigationRequestInfo> request_info( | 2578 std::unique_ptr<NavigationRequestInfo> request_info( |
| 2579 new NavigationRequestInfo(common_params, begin_params, download_url, | 2579 new NavigationRequestInfo(common_params, begin_params, download_url, |
| 2580 url::Origin(download_url), true, false, false, | 2580 url::Origin(download_url), true, false, false, |
| 2581 -1)); | 2581 -1)); |
| 2582 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create( | 2582 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create( |
| 2583 browser_context_.get(), std::move(request_info), nullptr, &delegate); | 2583 browser_context_.get(), std::move(request_info), nullptr, nullptr, |
| 2584 &delegate); |
| 2584 | 2585 |
| 2585 // Wait until a response has been received and proceed with the response. | 2586 // Wait until a response has been received and proceed with the response. |
| 2586 KickOffRequest(); | 2587 KickOffRequest(); |
| 2587 | 2588 |
| 2588 // Return some data so that the request is identified as a download | 2589 // Return some data so that the request is identified as a download |
| 2589 // and the proper resource handlers are created. | 2590 // and the proper resource handlers are created. |
| 2590 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); | 2591 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); |
| 2591 base::RunLoop().RunUntilIdle(); | 2592 base::RunLoop().RunUntilIdle(); |
| 2592 | 2593 |
| 2593 // The UI thread will be informed that the navigation failed with an error | 2594 // The UI thread will be informed that the navigation failed with an error |
| (...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3837 return nullptr; | 3838 return nullptr; |
| 3838 } | 3839 } |
| 3839 | 3840 |
| 3840 INSTANTIATE_TEST_CASE_P( | 3841 INSTANTIATE_TEST_CASE_P( |
| 3841 ResourceDispatcherHostTests, | 3842 ResourceDispatcherHostTests, |
| 3842 ResourceDispatcherHostTest, | 3843 ResourceDispatcherHostTest, |
| 3843 testing::Values(TestConfig::kDefault, | 3844 testing::Values(TestConfig::kDefault, |
| 3844 TestConfig::kOptimizeIPCForSmallResourceEnabled)); | 3845 TestConfig::kOptimizeIPCForSmallResourceEnabled)); |
| 3845 | 3846 |
| 3846 } // namespace content | 3847 } // namespace content |
| OLD | NEW |