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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "chrome/browser/download/download_service_factory.h" | 36 #include "chrome/browser/download/download_service_factory.h" |
37 #include "chrome/browser/download/download_shelf.h" | 37 #include "chrome/browser/download/download_shelf.h" |
38 #include "chrome/browser/download/download_target_determiner.h" | 38 #include "chrome/browser/download/download_target_determiner.h" |
39 #include "chrome/browser/download/download_test_file_activity_observer.h" | 39 #include "chrome/browser/download/download_test_file_activity_observer.h" |
40 #include "chrome/browser/extensions/extension_install_prompt.h" | 40 #include "chrome/browser/extensions/extension_install_prompt.h" |
41 #include "chrome/browser/extensions/extension_service.h" | 41 #include "chrome/browser/extensions/extension_service.h" |
42 #include "chrome/browser/history/download_row.h" | 42 #include "chrome/browser/history/download_row.h" |
43 #include "chrome/browser/history/history_service.h" | 43 #include "chrome/browser/history/history_service.h" |
44 #include "chrome/browser/history/history_service_factory.h" | 44 #include "chrome/browser/history/history_service_factory.h" |
45 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 45 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
46 #include "chrome/browser/infobars/infobar.h" | |
47 #include "chrome/browser/infobars/infobar_service.h" | 46 #include "chrome/browser/infobars/infobar_service.h" |
48 #include "chrome/browser/net/url_request_mock_util.h" | 47 #include "chrome/browser/net/url_request_mock_util.h" |
49 #include "chrome/browser/profiles/profile.h" | 48 #include "chrome/browser/profiles/profile.h" |
50 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" | 49 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" |
51 #include "chrome/browser/ui/browser.h" | 50 #include "chrome/browser/ui/browser.h" |
52 #include "chrome/browser/ui/browser_commands.h" | 51 #include "chrome/browser/ui/browser_commands.h" |
53 #include "chrome/browser/ui/browser_finder.h" | 52 #include "chrome/browser/ui/browser_finder.h" |
54 #include "chrome/browser/ui/browser_list.h" | 53 #include "chrome/browser/ui/browser_list.h" |
55 #include "chrome/browser/ui/browser_tabstrip.h" | 54 #include "chrome/browser/ui/browser_tabstrip.h" |
56 #include "chrome/browser/ui/browser_window.h" | 55 #include "chrome/browser/ui/browser_window.h" |
57 #include "chrome/browser/ui/chrome_pages.h" | 56 #include "chrome/browser/ui/chrome_pages.h" |
58 #include "chrome/browser/ui/host_desktop.h" | 57 #include "chrome/browser/ui/host_desktop.h" |
59 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 58 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
60 #include "chrome/common/chrome_paths.h" | 59 #include "chrome/common/chrome_paths.h" |
61 #include "chrome/common/pref_names.h" | 60 #include "chrome/common/pref_names.h" |
62 #include "chrome/common/url_constants.h" | 61 #include "chrome/common/url_constants.h" |
63 #include "chrome/test/base/in_process_browser_test.h" | 62 #include "chrome/test/base/in_process_browser_test.h" |
64 #include "chrome/test/base/test_switches.h" | 63 #include "chrome/test/base/test_switches.h" |
65 #include "chrome/test/base/ui_test_utils.h" | 64 #include "chrome/test/base/ui_test_utils.h" |
| 65 #include "components/infobars/core/infobar.h" |
66 #include "content/public/browser/download_interrupt_reasons.h" | 66 #include "content/public/browser/download_interrupt_reasons.h" |
67 #include "content/public/browser/download_item.h" | 67 #include "content/public/browser/download_item.h" |
68 #include "content/public/browser/download_manager.h" | 68 #include "content/public/browser/download_manager.h" |
69 #include "content/public/browser/download_save_info.h" | 69 #include "content/public/browser/download_save_info.h" |
70 #include "content/public/browser/download_url_parameters.h" | 70 #include "content/public/browser/download_url_parameters.h" |
71 #include "content/public/browser/notification_source.h" | 71 #include "content/public/browser/notification_source.h" |
72 #include "content/public/browser/render_frame_host.h" | 72 #include "content/public/browser/render_frame_host.h" |
73 #include "content/public/browser/render_view_host.h" | 73 #include "content/public/browser/render_view_host.h" |
74 #include "content/public/browser/resource_context.h" | 74 #include "content/public/browser/resource_context.h" |
75 #include "content/public/browser/web_contents.h" | 75 #include "content/public/browser/web_contents.h" |
(...skipping 2713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2789 browser(), | 2789 browser(), |
2790 test_server()->GetURL("files/downloads/download-a_zip_file.html")); | 2790 test_server()->GetURL("files/downloads/download-a_zip_file.html")); |
2791 infobar_added_1.Wait(); | 2791 infobar_added_1.Wait(); |
2792 | 2792 |
2793 InfoBarService* infobar_service = InfoBarService::FromWebContents( | 2793 InfoBarService* infobar_service = InfoBarService::FromWebContents( |
2794 browser()->tab_strip_model()->GetActiveWebContents()); | 2794 browser()->tab_strip_model()->GetActiveWebContents()); |
2795 // Verify that there is only one infobar. | 2795 // Verify that there is only one infobar. |
2796 ASSERT_EQ(1u, infobar_service->infobar_count()); | 2796 ASSERT_EQ(1u, infobar_service->infobar_count()); |
2797 | 2797 |
2798 // Get the infobar at index 0. | 2798 // Get the infobar at index 0. |
2799 InfoBar* infobar = infobar_service->infobar_at(0); | 2799 infobars::InfoBar* infobar = infobar_service->infobar_at(0); |
2800 ConfirmInfoBarDelegate* confirm_infobar = | 2800 ConfirmInfoBarDelegate* confirm_infobar = |
2801 infobar->delegate()->AsConfirmInfoBarDelegate(); | 2801 infobar->delegate()->AsConfirmInfoBarDelegate(); |
2802 ASSERT_TRUE(confirm_infobar != NULL); | 2802 ASSERT_TRUE(confirm_infobar != NULL); |
2803 | 2803 |
2804 // Verify multi download warning infobar message. | 2804 // Verify multi download warning infobar message. |
2805 EXPECT_EQ(confirm_infobar->GetMessageText(), | 2805 EXPECT_EQ(confirm_infobar->GetMessageText(), |
2806 l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING)); | 2806 l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING)); |
2807 | 2807 |
2808 // Click on the "Allow" button to allow multiple downloads. | 2808 // Click on the "Allow" button to allow multiple downloads. |
2809 if (confirm_infobar->Accept()) | 2809 if (confirm_infobar->Accept()) |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3205 | 3205 |
3206 // No errors this time. The download should complete successfully. | 3206 // No errors this time. The download should complete successfully. |
3207 EXPECT_FALSE(completion_observer->IsFinished()); | 3207 EXPECT_FALSE(completion_observer->IsFinished()); |
3208 completion_observer->StartObserving(); | 3208 completion_observer->StartObserving(); |
3209 download->Resume(); | 3209 download->Resume(); |
3210 completion_observer->WaitForFinished(); | 3210 completion_observer->WaitForFinished(); |
3211 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); | 3211 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); |
3212 | 3212 |
3213 EXPECT_FALSE(DidShowFileChooser()); | 3213 EXPECT_FALSE(DidShowFileChooser()); |
3214 } | 3214 } |
OLD | NEW |