| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 // Opens in new tab. | 78 // Opens in new tab. |
| 79 EXPECT_EQ(2, browser()->tab_count()); | 79 EXPECT_EQ(2, browser()->tab_count()); |
| 80 EXPECT_EQ(1, browser()->active_index()); | 80 EXPECT_EQ(1, browser()->active_index()); |
| 81 EXPECT_EQ("/files/title2.html", | 81 EXPECT_EQ("/files/title2.html", |
| 82 browser()->GetSelectedTabContents()->GetURL().path()); | 82 browser()->GetSelectedTabContents()->GetURL().path()); |
| 83 | 83 |
| 84 // Wait for the cross-site transition in the new tab to finish. | 84 // Wait for the cross-site transition in the new tab to finish. |
| 85 ui_test_utils::WaitForLoadStop(browser()->GetSelectedTabContents()); | 85 ui_test_utils::WaitForLoadStop(browser()->GetSelectedTabContents()); |
| 86 EXPECT_FALSE(browser()->GetSelectedTabContents()-> | 86 EXPECT_FALSE(browser()->GetSelectedTabContents()-> |
| 87 render_manager_for_testing()->pending_render_view_host()); | 87 GetRenderManagerForTesting()->pending_render_view_host()); |
| 88 | 88 |
| 89 // Should have a new SiteInstance. | 89 // Should have a new SiteInstance. |
| 90 scoped_refptr<SiteInstance> noref_blank_site_instance( | 90 scoped_refptr<SiteInstance> noref_blank_site_instance( |
| 91 browser()->GetSelectedTabContents()->GetSiteInstance()); | 91 browser()->GetSelectedTabContents()->GetSiteInstance()); |
| 92 EXPECT_NE(orig_site_instance, noref_blank_site_instance); | 92 EXPECT_NE(orig_site_instance, noref_blank_site_instance); |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Test for crbug.com/24447. Following a cross-site link with just | 95 // Test for crbug.com/24447. Following a cross-site link with just |
| 96 // target=_blank should not create a new SiteInstance. | 96 // target=_blank should not create a new SiteInstance. |
| 97 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 97 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 // Now navigate to a different instance so that we swap out again. | 328 // Now navigate to a different instance so that we swap out again. |
| 329 ui_test_utils::NavigateToURL(browser(), | 329 ui_test_utils::NavigateToURL(browser(), |
| 330 https_server.GetURL("files/title2.html")); | 330 https_server.GetURL("files/title2.html")); |
| 331 rvh_observers.AddObserverToRVH(browser()->GetSelectedTabContents()-> | 331 rvh_observers.AddObserverToRVH(browser()->GetSelectedTabContents()-> |
| 332 GetRenderViewHost()); | 332 GetRenderViewHost()); |
| 333 | 333 |
| 334 // This used to leak a render view host. | 334 // This used to leak a render view host. |
| 335 browser()->CloseTabContents(browser()->GetSelectedTabContents()); | 335 browser()->CloseTabContents(browser()->GetSelectedTabContents()); |
| 336 EXPECT_EQ(0U, rvh_observers.GetNumObservers()); | 336 EXPECT_EQ(0U, rvh_observers.GetNumObservers()); |
| 337 } | 337 } |
| OLD | NEW |