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

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: remove gesture dcheck 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 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 1062
1063 // Creates and drives a main resource request until completion. Then asserts 1063 // Creates and drives a main resource request until completion. Then asserts
1064 // that the expected_error_code has been emitted for the request. 1064 // that the expected_error_code has been emitted for the request.
1065 void CompleteFailingMainResourceRequest(const GURL& url, 1065 void CompleteFailingMainResourceRequest(const GURL& url,
1066 int expected_error_code) { 1066 int expected_error_code) {
1067 if (IsBrowserSideNavigationEnabled()) { 1067 if (IsBrowserSideNavigationEnabled()) {
1068 auto_advance_ = true; 1068 auto_advance_ = true;
1069 1069
1070 // Make a navigation request. 1070 // Make a navigation request.
1071 TestNavigationURLLoaderDelegate delegate; 1071 TestNavigationURLLoaderDelegate delegate;
1072 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, 1072 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL,
1073 false, REQUEST_CONTEXT_TYPE_LOCATION); 1073 NavigationGestureAuto, false,
1074 REQUEST_CONTEXT_TYPE_LOCATION);
1074 CommonNavigationParams common_params; 1075 CommonNavigationParams common_params;
1075 common_params.url = url; 1076 common_params.url = url;
1076 std::unique_ptr<NavigationRequestInfo> request_info( 1077 std::unique_ptr<NavigationRequestInfo> request_info(
1077 new NavigationRequestInfo(common_params, begin_params, url, 1078 new NavigationRequestInfo(common_params, begin_params, url,
1078 url::Origin(url), true, false, false, -1, 1079 url::Origin(url), true, false, false, -1,
1079 false, false)); 1080 false, false));
1080 std::unique_ptr<NavigationURLLoader> test_loader = 1081 std::unique_ptr<NavigationURLLoader> test_loader =
1081 NavigationURLLoader::Create(browser_context_.get(), 1082 NavigationURLLoader::Create(browser_context_.get(),
1082 std::move(request_info), nullptr, nullptr, 1083 std::move(request_info), nullptr, nullptr,
1083 &delegate); 1084 &delegate);
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after
2551 2552
2552 SetResponse(raw_headers, response_data); 2553 SetResponse(raw_headers, response_data);
2553 job_factory_->SetDelayedCompleteJobGeneration(true); 2554 job_factory_->SetDelayedCompleteJobGeneration(true);
2554 HandleScheme("http"); 2555 HandleScheme("http");
2555 2556
2556 const GURL download_url = GURL("http://example.com/blah"); 2557 const GURL download_url = GURL("http://example.com/blah");
2557 2558
2558 if (IsBrowserSideNavigationEnabled()) { 2559 if (IsBrowserSideNavigationEnabled()) {
2559 // Create a NavigationRequest. 2560 // Create a NavigationRequest.
2560 TestNavigationURLLoaderDelegate delegate; 2561 TestNavigationURLLoaderDelegate delegate;
2561 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, 2562 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL,
2562 false, REQUEST_CONTEXT_TYPE_LOCATION); 2563 NavigationGestureAuto, false,
2564 REQUEST_CONTEXT_TYPE_LOCATION);
2563 CommonNavigationParams common_params; 2565 CommonNavigationParams common_params;
2564 common_params.url = download_url; 2566 common_params.url = download_url;
2565 std::unique_ptr<NavigationRequestInfo> request_info( 2567 std::unique_ptr<NavigationRequestInfo> request_info(
2566 new NavigationRequestInfo(common_params, begin_params, download_url, 2568 new NavigationRequestInfo(common_params, begin_params, download_url,
2567 url::Origin(download_url), true, false, false, 2569 url::Origin(download_url), true, false, false,
2568 -1, false, false)); 2570 -1, false, false));
2569 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create( 2571 std::unique_ptr<NavigationURLLoader> loader = NavigationURLLoader::Create(
2570 browser_context_.get(), std::move(request_info), nullptr, nullptr, 2572 browser_context_.get(), std::move(request_info), nullptr, nullptr,
2571 &delegate); 2573 &delegate);
2572 2574
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
3843 return nullptr; 3845 return nullptr;
3844 } 3846 }
3845 3847
3846 INSTANTIATE_TEST_CASE_P( 3848 INSTANTIATE_TEST_CASE_P(
3847 ResourceDispatcherHostTests, 3849 ResourceDispatcherHostTests,
3848 ResourceDispatcherHostTest, 3850 ResourceDispatcherHostTest,
3849 testing::Values(TestConfig::kDefault, 3851 testing::Values(TestConfig::kDefault,
3850 TestConfig::kOptimizeIPCForSmallResourceEnabled)); 3852 TestConfig::kOptimizeIPCForSmallResourceEnabled));
3851 3853
3852 } // namespace content 3854 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698