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

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

Issue 2445993006: [WIP] Upgrade-insecure-request: upgrade insecurely-redirected requests.
Patch Set: bugfix Created 4 years, 1 month 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 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 if (IsBrowserSideNavigationEnabled()) { 1071 if (IsBrowserSideNavigationEnabled()) {
1072 auto_advance_ = true; 1072 auto_advance_ = true;
1073 1073
1074 // Make a navigation request. 1074 // Make a navigation request.
1075 TestNavigationURLLoaderDelegate delegate; 1075 TestNavigationURLLoaderDelegate delegate;
1076 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, 1076 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false,
1077 false, REQUEST_CONTEXT_TYPE_LOCATION); 1077 false, REQUEST_CONTEXT_TYPE_LOCATION);
1078 CommonNavigationParams common_params; 1078 CommonNavigationParams common_params;
1079 common_params.url = url; 1079 common_params.url = url;
1080 std::unique_ptr<NavigationRequestInfo> request_info( 1080 std::unique_ptr<NavigationRequestInfo> request_info(
1081 new NavigationRequestInfo(common_params, begin_params, url, 1081 new NavigationRequestInfo(
1082 url::Origin(url), true, false, false, -1, 1082 common_params, begin_params, url, url::Origin(url), true, false,
1083 false, false)); 1083 false, -1, false, false, blink::kLeaveInsecureRequestsAlone));
1084 std::unique_ptr<NavigationURLLoader> test_loader = 1084 std::unique_ptr<NavigationURLLoader> test_loader =
1085 NavigationURLLoader::Create(browser_context_.get(), 1085 NavigationURLLoader::Create(browser_context_.get(),
1086 std::move(request_info), nullptr, nullptr, 1086 std::move(request_info), nullptr, nullptr,
1087 &delegate); 1087 &delegate);
1088 1088
1089 // The navigation should fail with the expected error code. 1089 // The navigation should fail with the expected error code.
1090 delegate.WaitForRequestFailed(); 1090 delegate.WaitForRequestFailed();
1091 ASSERT_EQ(expected_error_code, delegate.net_error()); 1091 ASSERT_EQ(expected_error_code, delegate.net_error());
1092 return; 1092 return;
1093 } 1093 }
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 if (IsBrowserSideNavigationEnabled()) { 2561 if (IsBrowserSideNavigationEnabled()) {
2562 // Create a NavigationRequest. 2562 // Create a NavigationRequest.
2563 TestNavigationURLLoaderDelegate delegate; 2563 TestNavigationURLLoaderDelegate delegate;
2564 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, 2564 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false,
2565 false, REQUEST_CONTEXT_TYPE_LOCATION); 2565 false, REQUEST_CONTEXT_TYPE_LOCATION);
2566 CommonNavigationParams common_params; 2566 CommonNavigationParams common_params;
2567 common_params.url = download_url; 2567 common_params.url = download_url;
2568 std::unique_ptr<NavigationRequestInfo> request_info( 2568 std::unique_ptr<NavigationRequestInfo> request_info(
2569 new NavigationRequestInfo(common_params, begin_params, download_url, 2569 new NavigationRequestInfo(common_params, begin_params, download_url,
2570 url::Origin(download_url), true, false, false, 2570 url::Origin(download_url), true, false, false,
2571 -1, false, false)); 2571 -1, false, false,
2572 blink::kLeaveInsecureRequestsAlone));
2572 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create( 2573 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create(
2573 browser_context_.get(), std::move(request_info), nullptr, nullptr, 2574 browser_context_.get(), std::move(request_info), nullptr, nullptr,
2574 &delegate); 2575 &delegate);
2575 2576
2576 // Wait until a response has been received and proceed with the response. 2577 // Wait until a response has been received and proceed with the response.
2577 KickOffRequest(); 2578 KickOffRequest();
2578 2579
2579 // Return some data so that the request is identified as a download 2580 // Return some data so that the request is identified as a download
2580 // and the proper resource handlers are created. 2581 // and the proper resource handlers are created.
2581 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); 2582 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage());
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
3846 return nullptr; 3847 return nullptr;
3847 } 3848 }
3848 3849
3849 INSTANTIATE_TEST_CASE_P( 3850 INSTANTIATE_TEST_CASE_P(
3850 ResourceDispatcherHostTests, 3851 ResourceDispatcherHostTests,
3851 ResourceDispatcherHostTest, 3852 ResourceDispatcherHostTest,
3852 testing::Values(TestConfig::kDefault, 3853 testing::Values(TestConfig::kDefault,
3853 TestConfig::kOptimizeIPCForSmallResourceEnabled)); 3854 TestConfig::kOptimizeIPCForSmallResourceEnabled));
3854 3855
3855 } // namespace content 3856 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.cc ('k') | content/browser/loader/resource_request_info_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698