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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/test/histogram_tester.h" | 8 #include "base/test/histogram_tester.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" | 10 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "content/public/browser/render_process_host.h" | 26 #include "content/public/browser/render_process_host.h" |
27 #include "content/public/browser/render_widget_host_iterator.h" | 27 #include "content/public/browser/render_widget_host_iterator.h" |
28 #include "content/public/browser/web_contents_delegate.h" | 28 #include "content/public/browser/web_contents_delegate.h" |
29 #include "content/public/browser/web_contents_observer.h" | 29 #include "content/public/browser/web_contents_observer.h" |
30 #include "content/public/browser/web_ui_controller.h" | 30 #include "content/public/browser/web_ui_controller.h" |
31 #include "content/public/common/bindings_policy.h" | 31 #include "content/public/common/bindings_policy.h" |
32 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
33 #include "content/public/common/javascript_message_type.h" | 33 #include "content/public/common/javascript_message_type.h" |
34 #include "content/public/common/url_constants.h" | 34 #include "content/public/common/url_constants.h" |
35 #include "content/public/common/url_utils.h" | 35 #include "content/public/common/url_utils.h" |
36 #include "content/public/test/browser_test_utils.h" | |
37 #include "content/public/test/mock_render_process_host.h" | 36 #include "content/public/test/mock_render_process_host.h" |
38 #include "content/public/test/test_notification_tracker.h" | 37 #include "content/public/test/test_notification_tracker.h" |
39 #include "content/test/test_content_browser_client.h" | 38 #include "content/test/test_content_browser_client.h" |
40 #include "content/test/test_content_client.h" | 39 #include "content/test/test_content_client.h" |
41 #include "content/test/test_render_frame_host.h" | 40 #include "content/test/test_render_frame_host.h" |
42 #include "content/test/test_render_view_host.h" | 41 #include "content/test/test_render_view_host.h" |
43 #include "content/test/test_web_contents.h" | 42 #include "content/test/test_web_contents.h" |
44 #include "net/base/load_flags.h" | 43 #include "net/base/load_flags.h" |
45 #include "testing/gtest/include/gtest/gtest.h" | 44 #include "testing/gtest/include/gtest/gtest.h" |
46 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 45 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 bool created() { | 167 bool created() { |
169 return created_; | 168 return created_; |
170 } | 169 } |
171 | 170 |
172 private: | 171 private: |
173 bool created_; | 172 bool created_; |
174 | 173 |
175 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostCreatedObserver); | 174 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostCreatedObserver); |
176 }; | 175 }; |
177 | 176 |
| 177 // This observer keeps track of the last deleted RenderFrameHost to avoid |
| 178 // accessing it and causing use-after-free condition. |
| 179 class RenderFrameHostDeletedObserver : public WebContentsObserver { |
| 180 public: |
| 181 RenderFrameHostDeletedObserver(RenderFrameHost* rfh) |
| 182 : WebContentsObserver(WebContents::FromRenderFrameHost(rfh)), |
| 183 process_id_(rfh->GetProcess()->GetID()), |
| 184 routing_id_(rfh->GetRoutingID()), |
| 185 deleted_(false) { |
| 186 } |
| 187 |
| 188 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override { |
| 189 if (render_frame_host->GetProcess()->GetID() == process_id_ && |
| 190 render_frame_host->GetRoutingID() == routing_id_) { |
| 191 deleted_ = true; |
| 192 } |
| 193 } |
| 194 |
| 195 bool deleted() { |
| 196 return deleted_; |
| 197 } |
| 198 |
| 199 private: |
| 200 int process_id_; |
| 201 int routing_id_; |
| 202 bool deleted_; |
| 203 |
| 204 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostDeletedObserver); |
| 205 }; |
| 206 |
178 // This WebContents observer keep track of its RVH change. | 207 // This WebContents observer keep track of its RVH change. |
179 class RenderViewHostChangedObserver : public WebContentsObserver { | 208 class RenderViewHostChangedObserver : public WebContentsObserver { |
180 public: | 209 public: |
181 RenderViewHostChangedObserver(WebContents* web_contents) | 210 RenderViewHostChangedObserver(WebContents* web_contents) |
182 : WebContentsObserver(web_contents), host_changed_(false) {} | 211 : WebContentsObserver(web_contents), host_changed_(false) {} |
183 | 212 |
184 // WebContentsObserver. | 213 // WebContentsObserver. |
185 void RenderViewHostChanged(RenderViewHost* old_host, | 214 void RenderViewHostChanged(RenderViewHost* old_host, |
186 RenderViewHost* new_host) override { | 215 RenderViewHost* new_host) override { |
187 host_changed_ = true; | 216 host_changed_ = true; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 ? contents()->GetPendingMainFrame() | 314 ? contents()->GetPendingMainFrame() |
286 : old_rfh; | 315 : old_rfh; |
287 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, old_rfh->rfh_state()); | 316 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, old_rfh->rfh_state()); |
288 | 317 |
289 // Commit the navigation with a new page ID. | 318 // Commit the navigation with a new page ID. |
290 int32 max_page_id = contents()->GetMaxPageIDForSiteInstance( | 319 int32 max_page_id = contents()->GetMaxPageIDForSiteInstance( |
291 active_rfh->GetSiteInstance()); | 320 active_rfh->GetSiteInstance()); |
292 | 321 |
293 // Use an observer to avoid accessing a deleted renderer later on when the | 322 // Use an observer to avoid accessing a deleted renderer later on when the |
294 // state is being checked. | 323 // state is being checked. |
295 RenderFrameDeletedObserver rfh_observer(old_rfh); | 324 RenderFrameHostDeletedObserver rfh_observer(old_rfh); |
296 RenderViewHostDeletedObserver rvh_observer(old_rfh->GetRenderViewHost()); | 325 RenderViewHostDeletedObserver rvh_observer(old_rfh->GetRenderViewHost()); |
297 active_rfh->SendNavigate(max_page_id + 1, entry_id, true, url); | 326 active_rfh->SendNavigate(max_page_id + 1, entry_id, true, url); |
298 | 327 |
299 // Make sure that we start to run the unload handler at the time of commit. | 328 // Make sure that we start to run the unload handler at the time of commit. |
300 bool expecting_rfh_shutdown = false; | 329 bool expecting_rfh_shutdown = false; |
301 if (old_rfh != active_rfh && !rfh_observer.deleted()) { | 330 if (old_rfh != active_rfh && !rfh_observer.deleted()) { |
302 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, | 331 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, |
303 old_rfh->rfh_state()); | 332 old_rfh->rfh_state()); |
304 if (!old_rfh->GetSiteInstance()->active_frame_count() || | 333 if (!old_rfh->GetSiteInstance()->active_frame_count() || |
305 RenderFrameHostManager::IsSwappedOutStateForbidden()) { | 334 RenderFrameHostManager::IsSwappedOutStateForbidden()) { |
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 TEST_F(RenderFrameHostManagerTest, CreateSwappedOutOpenerRFHs) { | 1375 TEST_F(RenderFrameHostManagerTest, CreateSwappedOutOpenerRFHs) { |
1347 const GURL kUrl1("http://www.google.com/"); | 1376 const GURL kUrl1("http://www.google.com/"); |
1348 const GURL kUrl2("http://www.chromium.org/"); | 1377 const GURL kUrl2("http://www.chromium.org/"); |
1349 const GURL kChromeUrl("chrome://foo"); | 1378 const GURL kChromeUrl("chrome://foo"); |
1350 | 1379 |
1351 // Navigate to an initial URL. | 1380 // Navigate to an initial URL. |
1352 contents()->NavigateAndCommit(kUrl1); | 1381 contents()->NavigateAndCommit(kUrl1); |
1353 RenderFrameHostManager* manager = contents()->GetRenderManagerForTesting(); | 1382 RenderFrameHostManager* manager = contents()->GetRenderManagerForTesting(); |
1354 TestRenderFrameHost* rfh1 = main_test_rfh(); | 1383 TestRenderFrameHost* rfh1 = main_test_rfh(); |
1355 scoped_refptr<SiteInstanceImpl> site_instance1 = rfh1->GetSiteInstance(); | 1384 scoped_refptr<SiteInstanceImpl> site_instance1 = rfh1->GetSiteInstance(); |
1356 RenderFrameDeletedObserver rfh1_deleted_observer(rfh1); | 1385 RenderFrameHostDeletedObserver rfh1_deleted_observer(rfh1); |
1357 TestRenderViewHost* rvh1 = test_rvh(); | 1386 TestRenderViewHost* rvh1 = test_rvh(); |
1358 | 1387 |
1359 // Create 2 new tabs and simulate them being the opener chain for the main | 1388 // Create 2 new tabs and simulate them being the opener chain for the main |
1360 // tab. They should be in the same SiteInstance. | 1389 // tab. They should be in the same SiteInstance. |
1361 scoped_ptr<TestWebContents> opener1( | 1390 scoped_ptr<TestWebContents> opener1( |
1362 TestWebContents::Create(browser_context(), site_instance1.get())); | 1391 TestWebContents::Create(browser_context(), site_instance1.get())); |
1363 RenderFrameHostManager* opener1_manager = | 1392 RenderFrameHostManager* opener1_manager = |
1364 opener1->GetRenderManagerForTesting(); | 1393 opener1->GetRenderManagerForTesting(); |
1365 contents()->SetOpener(opener1.get()); | 1394 contents()->SetOpener(opener1.get()); |
1366 | 1395 |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 // Tests that the RenderFrameHost is properly deleted when the SwapOutACK is | 1850 // Tests that the RenderFrameHost is properly deleted when the SwapOutACK is |
1822 // received. (SwapOut and the corresponding ACK always occur after commit.) | 1851 // received. (SwapOut and the corresponding ACK always occur after commit.) |
1823 // Also tests that an early SwapOutACK is properly ignored. | 1852 // Also tests that an early SwapOutACK is properly ignored. |
1824 TEST_F(RenderFrameHostManagerTest, DeleteFrameAfterSwapOutACK) { | 1853 TEST_F(RenderFrameHostManagerTest, DeleteFrameAfterSwapOutACK) { |
1825 const GURL kUrl1("http://www.google.com/"); | 1854 const GURL kUrl1("http://www.google.com/"); |
1826 const GURL kUrl2("http://www.chromium.org/"); | 1855 const GURL kUrl2("http://www.chromium.org/"); |
1827 | 1856 |
1828 // Navigate to the first page. | 1857 // Navigate to the first page. |
1829 contents()->NavigateAndCommit(kUrl1); | 1858 contents()->NavigateAndCommit(kUrl1); |
1830 TestRenderFrameHost* rfh1 = contents()->GetMainFrame(); | 1859 TestRenderFrameHost* rfh1 = contents()->GetMainFrame(); |
1831 RenderFrameDeletedObserver rfh_deleted_observer(rfh1); | 1860 RenderFrameHostDeletedObserver rfh_deleted_observer(rfh1); |
1832 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); | 1861 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); |
1833 | 1862 |
1834 // Navigate to new site, simulating onbeforeunload approval. | 1863 // Navigate to new site, simulating onbeforeunload approval. |
1835 controller().LoadURL( | 1864 controller().LoadURL( |
1836 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 1865 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
1837 int entry_id = controller().GetPendingEntry()->GetUniqueID(); | 1866 int entry_id = controller().GetPendingEntry()->GetUniqueID(); |
1838 contents()->GetMainFrame()->PrepareForCommit(); | 1867 contents()->GetMainFrame()->PrepareForCommit(); |
1839 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); | 1868 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); |
1840 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); | 1869 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); |
1841 TestRenderFrameHost* rfh2 = contents()->GetPendingMainFrame(); | 1870 TestRenderFrameHost* rfh2 = contents()->GetPendingMainFrame(); |
(...skipping 25 matching lines...) Expand all Loading... |
1867 | 1896 |
1868 // Tests that the RenderFrameHost is properly swapped out when the SwapOut ACK | 1897 // Tests that the RenderFrameHost is properly swapped out when the SwapOut ACK |
1869 // is received. (SwapOut and the corresponding ACK always occur after commit.) | 1898 // is received. (SwapOut and the corresponding ACK always occur after commit.) |
1870 TEST_F(RenderFrameHostManagerTest, SwapOutFrameAfterSwapOutACK) { | 1899 TEST_F(RenderFrameHostManagerTest, SwapOutFrameAfterSwapOutACK) { |
1871 const GURL kUrl1("http://www.google.com/"); | 1900 const GURL kUrl1("http://www.google.com/"); |
1872 const GURL kUrl2("http://www.chromium.org/"); | 1901 const GURL kUrl2("http://www.chromium.org/"); |
1873 | 1902 |
1874 // Navigate to the first page. | 1903 // Navigate to the first page. |
1875 contents()->NavigateAndCommit(kUrl1); | 1904 contents()->NavigateAndCommit(kUrl1); |
1876 TestRenderFrameHost* rfh1 = contents()->GetMainFrame(); | 1905 TestRenderFrameHost* rfh1 = contents()->GetMainFrame(); |
1877 RenderFrameDeletedObserver rfh_deleted_observer(rfh1); | 1906 RenderFrameHostDeletedObserver rfh_deleted_observer(rfh1); |
1878 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); | 1907 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); |
1879 | 1908 |
1880 // Increment the number of active frames in SiteInstanceImpl so that rfh1 is | 1909 // Increment the number of active frames in SiteInstanceImpl so that rfh1 is |
1881 // not deleted on swap out. | 1910 // not deleted on swap out. |
1882 rfh1->GetSiteInstance()->increment_active_frame_count(); | 1911 rfh1->GetSiteInstance()->increment_active_frame_count(); |
1883 | 1912 |
1884 // Navigate to new site, simulating onbeforeunload approval. | 1913 // Navigate to new site, simulating onbeforeunload approval. |
1885 controller().LoadURL( | 1914 controller().LoadURL( |
1886 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 1915 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
1887 int entry_id = controller().GetPendingEntry()->GetUniqueID(); | 1916 int entry_id = controller().GetPendingEntry()->GetUniqueID(); |
(...skipping 28 matching lines...) Expand all Loading... |
1916 // This simulates a cross-site navigation to a synchronously committing URL | 1945 // This simulates a cross-site navigation to a synchronously committing URL |
1917 // (e.g., a data URL) and ensures it works properly. | 1946 // (e.g., a data URL) and ensures it works properly. |
1918 TEST_F(RenderFrameHostManagerTest, | 1947 TEST_F(RenderFrameHostManagerTest, |
1919 CommitNewNavigationBeforeSendingSwapOut) { | 1948 CommitNewNavigationBeforeSendingSwapOut) { |
1920 const GURL kUrl1("http://www.google.com/"); | 1949 const GURL kUrl1("http://www.google.com/"); |
1921 const GURL kUrl2("http://www.chromium.org/"); | 1950 const GURL kUrl2("http://www.chromium.org/"); |
1922 | 1951 |
1923 // Navigate to the first page. | 1952 // Navigate to the first page. |
1924 contents()->NavigateAndCommit(kUrl1); | 1953 contents()->NavigateAndCommit(kUrl1); |
1925 TestRenderFrameHost* rfh1 = contents()->GetMainFrame(); | 1954 TestRenderFrameHost* rfh1 = contents()->GetMainFrame(); |
1926 RenderFrameDeletedObserver rfh_deleted_observer(rfh1); | 1955 RenderFrameHostDeletedObserver rfh_deleted_observer(rfh1); |
1927 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); | 1956 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); |
1928 | 1957 |
1929 // Increment the number of active frames in SiteInstanceImpl so that rfh1 is | 1958 // Increment the number of active frames in SiteInstanceImpl so that rfh1 is |
1930 // not deleted on swap out. | 1959 // not deleted on swap out. |
1931 scoped_refptr<SiteInstanceImpl> site_instance = rfh1->GetSiteInstance(); | 1960 scoped_refptr<SiteInstanceImpl> site_instance = rfh1->GetSiteInstance(); |
1932 site_instance->increment_active_frame_count(); | 1961 site_instance->increment_active_frame_count(); |
1933 | 1962 |
1934 // Navigate to new site, simulating onbeforeunload approval. | 1963 // Navigate to new site, simulating onbeforeunload approval. |
1935 controller().LoadURL( | 1964 controller().LoadURL( |
1936 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 1965 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1975 contents()->NavigateAndCommit(kUrl1); | 2004 contents()->NavigateAndCommit(kUrl1); |
1976 TestRenderFrameHost* rfh1 = main_test_rfh(); | 2005 TestRenderFrameHost* rfh1 = main_test_rfh(); |
1977 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); | 2006 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); |
1978 | 2007 |
1979 // Navigate to a new site, starting a cross-site navigation. | 2008 // Navigate to a new site, starting a cross-site navigation. |
1980 controller().LoadURL( | 2009 controller().LoadURL( |
1981 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 2010 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
1982 { | 2011 { |
1983 pending_rfh = contents()->GetFrameTree()->root()->render_manager() | 2012 pending_rfh = contents()->GetFrameTree()->root()->render_manager() |
1984 ->pending_frame_host(); | 2013 ->pending_frame_host(); |
1985 RenderFrameDeletedObserver rfh_deleted_observer(pending_rfh); | 2014 RenderFrameHostDeletedObserver rfh_deleted_observer(pending_rfh); |
1986 | 2015 |
1987 // Cancel the navigation by simulating a declined beforeunload dialog. | 2016 // Cancel the navigation by simulating a declined beforeunload dialog. |
1988 contents()->GetMainFrame()->OnMessageReceived( | 2017 contents()->GetMainFrame()->OnMessageReceived( |
1989 FrameHostMsg_BeforeUnload_ACK(0, false, now, now)); | 2018 FrameHostMsg_BeforeUnload_ACK(0, false, now, now)); |
1990 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); | 2019 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); |
1991 | 2020 |
1992 // Since the pending RFH is the only one for the new SiteInstance, it should | 2021 // Since the pending RFH is the only one for the new SiteInstance, it should |
1993 // be deleted. | 2022 // be deleted. |
1994 EXPECT_TRUE(rfh_deleted_observer.deleted()); | 2023 EXPECT_TRUE(rfh_deleted_observer.deleted()); |
1995 } | 2024 } |
1996 | 2025 |
1997 // Start another cross-site navigation. | 2026 // Start another cross-site navigation. |
1998 controller().LoadURL( | 2027 controller().LoadURL( |
1999 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 2028 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
2000 { | 2029 { |
2001 pending_rfh = contents()->GetFrameTree()->root()->render_manager() | 2030 pending_rfh = contents()->GetFrameTree()->root()->render_manager() |
2002 ->pending_frame_host(); | 2031 ->pending_frame_host(); |
2003 RenderFrameDeletedObserver rfh_deleted_observer(pending_rfh); | 2032 RenderFrameHostDeletedObserver rfh_deleted_observer(pending_rfh); |
2004 | 2033 |
2005 // Increment the number of active frames in the new SiteInstance, which will | 2034 // Increment the number of active frames in the new SiteInstance, which will |
2006 // cause the pending RFH to be deleted and a RenderFrameProxyHost to be | 2035 // cause the pending RFH to be deleted and a RenderFrameProxyHost to be |
2007 // created. | 2036 // created. |
2008 scoped_refptr<SiteInstanceImpl> site_instance = | 2037 scoped_refptr<SiteInstanceImpl> site_instance = |
2009 pending_rfh->GetSiteInstance(); | 2038 pending_rfh->GetSiteInstance(); |
2010 site_instance->increment_active_frame_count(); | 2039 site_instance->increment_active_frame_count(); |
2011 | 2040 |
2012 contents()->GetMainFrame()->OnMessageReceived( | 2041 contents()->GetMainFrame()->OnMessageReceived( |
2013 FrameHostMsg_BeforeUnload_ACK(0, false, now, now)); | 2042 FrameHostMsg_BeforeUnload_ACK(0, false, now, now)); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 EXPECT_TRUE(RenderFrameHostImpl::IsRFHStateActive( | 2116 EXPECT_TRUE(RenderFrameHostImpl::IsRFHStateActive( |
2088 GetPendingFrameHost(iframe2)->rfh_state())); | 2117 GetPendingFrameHost(iframe2)->rfh_state())); |
2089 EXPECT_NE(GetPendingFrameHost(iframe1), GetPendingFrameHost(iframe2)); | 2118 EXPECT_NE(GetPendingFrameHost(iframe1), GetPendingFrameHost(iframe2)); |
2090 EXPECT_EQ(GetPendingFrameHost(iframe1)->GetSiteInstance(), | 2119 EXPECT_EQ(GetPendingFrameHost(iframe1)->GetSiteInstance(), |
2091 GetPendingFrameHost(iframe2)->GetSiteInstance()); | 2120 GetPendingFrameHost(iframe2)->GetSiteInstance()); |
2092 EXPECT_NE(iframe1->current_frame_host(), GetPendingFrameHost(iframe1)); | 2121 EXPECT_NE(iframe1->current_frame_host(), GetPendingFrameHost(iframe1)); |
2093 EXPECT_NE(iframe2->current_frame_host(), GetPendingFrameHost(iframe2)); | 2122 EXPECT_NE(iframe2->current_frame_host(), GetPendingFrameHost(iframe2)); |
2094 EXPECT_FALSE(contents()->CrossProcessNavigationPending()) | 2123 EXPECT_FALSE(contents()->CrossProcessNavigationPending()) |
2095 << "There should be no top-level pending navigation."; | 2124 << "There should be no top-level pending navigation."; |
2096 | 2125 |
2097 RenderFrameDeletedObserver delete_watcher1(GetPendingFrameHost(iframe1)); | 2126 RenderFrameHostDeletedObserver delete_watcher1(GetPendingFrameHost(iframe1)); |
2098 RenderFrameDeletedObserver delete_watcher2(GetPendingFrameHost(iframe2)); | 2127 RenderFrameHostDeletedObserver delete_watcher2(GetPendingFrameHost(iframe2)); |
2099 EXPECT_FALSE(delete_watcher1.deleted()); | 2128 EXPECT_FALSE(delete_watcher1.deleted()); |
2100 EXPECT_FALSE(delete_watcher2.deleted()); | 2129 EXPECT_FALSE(delete_watcher2.deleted()); |
2101 | 2130 |
2102 // Keep the SiteInstance alive for testing. | 2131 // Keep the SiteInstance alive for testing. |
2103 scoped_refptr<SiteInstanceImpl> site_instance = | 2132 scoped_refptr<SiteInstanceImpl> site_instance = |
2104 GetPendingFrameHost(iframe1)->GetSiteInstance(); | 2133 GetPendingFrameHost(iframe1)->GetSiteInstance(); |
2105 EXPECT_TRUE(site_instance->HasSite()); | 2134 EXPECT_TRUE(site_instance->HasSite()); |
2106 EXPECT_NE(site_instance, contents()->GetSiteInstance()); | 2135 EXPECT_NE(site_instance, contents()->GetSiteInstance()); |
2107 EXPECT_EQ(2U, site_instance->active_frame_count()); | 2136 EXPECT_EQ(2U, site_instance->active_frame_count()); |
2108 | 2137 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2206 EXPECT_FALSE(contents2->GetMainFrame()->IsRenderFrameLive()); | 2235 EXPECT_FALSE(contents2->GetMainFrame()->IsRenderFrameLive()); |
2207 contents2->NavigateAndCommit(kUrl3); | 2236 contents2->NavigateAndCommit(kUrl3); |
2208 EXPECT_TRUE(contents2->GetMainFrame()->IsRenderFrameLive()); | 2237 EXPECT_TRUE(contents2->GetMainFrame()->IsRenderFrameLive()); |
2209 EXPECT_NE(nullptr, | 2238 EXPECT_NE(nullptr, |
2210 iframe->GetRenderFrameProxyHost(contents1->GetSiteInstance())); | 2239 iframe->GetRenderFrameProxyHost(contents1->GetSiteInstance())); |
2211 EXPECT_EQ(nullptr, | 2240 EXPECT_EQ(nullptr, |
2212 iframe->GetRenderFrameProxyHost(contents2->GetSiteInstance())); | 2241 iframe->GetRenderFrameProxyHost(contents2->GetSiteInstance())); |
2213 } | 2242 } |
2214 | 2243 |
2215 } // namespace content | 2244 } // namespace content |
OLD | NEW |