| 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/ui/gtk/extensions/media_galleries_dialog_gtk.h" | 9 #include "chrome/browser/ui/gtk/extensions/media_galleries_dialog_gtk.h" |
| 10 #include "chrome/common/extensions/extension_test_util.h" | |
| 11 #include "extensions/common/extension.h" | 10 #include "extensions/common/extension.h" |
| 11 #include "extensions/common/test_util.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 using ::testing::_; | 14 using ::testing::_; |
| 15 using ::testing::NiceMock; | 15 using ::testing::NiceMock; |
| 16 using ::testing::Return; | 16 using ::testing::Return; |
| 17 using ::testing::ReturnPointee; | 17 using ::testing::ReturnPointee; |
| 18 using ::testing::ReturnRef; | 18 using ::testing::ReturnRef; |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 MediaGalleryPrefInfo MakePrefInfoForTesting(MediaGalleryPrefId id) { | 22 MediaGalleryPrefInfo MakePrefInfoForTesting(MediaGalleryPrefId id) { |
| 23 MediaGalleryPrefInfo gallery; | 23 MediaGalleryPrefInfo gallery; |
| 24 gallery.pref_id = id; | 24 gallery.pref_id = id; |
| 25 gallery.device_id = StorageInfo::MakeDeviceId(StorageInfo::FIXED_MASS_STORAGE, | 25 gallery.device_id = StorageInfo::MakeDeviceId(StorageInfo::FIXED_MASS_STORAGE, |
| 26 base::Int64ToString(id)); | 26 base::Int64ToString(id)); |
| 27 gallery.display_name = base::ASCIIToUTF16("Display Name"); | 27 gallery.display_name = base::ASCIIToUTF16("Display Name"); |
| 28 return gallery; | 28 return gallery; |
| 29 } | 29 } |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 class MediaGalleriesDialogTest : public testing::Test { | 33 class MediaGalleriesDialogTest : public testing::Test { |
| 34 public: | 34 public: |
| 35 MediaGalleriesDialogTest() {} | 35 MediaGalleriesDialogTest() {} |
| 36 virtual ~MediaGalleriesDialogTest() {} | 36 virtual ~MediaGalleriesDialogTest() {} |
| 37 virtual void SetUp() OVERRIDE { | 37 virtual void SetUp() OVERRIDE { |
| 38 dummy_extension_ = extension_test_util::CreateExtensionWithID("dummy"); | 38 dummy_extension_ = extensions::test_util::CreateExtensionWithID("dummy"); |
| 39 } | 39 } |
| 40 virtual void TearDown() OVERRIDE { | 40 virtual void TearDown() OVERRIDE { |
| 41 dummy_extension_ = NULL; | 41 dummy_extension_ = NULL; |
| 42 } | 42 } |
| 43 | 43 |
| 44 const extensions::Extension& dummy_extension() const { | 44 const extensions::Extension& dummy_extension() const { |
| 45 return *dummy_extension_; | 45 return *dummy_extension_; |
| 46 } | 46 } |
| 47 | 47 |
| 48 private: | 48 private: |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 MediaGalleryPrefInfo gallery2 = MakePrefInfoForTesting(2); | 175 MediaGalleryPrefInfo gallery2 = MakePrefInfoForTesting(2); |
| 176 attached_permissions.push_back( | 176 attached_permissions.push_back( |
| 177 MediaGalleriesDialogController::GalleryPermission(gallery2, true)); | 177 MediaGalleriesDialogController::GalleryPermission(gallery2, true)); |
| 178 dialog.UpdateGalleries(); | 178 dialog.UpdateGalleries(); |
| 179 EXPECT_EQ(2U, dialog.checkbox_map_.size()); | 179 EXPECT_EQ(2U, dialog.checkbox_map_.size()); |
| 180 | 180 |
| 181 attached_permissions.pop_back(); | 181 attached_permissions.pop_back(); |
| 182 dialog.UpdateGalleries(); | 182 dialog.UpdateGalleries(); |
| 183 EXPECT_EQ(1U, dialog.checkbox_map_.size()); | 183 EXPECT_EQ(1U, dialog.checkbox_map_.size()); |
| 184 } | 184 } |
| OLD | NEW |