| OLD | NEW |
| 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 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1823 Shell* new_shell = shao.GetShell(); | 1823 Shell* new_shell = shao.GetShell(); |
| 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. | |
| 1834 EXPECT_EQ(0, initial_rvh->GetEnabledBindings()); | |
| 1835 | 1833 |
| 1836 // Navigate to url1 and check bindings. | 1834 // Navigate to url1 and check bindings. |
| 1837 NavigateToURL(new_shell, url1); | 1835 NavigateToURL(new_shell, url1); |
| 1838 // The navigation should have used the first SiteInstance, otherwise | 1836 // The navigation should have used the first SiteInstance, otherwise |
| 1839 // |initial_rvh| did not have a chance to be used. | 1837 // |initial_rvh| did not have a chance to be used. |
| 1840 EXPECT_EQ(new_web_contents->GetSiteInstance(), site_instance1); | 1838 EXPECT_EQ(new_web_contents->GetSiteInstance(), site_instance1); |
| 1841 EXPECT_EQ(BINDINGS_POLICY_WEB_UI, | 1839 EXPECT_EQ(BINDINGS_POLICY_WEB_UI, |
| 1842 new_web_contents->GetRenderViewHost()->GetEnabledBindings()); | 1840 new_web_contents->GetMainFrame()->GetEnabledBindings()); |
| 1843 } | 1841 } |
| 1844 | 1842 |
| 1845 // crbug.com/424526 | 1843 // crbug.com/424526 |
| 1846 // The test loads a WebUI page in process-per-tab mode, then navigates to a | 1844 // 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 | 1845 // blank page and then to a regular page. The bug reproduces if blank page is |
| 1848 // visited in between WebUI and regular page. | 1846 // visited in between WebUI and regular page. |
| 1849 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, | 1847 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
| 1850 ForceSwapAfterWebUIBindings) { | 1848 ForceSwapAfterWebUIBindings) { |
| 1851 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 1849 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 1852 switches::kProcessPerTab); | 1850 switches::kProcessPerTab); |
| (...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3096 NavigationEntryImpl* entry = controller.GetLastCommittedEntry(); | 3094 NavigationEntryImpl* entry = controller.GetLastCommittedEntry(); |
| 3097 ASSERT_EQ(2U, entry->root_node()->children.size()); | 3095 ASSERT_EQ(2U, entry->root_node()->children.size()); |
| 3098 EXPECT_EQ(regular_web_url, | 3096 EXPECT_EQ(regular_web_url, |
| 3099 entry->root_node()->children[1]->frame_entry->url()); | 3097 entry->root_node()->children[1]->frame_entry->url()); |
| 3100 EXPECT_NE(root->current_frame_host()->GetSiteInstance(), | 3098 EXPECT_NE(root->current_frame_host()->GetSiteInstance(), |
| 3101 root->child_at(1)->current_frame_host()->GetSiteInstance()); | 3099 root->child_at(1)->current_frame_host()->GetSiteInstance()); |
| 3102 } | 3100 } |
| 3103 } | 3101 } |
| 3104 | 3102 |
| 3105 } // namespace content | 3103 } // namespace content |
| OLD | NEW |