| 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_shelf.h" | 36 #include "chrome/browser/download/download_shelf.h" |
| 37 #include "chrome/browser/download/download_target_determiner.h" | 37 #include "chrome/browser/download/download_target_determiner.h" |
| 38 #include "chrome/browser/download/download_test_file_activity_observer.h" | 38 #include "chrome/browser/download/download_test_file_activity_observer.h" |
| 39 #include "chrome/browser/extensions/extension_install_prompt.h" | 39 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 40 #include "chrome/browser/extensions/extension_service.h" | 40 #include "chrome/browser/extensions/extension_service.h" |
| 41 #include "chrome/browser/history/download_row.h" | 41 #include "chrome/browser/history/download_row.h" |
| 42 #include "chrome/browser/history/history_service.h" | 42 #include "chrome/browser/history/history_service.h" |
| 43 #include "chrome/browser/history/history_service_factory.h" | 43 #include "chrome/browser/history/history_service_factory.h" |
| 44 #include "chrome/browser/infobars/confirm_infobar_delegate.h" | 44 #include "chrome/browser/infobars/confirm_infobar_delegate.h" |
| 45 #include "chrome/browser/infobars/infobar.h" | 45 #include "chrome/browser/infobars/infobar.h" |
| 46 #include "chrome/browser/infobars/infobar_manager.h" |
| 46 #include "chrome/browser/infobars/infobar_service.h" | 47 #include "chrome/browser/infobars/infobar_service.h" |
| 47 #include "chrome/browser/net/url_request_mock_util.h" | 48 #include "chrome/browser/net/url_request_mock_util.h" |
| 48 #include "chrome/browser/profiles/profile.h" | 49 #include "chrome/browser/profiles/profile.h" |
| 49 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" | 50 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" |
| 50 #include "chrome/browser/ui/browser.h" | 51 #include "chrome/browser/ui/browser.h" |
| 51 #include "chrome/browser/ui/browser_commands.h" | 52 #include "chrome/browser/ui/browser_commands.h" |
| 52 #include "chrome/browser/ui/browser_finder.h" | 53 #include "chrome/browser/ui/browser_finder.h" |
| 53 #include "chrome/browser/ui/browser_list.h" | 54 #include "chrome/browser/ui/browser_list.h" |
| 54 #include "chrome/browser/ui/browser_tabstrip.h" | 55 #include "chrome/browser/ui/browser_tabstrip.h" |
| 55 #include "chrome/browser/ui/browser_window.h" | 56 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 2728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2784 content::WindowedNotificationObserver infobar_added_1( | 2785 content::WindowedNotificationObserver infobar_added_1( |
| 2785 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, | 2786 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, |
| 2786 content::NotificationService::AllSources()); | 2787 content::NotificationService::AllSources()); |
| 2787 ui_test_utils::NavigateToURL( | 2788 ui_test_utils::NavigateToURL( |
| 2788 browser(), | 2789 browser(), |
| 2789 test_server()->GetURL("files/downloads/download-a_zip_file.html")); | 2790 test_server()->GetURL("files/downloads/download-a_zip_file.html")); |
| 2790 infobar_added_1.Wait(); | 2791 infobar_added_1.Wait(); |
| 2791 | 2792 |
| 2792 InfoBarService* infobar_service = InfoBarService::FromWebContents( | 2793 InfoBarService* infobar_service = InfoBarService::FromWebContents( |
| 2793 browser()->tab_strip_model()->GetActiveWebContents()); | 2794 browser()->tab_strip_model()->GetActiveWebContents()); |
| 2795 InfoBarManager* infobar_manager = infobar_service->infobar_manager(); |
| 2794 // Verify that there is only one infobar. | 2796 // Verify that there is only one infobar. |
| 2795 ASSERT_EQ(1u, infobar_service->infobar_count()); | 2797 ASSERT_EQ(1u, infobar_manager->infobar_count()); |
| 2796 | 2798 |
| 2797 // Get the infobar at index 0. | 2799 // Get the infobar at index 0. |
| 2798 InfoBar* infobar = infobar_service->infobar_at(0); | 2800 InfoBar* infobar = infobar_manager->infobar_at(0); |
| 2799 ConfirmInfoBarDelegate* confirm_infobar = | 2801 ConfirmInfoBarDelegate* confirm_infobar = |
| 2800 infobar->delegate()->AsConfirmInfoBarDelegate(); | 2802 infobar->delegate()->AsConfirmInfoBarDelegate(); |
| 2801 ASSERT_TRUE(confirm_infobar != NULL); | 2803 ASSERT_TRUE(confirm_infobar != NULL); |
| 2802 | 2804 |
| 2803 // Verify multi download warning infobar message. | 2805 // Verify multi download warning infobar message. |
| 2804 EXPECT_EQ(confirm_infobar->GetMessageText(), | 2806 EXPECT_EQ(confirm_infobar->GetMessageText(), |
| 2805 l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING)); | 2807 l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING)); |
| 2806 | 2808 |
| 2807 // Click on the "Allow" button to allow multiple downloads. | 2809 // Click on the "Allow" button to allow multiple downloads. |
| 2808 if (confirm_infobar->Accept()) | 2810 if (confirm_infobar->Accept()) |
| 2809 infobar_service->RemoveInfoBar(infobar); | 2811 infobar_manager->RemoveInfoBar(infobar); |
| 2810 // Verify that there are no more infobars. | 2812 // Verify that there are no more infobars. |
| 2811 EXPECT_EQ(0u, infobar_service->infobar_count()); | 2813 EXPECT_EQ(0u, infobar_manager->infobar_count()); |
| 2812 | 2814 |
| 2813 // Waits for the download to complete. | 2815 // Waits for the download to complete. |
| 2814 downloads_observer->WaitForFinished(); | 2816 downloads_observer->WaitForFinished(); |
| 2815 EXPECT_EQ(2u, downloads_observer->NumDownloadsSeenInState( | 2817 EXPECT_EQ(2u, downloads_observer->NumDownloadsSeenInState( |
| 2816 DownloadItem::COMPLETE)); | 2818 DownloadItem::COMPLETE)); |
| 2817 } | 2819 } |
| 2818 | 2820 |
| 2819 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_Renaming) { | 2821 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_Renaming) { |
| 2820 ASSERT_TRUE(test_server()->Start()); | 2822 ASSERT_TRUE(test_server()->Start()); |
| 2821 GURL url(test_server()->GetURL("files/downloads/a_zip_file.zip")); | 2823 GURL url(test_server()->GetURL("files/downloads/a_zip_file.zip")); |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3223 | 3225 |
| 3224 // No errors this time. The download should complete successfully. | 3226 // No errors this time. The download should complete successfully. |
| 3225 EXPECT_FALSE(completion_observer->IsFinished()); | 3227 EXPECT_FALSE(completion_observer->IsFinished()); |
| 3226 completion_observer->StartObserving(); | 3228 completion_observer->StartObserving(); |
| 3227 download->Resume(); | 3229 download->Resume(); |
| 3228 completion_observer->WaitForFinished(); | 3230 completion_observer->WaitForFinished(); |
| 3229 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); | 3231 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); |
| 3230 | 3232 |
| 3231 EXPECT_FALSE(DidShowFileChooser()); | 3233 EXPECT_FALSE(DidShowFileChooser()); |
| 3232 } | 3234 } |
| OLD | NEW |