| 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/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
| 7 #include "chrome/app/chrome_dll_resource.h" | 7 #include "chrome/app/chrome_dll_resource.h" |
| 8 #include "chrome/common/chrome_constants.h" | 8 #include "chrome/common/chrome_constants.h" |
| 9 #include "chrome/common/l10n_util.h" | 9 #include "chrome/common/l10n_util.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // (Bug 1115708) | 233 // (Bug 1115708) |
| 234 // This test can only run if V8 is in use, and not KJS, because KJS will not | 234 // This test can only run if V8 is in use, and not KJS, because KJS will not |
| 235 // set window.opener to null properly. | 235 // set window.opener to null properly. |
| 236 #ifdef CHROME_V8 | 236 #ifdef CHROME_V8 |
| 237 TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { | 237 TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { |
| 238 // This test only works in multi-process mode | 238 // This test only works in multi-process mode |
| 239 if (in_process_renderer()) | 239 if (in_process_renderer()) |
| 240 return; | 240 return; |
| 241 | 241 |
| 242 const wchar_t kDocRoot[] = L"chrome/test/data"; | 242 const wchar_t kDocRoot[] = L"chrome/test/data"; |
| 243 scoped_refptr<HTTPTestServer> server = | 243 TestServer server(kDocRoot); |
| 244 HTTPTestServer::CreateServer(kDocRoot); | |
| 245 ASSERT_TRUE(NULL != server.get()); | |
| 246 std::wstring test_file(test_data_directory_); | 244 std::wstring test_file(test_data_directory_); |
| 247 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 245 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
| 248 scoped_ptr<TabProxy> tab(window->GetActiveTab()); | 246 scoped_ptr<TabProxy> tab(window->GetActiveTab()); |
| 249 | 247 |
| 250 // Start with a file:// url | 248 // Start with a file:// url |
| 251 file_util::AppendToPath(&test_file, L"title2.html"); | 249 file_util::AppendToPath(&test_file, L"title2.html"); |
| 252 tab->NavigateToURL(net::FilePathToFileURL(test_file)); | 250 tab->NavigateToURL(net::FilePathToFileURL(test_file)); |
| 253 int orig_tab_count = -1; | 251 int orig_tab_count = -1; |
| 254 ASSERT_TRUE(window->GetTabCount(&orig_tab_count)); | 252 ASSERT_TRUE(window->GetTabCount(&orig_tab_count)); |
| 255 int orig_process_count = GetBrowserProcessCount(); | 253 int orig_process_count = GetBrowserProcessCount(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 273 #endif | 271 #endif |
| 274 | 272 |
| 275 // Tests that non-Gmail-like script redirects (i.e., non-null window.opener) or | 273 // Tests that non-Gmail-like script redirects (i.e., non-null window.opener) or |
| 276 // a same-page-redirect) will not fork a new process. | 274 // a same-page-redirect) will not fork a new process. |
| 277 TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { | 275 TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { |
| 278 // This test only works in multi-process mode | 276 // This test only works in multi-process mode |
| 279 if (in_process_renderer()) | 277 if (in_process_renderer()) |
| 280 return; | 278 return; |
| 281 | 279 |
| 282 const wchar_t kDocRoot[] = L"chrome/test/data"; | 280 const wchar_t kDocRoot[] = L"chrome/test/data"; |
| 283 scoped_refptr<HTTPTestServer> server = | 281 TestServer server(kDocRoot); |
| 284 HTTPTestServer::CreateServer(kDocRoot); | |
| 285 ASSERT_TRUE(NULL != server.get()); | |
| 286 std::wstring test_file(test_data_directory_); | 282 std::wstring test_file(test_data_directory_); |
| 287 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 283 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
| 288 scoped_ptr<TabProxy> tab(window->GetActiveTab()); | 284 scoped_ptr<TabProxy> tab(window->GetActiveTab()); |
| 289 | 285 |
| 290 // Start with a file:// url | 286 // Start with a file:// url |
| 291 file_util::AppendToPath(&test_file, L"title2.html"); | 287 file_util::AppendToPath(&test_file, L"title2.html"); |
| 292 tab->NavigateToURL(net::FilePathToFileURL(test_file)); | 288 tab->NavigateToURL(net::FilePathToFileURL(test_file)); |
| 293 int orig_tab_count = -1; | 289 int orig_tab_count = -1; |
| 294 ASSERT_TRUE(window->GetTabCount(&orig_tab_count)); | 290 ASSERT_TRUE(window->GetTabCount(&orig_tab_count)); |
| 295 int orig_process_count = GetBrowserProcessCount(); | 291 int orig_process_count = GetBrowserProcessCount(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 if (title == L"PASSED") { | 328 if (title == L"PASSED") { |
| 333 // Success, bail out. | 329 // Success, bail out. |
| 334 break; | 330 break; |
| 335 } | 331 } |
| 336 } | 332 } |
| 337 | 333 |
| 338 if (i == 10) | 334 if (i == 10) |
| 339 FAIL() << "failed to get error page title"; | 335 FAIL() << "failed to get error page title"; |
| 340 } | 336 } |
| 341 | 337 |
| OLD | NEW |