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

Add Javascript back/forth/go to the NAVIGATION_TYPE_EXISTING_PAGE classification test.

BUG=none
TEST=more testing

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

Cr-Commit-Position: refs/heads/master@{#320793}
parent d9dc790d
......@@ -396,7 +396,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
GetFrameTree()->root();
{
// Back.
// Back from the browser side.
FrameNavigateParamsCapturer capturer(root);
shell()->web_contents()->GetController().GoBack();
capturer.Wait();
......@@ -408,7 +408,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
}
{
// Forward.
// Forward from the browser side.
FrameNavigateParamsCapturer capturer(root);
shell()->web_contents()->GetController().GoForward();
capturer.Wait();
......@@ -419,6 +419,58 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
EXPECT_EQ(NAVIGATION_TYPE_EXISTING_PAGE, capturer.details().type);
}
{
// Back from the renderer side.
FrameNavigateParamsCapturer capturer(root);
EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(),
"history.back()"));
capturer.Wait();
EXPECT_EQ(ui::PAGE_TRANSITION_TYPED
| ui::PAGE_TRANSITION_FORWARD_BACK
| ui::PAGE_TRANSITION_FROM_ADDRESS_BAR,
capturer.params().transition);
EXPECT_EQ(NAVIGATION_TYPE_EXISTING_PAGE, capturer.details().type);
}
{
// Forward from the renderer side.
FrameNavigateParamsCapturer capturer(root);
EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(),
"history.forward()"));
capturer.Wait();
EXPECT_EQ(ui::PAGE_TRANSITION_TYPED
| ui::PAGE_TRANSITION_FORWARD_BACK
| ui::PAGE_TRANSITION_FROM_ADDRESS_BAR,
capturer.params().transition);
EXPECT_EQ(NAVIGATION_TYPE_EXISTING_PAGE, capturer.details().type);
}
{
// Back from the renderer side via history.go().
FrameNavigateParamsCapturer capturer(root);
EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(),
"history.go(-1)"));
capturer.Wait();
EXPECT_EQ(ui::PAGE_TRANSITION_TYPED
| ui::PAGE_TRANSITION_FORWARD_BACK
| ui::PAGE_TRANSITION_FROM_ADDRESS_BAR,
capturer.params().transition);
EXPECT_EQ(NAVIGATION_TYPE_EXISTING_PAGE, capturer.details().type);
}
{
// Forward from the renderer side via history.go().
FrameNavigateParamsCapturer capturer(root);
EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(),
"history.go(1)"));
capturer.Wait();
EXPECT_EQ(ui::PAGE_TRANSITION_TYPED
| ui::PAGE_TRANSITION_FORWARD_BACK
| ui::PAGE_TRANSITION_FROM_ADDRESS_BAR,
capturer.params().transition);
EXPECT_EQ(NAVIGATION_TYPE_EXISTING_PAGE, capturer.details().type);
}
{
// Reload from the browser side.
FrameNavigateParamsCapturer capturer(root);
......
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