| 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 30 matching lines...) Expand all Loading... |
| 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/notifications/notification_ui_manager.h" | 50 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 51 #include "chrome/browser/permissions/permission_request_manager.h" |
| 51 #include "chrome/browser/profiles/profile.h" | 52 #include "chrome/browser/profiles/profile.h" |
| 52 #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsert
est_util.h" | 53 #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsert
est_util.h" |
| 53 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" | 54 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" |
| 54 #include "chrome/browser/ui/browser.h" | 55 #include "chrome/browser/ui/browser.h" |
| 55 #include "chrome/browser/ui/browser_commands.h" | 56 #include "chrome/browser/ui/browser_commands.h" |
| 56 #include "chrome/browser/ui/browser_finder.h" | 57 #include "chrome/browser/ui/browser_finder.h" |
| 57 #include "chrome/browser/ui/browser_list.h" | 58 #include "chrome/browser/ui/browser_list.h" |
| 58 #include "chrome/browser/ui/browser_tabstrip.h" | 59 #include "chrome/browser/ui/browser_tabstrip.h" |
| 59 #include "chrome/browser/ui/browser_window.h" | 60 #include "chrome/browser/ui/browser_window.h" |
| 60 #include "chrome/browser/ui/chrome_pages.h" | 61 #include "chrome/browser/ui/chrome_pages.h" |
| 61 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 62 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 62 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | |
| 63 #include "chrome/common/chrome_paths.h" | 63 #include "chrome/common/chrome_paths.h" |
| 64 #include "chrome/common/chrome_switches.h" | 64 #include "chrome/common/chrome_switches.h" |
| 65 #include "chrome/common/pref_names.h" | 65 #include "chrome/common/pref_names.h" |
| 66 #include "chrome/common/safe_browsing/csd.pb.h" | 66 #include "chrome/common/safe_browsing/csd.pb.h" |
| 67 #include "chrome/common/safe_browsing/download_file_types.pb.h" | 67 #include "chrome/common/safe_browsing/download_file_types.pb.h" |
| 68 #include "chrome/common/url_constants.h" | 68 #include "chrome/common/url_constants.h" |
| 69 #include "chrome/grit/generated_resources.h" | 69 #include "chrome/grit/generated_resources.h" |
| 70 #include "chrome/test/base/in_process_browser_test.h" | 70 #include "chrome/test/base/in_process_browser_test.h" |
| 71 #include "chrome/test/base/ui_test_utils.h" | 71 #include "chrome/test/base/ui_test_utils.h" |
| 72 #include "components/history/content/browser/download_constants_utils.h" | 72 #include "components/history/content/browser/download_constants_utils.h" |
| (...skipping 2696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2769 infobar_service->RemoveInfoBar(infobar); | 2769 infobar_service->RemoveInfoBar(infobar); |
| 2770 // Verify that there are no more infobars. | 2770 // Verify that there are no more infobars. |
| 2771 EXPECT_EQ(0u, infobar_service->infobar_count()); | 2771 EXPECT_EQ(0u, infobar_service->infobar_count()); |
| 2772 | 2772 |
| 2773 // Waits for the download to complete. | 2773 // Waits for the download to complete. |
| 2774 downloads_observer->WaitForFinished(); | 2774 downloads_observer->WaitForFinished(); |
| 2775 EXPECT_EQ(2u, downloads_observer->NumDownloadsSeenInState( | 2775 EXPECT_EQ(2u, downloads_observer->NumDownloadsSeenInState( |
| 2776 DownloadItem::COMPLETE)); | 2776 DownloadItem::COMPLETE)); |
| 2777 } | 2777 } |
| 2778 #else | 2778 #else |
| 2779 IN_PROC_BROWSER_TEST_F(DownloadTest, TestMultipleDownloadsBubble) { | 2779 IN_PROC_BROWSER_TEST_F(DownloadTest, TestMultipleDownloadsRequests) { |
| 2780 // Create a downloads observer. | 2780 // Create a downloads observer. |
| 2781 std::unique_ptr<content::DownloadTestObserver> downloads_observer( | 2781 std::unique_ptr<content::DownloadTestObserver> downloads_observer( |
| 2782 CreateWaiter(browser(), 2)); | 2782 CreateWaiter(browser(), 2)); |
| 2783 | 2783 |
| 2784 PermissionBubbleManager* permission_bubble_manager = | 2784 PermissionRequestManager* permission_request_manager = |
| 2785 PermissionBubbleManager::FromWebContents( | 2785 PermissionRequestManager::FromWebContents( |
| 2786 browser()->tab_strip_model()->GetActiveWebContents()); | 2786 browser()->tab_strip_model()->GetActiveWebContents()); |
| 2787 permission_bubble_manager->DisplayPendingRequests(); | 2787 permission_request_manager->DisplayPendingRequests(); |
| 2788 permission_bubble_manager->set_auto_response_for_test( | 2788 permission_request_manager->set_auto_response_for_test( |
| 2789 PermissionBubbleManager::ACCEPT_ALL); | 2789 PermissionRequestManager::ACCEPT_ALL); |
| 2790 | 2790 |
| 2791 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 2791 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
| 2792 browser(), net::URLRequestMockHTTPJob::GetMockUrl( | 2792 browser(), net::URLRequestMockHTTPJob::GetMockUrl( |
| 2793 "downloads/download-a_zip_file.html"), | 2793 "downloads/download-a_zip_file.html"), |
| 2794 1); | 2794 1); |
| 2795 | 2795 |
| 2796 // Waits for the download to complete. | 2796 // Waits for the download to complete. |
| 2797 downloads_observer->WaitForFinished(); | 2797 downloads_observer->WaitForFinished(); |
| 2798 EXPECT_EQ(2u, downloads_observer->NumDownloadsSeenInState( | 2798 EXPECT_EQ(2u, downloads_observer->NumDownloadsSeenInState( |
| 2799 DownloadItem::COMPLETE)); | 2799 DownloadItem::COMPLETE)); |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3671 DangerousDownloadWaiter( | 3671 DangerousDownloadWaiter( |
| 3672 browser(), 1, | 3672 browser(), 1, |
| 3673 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); | 3673 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); |
| 3674 ui_test_utils::NavigateToURL(browser(), extension_url); | 3674 ui_test_utils::NavigateToURL(browser(), extension_url); |
| 3675 | 3675 |
| 3676 observer->WaitForFinished(); | 3676 observer->WaitForFinished(); |
| 3677 | 3677 |
| 3678 // Download shelf should close. | 3678 // Download shelf should close. |
| 3679 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 3679 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
| 3680 } | 3680 } |
| OLD | NEW |