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

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

Issue 2566583002: Change allowed bindings to be per RenderFrame instead of per RenderView. (Closed)
Patch Set: Created 3 years, 11 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
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 10
(...skipping 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1824 WebContentsImpl* new_web_contents = static_cast<WebContentsImpl*>( 1824 WebContentsImpl* new_web_contents = static_cast<WebContentsImpl*>(
1825 new_shell->web_contents()); 1825 new_shell->web_contents());
1826 SiteInstance* site_instance2 = new_web_contents->GetSiteInstance(); 1826 SiteInstance* site_instance2 = new_web_contents->GetSiteInstance();
1827 1827
1828 EXPECT_NE(site_instance2, site_instance1); 1828 EXPECT_NE(site_instance2, site_instance1);
1829 EXPECT_TRUE(site_instance2->IsRelatedSiteInstance(site_instance1)); 1829 EXPECT_TRUE(site_instance2->IsRelatedSiteInstance(site_instance1));
1830 RenderViewHost* initial_rvh = new_web_contents-> 1830 RenderViewHost* initial_rvh = new_web_contents->
1831 GetRenderManagerForTesting()->GetSwappedOutRenderViewHost(site_instance1); 1831 GetRenderManagerForTesting()->GetSwappedOutRenderViewHost(site_instance1);
1832 ASSERT_TRUE(initial_rvh); 1832 ASSERT_TRUE(initial_rvh);
1833 // The following condition is what was causing the bug. 1833 // The following condition is what was causing the bug.
1834 EXPECT_EQ(0, initial_rvh->GetEnabledBindings()); 1834 // EXPECT_EQ(0, initial_rvh->GetMainFrame()->GetEnabledBindings());
Charlie Reis 2017/01/18 22:18:43 Ok. Can we replace it with an EXPECT_FALSE versio
Sam McNally 2017/01/19 05:30:37 No, that's true since both webui WebContents end u
Charlie Reis 2017/01/19 17:58:55 Acknowledged.
1835 1835
1836 // Navigate to url1 and check bindings. 1836 // Navigate to url1 and check bindings.
1837 NavigateToURL(new_shell, url1); 1837 NavigateToURL(new_shell, url1);
1838 // The navigation should have used the first SiteInstance, otherwise 1838 // The navigation should have used the first SiteInstance, otherwise
1839 // |initial_rvh| did not have a chance to be used. 1839 // |initial_rvh| did not have a chance to be used.
1840 EXPECT_EQ(new_web_contents->GetSiteInstance(), site_instance1); 1840 EXPECT_EQ(new_web_contents->GetSiteInstance(), site_instance1);
1841 EXPECT_EQ(BINDINGS_POLICY_WEB_UI, 1841 EXPECT_EQ(BINDINGS_POLICY_WEB_UI,
1842 new_web_contents->GetRenderViewHost()->GetEnabledBindings()); 1842 new_web_contents->GetMainFrame()->GetEnabledBindings());
1843 } 1843 }
1844 1844
1845 // crbug.com/424526 1845 // crbug.com/424526
1846 // The test loads a WebUI page in process-per-tab mode, then navigates to a 1846 // The test loads a WebUI page in process-per-tab mode, then navigates to a
1847 // blank page and then to a regular page. The bug reproduces if blank page is 1847 // blank page and then to a regular page. The bug reproduces if blank page is
1848 // visited in between WebUI and regular page. 1848 // visited in between WebUI and regular page.
1849 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, 1849 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
1850 ForceSwapAfterWebUIBindings) { 1850 ForceSwapAfterWebUIBindings) {
1851 base::CommandLine::ForCurrentProcess()->AppendSwitch( 1851 base::CommandLine::ForCurrentProcess()->AppendSwitch(
1852 switches::kProcessPerTab); 1852 switches::kProcessPerTab);
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after
3025 // the iframe's old RFH still has correct origin, even though it's pending 3025 // the iframe's old RFH still has correct origin, even though it's pending
3026 // deletion. 3026 // deletion.
3027 if (AreAllSitesIsolatedForTesting()) { 3027 if (AreAllSitesIsolatedForTesting()) {
3028 EXPECT_FALSE(child_rfh_b->is_active()); 3028 EXPECT_FALSE(child_rfh_b->is_active());
3029 EXPECT_NE(child_rfh_b, child->current_frame_host()); 3029 EXPECT_NE(child_rfh_b, child->current_frame_host());
3030 EXPECT_EQ(url::Origin(url_b), child_rfh_b->GetLastCommittedOrigin()); 3030 EXPECT_EQ(url::Origin(url_b), child_rfh_b->GetLastCommittedOrigin());
3031 } 3031 }
3032 } 3032 }
3033 3033
3034 } // namespace content 3034 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698