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