| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/test/test_navigation_url_loader_delegate.h" | 5 #include "content/test/test_navigation_url_loader_delegate.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "content/public/browser/navigation_data.h" | 8 #include "content/public/browser/navigation_data.h" |
| 9 #include "content/public/browser/stream_handle.h" | 9 #include "content/public/browser/stream_handle.h" |
| 10 #include "content/public/common/resource_response.h" | 10 #include "content/public/common/resource_response.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 redirect_info_ = redirect_info; | 51 redirect_info_ = redirect_info; |
| 52 redirect_response_ = response; | 52 redirect_response_ = response; |
| 53 ASSERT_TRUE(request_redirected_); | 53 ASSERT_TRUE(request_redirected_); |
| 54 request_redirected_->Quit(); | 54 request_redirected_->Quit(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void TestNavigationURLLoaderDelegate::OnResponseStarted( | 57 void TestNavigationURLLoaderDelegate::OnResponseStarted( |
| 58 const scoped_refptr<ResourceResponse>& response, | 58 const scoped_refptr<ResourceResponse>& response, |
| 59 std::unique_ptr<StreamHandle> body, | 59 std::unique_ptr<StreamHandle> body, |
| 60 const SSLStatus& ssl_status, | 60 const SSLStatus& ssl_status, |
| 61 std::unique_ptr<NavigationData> navigation_data) { | 61 std::unique_ptr<NavigationData> navigation_data, |
| 62 bool is_download) { |
| 62 response_ = response; | 63 response_ = response; |
| 63 body_ = std::move(body); | 64 body_ = std::move(body); |
| 64 ASSERT_TRUE(response_started_); | 65 ASSERT_TRUE(response_started_); |
| 65 response_started_->Quit(); | 66 response_started_->Quit(); |
| 66 } | 67 } |
| 67 | 68 |
| 68 void TestNavigationURLLoaderDelegate::OnRequestFailed(bool in_cache, | 69 void TestNavigationURLLoaderDelegate::OnRequestFailed(bool in_cache, |
| 69 int net_error) { | 70 int net_error) { |
| 70 net_error_ = net_error; | 71 net_error_ = net_error; |
| 71 if (request_failed_) | 72 if (request_failed_) |
| 72 request_failed_->Quit(); | 73 request_failed_->Quit(); |
| 73 } | 74 } |
| 74 | 75 |
| 75 void TestNavigationURLLoaderDelegate::OnRequestStarted( | 76 void TestNavigationURLLoaderDelegate::OnRequestStarted( |
| 76 base::TimeTicks timestamp) { | 77 base::TimeTicks timestamp) { |
| 77 ASSERT_FALSE(timestamp.is_null()); | 78 ASSERT_FALSE(timestamp.is_null()); |
| 78 ++on_request_handled_counter_; | 79 ++on_request_handled_counter_; |
| 79 if (request_started_) | 80 if (request_started_) |
| 80 request_started_->Quit(); | 81 request_started_->Quit(); |
| 81 } | 82 } |
| 82 | 83 |
| 83 } // namespace content | 84 } // namespace content |
| OLD | NEW |