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 <memory> | 5 #include <memory> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
20 #include "base/threading/sequenced_worker_pool.h" | 20 #include "base/threading/sequenced_worker_pool.h" |
| 21 #include "base/threading/thread_restrictions.h" |
21 #include "base/values.h" | 22 #include "base/values.h" |
22 #include "build/build_config.h" | 23 #include "build/build_config.h" |
23 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 24 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
24 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 25 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
25 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 26 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
26 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" | 27 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" |
27 #include "chrome/browser/net/net_error_diagnostics_dialog.h" | 28 #include "chrome/browser/net/net_error_diagnostics_dialog.h" |
28 #include "chrome/browser/net/url_request_mock_util.h" | 29 #include "chrome/browser/net/url_request_mock_util.h" |
29 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
30 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 31 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 new net::FailingHttpTransactionFactory(cache->GetSession(), error)); | 535 new net::FailingHttpTransactionFactory(cache->GetSession(), error)); |
535 // Throw away old version; since this is a a browser test, we don't | 536 // Throw away old version; since this is a a browser test, we don't |
536 // need to restore the old state. | 537 // need to restore the old state. |
537 cache->SetHttpNetworkTransactionFactoryForTesting(std::move(factory)); | 538 cache->SetHttpNetworkTransactionFactoryForTesting(std::move(factory)); |
538 } | 539 } |
539 | 540 |
540 // Test an error with a file URL, and make sure it doesn't have a | 541 // Test an error with a file URL, and make sure it doesn't have a |
541 // button to launch a network diagnostics tool. | 542 // button to launch a network diagnostics tool. |
542 IN_PROC_BROWSER_TEST_F(ErrorPageTest, FileNotFound) { | 543 IN_PROC_BROWSER_TEST_F(ErrorPageTest, FileNotFound) { |
543 // Create an empty temp directory, to be sure there's no file in it. | 544 // Create an empty temp directory, to be sure there's no file in it. |
| 545 base::ThreadRestrictions::ScopedAllowIO allow_io; |
544 base::ScopedTempDir temp_dir; | 546 base::ScopedTempDir temp_dir; |
545 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 547 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
546 GURL non_existent_file_url = | 548 GURL non_existent_file_url = |
547 net::FilePathToFileURL(temp_dir.GetPath().AppendASCII("marmoset")); | 549 net::FilePathToFileURL(temp_dir.GetPath().AppendASCII("marmoset")); |
548 | 550 |
549 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 551 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
550 browser(), non_existent_file_url, 1); | 552 browser(), non_existent_file_url, 1); |
551 | 553 |
552 ExpectDisplayingLocalErrorPage(browser(), net::ERR_FILE_NOT_FOUND); | 554 ExpectDisplayingLocalErrorPage(browser(), net::ERR_FILE_NOT_FOUND); |
553 // Should not request Link Doctor corrections for local errors. | 555 // Should not request Link Doctor corrections for local errors. |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 Http09WeirdPortEnabled) { | 1530 Http09WeirdPortEnabled) { |
1529 const char kHttp09Response[] = "JumboShrimp"; | 1531 const char kHttp09Response[] = "JumboShrimp"; |
1530 ASSERT_TRUE(embedded_test_server()->Start()); | 1532 ASSERT_TRUE(embedded_test_server()->Start()); |
1531 ui_test_utils::NavigateToURL( | 1533 ui_test_utils::NavigateToURL( |
1532 browser(), embedded_test_server()->GetURL(std::string("/echo-raw?") + | 1534 browser(), embedded_test_server()->GetURL(std::string("/echo-raw?") + |
1533 kHttp09Response)); | 1535 kHttp09Response)); |
1534 EXPECT_TRUE(IsDisplayingText(browser(), kHttp09Response)); | 1536 EXPECT_TRUE(IsDisplayingText(browser(), kHttp09Response)); |
1535 } | 1537 } |
1536 | 1538 |
1537 } // namespace | 1539 } // namespace |
OLD | NEW |