Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 2682313002: Introduce NavigationSimulator to use in unit tests (Closed)
Patch Set: Added same-page navigation simulation Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/browser/frame_host/navigation_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/debug/dump_without_crashing.h" 9 #include "base/debug/dump_without_crashing.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 } 640 }
641 } 641 }
642 642
643 void NavigationHandleImpl::Transfer() { 643 void NavigationHandleImpl::Transfer() {
644 DCHECK(!IsBrowserSideNavigationEnabled()); 644 DCHECK(!IsBrowserSideNavigationEnabled());
645 // This is an actual transfer. Inform the NavigationResourceThrottle. This 645 // This is an actual transfer. Inform the NavigationResourceThrottle. This
646 // will allow to mark the URLRequest as transferring. When it is marked as 646 // will allow to mark the URLRequest as transferring. When it is marked as
647 // transferring, the URLRequest can no longer be cancelled by its original 647 // transferring, the URLRequest can no longer be cancelled by its original
648 // RenderFrame. Instead it will persist until being picked up by the transfer 648 // RenderFrame. Instead it will persist until being picked up by the transfer
649 // RenderFrame, even if the original RenderFrame is destroyed. 649 // RenderFrame, even if the original RenderFrame is destroyed.
650 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, transfer_callback_); 650 // Note: |transfer_callback_| can be null in unit tests.
651 if (!transfer_callback_.is_null())
652 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, transfer_callback_);
651 transfer_callback_.Reset(); 653 transfer_callback_.Reset();
652 } 654 }
653 655
654 NavigationThrottle::ThrottleCheckResult 656 NavigationThrottle::ThrottleCheckResult
655 NavigationHandleImpl::CheckWillStartRequest() { 657 NavigationHandleImpl::CheckWillStartRequest() {
656 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START); 658 DCHECK(state_ == WILL_SEND_REQUEST || state_ == DEFERRING_START);
657 DCHECK(state_ != WILL_SEND_REQUEST || next_index_ == 0); 659 DCHECK(state_ != WILL_SEND_REQUEST || next_index_ == 0);
658 DCHECK(state_ != DEFERRING_START || next_index_ != 0); 660 DCHECK(state_ != DEFERRING_START || next_index_ != 0);
659 for (size_t i = next_index_; i < throttles_.size(); ++i) { 661 for (size_t i = next_index_; i < throttles_.size(); ++i) {
660 NavigationThrottle::ThrottleCheckResult result = 662 NavigationThrottle::ThrottleCheckResult result =
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 content::AncestorThrottle::MaybeCreateThrottleFor(this); 885 content::AncestorThrottle::MaybeCreateThrottleFor(this);
884 if (ancestor_throttle) 886 if (ancestor_throttle)
885 throttles_.push_back(std::move(ancestor_throttle)); 887 throttles_.push_back(std::move(ancestor_throttle));
886 888
887 throttles_.insert(throttles_.begin(), 889 throttles_.insert(throttles_.begin(),
888 std::make_move_iterator(throttles_to_register.begin()), 890 std::make_move_iterator(throttles_to_register.begin()),
889 std::make_move_iterator(throttles_to_register.end())); 891 std::make_move_iterator(throttles_to_register.end()));
890 } 892 }
891 893
892 } // namespace content 894 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698