| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 EXPECT_EQ(1u, visible_notifications.size()); | 661 EXPECT_EQ(1u, visible_notifications.size()); |
| 662 EXPECT_TRUE(IsInNotifications(visible_notifications, notification_id())); | 662 EXPECT_TRUE(IsInNotifications(visible_notifications, notification_id())); |
| 663 } | 663 } |
| 664 | 664 |
| 665 IN_PROC_BROWSER_TEST_F(DownloadNotificationTest, InterruptDownload) { | 665 IN_PROC_BROWSER_TEST_F(DownloadNotificationTest, InterruptDownload) { |
| 666 CreateDownload(); | 666 CreateDownload(); |
| 667 | 667 |
| 668 // Installs observers before requesting. | 668 // Installs observers before requesting. |
| 669 NotificationUpdateObserver | 669 NotificationUpdateObserver |
| 670 download_notification_update_observer(notification_id()); | 670 download_notification_update_observer(notification_id()); |
| 671 content::DownloadTestObserverTerminal download_terminal_observer( | 671 content::DownloadTestObserverInterrupted download_terminal_observer( |
| 672 GetDownloadManager(browser()), | 672 GetDownloadManager(browser()), |
| 673 1u, /* wait_count */ | 673 1u, /* wait_count */ |
| 674 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); | 674 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); |
| 675 | 675 |
| 676 // Requests to fail the download and wait for it. | 676 // Requests to fail the download and wait for it. |
| 677 ui_test_utils::NavigateToURL( | 677 ui_test_utils::NavigateToURL( |
| 678 browser(), GURL(net::URLRequestSlowDownloadJob::kErrorDownloadUrl)); | 678 browser(), GURL(net::URLRequestSlowDownloadJob::kErrorDownloadUrl)); |
| 679 download_terminal_observer.WaitForFinished(); | 679 download_terminal_observer.WaitForFinished(); |
| 680 | 680 |
| 681 // Waits that new notification. | 681 // Waits that new notification. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 | 715 |
| 716 // Confirms that a download is still in progress. | 716 // Confirms that a download is still in progress. |
| 717 std::vector<content::DownloadItem*> downloads; | 717 std::vector<content::DownloadItem*> downloads; |
| 718 content::DownloadManager* download_manager = GetDownloadManager(browser()); | 718 content::DownloadManager* download_manager = GetDownloadManager(browser()); |
| 719 download_manager->GetAllDownloads(&downloads); | 719 download_manager->GetAllDownloads(&downloads); |
| 720 EXPECT_EQ(1u, downloads.size()); | 720 EXPECT_EQ(1u, downloads.size()); |
| 721 EXPECT_EQ(content::DownloadItem::IN_PROGRESS, downloads[0]->GetState()); | 721 EXPECT_EQ(content::DownloadItem::IN_PROGRESS, downloads[0]->GetState()); |
| 722 | 722 |
| 723 // Installs observers before requesting the completion. | 723 // Installs observers before requesting the completion. |
| 724 NotificationAddObserver download_notification_add_observer; | 724 NotificationAddObserver download_notification_add_observer; |
| 725 content::DownloadTestObserverTerminal download_terminal_observer( | 725 content::DownloadTestObserverInterrupted download_terminal_observer( |
| 726 download_manager, | 726 download_manager, |
| 727 1u, /* wait_count */ | 727 1u, /* wait_count */ |
| 728 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); | 728 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); |
| 729 | 729 |
| 730 // Requests to fail the download and wait for it. | 730 // Requests to fail the download and wait for it. |
| 731 ui_test_utils::NavigateToURL( | 731 ui_test_utils::NavigateToURL( |
| 732 browser(), GURL(net::URLRequestSlowDownloadJob::kErrorDownloadUrl)); | 732 browser(), GURL(net::URLRequestSlowDownloadJob::kErrorDownloadUrl)); |
| 733 download_terminal_observer.WaitForFinished(); | 733 download_terminal_observer.WaitForFinished(); |
| 734 | 734 |
| 735 // Waits that new notification. | 735 // Waits that new notification. |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1301 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, | 1301 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, |
| 1302 GetNotification(notification_id_user1)->type()); | 1302 GetNotification(notification_id_user1)->type()); |
| 1303 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, | 1303 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, |
| 1304 GetNotification(notification_id_user2_1)->type()); | 1304 GetNotification(notification_id_user2_1)->type()); |
| 1305 // Normal notifications for user2. | 1305 // Normal notifications for user2. |
| 1306 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, | 1306 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, |
| 1307 GetNotification(notification_id_user2_1)->type()); | 1307 GetNotification(notification_id_user2_1)->type()); |
| 1308 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, | 1308 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, |
| 1309 GetNotification(notification_id_user2_2)->type()); | 1309 GetNotification(notification_id_user2_2)->type()); |
| 1310 } | 1310 } |
| OLD | NEW |