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

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

Issue 1229133005: Fix for single-process WebUI transition CHECK failure. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 | « content/browser/frame_host/render_frame_host_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/render_frame_host_manager_unittest.cc
diff --git a/content/browser/frame_host/render_frame_host_manager_unittest.cc b/content/browser/frame_host/render_frame_host_manager_unittest.cc
index 7fc11299e538d96090c151d79c3c8ff0ec7ae099..fc1976f27ad4353227dd82f88544f65f62d4e212 100644
--- a/content/browser/frame_host/render_frame_host_manager_unittest.cc
+++ b/content/browser/frame_host/render_frame_host_manager_unittest.cc
@@ -1238,6 +1238,37 @@ TEST_F(RenderFrameHostManagerTest, WebUIWasCleared) {
EXPECT_FALSE(main_test_rfh()->frame_tree_node()->render_manager()->web_ui());
}
+// Test that WebUI can be navigated to in single-process mode.
+TEST_F(RenderFrameHostManagerTest,
+ CanNavigateBetweenNormalPagesAndWebUIInSingleProcess) {
+ const GURL kNormalUrl1("http://chromium.org");
+ const GURL kNormalUrl2("http://example.com");
+ const GURL kWebUIUrl("chrome://foo");
+
+ // We both set flag on RenderProcesHost and append the switch due to the fact
+ // that some code checks the switch directly instead of relying
+ // on RenderProcessHost
+ RenderProcessHost::SetRunRendererInProcess(true);
+ CommandLine::ForCurrentProcess()->AppendSwitch(switches::kSingleProcess);
+ set_should_create_webui(true);
+
+ RenderFrameHostManager* manager = static_cast<TestWebContents*>(
+ web_contents())->GetRenderManagerForTesting();
+
+ NavigateAndCommit(kNormalUrl1);
+ EXPECT_EQ(kNormalUrl1,
+ manager->current_frame_host()->GetSiteInstance()->GetSiteURL());
+ EXPECT_FALSE(manager->web_ui());
+ NavigateAndCommit(kWebUIUrl);
+ EXPECT_EQ(kWebUIUrl,
+ manager->current_frame_host()->GetSiteInstance()->GetSiteURL());
+ EXPECT_TRUE(manager->web_ui());
+ NavigateAndCommit(kNormalUrl2);
+ EXPECT_EQ(kNormalUrl2,
+ manager->current_frame_host()->GetSiteInstance()->GetSiteURL());
+ EXPECT_FALSE(manager->web_ui());
+}
+
// Tests that we don't end up in an inconsistent state if a page does a back and
// then reload. http://crbug.com/51680
// Also tests that only user-gesture navigations can interrupt cross-process
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698