| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/string_number_conversions.h" | 5 #include "base/string_number_conversions.h" |
| 6 #include "chrome/browser/system_monitor/media_storage_util.h" | 6 #include "chrome/browser/system_monitor/media_storage_util.h" |
| 7 #include "chrome/browser/media_gallery/media_galleries_dialog_controller_mock.h" | 7 #include "chrome/browser/media_gallery/media_galleries_dialog_controller_mock.h" |
| 8 #include "chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.h" | 8 #include "chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 old_container_height = new_container_height; | 122 old_container_height = new_container_height; |
| 123 | 123 |
| 124 dialog->UpdateGallery(&gallery2, false); | 124 dialog->UpdateGallery(&gallery2, false); |
| 125 EXPECT_EQ(2U, [dialog->checkboxes_ count]); | 125 EXPECT_EQ(2U, [dialog->checkboxes_ count]); |
| 126 | 126 |
| 127 // The checkbox container height should not have changed. | 127 // The checkbox container height should not have changed. |
| 128 new_container_height = NSHeight([dialog->checkbox_container_ frame]); | 128 new_container_height = NSHeight([dialog->checkbox_container_ frame]); |
| 129 EXPECT_EQ(new_container_height, old_container_height); | 129 EXPECT_EQ(new_container_height, old_container_height); |
| 130 } | 130 } |
| 131 | 131 |
| 132 TEST_F(MediaGalleriesDialogTest, ForgetDeletes) { |
| 133 NiceMock<MediaGalleriesDialogControllerMock> controller; |
| 134 |
| 135 MediaGalleriesDialogController::KnownGalleryPermissions permissions; |
| 136 EXPECT_CALL(controller, permissions()). |
| 137 WillRepeatedly(ReturnRef(permissions)); |
| 138 |
| 139 scoped_ptr<MediaGalleriesDialogCocoa> dialog( |
| 140 static_cast<MediaGalleriesDialogCocoa*>( |
| 141 MediaGalleriesDialog::Create(&controller))); |
| 142 |
| 143 // Add a couple of galleries. |
| 144 MediaGalleryPrefInfo gallery1 = MakePrefInfoForTesting(1); |
| 145 dialog->UpdateGallery(&gallery1, true); |
| 146 MediaGalleryPrefInfo gallery2 = MakePrefInfoForTesting(2); |
| 147 dialog->UpdateGallery(&gallery2, true); |
| 148 EXPECT_EQ(2U, [dialog->checkboxes_ count]); |
| 149 CGFloat old_container_height = NSHeight([dialog->checkbox_container_ frame]); |
| 150 |
| 151 // Remove a gallery. |
| 152 dialog->ForgetGallery(&gallery1); |
| 153 EXPECT_EQ(1U, [dialog->checkboxes_ count]); |
| 154 |
| 155 // The checkbox container should be shorter. |
| 156 CGFloat new_container_height = NSHeight([dialog->checkbox_container_ frame]); |
| 157 EXPECT_LT(new_container_height, old_container_height); |
| 158 } |
| 159 |
| 132 } // namespace chrome | 160 } // namespace chrome |
| OLD | NEW |