| 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 "chrome/browser/download/download_browsertest.h" | 5 #include "chrome/browser/download/download_browsertest.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "chrome/browser/download/download_request_limiter.h" | 40 #include "chrome/browser/download/download_request_limiter.h" |
| 41 #include "chrome/browser/download/download_service.h" | 41 #include "chrome/browser/download/download_service.h" |
| 42 #include "chrome/browser/download/download_service_factory.h" | 42 #include "chrome/browser/download/download_service_factory.h" |
| 43 #include "chrome/browser/download/download_shelf.h" | 43 #include "chrome/browser/download/download_shelf.h" |
| 44 #include "chrome/browser/download/download_target_determiner.h" | 44 #include "chrome/browser/download/download_target_determiner.h" |
| 45 #include "chrome/browser/download/download_test_file_activity_observer.h" | 45 #include "chrome/browser/download/download_test_file_activity_observer.h" |
| 46 #include "chrome/browser/extensions/extension_service.h" | 46 #include "chrome/browser/extensions/extension_service.h" |
| 47 #include "chrome/browser/history/history_service_factory.h" | 47 #include "chrome/browser/history/history_service_factory.h" |
| 48 #include "chrome/browser/infobars/infobar_service.h" | 48 #include "chrome/browser/infobars/infobar_service.h" |
| 49 #include "chrome/browser/net/url_request_mock_util.h" | 49 #include "chrome/browser/net/url_request_mock_util.h" |
| 50 #include "chrome/browser/permissions/permission_request_manager.h" |
| 50 #include "chrome/browser/profiles/profile.h" | 51 #include "chrome/browser/profiles/profile.h" |
| 51 #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsert
est_util.h" | 52 #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsert
est_util.h" |
| 52 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" | 53 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" |
| 53 #include "chrome/browser/ui/browser.h" | 54 #include "chrome/browser/ui/browser.h" |
| 54 #include "chrome/browser/ui/browser_commands.h" | 55 #include "chrome/browser/ui/browser_commands.h" |
| 55 #include "chrome/browser/ui/browser_finder.h" | 56 #include "chrome/browser/ui/browser_finder.h" |
| 56 #include "chrome/browser/ui/browser_list.h" | 57 #include "chrome/browser/ui/browser_list.h" |
| 57 #include "chrome/browser/ui/browser_tabstrip.h" | 58 #include "chrome/browser/ui/browser_tabstrip.h" |
| 58 #include "chrome/browser/ui/browser_window.h" | 59 #include "chrome/browser/ui/browser_window.h" |
| 59 #include "chrome/browser/ui/chrome_pages.h" | 60 #include "chrome/browser/ui/chrome_pages.h" |
| 60 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 61 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 61 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | |
| 62 #include "chrome/common/chrome_paths.h" | 62 #include "chrome/common/chrome_paths.h" |
| 63 #include "chrome/common/chrome_switches.h" | 63 #include "chrome/common/chrome_switches.h" |
| 64 #include "chrome/common/pref_names.h" | 64 #include "chrome/common/pref_names.h" |
| 65 #include "chrome/common/safe_browsing/csd.pb.h" | 65 #include "chrome/common/safe_browsing/csd.pb.h" |
| 66 #include "chrome/common/url_constants.h" | 66 #include "chrome/common/url_constants.h" |
| 67 #include "chrome/grit/generated_resources.h" | 67 #include "chrome/grit/generated_resources.h" |
| 68 #include "chrome/test/base/in_process_browser_test.h" | 68 #include "chrome/test/base/in_process_browser_test.h" |
| 69 #include "chrome/test/base/test_switches.h" | 69 #include "chrome/test/base/test_switches.h" |
| 70 #include "chrome/test/base/ui_test_utils.h" | 70 #include "chrome/test/base/ui_test_utils.h" |
| 71 #include "components/history/content/browser/download_constants_utils.h" | 71 #include "components/history/content/browser/download_constants_utils.h" |
| (...skipping 2708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2780 infobar_service->RemoveInfoBar(infobar); | 2780 infobar_service->RemoveInfoBar(infobar); |
| 2781 // Verify that there are no more infobars. | 2781 // Verify that there are no more infobars. |
| 2782 EXPECT_EQ(0u, infobar_service->infobar_count()); | 2782 EXPECT_EQ(0u, infobar_service->infobar_count()); |
| 2783 | 2783 |
| 2784 // Waits for the download to complete. | 2784 // Waits for the download to complete. |
| 2785 downloads_observer->WaitForFinished(); | 2785 downloads_observer->WaitForFinished(); |
| 2786 EXPECT_EQ(2u, downloads_observer->NumDownloadsSeenInState( | 2786 EXPECT_EQ(2u, downloads_observer->NumDownloadsSeenInState( |
| 2787 DownloadItem::COMPLETE)); | 2787 DownloadItem::COMPLETE)); |
| 2788 } | 2788 } |
| 2789 #else | 2789 #else |
| 2790 IN_PROC_BROWSER_TEST_F(DownloadTest, TestMultipleDownloadsBubble) { | 2790 IN_PROC_BROWSER_TEST_F(DownloadTest, TestMultipleDownloadRequests) { |
| 2791 #if defined(OS_WIN) && defined(USE_ASH) | 2791 #if defined(OS_WIN) && defined(USE_ASH) |
| 2792 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 2792 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 2793 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 2793 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2794 switches::kAshBrowserTests)) | 2794 switches::kAshBrowserTests)) |
| 2795 return; | 2795 return; |
| 2796 #endif | 2796 #endif |
| 2797 | 2797 |
| 2798 // Create a downloads observer. | 2798 // Create a downloads observer. |
| 2799 std::unique_ptr<content::DownloadTestObserver> downloads_observer( | 2799 std::unique_ptr<content::DownloadTestObserver> downloads_observer( |
| 2800 CreateWaiter(browser(), 2)); | 2800 CreateWaiter(browser(), 2)); |
| 2801 | 2801 |
| 2802 PermissionBubbleManager* permission_bubble_manager = | 2802 PermissionRequestManager* permission_request_manager = |
| 2803 PermissionBubbleManager::FromWebContents( | 2803 PermissionRequestManager::FromWebContents( |
| 2804 browser()->tab_strip_model()->GetActiveWebContents()); | 2804 browser()->tab_strip_model()->GetActiveWebContents()); |
| 2805 permission_bubble_manager->DisplayPendingRequests(); | 2805 permission_request_manager->DisplayPendingRequests(); |
| 2806 permission_bubble_manager->set_auto_response_for_test( | 2806 permission_request_manager->set_auto_response_for_test( |
| 2807 PermissionBubbleManager::ACCEPT_ALL); | 2807 PermissionRequestManager::ACCEPT_ALL); |
| 2808 | 2808 |
| 2809 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 2809 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
| 2810 browser(), net::URLRequestMockHTTPJob::GetMockUrl( | 2810 browser(), net::URLRequestMockHTTPJob::GetMockUrl( |
| 2811 "downloads/download-a_zip_file.html"), | 2811 "downloads/download-a_zip_file.html"), |
| 2812 1); | 2812 1); |
| 2813 | 2813 |
| 2814 // Waits for the download to complete. | 2814 // Waits for the download to complete. |
| 2815 downloads_observer->WaitForFinished(); | 2815 downloads_observer->WaitForFinished(); |
| 2816 EXPECT_EQ(2u, downloads_observer->NumDownloadsSeenInState( | 2816 EXPECT_EQ(2u, downloads_observer->NumDownloadsSeenInState( |
| 2817 DownloadItem::COMPLETE)); | 2817 DownloadItem::COMPLETE)); |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3687 DangerousDownloadWaiter( | 3687 DangerousDownloadWaiter( |
| 3688 browser(), 1, | 3688 browser(), 1, |
| 3689 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); | 3689 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); |
| 3690 ui_test_utils::NavigateToURL(browser(), extension_url); | 3690 ui_test_utils::NavigateToURL(browser(), extension_url); |
| 3691 | 3691 |
| 3692 observer->WaitForFinished(); | 3692 observer->WaitForFinished(); |
| 3693 | 3693 |
| 3694 // Download shelf should close. | 3694 // Download shelf should close. |
| 3695 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 3695 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
| 3696 } | 3696 } |
| OLD | NEW |