| 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/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/test/in_process_browser_test.h" | 10 #include "chrome/test/in_process_browser_test.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 std::vector<net::TestServer::StringPair> replacement_text; | 31 std::vector<net::TestServer::StringPair> replacement_text; |
| 32 replacement_text.push_back( | 32 replacement_text.push_back( |
| 33 make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString())); | 33 make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString())); |
| 34 return net::TestServer::GetFilePathWithReplacements( | 34 return net::TestServer::GetFilePathWithReplacements( |
| 35 original_file_path, replacement_text, replacement_path); | 35 original_file_path, replacement_text, replacement_path); |
| 36 } | 36 } |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer | 39 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer |
| 40 // and target=_blank should create a new SiteInstance. | 40 // and target=_blank should create a new SiteInstance. |
| 41 // Disabled for http://code.google.com/p/chromium/issues/detail?id=86346 |
| 41 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 42 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
| 42 SwapProcessWithRelNoreferrerAndTargetBlank) { | 43 DISABLED_SwapProcessWithRelNoreferrerAndTargetBlank) { |
| 43 // Start two servers with different sites. | 44 // Start two servers with different sites. |
| 44 ASSERT_TRUE(test_server()->Start()); | 45 ASSERT_TRUE(test_server()->Start()); |
| 45 net::TestServer https_server( | 46 net::TestServer https_server( |
| 46 net::TestServer::TYPE_HTTPS, | 47 net::TestServer::TYPE_HTTPS, |
| 47 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 48 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| 48 ASSERT_TRUE(https_server.Start()); | 49 ASSERT_TRUE(https_server.Start()); |
| 49 | 50 |
| 50 // Load a page with links that open in a new window. | 51 // Load a page with links that open in a new window. |
| 51 std::string replacement_path; | 52 std::string replacement_path; |
| 52 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 53 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 pending_render_view_host()); | 86 pending_render_view_host()); |
| 86 | 87 |
| 87 // Should have a new SiteInstance. | 88 // Should have a new SiteInstance. |
| 88 scoped_refptr<SiteInstance> noref_blank_site_instance( | 89 scoped_refptr<SiteInstance> noref_blank_site_instance( |
| 89 browser()->GetSelectedTabContents()->GetSiteInstance()); | 90 browser()->GetSelectedTabContents()->GetSiteInstance()); |
| 90 EXPECT_NE(orig_site_instance, noref_blank_site_instance); | 91 EXPECT_NE(orig_site_instance, noref_blank_site_instance); |
| 91 } | 92 } |
| 92 | 93 |
| 93 // Test for crbug.com/24447. Following a cross-site link with just | 94 // Test for crbug.com/24447. Following a cross-site link with just |
| 94 // target=_blank should not create a new SiteInstance. | 95 // target=_blank should not create a new SiteInstance. |
| 96 // Disabled for http://code.google.com/p/chromium/issues/detail?id=86346 |
| 95 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 97 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
| 96 DontSwapProcessWithOnlyTargetBlank) { | 98 DISABLED_DontSwapProcessWithOnlyTargetBlank) { |
| 97 // Start two servers with different sites. | 99 // Start two servers with different sites. |
| 98 ASSERT_TRUE(test_server()->Start()); | 100 ASSERT_TRUE(test_server()->Start()); |
| 99 net::TestServer https_server( | 101 net::TestServer https_server( |
| 100 net::TestServer::TYPE_HTTPS, | 102 net::TestServer::TYPE_HTTPS, |
| 101 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 103 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| 102 ASSERT_TRUE(https_server.Start()); | 104 ASSERT_TRUE(https_server.Start()); |
| 103 | 105 |
| 104 // Load a page with links that open in a new window. | 106 // Load a page with links that open in a new window. |
| 105 std::string replacement_path; | 107 std::string replacement_path; |
| 106 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 108 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 EXPECT_EQ(1, browser()->tab_count()); | 242 EXPECT_EQ(1, browser()->tab_count()); |
| 241 EXPECT_EQ(0, browser()->active_index()); | 243 EXPECT_EQ(0, browser()->active_index()); |
| 242 EXPECT_EQ("/files/title2.html", | 244 EXPECT_EQ("/files/title2.html", |
| 243 browser()->GetSelectedTabContents()->GetURL().path()); | 245 browser()->GetSelectedTabContents()->GetURL().path()); |
| 244 | 246 |
| 245 // Should have the same SiteInstance. | 247 // Should have the same SiteInstance. |
| 246 scoped_refptr<SiteInstance> noref_site_instance( | 248 scoped_refptr<SiteInstance> noref_site_instance( |
| 247 browser()->GetSelectedTabContents()->GetSiteInstance()); | 249 browser()->GetSelectedTabContents()->GetSiteInstance()); |
| 248 EXPECT_EQ(orig_site_instance, noref_site_instance); | 250 EXPECT_EQ(orig_site_instance, noref_site_instance); |
| 249 } | 251 } |
| OLD | NEW |