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

Side by Side Diff: chrome/browser/ui/cocoa/download/download_item_controller_unittest.mm

Issue 209613002: Download shelf autohides on showing in shell, just same as regular open Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added browser and unit tests. Renamed 'UserActed' to 'OpenedOrShown'. Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "chrome/browser/ui/cocoa/download/download_item_controller.h" 5 #import "chrome/browser/ui/cocoa/download/download_item_controller.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 } 98 }
99 99
100 protected: 100 protected:
101 std::unique_ptr<content::MockDownloadItem> download_item_; 101 std::unique_ptr<content::MockDownloadItem> download_item_;
102 base::scoped_nsobject<DownloadShelfController> shelf_; 102 base::scoped_nsobject<DownloadShelfController> shelf_;
103 }; 103 };
104 104
105 TEST_F(DownloadItemControllerTest, ShelfNotifiedOfOpenedDownload) { 105 TEST_F(DownloadItemControllerTest, ShelfNotifiedOfOpenedDownload) {
106 base::scoped_nsobject<DownloadItemController> item(CreateItemController()); 106 base::scoped_nsobject<DownloadItemController> item(CreateItemController());
107 [[(id)shelf_ expect] downloadWasOpened:[OCMArg any]]; 107 [[(id)shelf_ expect] downloadWasOpenedOrShown:[OCMArg any]];
108 download_item_->NotifyObserversDownloadOpened(); 108 download_item_->NotifyObserversDownloadOpened();
109 } 109 }
110 110
111 TEST_F(DownloadItemControllerTest, ShelfNotifiedOfShownDownload) {
112 base::scoped_nsobject<DownloadItemController> item(CreateItemController());
113 [[(id)shelf_ expect] downloadWasOpenedOrShown:[OCMArg any]];
114 download_item_->NotifyObserversDownloadShown();
115 }
116
111 TEST_F(DownloadItemControllerTest, RemovesSelfWhenDownloadIsDestroyed) { 117 TEST_F(DownloadItemControllerTest, RemovesSelfWhenDownloadIsDestroyed) {
112 base::scoped_nsobject<DownloadItemController> item(CreateItemController()); 118 base::scoped_nsobject<DownloadItemController> item(CreateItemController());
113 [[(id)shelf_ expect] remove:[OCMArg any]]; 119 [[(id)shelf_ expect] remove:[OCMArg any]];
114 download_item_.reset(); 120 download_item_.reset();
115 } 121 }
116 122
117 TEST_F(DownloadItemControllerTest, NormalDownload) { 123 TEST_F(DownloadItemControllerTest, NormalDownload) {
118 base::scoped_nsobject<DownloadItemController> item(CreateItemController()); 124 base::scoped_nsobject<DownloadItemController> item(CreateItemController());
119 125
120 [item verifyProgressViewIsVisible:true]; 126 [item verifyProgressViewIsVisible:true];
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // download item are mock objects. 188 // download item are mock objects.
183 [downloadItemButton removeFromSuperview]; 189 [downloadItemButton removeFromSuperview];
184 }]; 190 }];
185 // The unit test will stop here until the block causes the DownloadItemButton 191 // The unit test will stop here until the block causes the DownloadItemButton
186 // to dismiss the menu. 192 // to dismiss the menu.
187 [item showContextMenu:nil]; 193 [item showContextMenu:nil];
188 } 194 }
189 195
190 196
191 } // namespace 197 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/download/download_item_controller.mm ('k') | chrome/browser/ui/cocoa/download/download_item_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698