Commit 73777224 authored by avi's avatar avi Committed by Commit bot

PlzNavigate: Trigger navigation via the NavigationController in the NavigatorImpl unit tests.

BUG=369661
TEST=tests should stay passing

Review URL: https://codereview.chromium.org/1010243002

Cr-Commit-Position: refs/heads/master@{#321392}
parent b7bffcae
...@@ -48,27 +48,20 @@ class NavigatorTestWithBrowserSideNavigation ...@@ -48,27 +48,20 @@ class NavigatorTestWithBrowserSideNavigation
void RequestNavigation(FrameTreeNode* node, const GURL& url) { void RequestNavigation(FrameTreeNode* node, const GURL& url) {
RequestNavigationWithParameters(node, url, Referrer(), RequestNavigationWithParameters(node, url, Referrer(),
ui::PAGE_TRANSITION_LINK, ui::PAGE_TRANSITION_LINK);
NavigationController::NO_RELOAD);
} }
void RequestNavigationWithParameters( void RequestNavigationWithParameters(
FrameTreeNode* node, FrameTreeNode* node,
const GURL& url, const GURL& url,
const Referrer& referrer, const Referrer& referrer,
ui::PageTransition transition_type, ui::PageTransition transition_type) {
NavigationController::ReloadType reload_type) { NavigationController::LoadURLParams load_params(url);
scoped_ptr<NavigationEntryImpl> entry( load_params.frame_tree_node_id = node->frame_tree_node_id();
NavigationEntryImpl::FromNavigationEntry( load_params.referrer = referrer;
NavigationController::CreateNavigationEntry( load_params.transition_type = transition_type;
url,
referrer, controller().LoadURLWithParams(load_params);
transition_type,
false,
std::string(),
controller().GetBrowserContext())));
static_cast<NavigatorImpl*>(node->navigator())->RequestNavigation(
node, *entry, reload_type, base::TimeTicks::Now());
} }
NavigationRequest* GetNavigationRequestForFrameTreeNode( NavigationRequest* GetNavigationRequestForFrameTreeNode(
...@@ -772,9 +765,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, Reload) { ...@@ -772,9 +765,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, Reload) {
contents()->NavigateAndCommit(kUrl); contents()->NavigateAndCommit(kUrl);
FrameTreeNode* node = main_test_rfh()->frame_tree_node(); FrameTreeNode* node = main_test_rfh()->frame_tree_node();
RequestNavigationWithParameters(node, kUrl, Referrer(), controller().Reload(false);
ui::PAGE_TRANSITION_LINK,
NavigationController::RELOAD);
// A NavigationRequest should have been generated. // A NavigationRequest should have been generated.
NavigationRequest* main_request = GetNavigationRequestForFrameTreeNode(node); NavigationRequest* main_request = GetNavigationRequestForFrameTreeNode(node);
ASSERT_TRUE(main_request != NULL); ASSERT_TRUE(main_request != NULL);
...@@ -787,9 +778,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, Reload) { ...@@ -787,9 +778,7 @@ TEST_F(NavigatorTestWithBrowserSideNavigation, Reload) {
EXPECT_FALSE(GetSpeculativeRenderFrameHost(node)); EXPECT_FALSE(GetSpeculativeRenderFrameHost(node));
// Now do a shift+reload. // Now do a shift+reload.
RequestNavigationWithParameters(node, kUrl, Referrer(), controller().ReloadIgnoringCache(false);
ui::PAGE_TRANSITION_LINK,
NavigationController::RELOAD_IGNORING_CACHE);
// A NavigationRequest should have been generated. // A NavigationRequest should have been generated.
main_request = GetNavigationRequestForFrameTreeNode(node); main_request = GetNavigationRequestForFrameTreeNode(node);
ASSERT_TRUE(main_request != NULL); ASSERT_TRUE(main_request != NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment