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/stream_handle.h" | 8 #include "content/public/browser/stream_handle.h" |
9 #include "content/public/common/resource_response.h" | 9 #include "content/public/common/resource_response.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 const net::RedirectInfo& redirect_info, | 48 const net::RedirectInfo& redirect_info, |
49 const scoped_refptr<ResourceResponse>& response) { | 49 const scoped_refptr<ResourceResponse>& response) { |
50 redirect_info_ = redirect_info; | 50 redirect_info_ = redirect_info; |
51 redirect_response_ = response; | 51 redirect_response_ = response; |
52 ASSERT_TRUE(request_redirected_); | 52 ASSERT_TRUE(request_redirected_); |
53 request_redirected_->Quit(); | 53 request_redirected_->Quit(); |
54 } | 54 } |
55 | 55 |
56 void TestNavigationURLLoaderDelegate::OnResponseStarted( | 56 void TestNavigationURLLoaderDelegate::OnResponseStarted( |
57 const scoped_refptr<ResourceResponse>& response, | 57 const scoped_refptr<ResourceResponse>& response, |
58 scoped_ptr<StreamHandle> body) { | 58 std::unique_ptr<StreamHandle> body) { |
59 response_ = response; | 59 response_ = response; |
60 body_ = std::move(body); | 60 body_ = std::move(body); |
61 ASSERT_TRUE(response_started_); | 61 ASSERT_TRUE(response_started_); |
62 response_started_->Quit(); | 62 response_started_->Quit(); |
63 } | 63 } |
64 | 64 |
65 void TestNavigationURLLoaderDelegate::OnRequestFailed(bool in_cache, | 65 void TestNavigationURLLoaderDelegate::OnRequestFailed(bool in_cache, |
66 int net_error) { | 66 int net_error) { |
67 net_error_ = net_error; | 67 net_error_ = net_error; |
68 if (request_failed_) | 68 if (request_failed_) |
69 request_failed_->Quit(); | 69 request_failed_->Quit(); |
70 } | 70 } |
71 | 71 |
72 void TestNavigationURLLoaderDelegate::OnRequestStarted( | 72 void TestNavigationURLLoaderDelegate::OnRequestStarted( |
73 base::TimeTicks timestamp) { | 73 base::TimeTicks timestamp) { |
74 ASSERT_FALSE(timestamp.is_null()); | 74 ASSERT_FALSE(timestamp.is_null()); |
75 ++on_request_handled_counter_; | 75 ++on_request_handled_counter_; |
76 if (request_started_) | 76 if (request_started_) |
77 request_started_->Quit(); | 77 request_started_->Quit(); |
78 } | 78 } |
79 | 79 |
80 } // namespace content | 80 } // namespace content |
OLD | NEW |