| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 request_context->set_job_factory(&job_factory_); | 163 request_context->set_job_factory(&job_factory_); |
| 164 | 164 |
| 165 // NavigationURLLoader is only used for browser-side navigations. | 165 // NavigationURLLoader is only used for browser-side navigations. |
| 166 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 166 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 167 switches::kEnableBrowserSideNavigation); | 167 switches::kEnableBrowserSideNavigation); |
| 168 } | 168 } |
| 169 | 169 |
| 170 scoped_ptr<NavigationURLLoader> MakeTestLoader( | 170 scoped_ptr<NavigationURLLoader> MakeTestLoader( |
| 171 const GURL& url, | 171 const GURL& url, |
| 172 NavigationURLLoaderDelegate* delegate) { | 172 NavigationURLLoaderDelegate* delegate) { |
| 173 FrameHostMsg_BeginNavigation_Params begin_params; | 173 BeginNavigationParams begin_params; |
| 174 CommonNavigationParams common_params; | 174 CommonNavigationParams common_params; |
| 175 begin_params.method = "GET"; | 175 begin_params.method = "GET"; |
| 176 common_params.url = url; | 176 common_params.url = url; |
| 177 scoped_ptr<NavigationRequestInfo> request_info( | 177 scoped_ptr<NavigationRequestInfo> request_info( |
| 178 new NavigationRequestInfo(begin_params)); | 178 new NavigationRequestInfo(begin_params, url, true, false, |
| 179 request_info->first_party_for_cookies = url; | 179 scoped_refptr<ResourceRequestBody>())); |
| 180 request_info->is_main_frame = true; | |
| 181 | 180 |
| 182 return NavigationURLLoader::Create( | 181 return NavigationURLLoader::Create( |
| 183 browser_context_.get(), 0, | 182 browser_context_.get(), 0, common_params, request_info.Pass(), |
| 184 common_params, request_info.Pass(), nullptr, delegate); | 183 delegate); |
| 185 } | 184 } |
| 186 | 185 |
| 187 // Helper function for fetching the body of a URL to a string. | 186 // Helper function for fetching the body of a URL to a string. |
| 188 std::string FetchURL(const GURL& url) { | 187 std::string FetchURL(const GURL& url) { |
| 189 net::TestDelegate delegate; | 188 net::TestDelegate delegate; |
| 190 net::URLRequestContext* request_context = | 189 net::URLRequestContext* request_context = |
| 191 browser_context_->GetResourceContext()->GetRequestContext(); | 190 browser_context_->GetResourceContext()->GetRequestContext(); |
| 192 scoped_ptr<net::URLRequest> request(request_context->CreateRequest( | 191 scoped_ptr<net::URLRequest> request(request_context->CreateRequest( |
| 193 url, net::DEFAULT_PRIORITY, &delegate, nullptr)); | 192 url, net::DEFAULT_PRIORITY, &delegate, nullptr)); |
| 194 request->Start(); | 193 request->Start(); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 | 379 |
| 381 // Release the body. | 380 // Release the body. |
| 382 delegate.ReleaseBody(); | 381 delegate.ReleaseBody(); |
| 383 base::RunLoop().RunUntilIdle(); | 382 base::RunLoop().RunUntilIdle(); |
| 384 | 383 |
| 385 // Verify that URLRequestTestJob no longer has anything paused. | 384 // Verify that URLRequestTestJob no longer has anything paused. |
| 386 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage()); | 385 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage()); |
| 387 } | 386 } |
| 388 | 387 |
| 389 } // namespace content | 388 } // namespace content |
| OLD | NEW |