| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/macros.h" | 5 #include "base/macros.h" |
| 6 #include "content/browser/frame_host/navigation_handle_impl.h" | 6 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 7 #include "content/public/browser/navigation_throttle.h" | 7 #include "content/public/browser/navigation_throttle.h" |
| 8 #include "content/public/browser/ssl_status.h" | 8 #include "content/public/browser/ssl_status.h" |
| 9 #include "content/public/common/request_context_type.h" | 9 #include "content/public/common/request_context_type.h" |
| 10 #include "content/test/test_render_frame_host.h" | 10 #include "content/test/test_render_frame_host.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // it has not been called before. | 136 // it has not been called before. |
| 137 void SimulateWillProcessResponse() { | 137 void SimulateWillProcessResponse() { |
| 138 was_callback_called_ = false; | 138 was_callback_called_ = false; |
| 139 callback_result_ = NavigationThrottle::DEFER; | 139 callback_result_ = NavigationThrottle::DEFER; |
| 140 | 140 |
| 141 // It's safe to use base::Unretained since the NavigationHandle is owned by | 141 // It's safe to use base::Unretained since the NavigationHandle is owned by |
| 142 // the NavigationHandleImplTest. | 142 // the NavigationHandleImplTest. |
| 143 test_handle_->WillProcessResponse( | 143 test_handle_->WillProcessResponse( |
| 144 main_test_rfh(), | 144 main_test_rfh(), |
| 145 scoped_refptr<net::HttpResponseHeaders>(), SSLStatus(), | 145 scoped_refptr<net::HttpResponseHeaders>(), SSLStatus(), |
| 146 GlobalRequestID(), false, false, false, base::Closure(), |
| 146 base::Bind(&NavigationHandleImplTest::UpdateThrottleCheckResult, | 147 base::Bind(&NavigationHandleImplTest::UpdateThrottleCheckResult, |
| 147 base::Unretained(this))); | 148 base::Unretained(this))); |
| 148 } | 149 } |
| 149 | 150 |
| 150 // Returns the handle used in tests. | 151 // Returns the handle used in tests. |
| 151 NavigationHandleImpl* test_handle() const { return test_handle_.get(); } | 152 NavigationHandleImpl* test_handle() const { return test_handle_.get(); } |
| 152 | 153 |
| 153 // Whether the callback was called. | 154 // Whether the callback was called. |
| 154 bool was_callback_called() const { return was_callback_called_; } | 155 bool was_callback_called() const { return was_callback_called_; } |
| 155 | 156 |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 EXPECT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, callback_result()); | 663 EXPECT_EQ(NavigationThrottle::CANCEL_AND_IGNORE, callback_result()); |
| 663 EXPECT_EQ(0, cancel_throttle->will_start_calls()); | 664 EXPECT_EQ(0, cancel_throttle->will_start_calls()); |
| 664 EXPECT_EQ(0, cancel_throttle->will_redirect_calls()); | 665 EXPECT_EQ(0, cancel_throttle->will_redirect_calls()); |
| 665 EXPECT_EQ(1, cancel_throttle->will_process_response_calls()); | 666 EXPECT_EQ(1, cancel_throttle->will_process_response_calls()); |
| 666 EXPECT_EQ(0, proceed_throttle->will_start_calls()); | 667 EXPECT_EQ(0, proceed_throttle->will_start_calls()); |
| 667 EXPECT_EQ(0, proceed_throttle->will_redirect_calls()); | 668 EXPECT_EQ(0, proceed_throttle->will_redirect_calls()); |
| 668 EXPECT_EQ(0, proceed_throttle->will_process_response_calls()); | 669 EXPECT_EQ(0, proceed_throttle->will_process_response_calls()); |
| 669 } | 670 } |
| 670 | 671 |
| 671 } // namespace content | 672 } // namespace content |
| OLD | NEW |