OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/test/test_timeouts.h" | 12 #include "base/test/test_timeouts.h" |
13 #include "chrome/browser/net/url_request_failed_dns_job.h" | 13 #include "chrome/browser/net/url_request_failed_dns_job.h" |
14 #include "chrome/browser/net/url_request_mock_http_job.h" | 14 #include "chrome/browser/net/url_request_mock_http_job.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/test/test_server.h" | 19 #include "net/test/test_server.h" |
21 | 20 |
22 namespace { | 21 namespace { |
23 | 22 |
24 class ResourceDispatcherTest : public UITest { | 23 class ResourceDispatcherTest : public UITest { |
25 public: | 24 public: |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 // Tests that ResourceDispatcherHostRequestInfo is updated correctly on failed | 376 // Tests that ResourceDispatcherHostRequestInfo is updated correctly on failed |
378 // requests, to prevent calling Read on a request that has already failed. | 377 // requests, to prevent calling Read on a request that has already failed. |
379 // See bug 40250. | 378 // See bug 40250. |
380 TEST_F(ResourceDispatcherTest, CrossSiteFailedRequest) { | 379 TEST_F(ResourceDispatcherTest, CrossSiteFailedRequest) { |
381 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 380 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
382 ASSERT_TRUE(browser_proxy.get()); | 381 ASSERT_TRUE(browser_proxy.get()); |
383 scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab()); | 382 scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab()); |
384 ASSERT_TRUE(tab.get()); | 383 ASSERT_TRUE(tab.get()); |
385 | 384 |
386 // Visit another URL first to trigger a cross-site navigation. | 385 // Visit another URL first to trigger a cross-site navigation. |
387 GURL url(chrome::kChromeUINewTabURL); | 386 GURL url("chrome://newtab"); |
388 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url)); | 387 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url)); |
389 | 388 |
390 // Visit a URL that fails without calling ResourceDispatcherHost::Read. | 389 // Visit a URL that fails without calling ResourceDispatcherHost::Read. |
391 GURL broken_url("chrome://theme"); | 390 GURL broken_url("chrome://theme"); |
392 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(broken_url)); | 391 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(broken_url)); |
393 | 392 |
394 // Make sure the navigation finishes. | 393 // Make sure the navigation finishes. |
395 std::wstring tab_title; | 394 std::wstring tab_title; |
396 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); | 395 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); |
397 EXPECT_EQ(L"chrome://theme/ is not available", tab_title); | 396 EXPECT_EQ(L"chrome://theme/ is not available", tab_title); |
398 } | 397 } |
399 | 398 |
400 } // namespace | 399 } // namespace |
OLD | NEW |