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

Unified Diff: chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_unittest.mm

Issue 12095074: Media Galleries: Keep media gallery permission dialogs in sync with the gallery (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: merge Created 7 years, 10 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/extensions/media_galleries_dialog_cocoa_unittest.mm
===================================================================
--- chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_unittest.mm (revision 181441)
+++ chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_unittest.mm (working copy)
@@ -129,4 +129,44 @@
EXPECT_EQ(new_container_height, old_container_height);
}
+TEST_F(MediaGalleriesDialogTest, ForgetDeletes) {
+ NiceMock<MediaGalleriesDialogControllerMock> controller;
+
+ MediaGalleriesDialogController::KnownGalleryPermissions permissions;
+ EXPECT_CALL(controller, permissions()).
+ WillRepeatedly(ReturnRef(permissions));
+
+ scoped_ptr<MediaGalleriesDialogCocoa> dialog(
+ static_cast<MediaGalleriesDialogCocoa*>(
+ MediaGalleriesDialog::Create(&controller)));
+
+ EXPECT_EQ(0U, [dialog->checkboxes_ count]);
+ CGFloat old_container_height = NSHeight([dialog->checkbox_container_ frame]);
+
+ MediaGalleryPrefInfo gallery1 = MakePrefInfoForTesting(1);
+ dialog->UpdateGallery(&gallery1, true);
+ EXPECT_EQ(1U, [dialog->checkboxes_ count]);
+
+ // The checkbox container should be taller.
+ CGFloat new_container_height = NSHeight([dialog->checkbox_container_ frame]);
+ EXPECT_GT(new_container_height, old_container_height);
+ old_container_height = new_container_height;
+
+ MediaGalleryPrefInfo gallery2 = MakePrefInfoForTesting(2);
+ dialog->UpdateGallery(&gallery2, true);
+ EXPECT_EQ(2U, [dialog->checkboxes_ count]);
+
+ // The checkbox container should be taller.
+ new_container_height = NSHeight([dialog->checkbox_container_ frame]);
sail 2013/02/08 19:48:22 this test is a bit long. How about removing the tw
Lei Zhang 2013/02/08 20:48:02 Done.
+ EXPECT_GT(new_container_height, old_container_height);
+ old_container_height = new_container_height;
+
+ dialog->ForgetGallery(&gallery2);
+ EXPECT_EQ(1U, [dialog->checkboxes_ count]);
+
+ // The checkbox container should be shorter.
+ new_container_height = NSHeight([dialog->checkbox_container_ frame]);
+ EXPECT_LT(new_container_height, old_container_height);
+}
+
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698