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

Unified Diff: content/browser/frame_host/navigation_controller_impl_browsertest.cc

Issue 1309323004: Create a NavigationEntry for the initial blank page. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GetEntryCount, more tests Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/navigation_controller_impl_browsertest.cc
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
index f566e71e8c5c94a1ae2cf6e55aa140e49720015a..d4286c172b45604a98b76d96c668dcd2bf37ad79 100644
--- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -180,6 +180,12 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
NavigationController& controller =
shell()->web_contents()->GetController();
+ // Before any navigation begins, we have one entry in the NavigationController
+ // for the initial about:blank, but the renderer thinks the history is empty.
+ // TODO(creis): Fix https://crbug.com/521729 and verify RendererHistoryLength
+ // is 0 before the first navigation. (Or check in a popup.)
+ EXPECT_EQ(1, controller.GetEntryCount());
+
EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,page1")));
EXPECT_EQ(1, controller.GetEntryCount());
EXPECT_EQ(1, RendererHistoryLength(shell()));
@@ -261,10 +267,9 @@ class NoNavigationsObserver : public WebContentsObserver {
} // namespace
// Some pages create a popup, then write an iframe into it. This causes a
-// subframe navigation without having any committed entry. Such navigations
-// just get thrown on the ground, but we shouldn't crash.
+// subframe navigation on the initial blank committed entry.
//
-// This test actually hits NAVIGATION_TYPE_NAV_IGNORE three times. Two of them,
+// This test actually hits RendererDidNavigate three times. Two of them,
// the initial window.open() and the iframe creation, don't try to create
// navigation entries, and the third, the new navigation, tries to.
IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, SubframeOnEmptyPage) {
@@ -286,13 +291,15 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, SubframeOnEmptyPage) {
GetFrameTree()->root();
// Make a new iframe in it.
+ // TODO(creis): This should actually navigate.
NoNavigationsObserver observer(new_shell->web_contents());
script = "var iframe = document.createElement('iframe');"
"iframe.src = 'data:text/html,<p>some page</p>';"
"document.body.appendChild(iframe);";
EXPECT_TRUE(content::ExecuteScript(new_root->current_frame_host(), script));
// The success check is of the last-committed entry, and there is none.
- WaitForLoadStopWithoutSuccessCheck(new_shell->web_contents());
+ //WaitForLoadStopWithoutSuccessCheck(new_shell->web_contents());
+ WaitForLoadStop(new_shell->web_contents());
ASSERT_EQ(1U, new_root->child_count());
ASSERT_NE(nullptr, new_root->child_at(0));
@@ -304,9 +311,9 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, SubframeOnEmptyPage) {
EXPECT_TRUE(content::ExecuteScript(
new_root->child_at(0)->current_frame_host(), script));
- // Success is not crashing, and not navigating.
- EXPECT_EQ(nullptr,
- new_shell->web_contents()->GetController().GetLastCommittedEntry());
+ // TODO(creis): Should be able to go back.
+ // TODO(creis): This currently only works in --site-per-process. I think it's
+ // because PageState might not get sent if page ID is -1?
}
namespace {

Powered by Google App Engine
This is Rietveld 408576698