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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager_unittest.cc

Issue 298133002: Don't ensure, in single-process mode, that WebUI render views are the only ones in the process, as … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests + review suggestion Created 6 years, 6 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "content/browser/frame_host/cross_site_transferring_request.h" 7 #include "content/browser/frame_host/cross_site_transferring_request.h"
8 #include "content/browser/frame_host/navigation_controller_impl.h" 8 #include "content/browser/frame_host/navigation_controller_impl.h"
9 #include "content/browser/frame_host/navigation_entry_impl.h" 9 #include "content/browser/frame_host/navigation_entry_impl.h"
10 #include "content/browser/frame_host/navigator.h" 10 #include "content/browser/frame_host/navigator.h"
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 // used yet. UpdateStateForNavigate() took the short cut path. 1085 // used yet. UpdateStateForNavigate() took the short cut path.
1086 EXPECT_FALSE(manager->pending_web_ui()); 1086 EXPECT_FALSE(manager->pending_web_ui());
1087 EXPECT_TRUE(manager->web_ui()); 1087 EXPECT_TRUE(manager->web_ui());
1088 1088
1089 // Commit. 1089 // Commit.
1090 manager->DidNavigateFrame(host); 1090 manager->DidNavigateFrame(host);
1091 EXPECT_TRUE( 1091 EXPECT_TRUE(
1092 host->render_view_host()->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI); 1092 host->render_view_host()->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI);
1093 } 1093 }
1094 1094
1095 TEST_F(RenderFrameHostManagerTest,
1096 CanNavigateBetweenNormalPagesAndWebUIInSingleProcess) {
nasko 2014/05/28 17:02:04 This test doesn't seem to work as expected. The re
1097 const GURL kNormalUrl1("http://chromium.org");
1098 const GURL kNormalUrl2("http://example.com");
1099 const GURL kWebUIUrl("chrome://foo");
1100
1101 RenderProcessHost::SetRunRendererInProcess(true);
1102 set_should_create_webui(true);
1103
1104 RenderFrameHostManager* manager =
1105 static_cast<TestWebContents*>(
1106 web_contents())->GetRenderManagerForTesting();
nasko 2014/05/28 17:02:04 nit: wrong indent
1107
1108 NavigateAndCommit(kNormalUrl1);
1109 EXPECT_EQ(kNormalUrl1,
1110 manager->current_frame_host()->GetSiteInstance()->GetSiteURL());
1111 EXPECT_FALSE(manager->web_ui());
1112 NavigateAndCommit(kWebUIUrl);
1113 EXPECT_EQ(kWebUIUrl,
1114 manager->current_frame_host()->GetSiteInstance()->GetSiteURL());
1115 EXPECT_TRUE(manager->web_ui());
1116 NavigateAndCommit(kNormalUrl2);
1117 EXPECT_EQ(kNormalUrl2,
1118 manager->current_frame_host()->GetSiteInstance()->GetSiteURL());
1119 EXPECT_FALSE(manager->web_ui());
1120 }
1121
1095 // Tests that we can open a WebUI link in a new tab from a WebUI page and still 1122 // Tests that we can open a WebUI link in a new tab from a WebUI page and still
1096 // grant the correct bindings. http://crbug.com/189101. 1123 // grant the correct bindings. http://crbug.com/189101.
1097 TEST_F(RenderFrameHostManagerTest, WebUIInNewTab) { 1124 TEST_F(RenderFrameHostManagerTest, WebUIInNewTab) {
1098 set_should_create_webui(true); 1125 set_should_create_webui(true);
1099 SiteInstance* blank_instance = SiteInstance::Create(browser_context()); 1126 SiteInstance* blank_instance = SiteInstance::Create(browser_context());
1100 1127
1101 // Create a blank tab. 1128 // Create a blank tab.
1102 scoped_ptr<TestWebContents> web_contents1( 1129 scoped_ptr<TestWebContents> web_contents1(
1103 TestWebContents::Create(browser_context(), blank_instance)); 1130 TestWebContents::Create(browser_context(), blank_instance));
1104 RenderFrameHostManager* manager1 = 1131 RenderFrameHostManager* manager1 =
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1838 pending_rfh->GetSiteInstance())->increment_active_view_count(); 1865 pending_rfh->GetSiteInstance())->increment_active_view_count();
1839 1866
1840 main_test_rfh()->OnMessageReceived( 1867 main_test_rfh()->OnMessageReceived(
1841 FrameHostMsg_BeforeUnload_ACK(0, false, now, now)); 1868 FrameHostMsg_BeforeUnload_ACK(0, false, now, now));
1842 EXPECT_FALSE(contents()->cross_navigation_pending()); 1869 EXPECT_FALSE(contents()->cross_navigation_pending());
1843 EXPECT_FALSE(rvh_deleted_observer.deleted()); 1870 EXPECT_FALSE(rvh_deleted_observer.deleted());
1844 } 1871 }
1845 } 1872 }
1846 1873
1847 } // namespace content 1874 } // namespace content
OLDNEW
« 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