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

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

Issue 2099243002: PlzNavigate: properly set the initiator of the navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <memory> 5 #include <memory>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 // NavigationURLLoader is only used for browser-side navigations. 99 // NavigationURLLoader is only used for browser-side navigations.
100 base::CommandLine::ForCurrentProcess()->AppendSwitch( 100 base::CommandLine::ForCurrentProcess()->AppendSwitch(
101 switches::kEnableBrowserSideNavigation); 101 switches::kEnableBrowserSideNavigation);
102 } 102 }
103 103
104 std::unique_ptr<NavigationURLLoader> MakeTestLoader( 104 std::unique_ptr<NavigationURLLoader> MakeTestLoader(
105 const GURL& url, 105 const GURL& url,
106 NavigationURLLoaderDelegate* delegate) { 106 NavigationURLLoaderDelegate* delegate) {
107 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false, 107 BeginNavigationParams begin_params(std::string(), net::LOAD_NORMAL, false,
108 false, REQUEST_CONTEXT_TYPE_LOCATION); 108 false, REQUEST_CONTEXT_TYPE_LOCATION,
109 url::Origin(url));
109 CommonNavigationParams common_params; 110 CommonNavigationParams common_params;
110 common_params.url = url; 111 common_params.url = url;
111 std::unique_ptr<NavigationRequestInfo> request_info( 112 std::unique_ptr<NavigationRequestInfo> request_info(
112 new NavigationRequestInfo(common_params, begin_params, url, 113 new NavigationRequestInfo(common_params, begin_params, url, true, false,
113 url::Origin(url), true, false, -1)); 114 -1));
114 115
115 return NavigationURLLoader::Create( 116 return NavigationURLLoader::Create(
116 browser_context_.get(), std::move(request_info), nullptr, delegate); 117 browser_context_.get(), std::move(request_info), nullptr, delegate);
117 } 118 }
118 119
119 // Helper function for fetching the body of a URL to a string. 120 // Helper function for fetching the body of a URL to a string.
120 std::string FetchURL(const GURL& url) { 121 std::string FetchURL(const GURL& url) {
121 net::TestDelegate delegate; 122 net::TestDelegate delegate;
122 net::URLRequestContext* request_context = 123 net::URLRequestContext* request_context =
123 browser_context_->GetResourceContext()->GetRequestContext(); 124 browser_context_->GetResourceContext()->GetRequestContext();
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 329
329 // Release the body. 330 // Release the body.
330 delegate.ReleaseBody(); 331 delegate.ReleaseBody();
331 base::RunLoop().RunUntilIdle(); 332 base::RunLoop().RunUntilIdle();
332 333
333 // Verify that URLRequestTestJob no longer has anything paused. 334 // Verify that URLRequestTestJob no longer has anything paused.
334 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage()); 335 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage());
335 } 336 }
336 337
337 } // namespace content 338 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698