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