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 "base/bind.h" |
5 #include "base/file_path.h" | 6 #include "base/file_path.h" |
6 #include "base/file_util.h" | 7 #include "base/file_util.h" |
7 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
8 #include "base/path_service.h" | 9 #include "base/path_service.h" |
9 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
10 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
11 #include "base/test/test_file_util.h" | 12 #include "base/test/test_file_util.h" |
12 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
13 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 15 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
15 #include "chrome/browser/download/download_crx_util.h" | 16 #include "chrome/browser/download/download_crx_util.h" |
16 #include "chrome/browser/download/download_history.h" | 17 #include "chrome/browser/download/download_history.h" |
17 #include "chrome/browser/download/download_prefs.h" | 18 #include "chrome/browser/download/download_prefs.h" |
18 #include "chrome/browser/download/download_shelf.h" | 19 #include "chrome/browser/download/download_shelf.h" |
19 #include "chrome/browser/download/download_util.h" | 20 #include "chrome/browser/download/download_util.h" |
20 #include "chrome/browser/extensions/extension_install_ui.h" | 21 #include "chrome/browser/extensions/extension_install_ui.h" |
21 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
22 #include "chrome/browser/history/history.h" | 23 #include "chrome/browser/history/history.h" |
| 24 #include "chrome/browser/net/url_request_mock_util.h" |
23 #include "chrome/browser/prefs/pref_service.h" | 25 #include "chrome/browser/prefs/pref_service.h" |
24 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
26 #include "chrome/browser/ui/browser_list.h" | 28 #include "chrome/browser/ui/browser_list.h" |
27 #include "chrome/browser/ui/browser_window.h" | 29 #include "chrome/browser/ui/browser_window.h" |
28 #include "chrome/browser/ui/webui/active_downloads_ui.h" | 30 #include "chrome/browser/ui/webui/active_downloads_ui.h" |
29 #include "chrome/common/chrome_notification_types.h" | 31 #include "chrome/common/chrome_notification_types.h" |
30 #include "chrome/common/chrome_paths.h" | 32 #include "chrome/common/chrome_paths.h" |
31 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
32 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 enum SelectExpectation { | 630 enum SelectExpectation { |
629 EXPECT_NO_SELECT_DIALOG = -1, | 631 EXPECT_NO_SELECT_DIALOG = -1, |
630 EXPECT_NOTHING, | 632 EXPECT_NOTHING, |
631 EXPECT_SELECT_DIALOG | 633 EXPECT_SELECT_DIALOG |
632 }; | 634 }; |
633 | 635 |
634 DownloadTest() { | 636 DownloadTest() { |
635 EnableDOMAutomation(); | 637 EnableDOMAutomation(); |
636 } | 638 } |
637 | 639 |
| 640 void SetUpOnMainThread() OVERRIDE { |
| 641 BrowserThread::PostTask( |
| 642 BrowserThread::IO, FROM_HERE, |
| 643 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); |
| 644 } |
| 645 |
638 // Returning false indicates a failure of the setup, and should be asserted | 646 // Returning false indicates a failure of the setup, and should be asserted |
639 // in the caller. | 647 // in the caller. |
640 virtual bool InitialSetup(bool prompt_for_download) { | 648 virtual bool InitialSetup(bool prompt_for_download) { |
641 bool have_test_dir = PathService::Get(chrome::DIR_TEST_DATA, &test_dir_); | 649 bool have_test_dir = PathService::Get(chrome::DIR_TEST_DATA, &test_dir_); |
642 EXPECT_TRUE(have_test_dir); | 650 EXPECT_TRUE(have_test_dir); |
643 if (!have_test_dir) | 651 if (!have_test_dir) |
644 return false; | 652 return false; |
645 | 653 |
646 // Sanity check default values for window / tab count and shelf visibility. | 654 // Sanity check default values for window / tab count and shelf visibility. |
647 int window_count = BrowserList::size(); | 655 int window_count = BrowserList::size(); |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen()); | 1786 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen()); |
1779 | 1787 |
1780 // Download shelf should close. Download panel stays open on ChromeOS. | 1788 // Download shelf should close. Download panel stays open on ChromeOS. |
1781 CheckDownloadUI(browser(), false, true, FilePath()); | 1789 CheckDownloadUI(browser(), false, true, FilePath()); |
1782 | 1790 |
1783 // Check that the extension was installed. | 1791 // Check that the extension was installed. |
1784 ExtensionService* extension_service = | 1792 ExtensionService* extension_service = |
1785 browser()->profile()->GetExtensionService(); | 1793 browser()->profile()->GetExtensionService(); |
1786 ASSERT_TRUE(extension_service->GetExtensionById(kLargeThemeCrxId, false)); | 1794 ASSERT_TRUE(extension_service->GetExtensionById(kLargeThemeCrxId, false)); |
1787 } | 1795 } |
OLD | NEW |