Chromium Code Reviews| 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 EXPECT_EQ(0U, [dialog->checkboxes_ count]); | |
| 144 CGFloat old_container_height = NSHeight([dialog->checkbox_container_ frame]); | |
| 145 | |
| 146 MediaGalleryPrefInfo gallery1 = MakePrefInfoForTesting(1); | |
| 147 dialog->UpdateGallery(&gallery1, true); | |
| 148 EXPECT_EQ(1U, [dialog->checkboxes_ count]); | |
| 149 | |
| 150 // The checkbox container should be taller. | |
| 151 CGFloat new_container_height = NSHeight([dialog->checkbox_container_ frame]); | |
| 152 EXPECT_GT(new_container_height, old_container_height); | |
| 153 old_container_height = new_container_height; | |
| 154 | |
| 155 MediaGalleryPrefInfo gallery2 = MakePrefInfoForTesting(2); | |
| 156 dialog->UpdateGallery(&gallery2, true); | |
| 157 EXPECT_EQ(2U, [dialog->checkboxes_ count]); | |
| 158 | |
| 159 // The checkbox container should be taller. | |
| 160 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.
| |
| 161 EXPECT_GT(new_container_height, old_container_height); | |
| 162 old_container_height = new_container_height; | |
| 163 | |
| 164 dialog->ForgetGallery(&gallery2); | |
| 165 EXPECT_EQ(1U, [dialog->checkboxes_ count]); | |
| 166 | |
| 167 // The checkbox container should be shorter. | |
| 168 new_container_height = NSHeight([dialog->checkbox_container_ frame]); | |
| 169 EXPECT_LT(new_container_height, old_container_height); | |
| 170 } | |
| 171 | |
| 132 } // namespace chrome | 172 } // namespace chrome |
| OLD | NEW |