| 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/strings/string_number_conversions.h" | 5 #include "base/strings/string_number_conversions.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/browser/media_galleries/media_galleries_dialog_controller_mock.
h" | 7 #include "chrome/browser/media_galleries/media_galleries_dialog_controller_mock.
h" |
| 8 #include "chrome/browser/storage_monitor/storage_info.h" | 8 #include "chrome/browser/storage_monitor/storage_info.h" |
| 9 #include "chrome/browser/storage_monitor/test_storage_monitor.h" | |
| 10 #include "chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.h" | 9 #include "chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 11 |
| 13 using ::testing::_; | 12 using ::testing::_; |
| 14 using ::testing::NiceMock; | 13 using ::testing::NiceMock; |
| 15 using ::testing::Return; | 14 using ::testing::Return; |
| 16 using ::testing::ReturnPointee; | 15 using ::testing::ReturnPointee; |
| 17 using ::testing::ReturnRef; | 16 using ::testing::ReturnRef; |
| 18 | 17 |
| 19 namespace chrome { | 18 namespace chrome { |
| 20 | 19 |
| 21 MediaGalleryPrefInfo MakePrefInfoForTesting(MediaGalleryPrefId pref_id) { | 20 MediaGalleryPrefInfo MakePrefInfoForTesting(MediaGalleryPrefId pref_id) { |
| 22 MediaGalleryPrefInfo gallery; | 21 MediaGalleryPrefInfo gallery; |
| 23 gallery.pref_id = pref_id; | 22 gallery.pref_id = pref_id; |
| 24 gallery.device_id = | 23 gallery.device_id = |
| 25 StorageInfo::MakeDeviceId(StorageInfo::FIXED_MASS_STORAGE, | 24 StorageInfo::MakeDeviceId(StorageInfo::FIXED_MASS_STORAGE, |
| 26 base::Int64ToString(pref_id)); | 25 base::Int64ToString(pref_id)); |
| 27 gallery.display_name = ASCIIToUTF16("name"); | 26 gallery.display_name = ASCIIToUTF16("name"); |
| 28 return gallery; | 27 return gallery; |
| 29 } | 28 } |
| 30 | 29 |
| 31 class MediaGalleriesDialogTest : public testing::Test { | 30 class MediaGalleriesDialogTest : public testing::Test { |
| 32 private: | |
| 33 test::TestStorageMonitor test_storage_monitor_; | |
| 34 }; | 31 }; |
| 35 | 32 |
| 36 // Tests that checkboxes are initialized according to the contents of | 33 // Tests that checkboxes are initialized according to the contents of |
| 37 // permissions(). | 34 // permissions(). |
| 38 TEST_F(MediaGalleriesDialogTest, InitializeCheckboxes) { | 35 TEST_F(MediaGalleriesDialogTest, InitializeCheckboxes) { |
| 39 NiceMock<MediaGalleriesDialogControllerMock> controller; | 36 NiceMock<MediaGalleriesDialogControllerMock> controller; |
| 40 | 37 |
| 41 MediaGalleriesDialogController::GalleryPermissionsVector attached_permissions; | 38 MediaGalleriesDialogController::GalleryPermissionsVector attached_permissions; |
| 42 attached_permissions.push_back( | 39 attached_permissions.push_back( |
| 43 MediaGalleriesDialogController::GalleryPermission( | 40 MediaGalleriesDialogController::GalleryPermission( |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 attached_permissions.erase(attached_permissions.begin()); | 183 attached_permissions.erase(attached_permissions.begin()); |
| 187 dialog->ForgetGallery(1); | 184 dialog->ForgetGallery(1); |
| 188 EXPECT_EQ(1U, [dialog->checkboxes_ count]); | 185 EXPECT_EQ(1U, [dialog->checkboxes_ count]); |
| 189 | 186 |
| 190 // The checkbox container should be shorter. | 187 // The checkbox container should be shorter. |
| 191 CGFloat new_container_height = NSHeight([dialog->checkbox_container_ frame]); | 188 CGFloat new_container_height = NSHeight([dialog->checkbox_container_ frame]); |
| 192 EXPECT_LT(new_container_height, old_container_height); | 189 EXPECT_LT(new_container_height, old_container_height); |
| 193 } | 190 } |
| 194 | 191 |
| 195 } // namespace chrome | 192 } // namespace chrome |
| OLD | NEW |