| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/public/test/navigation_simulator.h" | 5 #include "content/public/test/navigation_simulator.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "content/browser/frame_host/navigation_handle_impl.h" | 10 #include "content/browser/frame_host/navigation_handle_impl.h" |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 switch (result) { | 585 switch (result) { |
| 586 case NavigationThrottle::PROCEED: | 586 case NavigationThrottle::PROCEED: |
| 587 case NavigationThrottle::DEFER: | 587 case NavigationThrottle::DEFER: |
| 588 NOTREACHED(); | 588 NOTREACHED(); |
| 589 break; | 589 break; |
| 590 case NavigationThrottle::CANCEL: | 590 case NavigationThrottle::CANCEL: |
| 591 case NavigationThrottle::CANCEL_AND_IGNORE: | 591 case NavigationThrottle::CANCEL_AND_IGNORE: |
| 592 error_code = net::ERR_ABORTED; | 592 error_code = net::ERR_ABORTED; |
| 593 break; | 593 break; |
| 594 case NavigationThrottle::BLOCK_REQUEST: | 594 case NavigationThrottle::BLOCK_REQUEST: |
| 595 case NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE: |
| 595 error_code = net::ERR_BLOCKED_BY_CLIENT; | 596 error_code = net::ERR_BLOCKED_BY_CLIENT; |
| 596 break; | 597 break; |
| 597 case NavigationThrottle::BLOCK_RESPONSE: | 598 case NavigationThrottle::BLOCK_RESPONSE: |
| 598 error_code = net::ERR_BLOCKED_BY_RESPONSE; | 599 error_code = net::ERR_BLOCKED_BY_RESPONSE; |
| 599 break; | 600 break; |
| 600 }; | 601 }; |
| 601 | 602 |
| 602 FrameHostMsg_DidFailProvisionalLoadWithError_Params error_params; | 603 FrameHostMsg_DidFailProvisionalLoadWithError_Params error_params; |
| 603 error_params.error_code = error_code; | 604 error_params.error_code = error_code; |
| 604 error_params.url = navigation_url_; | 605 error_params.url = navigation_url_; |
| 605 render_frame_host_->OnMessageReceived( | 606 render_frame_host_->OnMessageReceived( |
| 606 FrameHostMsg_DidFailProvisionalLoadWithError( | 607 FrameHostMsg_DidFailProvisionalLoadWithError( |
| 607 render_frame_host_->GetRoutingID(), error_params)); | 608 render_frame_host_->GetRoutingID(), error_params)); |
| 608 bool should_result_in_error_page = error_code != net::ERR_ABORTED; | 609 bool should_result_in_error_page = error_code != net::ERR_ABORTED; |
| 609 if (!should_result_in_error_page) { | 610 if (!should_result_in_error_page) { |
| 610 render_frame_host_->OnMessageReceived( | 611 render_frame_host_->OnMessageReceived( |
| 611 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID())); | 612 FrameHostMsg_DidStopLoading(render_frame_host_->GetRoutingID())); |
| 612 CHECK_EQ(1, num_did_finish_navigation_called_); | 613 CHECK_EQ(1, num_did_finish_navigation_called_); |
| 613 } else { | 614 } else { |
| 614 CHECK_EQ(0, num_did_finish_navigation_called_); | 615 CHECK_EQ(0, num_did_finish_navigation_called_); |
| 615 } | 616 } |
| 616 } | 617 } |
| 617 | 618 |
| 618 } // namespace content | 619 } // namespace content |
| OLD | NEW |