| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/base_paths.h" | 5 #include "base/base_paths.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 // Test that scripts can fork a new renderer process for a tab in a particular | 77 // Test that scripts can fork a new renderer process for a tab in a particular |
| 78 // case (which matches following a link in Gmail). The script must open a new | 78 // case (which matches following a link in Gmail). The script must open a new |
| 79 // tab, set its window.opener to null, and redirect it to a cross-site URL. | 79 // tab, set its window.opener to null, and redirect it to a cross-site URL. |
| 80 // (Bug 1115708) | 80 // (Bug 1115708) |
| 81 // This test can only run if V8 is in use, and not KJS, because KJS will not | 81 // This test can only run if V8 is in use, and not KJS, because KJS will not |
| 82 // set window.opener to null properly. | 82 // set window.opener to null properly. |
| 83 #ifdef CHROME_V8 | 83 #ifdef CHROME_V8 |
| 84 TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { | 84 TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { |
| 85 // This test only works in multi-process mode | 85 // This test only works in multi-process mode |
| 86 if (in_process_renderer()) | 86 if (ProxyLauncher::in_process_renderer()) |
| 87 return; | 87 return; |
| 88 | 88 |
| 89 net::TestServer test_server(net::TestServer::TYPE_HTTP, | 89 net::TestServer test_server(net::TestServer::TYPE_HTTP, |
| 90 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 90 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| 91 ASSERT_TRUE(test_server.Start()); | 91 ASSERT_TRUE(test_server.Start()); |
| 92 | 92 |
| 93 FilePath test_file(test_data_directory_); | 93 FilePath test_file(test_data_directory_); |
| 94 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 94 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
| 95 ASSERT_TRUE(window.get()); | 95 ASSERT_TRUE(window.get()); |
| 96 scoped_refptr<TabProxy> tab(window->GetActiveTab()); | 96 scoped_refptr<TabProxy> tab(window->GetActiveTab()); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 127 #if defined(OS_CHROMEOS) | 127 #if defined(OS_CHROMEOS) |
| 128 #define MAYBE_OtherRedirectsDontForkProcess DISABLED_OtherRedirectsDontForkProce
ss | 128 #define MAYBE_OtherRedirectsDontForkProcess DISABLED_OtherRedirectsDontForkProce
ss |
| 129 #else | 129 #else |
| 130 #define MAYBE_OtherRedirectsDontForkProcess FLAKY_OtherRedirectsDontForkProcess | 130 #define MAYBE_OtherRedirectsDontForkProcess FLAKY_OtherRedirectsDontForkProcess |
| 131 #endif | 131 #endif |
| 132 | 132 |
| 133 // Tests that non-Gmail-like script redirects (i.e., non-null window.opener) or | 133 // Tests that non-Gmail-like script redirects (i.e., non-null window.opener) or |
| 134 // a same-page-redirect) will not fork a new process. | 134 // a same-page-redirect) will not fork a new process. |
| 135 TEST_F(BrowserTest, MAYBE_OtherRedirectsDontForkProcess) { | 135 TEST_F(BrowserTest, MAYBE_OtherRedirectsDontForkProcess) { |
| 136 // This test only works in multi-process mode | 136 // This test only works in multi-process mode |
| 137 if (in_process_renderer()) | 137 if (ProxyLauncher::in_process_renderer()) |
| 138 return; | 138 return; |
| 139 | 139 |
| 140 net::TestServer test_server(net::TestServer::TYPE_HTTP, | 140 net::TestServer test_server(net::TestServer::TYPE_HTTP, |
| 141 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 141 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| 142 ASSERT_TRUE(test_server.Start()); | 142 ASSERT_TRUE(test_server.Start()); |
| 143 | 143 |
| 144 FilePath test_file(test_data_directory_); | 144 FilePath test_file(test_data_directory_); |
| 145 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 145 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
| 146 ASSERT_TRUE(window.get()); | 146 ASSERT_TRUE(window.get()); |
| 147 scoped_refptr<TabProxy> tab(window->GetActiveTab()); | 147 scoped_refptr<TabProxy> tab(window->GetActiveTab()); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 EXPECT_EQ(0, window_count); | 376 EXPECT_EQ(0, window_count); |
| 377 | 377 |
| 378 // Starting a browser window should work just fine. | 378 // Starting a browser window should work just fine. |
| 379 ASSERT_TRUE(IsBrowserRunning()); | 379 ASSERT_TRUE(IsBrowserRunning()); |
| 380 ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, true)); | 380 ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, true)); |
| 381 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 381 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 382 EXPECT_EQ(1, window_count); | 382 EXPECT_EQ(1, window_count); |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace | 385 } // namespace |
| OLD | NEW |