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_path.h" | 5 #include "base/file_path.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/sys_info.h" | 8 #include "base/sys_info.h" |
9 #include "base/test/test_file_util.h" | 9 #include "base/test/test_file_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // (Bug 1115708) | 79 // (Bug 1115708) |
80 // This test can only run if V8 is in use, and not KJS, because KJS will not | 80 // This test can only run if V8 is in use, and not KJS, because KJS will not |
81 // set window.opener to null properly. | 81 // set window.opener to null properly. |
82 #ifdef CHROME_V8 | 82 #ifdef CHROME_V8 |
83 TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { | 83 TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { |
84 // This test only works in multi-process mode | 84 // This test only works in multi-process mode |
85 if (in_process_renderer()) | 85 if (in_process_renderer()) |
86 return; | 86 return; |
87 | 87 |
88 const wchar_t kDocRoot[] = L"chrome/test/data"; | 88 const wchar_t kDocRoot[] = L"chrome/test/data"; |
89 scoped_refptr<HTTPTestServer> server = | 89 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); |
90 HTTPTestServer::CreateServer(kDocRoot, NULL); | |
91 ASSERT_TRUE(NULL != server.get()); | 90 ASSERT_TRUE(NULL != server.get()); |
92 FilePath test_file(test_data_directory_); | 91 FilePath test_file(test_data_directory_); |
93 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 92 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
94 ASSERT_TRUE(window.get()); | 93 ASSERT_TRUE(window.get()); |
95 scoped_refptr<TabProxy> tab(window->GetActiveTab()); | 94 scoped_refptr<TabProxy> tab(window->GetActiveTab()); |
96 ASSERT_TRUE(tab.get()); | 95 ASSERT_TRUE(tab.get()); |
97 | 96 |
98 // Start with a file:// url | 97 // Start with a file:// url |
99 test_file = test_file.AppendASCII("title2.html"); | 98 test_file = test_file.AppendASCII("title2.html"); |
100 tab->NavigateToURL(net::FilePathToFileURL(test_file)); | 99 tab->NavigateToURL(net::FilePathToFileURL(test_file)); |
(...skipping 29 matching lines...) Expand all Loading... |
130 #endif | 129 #endif |
131 | 130 |
132 // Tests that non-Gmail-like script redirects (i.e., non-null window.opener) or | 131 // Tests that non-Gmail-like script redirects (i.e., non-null window.opener) or |
133 // a same-page-redirect) will not fork a new process. | 132 // a same-page-redirect) will not fork a new process. |
134 TEST_F(BrowserTest, MAYBE_OtherRedirectsDontForkProcess) { | 133 TEST_F(BrowserTest, MAYBE_OtherRedirectsDontForkProcess) { |
135 // This test only works in multi-process mode | 134 // This test only works in multi-process mode |
136 if (in_process_renderer()) | 135 if (in_process_renderer()) |
137 return; | 136 return; |
138 | 137 |
139 const wchar_t kDocRoot[] = L"chrome/test/data"; | 138 const wchar_t kDocRoot[] = L"chrome/test/data"; |
140 scoped_refptr<HTTPTestServer> server = | 139 scoped_refptr<HTTPTestServer> server(HTTPTestServer::CreateServer(kDocRoot)); |
141 HTTPTestServer::CreateServer(kDocRoot, NULL); | |
142 ASSERT_TRUE(NULL != server.get()); | 140 ASSERT_TRUE(NULL != server.get()); |
143 FilePath test_file(test_data_directory_); | 141 FilePath test_file(test_data_directory_); |
144 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 142 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
145 ASSERT_TRUE(window.get()); | 143 ASSERT_TRUE(window.get()); |
146 scoped_refptr<TabProxy> tab(window->GetActiveTab()); | 144 scoped_refptr<TabProxy> tab(window->GetActiveTab()); |
147 ASSERT_TRUE(tab.get()); | 145 ASSERT_TRUE(tab.get()); |
148 | 146 |
149 // Start with a file:// url | 147 // Start with a file:// url |
150 test_file = test_file.AppendASCII("title2.html"); | 148 test_file = test_file.AppendASCII("title2.html"); |
151 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, | 149 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 ASSERT_TRUE(browser->RunCommand(IDC_CLOSE_WINDOW)); | 347 ASSERT_TRUE(browser->RunCommand(IDC_CLOSE_WINDOW)); |
350 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 348 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
351 EXPECT_EQ(0, window_count); | 349 EXPECT_EQ(0, window_count); |
352 ASSERT_TRUE(IsBrowserRunning()); | 350 ASSERT_TRUE(IsBrowserRunning()); |
353 ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, true)); | 351 ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, true)); |
354 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); | 352 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); |
355 EXPECT_EQ(1, window_count); | 353 EXPECT_EQ(1, window_count); |
356 } | 354 } |
357 | 355 |
358 } // namespace | 356 } // namespace |
OLD | NEW |