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 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 TestNavigationURLLoaderDelegate delegate; | 1090 TestNavigationURLLoaderDelegate delegate; |
1091 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, | 1091 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, |
1092 false, REQUEST_CONTEXT_TYPE_LOCATION); | 1092 false, REQUEST_CONTEXT_TYPE_LOCATION); |
1093 CommonNavigationParams common_params; | 1093 CommonNavigationParams common_params; |
1094 common_params.url = url; | 1094 common_params.url = url; |
1095 std::unique_ptr<NavigationRequestInfo> request_info( | 1095 std::unique_ptr<NavigationRequestInfo> request_info( |
1096 new NavigationRequestInfo(common_params, begin_params, url, | 1096 new NavigationRequestInfo(common_params, begin_params, url, |
1097 url::Origin(url), true, false, -1)); | 1097 url::Origin(url), true, false, -1)); |
1098 std::unique_ptr<NavigationURLLoader> test_loader = | 1098 std::unique_ptr<NavigationURLLoader> test_loader = |
1099 NavigationURLLoader::Create(browser_context_.get(), | 1099 NavigationURLLoader::Create(browser_context_.get(), |
1100 std::move(request_info), nullptr, | 1100 std::move(request_info), nullptr, nullptr, |
1101 &delegate); | 1101 &delegate); |
1102 | 1102 |
1103 // The navigation should fail with the expected error code. | 1103 // The navigation should fail with the expected error code. |
1104 delegate.WaitForRequestFailed(); | 1104 delegate.WaitForRequestFailed(); |
1105 ASSERT_EQ(expected_error_code, delegate.net_error()); | 1105 ASSERT_EQ(expected_error_code, delegate.net_error()); |
1106 return; | 1106 return; |
1107 } | 1107 } |
1108 | 1108 |
1109 MakeTestRequestWithResourceType(filter_.get(), 0, 1, url, | 1109 MakeTestRequestWithResourceType(filter_.get(), 0, 1, url, |
1110 RESOURCE_TYPE_MAIN_FRAME); | 1110 RESOURCE_TYPE_MAIN_FRAME); |
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2572 // Create a NavigationRequest. | 2572 // Create a NavigationRequest. |
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, -1)); | 2580 url::Origin(download_url), true, false, -1)); |
2581 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create( | 2581 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create( |
2582 browser_context_.get(), std::move(request_info), nullptr, &delegate); | 2582 browser_context_.get(), std::move(request_info), nullptr, nullptr, |
| 2583 &delegate); |
2583 | 2584 |
2584 // Wait until a response has been received and proceed with the response. | 2585 // Wait until a response has been received and proceed with the response. |
2585 KickOffRequest(); | 2586 KickOffRequest(); |
2586 | 2587 |
2587 // Return some data so that the request is identified as a download | 2588 // Return some data so that the request is identified as a download |
2588 // and the proper resource handlers are created. | 2589 // and the proper resource handlers are created. |
2589 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); | 2590 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); |
2590 base::RunLoop().RunUntilIdle(); | 2591 base::RunLoop().RunUntilIdle(); |
2591 | 2592 |
2592 // The UI thread will be informed that the navigation failed with an error | 2593 // The UI thread will be informed that the navigation failed with an error |
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3823 return nullptr; | 3824 return nullptr; |
3824 } | 3825 } |
3825 | 3826 |
3826 INSTANTIATE_TEST_CASE_P( | 3827 INSTANTIATE_TEST_CASE_P( |
3827 ResourceDispatcherHostTests, | 3828 ResourceDispatcherHostTests, |
3828 ResourceDispatcherHostTest, | 3829 ResourceDispatcherHostTest, |
3829 testing::Values(TestConfig::kDefault, | 3830 testing::Values(TestConfig::kDefault, |
3830 TestConfig::kOptimizeIPCForSmallResourceEnabled)); | 3831 TestConfig::kOptimizeIPCForSmallResourceEnabled)); |
3831 | 3832 |
3832 } // namespace content | 3833 } // namespace content |
OLD | NEW |