OLD | NEW |
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "content/browser/frame_host/navigation_request_info.h" | 10 #include "content/browser/frame_host/navigation_request_info.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 // NavigationURLLoader is only used for browser-side navigations. | 173 // NavigationURLLoader is only used for browser-side navigations. |
174 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 174 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
175 switches::kEnableBrowserSideNavigation); | 175 switches::kEnableBrowserSideNavigation); |
176 } | 176 } |
177 | 177 |
178 scoped_ptr<NavigationURLLoader> MakeTestLoader( | 178 scoped_ptr<NavigationURLLoader> MakeTestLoader( |
179 const GURL& url, | 179 const GURL& url, |
180 NavigationURLLoaderDelegate* delegate) { | 180 NavigationURLLoaderDelegate* delegate) { |
181 BeginNavigationParams begin_params( | 181 BeginNavigationParams begin_params( |
182 "GET", std::string(), net::LOAD_NORMAL, false); | 182 "GET", std::string(), net::LOAD_NORMAL, false, false, |
| 183 REQUEST_CONTEXT_TYPE_HYPERLINK); |
183 CommonNavigationParams common_params; | 184 CommonNavigationParams common_params; |
184 common_params.url = url; | 185 common_params.url = url; |
| 186 RequestNavigationParams request_params; |
185 scoped_ptr<NavigationRequestInfo> request_info( | 187 scoped_ptr<NavigationRequestInfo> request_info( |
186 new NavigationRequestInfo(common_params, begin_params, url, true, false, | 188 new NavigationRequestInfo( |
187 -1, scoped_refptr<ResourceRequestBody>())); | 189 common_params, begin_params, request_params, url, true, false, -1, |
| 190 scoped_refptr<ResourceRequestBody>())); |
188 | 191 |
189 return NavigationURLLoader::Create( | 192 return NavigationURLLoader::Create( |
190 browser_context_.get(), 0, request_info.Pass(), delegate); | 193 browser_context_.get(), 0, request_info.Pass(), delegate); |
191 } | 194 } |
192 | 195 |
193 // Helper function for fetching the body of a URL to a string. | 196 // Helper function for fetching the body of a URL to a string. |
194 std::string FetchURL(const GURL& url) { | 197 std::string FetchURL(const GURL& url) { |
195 net::TestDelegate delegate; | 198 net::TestDelegate delegate; |
196 net::URLRequestContext* request_context = | 199 net::URLRequestContext* request_context = |
197 browser_context_->GetResourceContext()->GetRequestContext(); | 200 browser_context_->GetResourceContext()->GetRequestContext(); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 397 |
395 // Release the body. | 398 // Release the body. |
396 delegate.ReleaseBody(); | 399 delegate.ReleaseBody(); |
397 base::RunLoop().RunUntilIdle(); | 400 base::RunLoop().RunUntilIdle(); |
398 | 401 |
399 // Verify that URLRequestTestJob no longer has anything paused. | 402 // Verify that URLRequestTestJob no longer has anything paused. |
400 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage()); | 403 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage()); |
401 } | 404 } |
402 | 405 |
403 } // namespace content | 406 } // namespace content |
OLD | NEW |