| 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/file_path.h" | 6 #include "base/file_path.h" |
| 6 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" |
| 7 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 8 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| 9 #include "base/test/test_file_util.h" | 11 #include "base/test/test_file_util.h" |
| 10 #include "base/values.h" | 12 #include "base/values.h" |
| 11 #include "chrome/app/chrome_dll_resource.h" | 13 #include "chrome/app/chrome_dll_resource.h" |
| 12 #include "chrome/browser/browser.h" | 14 #include "chrome/browser/browser.h" |
| 13 #include "chrome/browser/platform_util.h" | 15 #include "chrome/browser/platform_util.h" |
| 14 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/common/chrome_constants.h" | 17 #include "chrome/common/chrome_constants.h" |
| 16 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 17 #include "chrome/test/automation/browser_proxy.h" | 19 #include "chrome/test/automation/browser_proxy.h" |
| 18 #include "chrome/test/automation/tab_proxy.h" | 20 #include "chrome/test/automation/tab_proxy.h" |
| 19 #include "chrome/test/automation/window_proxy.h" | 21 #include "chrome/test/automation/window_proxy.h" |
| 20 #include "chrome/test/ui/ui_test.h" | 22 #include "chrome/test/ui/ui_test.h" |
| 21 #include "gfx/native_widget_types.h" | 23 #include "gfx/native_widget_types.h" |
| 22 #include "grit/chromium_strings.h" | 24 #include "grit/chromium_strings.h" |
| 23 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
| 24 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" |
| 25 #include "net/url_request/url_request_unittest.h" | 27 #include "net/test/test_server.h" |
| 26 | 28 |
| 27 namespace { | 29 namespace { |
| 28 | 30 |
| 29 class BrowserTest : public UITest { | 31 class BrowserTest : public UITest { |
| 30 }; | 32 }; |
| 31 | 33 |
| 32 class VisibleBrowserTest : public UITest { | 34 class VisibleBrowserTest : public UITest { |
| 33 protected: | 35 protected: |
| 34 VisibleBrowserTest() : UITest() { | 36 VisibleBrowserTest() : UITest() { |
| 35 show_window_ = true; | 37 show_window_ = true; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 #endif | 131 #endif |
| 130 | 132 |
| 131 // 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 |
| 132 // a same-page-redirect) will not fork a new process. | 134 // a same-page-redirect) will not fork a new process. |
| 133 TEST_F(BrowserTest, MAYBE_OtherRedirectsDontForkProcess) { | 135 TEST_F(BrowserTest, MAYBE_OtherRedirectsDontForkProcess) { |
| 134 // This test only works in multi-process mode | 136 // This test only works in multi-process mode |
| 135 if (in_process_renderer()) | 137 if (in_process_renderer()) |
| 136 return; | 138 return; |
| 137 | 139 |
| 138 const wchar_t kDocRoot[] = L"chrome/test/data"; | 140 const wchar_t kDocRoot[] = L"chrome/test/data"; |
| 139 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); | 141 scoped_refptr<net::HTTPTestServer> server( |
| 142 net::HTTPTestServer::CreateServer(kDocRoot)); |
| 140 ASSERT_TRUE(NULL != server.get()); | 143 ASSERT_TRUE(NULL != server.get()); |
| 141 FilePath test_file(test_data_directory_); | 144 FilePath test_file(test_data_directory_); |
| 142 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 145 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
| 143 ASSERT_TRUE(window.get()); | 146 ASSERT_TRUE(window.get()); |
| 144 scoped_refptr<TabProxy> tab(window->GetActiveTab()); | 147 scoped_refptr<TabProxy> tab(window->GetActiveTab()); |
| 145 ASSERT_TRUE(tab.get()); | 148 ASSERT_TRUE(tab.get()); |
| 146 | 149 |
| 147 // Start with a file:// url | 150 // Start with a file:// url |
| 148 test_file = test_file.AppendASCII("title2.html"); | 151 test_file = test_file.AppendASCII("title2.html"); |
| 149 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, | 152 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 ASSERT_TRUE(browser->RunCommand(IDC_CLOSE_WINDOW)); | 350 ASSERT_TRUE(browser->RunCommand(IDC_CLOSE_WINDOW)); |
| 348 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 351 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 349 EXPECT_EQ(0, window_count); | 352 EXPECT_EQ(0, window_count); |
| 350 ASSERT_TRUE(IsBrowserRunning()); | 353 ASSERT_TRUE(IsBrowserRunning()); |
| 351 ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, true)); | 354 ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, true)); |
| 352 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 355 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
| 353 EXPECT_EQ(1, window_count); | 356 EXPECT_EQ(1, window_count); |
| 354 } | 357 } |
| 355 | 358 |
| 356 } // namespace | 359 } // namespace |
| OLD | NEW |