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

Unified Diff: chrome/browser/ui/cocoa/download/download_shelf_mac_unittest.mm

Issue 12995025: [Mac] DownloadShelf should be notified when autoclosing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: + NSTrackingInVisibleRect Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/download/download_shelf_mac_unittest.mm
diff --git a/chrome/browser/ui/cocoa/download/download_shelf_mac_unittest.mm b/chrome/browser/ui/cocoa/download/download_shelf_mac_unittest.mm
index 114d0c0aaac399db091b9d4cf944625f138fb39e..32354e2d7d7e594ec44e78ba27aa753db3960090 100644
--- a/chrome/browser/ui/cocoa/download/download_shelf_mac_unittest.mm
+++ b/chrome/browser/ui/cocoa/download/download_shelf_mac_unittest.mm
@@ -18,11 +18,12 @@
int callCountIsVisible;
int callCountShow;
int callCountHide;
+ int callCountCloseWithUserAction;
}
- (BOOL)isVisible;
-- (IBAction)show:(id)sender;
-- (IBAction)hide:(id)sender;
+- (void)showDownloadShelf:(BOOL)enable
+ isUserAction:(BOOL)isUserAction;
@end
@implementation FakeDownloadShelfController
@@ -32,12 +33,14 @@
return YES;
}
-- (IBAction)show:(id)sender {
- ++callCountShow;
-}
-
-- (IBAction)hide:(id)sender {
- ++callCountHide;
+- (void)showDownloadShelf:(BOOL)enable
+ isUserAction:(BOOL)isUserAction {
+ if (enable)
+ ++callCountShow;
+ else
+ ++callCountHide;
+ if (isUserAction && !enable)
+ ++callCountCloseWithUserAction;
}
@end
@@ -75,8 +78,18 @@ TEST_F(DownloadShelfMacTest, ForwardsHide) {
DownloadShelfMac shelf(browser(),
(DownloadShelfController*)shelf_controller_.get());
EXPECT_EQ(0, shelf_controller_.get()->callCountHide);
- shelf.Close();
+ shelf.Close(DownloadShelf::AUTOMATIC);
+ EXPECT_EQ(1, shelf_controller_.get()->callCountHide);
+ EXPECT_EQ(0, shelf_controller_.get()->callCountCloseWithUserAction);
+}
+
+TEST_F(DownloadShelfMacTest, ForwardsHideWithUserAction) {
+ DownloadShelfMac shelf(browser(),
+ (DownloadShelfController*)shelf_controller_.get());
+ EXPECT_EQ(0, shelf_controller_.get()->callCountHide);
+ shelf.Close(DownloadShelf::USER_ACTION);
EXPECT_EQ(1, shelf_controller_.get()->callCountHide);
+ EXPECT_EQ(1, shelf_controller_.get()->callCountCloseWithUserAction);
}
TEST_F(DownloadShelfMacTest, ForwardsIsShowing) {
« no previous file with comments | « chrome/browser/ui/cocoa/download/download_shelf_mac.mm ('k') | chrome/browser/ui/gtk/download/download_shelf_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698