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

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

Issue 1802383004: Fix in-page navigation after LoadDataWithBaseURL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: browser test Created 4 years, 9 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 | content/renderer/render_frame_impl.h » ('j') | content/renderer/render_frame_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 81e71a0c95388d93b912c59c1f77cbbb2f466105..d9d0ff01c0e31f6484dc05d380f2579e6cc26e7a 100644
--- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -203,6 +203,39 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
}
}
+IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
+ FragmentNavigateFromLoadDataWithBaseURL) {
+ const GURL base_url("http://baseurl");
+ const GURL history_url("http://historyurl");
+ const std::string data =
+ "<html><body>"
+ " <p id=\"frag\"><a id=\"fraglink\" href=\"#frag\">in-page nav</a></p>"
+ "</body></html>";
+
+ const NavigationControllerImpl& controller =
+ static_cast<const NavigationControllerImpl&>(
+ shell()->web_contents()->GetController());
+
+ // Load data and commit.
+ TestNavigationObserver same_tab_observer(shell()->web_contents(), 1);
+#if defined(OS_ANDROID)
+ shell()->LoadDataAsStringWithBaseURL(history_url, data, base_url);
+#else
+ shell()->LoadDataWithBaseURL(history_url, data, base_url);
+#endif
+ same_tab_observer.Wait();
+ EXPECT_EQ(1, controller.GetEntryCount());
+
+ // Performance a fragment navigation using a javascript: URL.
Charlie Reis 2016/03/16 19:30:34 Perform?
+ GURL js_url("javascript:document.location = '#frag';");
+ NavigateToURL(shell(), js_url);
+ EXPECT_EQ(2, controller.GetEntryCount());
Charlie Reis 2016/03/16 19:30:34 Please add some expectations about what the variou
boliu 2016/03/16 20:18:21 On trunk these values are Base url: empty virtual
boliu 2016/03/16 20:26:07 I uploaded PS3 with all the other comments address
boliu 2016/03/16 20:38:32 Err, wait, these are just the expectations for a j
+
+ // Passes if renderer is still alive.
+ EXPECT_TRUE(
+ ExecuteScript(shell()->web_contents(), "console.log('Success');"));
+}
+
IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, UniqueIDs) {
const NavigationControllerImpl& controller =
static_cast<const NavigationControllerImpl&>(
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.h » ('j') | content/renderer/render_frame_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698