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/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 : ui_thread_(content::BrowserThread::UI, &loop_), | 73 : ui_thread_(content::BrowserThread::UI, &loop_), |
74 file_thread_(content::BrowserThread::FILE, &loop_), | 74 file_thread_(content::BrowserThread::FILE, &loop_), |
75 profile_(new TestingProfile()), | 75 profile_(new TestingProfile()), |
76 default_galleries_count_(0) { | 76 default_galleries_count_(0) { |
77 } | 77 } |
78 | 78 |
79 virtual ~MediaGalleriesPreferencesTest() { | 79 virtual ~MediaGalleriesPreferencesTest() { |
80 // TestExtensionSystem uses DeleteSoon, so we need to delete the profile | 80 // TestExtensionSystem uses DeleteSoon, so we need to delete the profile |
81 // and then run the message queue to clean up. | 81 // and then run the message queue to clean up. |
82 profile_.reset(); | 82 profile_.reset(); |
83 MessageLoop::current()->RunUntilIdle(); | 83 base::MessageLoop::current()->RunUntilIdle(); |
84 } | 84 } |
85 | 85 |
86 virtual void SetUp() OVERRIDE { | 86 virtual void SetUp() OVERRIDE { |
87 extensions::ExtensionTest::SetUp(); | 87 extensions::ExtensionTest::SetUp(); |
88 | 88 |
89 extensions::TestExtensionSystem* extension_system( | 89 extensions::TestExtensionSystem* extension_system( |
90 static_cast<extensions::TestExtensionSystem*>( | 90 static_cast<extensions::TestExtensionSystem*>( |
91 extensions::ExtensionSystem::Get(profile_.get()))); | 91 extensions::ExtensionSystem::Get(profile_.get()))); |
92 extension_system->CreateExtensionService( | 92 extension_system->CreateExtensionService( |
93 CommandLine::ForCurrentProcess(), base::FilePath(), false); | 93 CommandLine::ForCurrentProcess(), base::FilePath(), false); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 210 |
211 std::set<MediaGalleryPrefId> expected_galleries_for_all; | 211 std::set<MediaGalleryPrefId> expected_galleries_for_all; |
212 std::set<MediaGalleryPrefId> expected_galleries_for_regular; | 212 std::set<MediaGalleryPrefId> expected_galleries_for_regular; |
213 | 213 |
214 DeviceIdPrefIdsMap expected_device_map; | 214 DeviceIdPrefIdsMap expected_device_map; |
215 | 215 |
216 MediaGalleriesPrefInfoMap expected_galleries_; | 216 MediaGalleriesPrefInfoMap expected_galleries_; |
217 | 217 |
218 private: | 218 private: |
219 // Needed for extension service & friends to work. | 219 // Needed for extension service & friends to work. |
220 MessageLoop loop_; | 220 base::MessageLoop loop_; |
221 content::TestBrowserThread ui_thread_; | 221 content::TestBrowserThread ui_thread_; |
222 content::TestBrowserThread file_thread_; | 222 content::TestBrowserThread file_thread_; |
223 | 223 |
224 #if defined OS_CHROMEOS | 224 #if defined OS_CHROMEOS |
225 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 225 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
226 chromeos::ScopedTestCrosSettings test_cros_settings_; | 226 chromeos::ScopedTestCrosSettings test_cros_settings_; |
227 chromeos::ScopedTestUserManager test_user_manager_; | 227 chromeos::ScopedTestUserManager test_user_manager_; |
228 #endif | 228 #endif |
229 | 229 |
230 test::TestStorageMonitor monitor_; | 230 test::TestStorageMonitor monitor_; |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 // Remove a user added gallery and it should go away. | 728 // Remove a user added gallery and it should go away. |
729 gallery_prefs()->ForgetGalleryById(user_added_id); | 729 gallery_prefs()->ForgetGalleryById(user_added_id); |
730 expected_galleries_.erase(user_added_id); | 730 expected_galleries_.erase(user_added_id); |
731 expected_device_map[info.device_id].erase(user_added_id); | 731 expected_device_map[info.device_id].erase(user_added_id); |
732 | 732 |
733 EXPECT_EQ(2, observer1.notifications()); | 733 EXPECT_EQ(2, observer1.notifications()); |
734 EXPECT_EQ(3, observer2.notifications()); | 734 EXPECT_EQ(3, observer2.notifications()); |
735 } | 735 } |
736 | 736 |
737 } // namespace chrome | 737 } // namespace chrome |
OLD | NEW |