| 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/global_request_id.h" | 8 #include "content/public/browser/global_request_id.h" |
| 9 #include "content/public/browser/navigation_data.h" | 9 #include "content/public/browser/navigation_data.h" |
| 10 #include "content/public/browser/stream_handle.h" | 10 #include "content/public/browser/stream_handle.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 void TestNavigationURLLoaderDelegate::OnResponseStarted( | 58 void TestNavigationURLLoaderDelegate::OnResponseStarted( |
| 59 const scoped_refptr<ResourceResponse>& response, | 59 const scoped_refptr<ResourceResponse>& response, |
| 60 std::unique_ptr<StreamHandle> body, | 60 std::unique_ptr<StreamHandle> body, |
| 61 const SSLStatus& ssl_status, | 61 const SSLStatus& ssl_status, |
| 62 std::unique_ptr<NavigationData> navigation_data, | 62 std::unique_ptr<NavigationData> navigation_data, |
| 63 const GlobalRequestID& request_id, | 63 const GlobalRequestID& request_id, |
| 64 bool is_download, | 64 bool is_download, |
| 65 bool is_stream) { | 65 bool is_stream) { |
| 66 response_ = response; | 66 response_ = response; |
| 67 body_ = std::move(body); | 67 body_ = std::move(body); |
| 68 ASSERT_TRUE(response_started_); | 68 if (response_started_) |
| 69 response_started_->Quit(); | 69 response_started_->Quit(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void TestNavigationURLLoaderDelegate::OnRequestFailed(bool in_cache, | 72 void TestNavigationURLLoaderDelegate::OnRequestFailed(bool in_cache, |
| 73 int net_error) { | 73 int net_error) { |
| 74 net_error_ = net_error; | 74 net_error_ = net_error; |
| 75 if (request_failed_) | 75 if (request_failed_) |
| 76 request_failed_->Quit(); | 76 request_failed_->Quit(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void TestNavigationURLLoaderDelegate::OnRequestStarted( | 79 void TestNavigationURLLoaderDelegate::OnRequestStarted( |
| 80 base::TimeTicks timestamp) { | 80 base::TimeTicks timestamp) { |
| 81 ASSERT_FALSE(timestamp.is_null()); | 81 ASSERT_FALSE(timestamp.is_null()); |
| 82 ++on_request_handled_counter_; | 82 ++on_request_handled_counter_; |
| 83 if (request_started_) | 83 if (request_started_) |
| 84 request_started_->Quit(); | 84 request_started_->Quit(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace content | 87 } // namespace content |
| OLD | NEW |