OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_path.h" | 9 #include "base/file_path.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // 1- http://mock.http/cross-origin-redirect-blocked.html | 310 // 1- http://mock.http/cross-origin-redirect-blocked.html |
311 // 2- http://mock.http/redirect-to-title2.html | 311 // 2- http://mock.http/redirect-to-title2.html |
312 // 3- http://mock.http/title2.html | 312 // 3- http://mock.http/title2.html |
313 // | 313 // |
314 // If the redirect in #2 were not blocked, we'd also see a request | 314 // If the redirect in #2 were not blocked, we'd also see a request |
315 // for http://mock.http:4000/title2.html, and the title would be different. | 315 // for http://mock.http:4000/title2.html, and the title would be different. |
316 CheckTitleTest(L"cross-origin-redirect-blocked.html", | 316 CheckTitleTest(L"cross-origin-redirect-blocked.html", |
317 L"Title Of More Awesomeness", 2); | 317 L"Title Of More Awesomeness", 2); |
318 } | 318 } |
319 | 319 |
| 320 // Tests that ResourceDispatcherHostRequestInfo is updated correctly on failed |
| 321 // requests, to prevent calling Read on a request that has already failed. |
| 322 // See bug 40250. |
| 323 TEST_F(ResourceDispatcherTest, CrossSiteFailedRequest) { |
| 324 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
| 325 ASSERT_TRUE(browser_proxy.get()); |
| 326 scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab()); |
| 327 ASSERT_TRUE(tab.get()); |
| 328 |
| 329 // Visit another URL first to trigger a cross-site navigation. |
| 330 GURL url(chrome::kChromeUINewTabURL); |
| 331 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url)); |
| 332 |
| 333 // Visit a URL that fails without calling ResourceDispatcherHost::Read. |
| 334 GURL broken_url("chrome://theme"); |
| 335 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(broken_url)); |
| 336 |
| 337 // Make sure the navigation finishes. |
| 338 std::wstring tab_title; |
| 339 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); |
| 340 EXPECT_EQ(L"chrome://theme/ is not available", tab_title); |
| 341 } |
| 342 |
320 } // namespace | 343 } // namespace |
OLD | NEW |