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

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

Issue 2499313003: Set user_gesture bit at NavigationHandle creation time. (Closed)
Patch Set: address comments Created 4 years 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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 // Creates and drives a main resource request until completion. Then asserts 1082 // Creates and drives a main resource request until completion. Then asserts
1083 // that the expected_error_code has been emitted for the request. 1083 // that the expected_error_code has been emitted for the request.
1084 void CompleteFailingMainResourceRequest(const GURL& url, 1084 void CompleteFailingMainResourceRequest(const GURL& url,
1085 int expected_error_code) { 1085 int expected_error_code) {
1086 if (IsBrowserSideNavigationEnabled()) { 1086 if (IsBrowserSideNavigationEnabled()) {
1087 auto_advance_ = true; 1087 auto_advance_ = true;
1088 1088
1089 // Make a navigation request. 1089 // Make a navigation request.
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 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, false, -1, 1097 url::Origin(url), true, false, false, -1,
1098 false, false)); 1098 false, false));
1099 std::unique_ptr<NavigationURLLoader> test_loader = 1099 std::unique_ptr<NavigationURLLoader> test_loader =
1100 NavigationURLLoader::Create(browser_context_.get(), 1100 NavigationURLLoader::Create(browser_context_.get(),
1101 std::move(request_info), nullptr, nullptr, 1101 std::move(request_info), nullptr, nullptr,
1102 &delegate); 1102 &delegate);
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after
2632 SetResponse(raw_headers, response_data); 2632 SetResponse(raw_headers, response_data);
2633 job_factory_->SetDelayedCompleteJobGeneration(true); 2633 job_factory_->SetDelayedCompleteJobGeneration(true);
2634 HandleScheme("http"); 2634 HandleScheme("http");
2635 2635
2636 const GURL download_url = GURL("http://example.com/blah"); 2636 const GURL download_url = GURL("http://example.com/blah");
2637 2637
2638 if (IsBrowserSideNavigationEnabled()) { 2638 if (IsBrowserSideNavigationEnabled()) {
2639 // Create a NavigationRequest. 2639 // Create a NavigationRequest.
2640 TestNavigationURLLoaderDelegate delegate; 2640 TestNavigationURLLoaderDelegate delegate;
2641 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, 2641 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false,
2642 false, REQUEST_CONTEXT_TYPE_LOCATION); 2642 REQUEST_CONTEXT_TYPE_LOCATION);
2643 CommonNavigationParams common_params; 2643 CommonNavigationParams common_params;
2644 common_params.url = download_url; 2644 common_params.url = download_url;
2645 std::unique_ptr<NavigationRequestInfo> request_info( 2645 std::unique_ptr<NavigationRequestInfo> request_info(
2646 new NavigationRequestInfo(common_params, begin_params, download_url, 2646 new NavigationRequestInfo(common_params, begin_params, download_url,
2647 url::Origin(download_url), true, false, false, 2647 url::Origin(download_url), true, false, false,
2648 -1, false, false)); 2648 -1, false, false));
2649 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create( 2649 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create(
2650 browser_context_.get(), std::move(request_info), nullptr, nullptr, 2650 browser_context_.get(), std::move(request_info), nullptr, nullptr,
2651 &delegate); 2651 &delegate);
2652 2652
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
3935 return nullptr; 3935 return nullptr;
3936 } 3936 }
3937 3937
3938 INSTANTIATE_TEST_CASE_P( 3938 INSTANTIATE_TEST_CASE_P(
3939 ResourceDispatcherHostTests, 3939 ResourceDispatcherHostTests,
3940 ResourceDispatcherHostTest, 3940 ResourceDispatcherHostTest,
3941 testing::Values(TestConfig::kDefault, 3941 testing::Values(TestConfig::kDefault,
3942 TestConfig::kOptimizeIPCForSmallResourceEnabled)); 3942 TestConfig::kOptimizeIPCForSmallResourceEnabled));
3943 3943
3944 } // namespace content 3944 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698