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 <sstream> | 5 #include <sstream> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "chrome/browser/automation/url_request_failed_dns_job.h" | 12 #include "chrome/browser/automation/url_request_failed_dns_job.h" |
13 #include "chrome/browser/automation/url_request_mock_http_job.h" | 13 #include "chrome/browser/automation/url_request_mock_http_job.h" |
14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/common/url_constants.h" | |
16 #include "chrome/test/automation/browser_proxy.h" | 15 #include "chrome/test/automation/browser_proxy.h" |
17 #include "chrome/test/automation/tab_proxy.h" | 16 #include "chrome/test/automation/tab_proxy.h" |
18 #include "chrome/test/ui/ui_test.h" | 17 #include "chrome/test/ui/ui_test.h" |
19 #include "net/base/net_util.h" | 18 #include "net/base/net_util.h" |
20 #include "net/url_request/url_request_unittest.h" | 19 #include "net/url_request/url_request_unittest.h" |
21 | 20 |
22 namespace { | 21 namespace { |
23 | 22 |
24 class ResourceDispatcherTest : public UITest { | 23 class ResourceDispatcherTest : public UITest { |
25 public: | 24 public: |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // This test only works in multi-process mode | 182 // This test only works in multi-process mode |
184 if (in_process_renderer()) | 183 if (in_process_renderer()) |
185 return; | 184 return; |
186 | 185 |
187 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 186 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
188 EXPECT_TRUE(browser_proxy.get()); | 187 EXPECT_TRUE(browser_proxy.get()); |
189 scoped_ptr<TabProxy> tab(browser_proxy->GetActiveTab()); | 188 scoped_ptr<TabProxy> tab(browser_proxy->GetActiveTab()); |
190 | 189 |
191 // Cause the renderer to crash. | 190 // Cause the renderer to crash. |
192 expected_crashes_ = 1; | 191 expected_crashes_ = 1; |
193 tab->NavigateToURLAsync(GURL(chrome::kAboutCrashURL)); | 192 tab->NavigateToURLAsync(GURL("about:crash")); |
194 Sleep(sleep_timeout_ms()); // Wait for browser to notice the renderer crash. | 193 Sleep(sleep_timeout_ms()); // Wait for browser to notice the renderer crash. |
195 | 194 |
196 // Navigate to a new cross-site page. The browser should not wait around for | 195 // Navigate to a new cross-site page. The browser should not wait around for |
197 // the old renderer's on{before}unload handlers to run. | 196 // the old renderer's on{before}unload handlers to run. |
198 CheckTitleTest(L"content-sniffer-test0.html", | 197 CheckTitleTest(L"content-sniffer-test0.html", |
199 L"Content Sniffer Test 0"); | 198 L"Content Sniffer Test 0"); |
200 } | 199 } |
201 | 200 |
202 // Tests that cross-site navigations work when the new page does not go through | 201 // Tests that cross-site navigations work when the new page does not go through |
203 // the BufferedEventHandler (e.g., non-http{s} URLs). (Bug 1225872) | 202 // the BufferedEventHandler (e.g., non-http{s} URLs). (Bug 1225872) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // (Test by redirecting to javascript:window.location='someURL'.) | 270 // (Test by redirecting to javascript:window.location='someURL'.) |
272 GURL test_url(server->TestServerPageW(L"files/title2.html")); | 271 GURL test_url(server->TestServerPageW(L"files/title2.html")); |
273 std::wstring redirect_url = L"javascript:window.location='" + | 272 std::wstring redirect_url = L"javascript:window.location='" + |
274 ASCIIToWide(test_url.possibly_invalid_spec()) + L"'"; | 273 ASCIIToWide(test_url.possibly_invalid_spec()) + L"'"; |
275 tab->NavigateToURLAsync(GURL(redirect_url)); | 274 tab->NavigateToURLAsync(GURL(redirect_url)); |
276 Sleep(sleep_timeout_ms()); // Wait for JavaScript redirect to happen. | 275 Sleep(sleep_timeout_ms()); // Wait for JavaScript redirect to happen. |
277 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); | 276 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); |
278 EXPECT_EQ(L"Title Of Awesomeness", tab_title); | 277 EXPECT_EQ(L"Title Of Awesomeness", tab_title); |
279 } | 278 } |
280 | 279 |
OLD | NEW |