| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 const scoped_refptr<ResourceResponse>& response) { | 50 const scoped_refptr<ResourceResponse>& response) { |
| 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 std::unique_ptr<NavigationData> navigation_data) { | 61 std::unique_ptr<NavigationData> navigation_data) { |
| 61 response_ = response; | 62 response_ = response; |
| 62 body_ = std::move(body); | 63 body_ = std::move(body); |
| 63 ASSERT_TRUE(response_started_); | 64 ASSERT_TRUE(response_started_); |
| 64 response_started_->Quit(); | 65 response_started_->Quit(); |
| 65 } | 66 } |
| 66 | 67 |
| 67 void TestNavigationURLLoaderDelegate::OnRequestFailed(bool in_cache, | 68 void TestNavigationURLLoaderDelegate::OnRequestFailed(bool in_cache, |
| 68 int net_error) { | 69 int net_error) { |
| 69 net_error_ = net_error; | 70 net_error_ = net_error; |
| 70 if (request_failed_) | 71 if (request_failed_) |
| 71 request_failed_->Quit(); | 72 request_failed_->Quit(); |
| 72 } | 73 } |
| 73 | 74 |
| 74 void TestNavigationURLLoaderDelegate::OnRequestStarted( | 75 void TestNavigationURLLoaderDelegate::OnRequestStarted( |
| 75 base::TimeTicks timestamp) { | 76 base::TimeTicks timestamp) { |
| 76 ASSERT_FALSE(timestamp.is_null()); | 77 ASSERT_FALSE(timestamp.is_null()); |
| 77 ++on_request_handled_counter_; | 78 ++on_request_handled_counter_; |
| 78 if (request_started_) | 79 if (request_started_) |
| 79 request_started_->Quit(); | 80 request_started_->Quit(); |
| 80 } | 81 } |
| 81 | 82 |
| 82 void TestNavigationURLLoaderDelegate::OnServiceWorkerEncountered() {} | 83 void TestNavigationURLLoaderDelegate::OnServiceWorkerEncountered() {} |
| 83 | 84 |
| 84 } // namespace content | 85 } // namespace content |
| OLD | NEW |