Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: chrome/browser/download/notification/download_notification_browsertest.cc

Issue 1159363002: [Download Notification] Show preview if downloaded file is image (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase & use embedded server Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/download/notification/download_notification_item.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chromeos/profiles/profile_helper.h" 10 #include "chrome/browser/chromeos/profiles/profile_helper.h"
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 // Checks there is neither any download nor any notification. 503 // Checks there is neither any download nor any notification.
504 EXPECT_EQ(0u, GetMessageCenter()->GetVisibleNotifications().size()); 504 EXPECT_EQ(0u, GetMessageCenter()->GetVisibleNotifications().size());
505 std::vector<content::DownloadItem*> downloads; 505 std::vector<content::DownloadItem*> downloads;
506 GetDownloadManager(browser())->GetAllDownloads(&downloads); 506 GetDownloadManager(browser())->GetAllDownloads(&downloads);
507 EXPECT_EQ(0u, downloads.size()); 507 EXPECT_EQ(0u, downloads.size());
508 508
509 // Checks the downloaded file doesn't exist. 509 // Checks the downloaded file doesn't exist.
510 EXPECT_FALSE(base::PathExists(GetDownloadPath().Append(filename.BaseName()))); 510 EXPECT_FALSE(base::PathExists(GetDownloadPath().Append(filename.BaseName())));
511 } 511 }
512 512
513 IN_PROC_BROWSER_TEST_F(DownloadNotificationTest, DownloadImageFile) {
514 GURL download_url(embedded_test_server()->GetURL(
515 "/downloads/image-octet-stream.png"));
516
517 content::DownloadTestObserverTerminal download_terminal_observer(
518 GetDownloadManager(browser()), 1u, /* wait_count */
519 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_IGNORE);
520
521 CreateDownloadForBrowserAndURL(browser(), download_url);
522
523 // Wait for the download completion.
524 download_terminal_observer.WaitForFinished();
525
526 // Waits for download completion.
527 while (GetNotification(notification_id())->image().IsEmpty()) {
528 NotificationUpdateObserver download_change_notification_observer;
529 download_change_notification_observer.Wait();
530 }
531 }
532
513 IN_PROC_BROWSER_TEST_F(DownloadNotificationTest, 533 IN_PROC_BROWSER_TEST_F(DownloadNotificationTest,
514 CloseNotificationAfterDownload) { 534 CloseNotificationAfterDownload) {
515 CreateDownload(); 535 CreateDownload();
516 536
517 // Requests to complete the download. 537 // Requests to complete the download.
518 ui_test_utils::NavigateToURL( 538 ui_test_utils::NavigateToURL(
519 browser(), GURL(net::URLRequestSlowDownloadJob::kFinishDownloadUrl)); 539 browser(), GURL(net::URLRequestSlowDownloadJob::kFinishDownloadUrl));
520 540
521 // Waits for download completion. 541 // Waits for download completion.
522 while (download_item()->GetState() != content::DownloadItem::COMPLETE) { 542 while (download_item()->GetState() != content::DownloadItem::COMPLETE) {
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 EXPECT_EQ(message_center::NOTIFICATION_TYPE_MULTIPLE, 1134 EXPECT_EQ(message_center::NOTIFICATION_TYPE_MULTIPLE,
1115 GetNotification(notification_id_user2_group)->type()); 1135 GetNotification(notification_id_user2_group)->type());
1116 EXPECT_EQ(2u, 1136 EXPECT_EQ(2u,
1117 GetNotification(notification_id_user2_group)->items().size()); 1137 GetNotification(notification_id_user2_group)->items().size());
1118 // Normal notifications for user2. 1138 // Normal notifications for user2.
1119 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, 1139 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT,
1120 GetNotification(notification_id_user2_1)->type()); 1140 GetNotification(notification_id_user2_1)->type());
1121 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, 1141 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT,
1122 GetNotification(notification_id_user2_2)->type()); 1142 GetNotification(notification_id_user2_2)->type());
1123 } 1143 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/notification/download_notification_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698