Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_unittest.cc

Issue 2053693002: WIP: Move 'Upgrade-Insecure-Requests' to the browser process. Base URL: https://chromium.googlesource.com/chromium/src.git@replicate
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 auto_advance_ = true; 1136 auto_advance_ = true;
1137 1137
1138 // Make a navigation request. 1138 // Make a navigation request.
1139 TestNavigationURLLoaderDelegate delegate; 1139 TestNavigationURLLoaderDelegate delegate;
1140 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, 1140 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false,
1141 false, REQUEST_CONTEXT_TYPE_LOCATION); 1141 false, REQUEST_CONTEXT_TYPE_LOCATION);
1142 CommonNavigationParams common_params; 1142 CommonNavigationParams common_params;
1143 common_params.url = url; 1143 common_params.url = url;
1144 std::unique_ptr<NavigationRequestInfo> request_info( 1144 std::unique_ptr<NavigationRequestInfo> request_info(
1145 new NavigationRequestInfo(common_params, begin_params, url, 1145 new NavigationRequestInfo(common_params, begin_params, url,
1146 url::Origin(url), true, false, -1)); 1146 url::Origin(url), false, true, false, -1));
1147 std::unique_ptr<NavigationURLLoader> test_loader = 1147 std::unique_ptr<NavigationURLLoader> test_loader =
1148 NavigationURLLoader::Create(browser_context_.get(), 1148 NavigationURLLoader::Create(browser_context_.get(),
1149 std::move(request_info), nullptr, 1149 std::move(request_info), nullptr,
1150 &delegate); 1150 &delegate);
1151 1151
1152 // The navigation should fail with the expected error code. 1152 // The navigation should fail with the expected error code.
1153 delegate.WaitForRequestFailed(); 1153 delegate.WaitForRequestFailed();
1154 ASSERT_EQ(expected_error_code, delegate.net_error()); 1154 ASSERT_EQ(expected_error_code, delegate.net_error());
1155 return; 1155 return;
1156 } 1156 }
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
2602 2602
2603 if (IsBrowserSideNavigationEnabled()) { 2603 if (IsBrowserSideNavigationEnabled()) {
2604 // Create a NavigationRequest. 2604 // Create a NavigationRequest.
2605 TestNavigationURLLoaderDelegate delegate; 2605 TestNavigationURLLoaderDelegate delegate;
2606 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, 2606 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false,
2607 false, REQUEST_CONTEXT_TYPE_LOCATION); 2607 false, REQUEST_CONTEXT_TYPE_LOCATION);
2608 CommonNavigationParams common_params; 2608 CommonNavigationParams common_params;
2609 common_params.url = download_url; 2609 common_params.url = download_url;
2610 std::unique_ptr<NavigationRequestInfo> request_info( 2610 std::unique_ptr<NavigationRequestInfo> request_info(
2611 new NavigationRequestInfo(common_params, begin_params, download_url, 2611 new NavigationRequestInfo(common_params, begin_params, download_url,
2612 url::Origin(download_url), true, false, -1)); 2612 url::Origin(download_url), false, true, false,
2613 -1));
2613 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create( 2614 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create(
2614 browser_context_.get(), std::move(request_info), nullptr, &delegate); 2615 browser_context_.get(), std::move(request_info), nullptr, &delegate);
2615 2616
2616 // 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.
2617 KickOffRequest(); 2618 KickOffRequest();
2618 2619
2619 // 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
2620 // and the proper resource handlers are created. 2621 // and the proper resource handlers are created.
2621 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); 2622 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage());
2622 base::MessageLoop::current()->RunUntilIdle(); 2623 base::MessageLoop::current()->RunUntilIdle();
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
3896 return nullptr; 3897 return nullptr;
3897 } 3898 }
3898 3899
3899 INSTANTIATE_TEST_CASE_P( 3900 INSTANTIATE_TEST_CASE_P(
3900 ResourceDispatcherHostTests, 3901 ResourceDispatcherHostTests,
3901 ResourceDispatcherHostTest, 3902 ResourceDispatcherHostTest,
3902 testing::Values(TestConfig::kDefault, 3903 testing::Values(TestConfig::kDefault,
3903 TestConfig::kOptimizeIPCForSmallResourceEnabled)); 3904 TestConfig::kOptimizeIPCForSmallResourceEnabled));
3904 3905
3905 } // namespace content 3906 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698