| 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 <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1821 WebContentsImpl* new_web_contents = static_cast<WebContentsImpl*>( | 1821 WebContentsImpl* new_web_contents = static_cast<WebContentsImpl*>( |
| 1822 new_shell->web_contents()); | 1822 new_shell->web_contents()); |
| 1823 SiteInstance* site_instance2 = new_web_contents->GetSiteInstance(); | 1823 SiteInstance* site_instance2 = new_web_contents->GetSiteInstance(); |
| 1824 | 1824 |
| 1825 EXPECT_NE(site_instance2, site_instance1); | 1825 EXPECT_NE(site_instance2, site_instance1); |
| 1826 EXPECT_TRUE(site_instance2->IsRelatedSiteInstance(site_instance1)); | 1826 EXPECT_TRUE(site_instance2->IsRelatedSiteInstance(site_instance1)); |
| 1827 RenderViewHost* initial_rvh = new_web_contents-> | 1827 RenderViewHost* initial_rvh = new_web_contents-> |
| 1828 GetRenderManagerForTesting()->GetSwappedOutRenderViewHost(site_instance1); | 1828 GetRenderManagerForTesting()->GetSwappedOutRenderViewHost(site_instance1); |
| 1829 ASSERT_TRUE(initial_rvh); | 1829 ASSERT_TRUE(initial_rvh); |
| 1830 // The following condition is what was causing the bug. | 1830 // The following condition is what was causing the bug. |
| 1831 EXPECT_EQ(0, initial_rvh->GetEnabledBindings()); | 1831 EXPECT_FALSE(initial_rvh->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI); |
| 1832 | 1832 |
| 1833 // Navigate to url1 and check bindings. | 1833 // Navigate to url1 and check bindings. |
| 1834 NavigateToURL(new_shell, url1); | 1834 NavigateToURL(new_shell, url1); |
| 1835 // The navigation should have used the first SiteInstance, otherwise | 1835 // The navigation should have used the first SiteInstance, otherwise |
| 1836 // |initial_rvh| did not have a chance to be used. | 1836 // |initial_rvh| did not have a chance to be used. |
| 1837 EXPECT_EQ(new_web_contents->GetSiteInstance(), site_instance1); | 1837 EXPECT_EQ(new_web_contents->GetSiteInstance(), site_instance1); |
| 1838 EXPECT_EQ(BINDINGS_POLICY_WEB_UI, | 1838 EXPECT_TRUE(new_web_contents->GetRenderViewHost() |
| 1839 new_web_contents->GetRenderViewHost()->GetEnabledBindings()); | 1839 ->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI); |
| 1840 } | 1840 } |
| 1841 | 1841 |
| 1842 // crbug.com/424526 | 1842 // crbug.com/424526 |
| 1843 // The test loads a WebUI page in process-per-tab mode, then navigates to a | 1843 // The test loads a WebUI page in process-per-tab mode, then navigates to a |
| 1844 // blank page and then to a regular page. The bug reproduces if blank page is | 1844 // blank page and then to a regular page. The bug reproduces if blank page is |
| 1845 // visited in between WebUI and regular page. | 1845 // visited in between WebUI and regular page. |
| 1846 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, | 1846 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
| 1847 ForceSwapAfterWebUIBindings) { | 1847 ForceSwapAfterWebUIBindings) { |
| 1848 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 1848 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 1849 switches::kProcessPerTab); | 1849 switches::kProcessPerTab); |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2404 popup_root->current_frame_host()->render_view_host()->IsRenderViewLive()); | 2404 popup_root->current_frame_host()->render_view_host()->IsRenderViewLive()); |
| 2405 | 2405 |
| 2406 // Navigate the main tab to the site of the popup. This will cause the | 2406 // Navigate the main tab to the site of the popup. This will cause the |
| 2407 // RenderView for b.com in the main tab to be recreated. If the issue | 2407 // RenderView for b.com in the main tab to be recreated. If the issue |
| 2408 // is not fixed, this will result in process crash and failing test. | 2408 // is not fixed, this will result in process crash and failing test. |
| 2409 EXPECT_TRUE(NavigateToURL( | 2409 EXPECT_TRUE(NavigateToURL( |
| 2410 shell(), embedded_test_server()->GetURL("b.com", "/title3.html"))); | 2410 shell(), embedded_test_server()->GetURL("b.com", "/title3.html"))); |
| 2411 } | 2411 } |
| 2412 | 2412 |
| 2413 } // namespace content | 2413 } // namespace content |
| OLD | NEW |