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 |
| 7 #include <memory> |
6 #include <utility> | 8 #include <utility> |
7 #include <vector> | 9 #include <vector> |
8 | 10 |
9 #include "base/bind.h" | 11 #include "base/bind.h" |
10 #include "base/feature_list.h" | 12 #include "base/feature_list.h" |
11 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
12 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
13 #include "base/location.h" | 15 #include "base/location.h" |
14 #include "base/macros.h" | 16 #include "base/macros.h" |
15 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 int expected_error_code) { | 1133 int expected_error_code) { |
1132 if (IsBrowserSideNavigationEnabled()) { | 1134 if (IsBrowserSideNavigationEnabled()) { |
1133 auto_advance_ = true; | 1135 auto_advance_ = true; |
1134 | 1136 |
1135 // Make a navigation request. | 1137 // Make a navigation request. |
1136 TestNavigationURLLoaderDelegate delegate; | 1138 TestNavigationURLLoaderDelegate delegate; |
1137 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, | 1139 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, |
1138 false, REQUEST_CONTEXT_TYPE_LOCATION); | 1140 false, REQUEST_CONTEXT_TYPE_LOCATION); |
1139 CommonNavigationParams common_params; | 1141 CommonNavigationParams common_params; |
1140 common_params.url = url; | 1142 common_params.url = url; |
1141 scoped_ptr<NavigationRequestInfo> request_info(new NavigationRequestInfo( | 1143 std::unique_ptr<NavigationRequestInfo> request_info( |
1142 common_params, begin_params, url, url::Origin(url), true, false, -1, | 1144 new NavigationRequestInfo(common_params, begin_params, url, |
1143 scoped_refptr<ResourceRequestBody>())); | 1145 url::Origin(url), true, false, -1, |
1144 scoped_ptr<NavigationURLLoader> test_loader = NavigationURLLoader::Create( | 1146 scoped_refptr<ResourceRequestBody>())); |
1145 browser_context_.get(), std::move(request_info), nullptr, &delegate); | 1147 std::unique_ptr<NavigationURLLoader> test_loader = |
| 1148 NavigationURLLoader::Create(browser_context_.get(), |
| 1149 std::move(request_info), nullptr, |
| 1150 &delegate); |
1146 | 1151 |
1147 // The navigation should fail with the expected error code. | 1152 // The navigation should fail with the expected error code. |
1148 delegate.WaitForRequestFailed(); | 1153 delegate.WaitForRequestFailed(); |
1149 ASSERT_EQ(expected_error_code, delegate.net_error()); | 1154 ASSERT_EQ(expected_error_code, delegate.net_error()); |
1150 return; | 1155 return; |
1151 } | 1156 } |
1152 | 1157 |
1153 MakeTestRequestWithResourceType(filter_.get(), 0, 1, url, | 1158 MakeTestRequestWithResourceType(filter_.get(), 0, 1, url, |
1154 RESOURCE_TYPE_MAIN_FRAME); | 1159 RESOURCE_TYPE_MAIN_FRAME); |
1155 | 1160 |
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2595 | 2600 |
2596 const GURL download_url = GURL("http://example.com/blah"); | 2601 const GURL download_url = GURL("http://example.com/blah"); |
2597 | 2602 |
2598 if (IsBrowserSideNavigationEnabled()) { | 2603 if (IsBrowserSideNavigationEnabled()) { |
2599 // Create a NavigationRequest. | 2604 // Create a NavigationRequest. |
2600 TestNavigationURLLoaderDelegate delegate; | 2605 TestNavigationURLLoaderDelegate delegate; |
2601 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, | 2606 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, |
2602 false, REQUEST_CONTEXT_TYPE_LOCATION); | 2607 false, REQUEST_CONTEXT_TYPE_LOCATION); |
2603 CommonNavigationParams common_params; | 2608 CommonNavigationParams common_params; |
2604 common_params.url = download_url; | 2609 common_params.url = download_url; |
2605 scoped_ptr<NavigationRequestInfo> request_info(new NavigationRequestInfo( | 2610 std::unique_ptr<NavigationRequestInfo> request_info( |
2606 common_params, begin_params, download_url, url::Origin(download_url), | 2611 new NavigationRequestInfo(common_params, begin_params, download_url, |
2607 true, false, -1, scoped_refptr<ResourceRequestBody>())); | 2612 url::Origin(download_url), true, false, -1, |
2608 scoped_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create( | 2613 scoped_refptr<ResourceRequestBody>())); |
| 2614 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create( |
2609 browser_context_.get(), std::move(request_info), nullptr, &delegate); | 2615 browser_context_.get(), std::move(request_info), nullptr, &delegate); |
2610 | 2616 |
2611 // Wait until a response has been received and proceed with the response. | 2617 // Wait until a response has been received and proceed with the response. |
2612 KickOffRequest(); | 2618 KickOffRequest(); |
2613 | 2619 |
2614 // Return some data so that the request is identified as a download | 2620 // Return some data so that the request is identified as a download |
2615 // and the proper resource handlers are created. | 2621 // and the proper resource handlers are created. |
2616 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); | 2622 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); |
2617 base::MessageLoop::current()->RunUntilIdle(); | 2623 base::MessageLoop::current()->RunUntilIdle(); |
2618 | 2624 |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3898 return nullptr; | 3904 return nullptr; |
3899 } | 3905 } |
3900 | 3906 |
3901 INSTANTIATE_TEST_CASE_P( | 3907 INSTANTIATE_TEST_CASE_P( |
3902 ResourceDispatcherHostTests, | 3908 ResourceDispatcherHostTests, |
3903 ResourceDispatcherHostTest, | 3909 ResourceDispatcherHostTest, |
3904 testing::Values(TestConfig::kDefault, | 3910 testing::Values(TestConfig::kDefault, |
3905 TestConfig::kOptimizeIPCForSmallResourceEnabled)); | 3911 TestConfig::kOptimizeIPCForSmallResourceEnabled)); |
3906 | 3912 |
3907 } // namespace content | 3913 } // namespace content |
OLD | NEW |