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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 return NavigationURLLoader::Create( | 188 return NavigationURLLoader::Create( |
189 browser_context_.get(), 0, request_info.Pass(), delegate); | 189 browser_context_.get(), 0, request_info.Pass(), delegate); |
190 } | 190 } |
191 | 191 |
192 // Helper function for fetching the body of a URL to a string. | 192 // Helper function for fetching the body of a URL to a string. |
193 std::string FetchURL(const GURL& url) { | 193 std::string FetchURL(const GURL& url) { |
194 net::TestDelegate delegate; | 194 net::TestDelegate delegate; |
195 net::URLRequestContext* request_context = | 195 net::URLRequestContext* request_context = |
196 browser_context_->GetResourceContext()->GetRequestContext(); | 196 browser_context_->GetResourceContext()->GetRequestContext(); |
197 scoped_ptr<net::URLRequest> request(request_context->CreateRequest( | 197 scoped_ptr<net::URLRequest> request(request_context->CreateRequest( |
198 url, net::DEFAULT_PRIORITY, &delegate, nullptr)); | 198 url, net::DEFAULT_PRIORITY, &delegate)); |
199 request->Start(); | 199 request->Start(); |
200 base::RunLoop().Run(); | 200 base::RunLoop().Run(); |
201 | 201 |
202 EXPECT_TRUE(request->status().is_success()); | 202 EXPECT_TRUE(request->status().is_success()); |
203 EXPECT_EQ(200, request->response_headers()->response_code()); | 203 EXPECT_EQ(200, request->response_headers()->response_code()); |
204 return delegate.data_received(); | 204 return delegate.data_received(); |
205 } | 205 } |
206 | 206 |
207 protected: | 207 protected: |
208 TestBrowserThreadBundle thread_bundle_; | 208 TestBrowserThreadBundle thread_bundle_; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 393 |
394 // Release the body. | 394 // Release the body. |
395 delegate.ReleaseBody(); | 395 delegate.ReleaseBody(); |
396 base::RunLoop().RunUntilIdle(); | 396 base::RunLoop().RunUntilIdle(); |
397 | 397 |
398 // Verify that URLRequestTestJob no longer has anything paused. | 398 // Verify that URLRequestTestJob no longer has anything paused. |
399 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage()); | 399 EXPECT_FALSE(net::URLRequestTestJob::ProcessOnePendingMessage()); |
400 } | 400 } |
401 | 401 |
402 } // namespace content | 402 } // namespace content |
OLD | NEW |