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

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

Issue 2662533002: Convert NavigationControllerBrowserTest to use the new navigation callbacks. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_controller_impl.h" 5 #include "content/browser/frame_host/navigation_controller_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 4684 matching lines...) Expand 10 before | Expand all | Expand 10 after
4695 const base::string16& error_description, 4695 const base::string16& error_description,
4696 bool was_ignored_by_handler) override { 4696 bool was_ignored_by_handler) override {
4697 RenderFrameHostImpl* rfh = 4697 RenderFrameHostImpl* rfh =
4698 static_cast<RenderFrameHostImpl*>(render_frame_host); 4698 static_cast<RenderFrameHostImpl*>(render_frame_host);
4699 if (rfh->frame_tree_node()->frame_tree_node_id() != frame_tree_node_id_) 4699 if (rfh->frame_tree_node()->frame_tree_node_id() != frame_tree_node_id_)
4700 return; 4700 return;
4701 4701
4702 message_loop_runner_->Quit(); 4702 message_loop_runner_->Quit();
4703 } 4703 }
4704 4704
4705 void DidFailProvisionalLoad(
4706 RenderFrameHost* render_frame_host,
4707 const GURL& validated_url,
4708 int error_code,
4709 const base::string16& error_description,
4710 bool was_ignored_by_handler) override {
4711 RenderFrameHostImpl* rfh =
4712 static_cast<RenderFrameHostImpl*>(render_frame_host);
4713 if (rfh->frame_tree_node()->frame_tree_node_id() != frame_tree_node_id_)
4714 return;
4715
4716 message_loop_runner_->Quit();
4717 }
4718
4719 void DidFinishNavigation(NavigationHandle* handle) override { 4705 void DidFinishNavigation(NavigationHandle* handle) override {
4720 if (handle->GetFrameTreeNodeId() != frame_tree_node_id_) 4706 if (handle->HasCommitted() ||
4707 handle->GetFrameTreeNodeId() != frame_tree_node_id_) {
4721 return; 4708 return;
4722 if (handle->HasCommitted()) 4709 }
4723 return;
4724 4710
4725 message_loop_runner_->Quit(); 4711 message_loop_runner_->Quit();
4726 } 4712 }
4727 4713
4728 // The id of the FrameTreeNode whose navigations to observe. 4714 // The id of the FrameTreeNode whose navigations to observe.
4729 int frame_tree_node_id_; 4715 int frame_tree_node_id_;
4730 4716
4731 // The MessageLoopRunner used to spin the message loop. 4717 // The MessageLoopRunner used to spin the message loop.
4732 scoped_refptr<MessageLoopRunner> message_loop_runner_; 4718 scoped_refptr<MessageLoopRunner> message_loop_runner_;
4733 }; 4719 };
(...skipping 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after
6711 NavigationHandleCommitObserver handle_observer(shell()->web_contents(), 6697 NavigationHandleCommitObserver handle_observer(shell()->web_contents(),
6712 kFragmentURL); 6698 kFragmentURL);
6713 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL)); 6699 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL));
6714 6700
6715 EXPECT_TRUE(handle_observer.has_committed()); 6701 EXPECT_TRUE(handle_observer.has_committed());
6716 EXPECT_TRUE(handle_observer.was_same_page()); 6702 EXPECT_TRUE(handle_observer.was_same_page());
6717 EXPECT_FALSE(handle_observer.was_renderer_initiated()); 6703 EXPECT_FALSE(handle_observer.was_renderer_initiated());
6718 } 6704 }
6719 6705
6720 } // namespace content 6706 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698