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 // MediaGalleriesPreferences unit tests. | 5 // MediaGalleriesPreferences unit tests. |
6 | 6 |
7 #include "chrome/browser/media_galleries/media_galleries_preferences.h" | 7 #include "chrome/browser/media_galleries/media_galleries_preferences.h" |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 : ui_thread_(content::BrowserThread::UI, &loop_), | 71 : ui_thread_(content::BrowserThread::UI, &loop_), |
72 file_thread_(content::BrowserThread::FILE, &loop_), | 72 file_thread_(content::BrowserThread::FILE, &loop_), |
73 profile_(new TestingProfile()), | 73 profile_(new TestingProfile()), |
74 default_galleries_count_(0) { | 74 default_galleries_count_(0) { |
75 } | 75 } |
76 | 76 |
77 virtual ~MediaGalleriesPreferencesTest() { | 77 virtual ~MediaGalleriesPreferencesTest() { |
78 // TestExtensionSystem uses DeleteSoon, so we need to delete the profile | 78 // TestExtensionSystem uses DeleteSoon, so we need to delete the profile |
79 // and then run the message queue to clean up. | 79 // and then run the message queue to clean up. |
80 profile_.reset(); | 80 profile_.reset(); |
81 MessageLoop::current()->RunUntilIdle(); | 81 base::MessageLoop::current()->RunUntilIdle(); |
82 } | 82 } |
83 | 83 |
84 virtual void SetUp() OVERRIDE { | 84 virtual void SetUp() OVERRIDE { |
85 extensions::TestExtensionSystem* extension_system( | 85 extensions::TestExtensionSystem* extension_system( |
86 static_cast<extensions::TestExtensionSystem*>( | 86 static_cast<extensions::TestExtensionSystem*>( |
87 extensions::ExtensionSystem::Get(profile_.get()))); | 87 extensions::ExtensionSystem::Get(profile_.get()))); |
88 extension_system->CreateExtensionService( | 88 extension_system->CreateExtensionService( |
89 CommandLine::ForCurrentProcess(), base::FilePath(), false); | 89 CommandLine::ForCurrentProcess(), base::FilePath(), false); |
90 | 90 |
91 gallery_prefs_.reset(new MediaGalleriesPreferences(profile_.get())); | 91 gallery_prefs_.reset(new MediaGalleriesPreferences(profile_.get())); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 std::set<MediaGalleryPrefId> expected_galleries_for_all; | 206 std::set<MediaGalleryPrefId> expected_galleries_for_all; |
207 std::set<MediaGalleryPrefId> expected_galleries_for_regular; | 207 std::set<MediaGalleryPrefId> expected_galleries_for_regular; |
208 | 208 |
209 DeviceIdPrefIdsMap expected_device_map; | 209 DeviceIdPrefIdsMap expected_device_map; |
210 | 210 |
211 MediaGalleriesPrefInfoMap expected_galleries_; | 211 MediaGalleriesPrefInfoMap expected_galleries_; |
212 | 212 |
213 private: | 213 private: |
214 // Needed for extension service & friends to work. | 214 // Needed for extension service & friends to work. |
215 MessageLoop loop_; | 215 base::MessageLoop loop_; |
216 content::TestBrowserThread ui_thread_; | 216 content::TestBrowserThread ui_thread_; |
217 content::TestBrowserThread file_thread_; | 217 content::TestBrowserThread file_thread_; |
218 | 218 |
219 #if defined OS_CHROMEOS | 219 #if defined OS_CHROMEOS |
220 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 220 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
221 chromeos::ScopedTestCrosSettings test_cros_settings_; | 221 chromeos::ScopedTestCrosSettings test_cros_settings_; |
222 chromeos::ScopedTestUserManager test_user_manager_; | 222 chromeos::ScopedTestUserManager test_user_manager_; |
223 #endif | 223 #endif |
224 | 224 |
225 test::TestStorageMonitor monitor_; | 225 test::TestStorageMonitor monitor_; |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 // Remove a user added gallery and it should go away. | 712 // Remove a user added gallery and it should go away. |
713 gallery_prefs()->ForgetGalleryById(user_added_id); | 713 gallery_prefs()->ForgetGalleryById(user_added_id); |
714 expected_galleries_.erase(user_added_id); | 714 expected_galleries_.erase(user_added_id); |
715 expected_device_map[info.device_id()].erase(user_added_id); | 715 expected_device_map[info.device_id()].erase(user_added_id); |
716 | 716 |
717 EXPECT_EQ(2, observer1.notifications()); | 717 EXPECT_EQ(2, observer1.notifications()); |
718 EXPECT_EQ(3, observer2.notifications()); | 718 EXPECT_EQ(3, observer2.notifications()); |
719 } | 719 } |
720 | 720 |
721 } // namespace chrome | 721 } // namespace chrome |
OLD | NEW |