| 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/gtk/extensions/media_galleries_dialog_gtk.h" | 9 #include "chrome/browser/ui/gtk/extensions/media_galleries_dialog_gtk.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 namespace { | 20 namespace { |
| 22 | 21 |
| 23 MediaGalleryPrefInfo MakePrefInfoForTesting(MediaGalleryPrefId id) { | 22 MediaGalleryPrefInfo MakePrefInfoForTesting(MediaGalleryPrefId id) { |
| 24 MediaGalleryPrefInfo gallery; | 23 MediaGalleryPrefInfo gallery; |
| 25 gallery.pref_id = id; | 24 gallery.pref_id = id; |
| 26 gallery.device_id = | 25 gallery.device_id = |
| 27 StorageInfo::MakeDeviceId(StorageInfo::FIXED_MASS_STORAGE, | 26 StorageInfo::MakeDeviceId(StorageInfo::FIXED_MASS_STORAGE, |
| 28 base::Int64ToString(id)); | 27 base::Int64ToString(id)); |
| 29 gallery.display_name = ASCIIToUTF16("Display Name"); | 28 gallery.display_name = ASCIIToUTF16("Display Name"); |
| 30 return gallery; | 29 return gallery; |
| 31 } | 30 } |
| 32 | 31 |
| 33 } // namespace | 32 } // namespace |
| 34 | 33 |
| 35 class MediaGalleriesDialogTest : public testing::Test { | 34 class MediaGalleriesDialogTest : public testing::Test { |
| 36 private: | |
| 37 test::TestStorageMonitor test_storage_monitor_; | |
| 38 }; | 35 }; |
| 39 | 36 |
| 40 // Tests that checkboxes are initialized according to the contents of | 37 // Tests that checkboxes are initialized according to the contents of |
| 41 // permissions in the registry. | 38 // permissions in the registry. |
| 42 TEST_F(MediaGalleriesDialogTest, InitializeCheckboxes) { | 39 TEST_F(MediaGalleriesDialogTest, InitializeCheckboxes) { |
| 43 // TODO(gbillock): Get rid of this mock; make something specialized. | 40 // TODO(gbillock): Get rid of this mock; make something specialized. |
| 44 NiceMock<MediaGalleriesDialogControllerMock> controller; | 41 NiceMock<MediaGalleriesDialogControllerMock> controller; |
| 45 | 42 |
| 46 MediaGalleriesDialogController::GalleryPermissionsVector attached_permissions; | 43 MediaGalleriesDialogController::GalleryPermissionsVector attached_permissions; |
| 47 attached_permissions.push_back( | 44 attached_permissions.push_back( |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 MediaGalleriesDialogController::GalleryPermission(gallery2, true)); | 160 MediaGalleriesDialogController::GalleryPermission(gallery2, true)); |
| 164 dialog.UpdateGallery(gallery2, true); | 161 dialog.UpdateGallery(gallery2, true); |
| 165 EXPECT_EQ(2U, dialog.checkbox_map_.size()); | 162 EXPECT_EQ(2U, dialog.checkbox_map_.size()); |
| 166 | 163 |
| 167 dialog.ForgetGallery(gallery2.pref_id); | 164 dialog.ForgetGallery(gallery2.pref_id); |
| 168 attached_permissions.pop_back(); | 165 attached_permissions.pop_back(); |
| 169 EXPECT_EQ(1U, dialog.checkbox_map_.size()); | 166 EXPECT_EQ(1U, dialog.checkbox_map_.size()); |
| 170 } | 167 } |
| 171 | 168 |
| 172 } // namespace chrome | 169 } // namespace chrome |
| OLD | NEW |