OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // 1- http://mock.http/cross-origin-redirect-blocked.html | 387 // 1- http://mock.http/cross-origin-redirect-blocked.html |
388 // 2- http://mock.http/redirect-to-title2.html | 388 // 2- http://mock.http/redirect-to-title2.html |
389 // 3- http://mock.http/title2.html | 389 // 3- http://mock.http/title2.html |
390 // | 390 // |
391 // If the redirect in #2 were not blocked, we'd also see a request | 391 // If the redirect in #2 were not blocked, we'd also see a request |
392 // for http://mock.http:4000/title2.html, and the title would be different. | 392 // for http://mock.http:4000/title2.html, and the title would be different. |
393 CheckTitleTest("cross-origin-redirect-blocked.html", | 393 CheckTitleTest("cross-origin-redirect-blocked.html", |
394 "Title Of More Awesomeness", 2); | 394 "Title Of More Awesomeness", 2); |
395 } | 395 } |
396 | 396 |
397 // Tests that ResourceDispatcherHostRequestInfo is updated correctly on failed | 397 // Tests that ResourceRequestInfoImpl is updated correctly on failed |
398 // requests, to prevent calling Read on a request that has already failed. | 398 // requests, to prevent calling Read on a request that has already failed. |
399 // See bug 40250. | 399 // See bug 40250. |
400 TEST_F(ResourceDispatcherTest, CrossSiteFailedRequest) { | 400 TEST_F(ResourceDispatcherTest, CrossSiteFailedRequest) { |
401 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 401 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
402 ASSERT_TRUE(browser_proxy.get()); | 402 ASSERT_TRUE(browser_proxy.get()); |
403 scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab()); | 403 scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab()); |
404 ASSERT_TRUE(tab.get()); | 404 ASSERT_TRUE(tab.get()); |
405 | 405 |
406 // Visit another URL first to trigger a cross-site navigation. | 406 // Visit another URL first to trigger a cross-site navigation. |
407 GURL url(chrome::kTestNewTabURL); | 407 GURL url(chrome::kTestNewTabURL); |
408 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url)); | 408 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url)); |
409 | 409 |
410 // Visit a URL that fails without calling ResourceDispatcherHost::Read. | 410 // Visit a URL that fails without calling ResourceDispatcherHost::Read. |
411 GURL broken_url("chrome://theme"); | 411 GURL broken_url("chrome://theme"); |
412 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(broken_url)); | 412 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(broken_url)); |
413 | 413 |
414 // Make sure the navigation finishes. | 414 // Make sure the navigation finishes. |
415 std::wstring tab_title; | 415 std::wstring tab_title; |
416 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); | 416 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); |
417 EXPECT_EQ(L"chrome://theme/ is not available", tab_title); | 417 EXPECT_EQ(L"chrome://theme/ is not available", tab_title); |
418 } | 418 } |
419 | 419 |
420 } // namespace | 420 } // namespace |
OLD | NEW |