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

Unified Diff: chrome/browser/sessions/session_restore_browsertest.cc

Issue 2275643003: Notify about PageState changes after an AUTO_SUBFRAME commit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switch to ASSERT_TRUE. Created 4 years, 4 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
« no previous file with comments | « no previous file | chrome/test/data/iframe_blank.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_restore_browsertest.cc
diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc
index 60b2220401db23b0838287c771430eb5189eb434..fc3ad3d09ae4736819b8df8412ea2fbc011006b2 100644
--- a/chrome/browser/sessions/session_restore_browsertest.cc
+++ b/chrome/browser/sessions/session_restore_browsertest.cc
@@ -1281,6 +1281,44 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreWithNavigateSelectedTab) {
new_browser->tab_strip_model()->GetActiveWebContents()->GetURL());
}
+// Ensure that AUTO_SUBFRAME navigations in subframes are restored.
+// See https://crbug.com/638088.
+IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreAfterAutoSubframe) {
+ // Load a page with a blank iframe, then navigate the iframe. This will be an
+ // auto-subframe commit, and we expect it to be restored.
+ GURL main_url(ui_test_utils::GetTestUrl(
+ base::FilePath(base::FilePath::kCurrentDirectory),
+ base::FilePath(FILE_PATH_LITERAL("iframe_blank.html"))));
+ GURL subframe_url(ui_test_utils::GetTestUrl(
+ base::FilePath(base::FilePath::kCurrentDirectory),
+ base::FilePath(FILE_PATH_LITERAL("title1.html"))));
+ ui_test_utils::NavigateToURL(browser(), main_url);
+ content::TestNavigationObserver observer(
+ browser()->tab_strip_model()->GetActiveWebContents());
+ std::string nav_frame_script =
+ "frames[0].location.href = '" + subframe_url.spec() + "';";
+ ASSERT_TRUE(content::ExecuteScript(
+ browser()->tab_strip_model()->GetActiveWebContents(), nav_frame_script));
+ observer.Wait();
+
+ // Restore the session.
+ Browser* new_browser = QuitBrowserAndRestore(browser(), 1);
+ ASSERT_EQ(1u, active_browser_list_->size());
+ ASSERT_EQ(1, new_browser->tab_strip_model()->count());
+
+ // The restored page should have the right iframe.
+ ASSERT_EQ(main_url,
+ new_browser->tab_strip_model()->GetActiveWebContents()->GetURL());
+ std::string actual_frame_url;
+ std::string frame_url_script =
+ "window.domAutomationController.send("
+ "frames[0].location.href);";
+ EXPECT_TRUE(content::ExecuteScriptAndExtractString(
+ new_browser->tab_strip_model()->GetActiveWebContents(), frame_url_script,
+ &actual_frame_url));
+ EXPECT_EQ(subframe_url.possibly_invalid_spec(), actual_frame_url);
+}
+
// Do a clobber restore from the new tab page. This test follows the code path
// of a crash followed by the user clicking restore from the new tab page.
IN_PROC_BROWSER_TEST_F(SessionRestoreTest, ClobberRestoreTest) {
« no previous file with comments | « no previous file | chrome/test/data/iframe_blank.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698