Chromium Code Reviews| Index: chrome/browser/media_galleries/media_file_system_registry_unittest.cc |
| diff --git a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc |
| index 414f94de98a319f354b5948e6e8650ba70c790a7..db9880ba957143389b92906596dd004ad704b564 100644 |
| --- a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc |
| +++ b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc |
| @@ -7,6 +7,7 @@ |
| #include <algorithm> |
| #include <set> |
| +#include "base/bind_helpers.h" |
| #include "base/command_line.h" |
| #include "base/file_util.h" |
| #include "base/files/scoped_temp_dir.h" |
| @@ -291,6 +292,8 @@ class MediaFileSystemRegistryTest : public ChromeRenderViewHostTestHarness { |
| ProfileState* GetProfileState(size_t i); |
| + MediaGalleriesPreferences* GetPreferences(Profile* profile); |
| + |
| base::FilePath empty_dir() { |
| return empty_dir_; |
| } |
| @@ -382,7 +385,7 @@ class MediaFileSystemRegistryTest : public ChromeRenderViewHostTestHarness { |
| #if defined(OS_WIN) |
| scoped_ptr<test::TestStorageMonitorWin> monitor_; |
| #else |
| - chrome::test::TestStorageMonitor monitor_; |
| + scoped_ptr<chrome::test::TestStorageMonitor> monitor_; |
| #endif |
| MockProfileSharedRenderProcessHostFactory rph_factory_; |
| @@ -593,6 +596,11 @@ ProfileState* MediaFileSystemRegistryTest::GetProfileState(size_t i) { |
| return profile_states_[i]; |
| } |
| +MediaGalleriesPreferences* MediaFileSystemRegistryTest::GetPreferences( |
| + Profile* profile) { |
| + return GetMediaFileSystemRegistry()->GetPreferences(profile); |
| +} |
| + |
| std::string MediaFileSystemRegistryTest::AddUserGallery( |
| StorageInfo::Type type, |
| const std::string& unique_id, |
| @@ -720,7 +728,12 @@ MediaFileSystemRegistryTest::GetAutoAddedGalleries( |
| } |
| void MediaFileSystemRegistryTest::SetUp() { |
| -#if defined(OS_WIN) |
| +#if !defined(OS_WIN) |
|
Lei Zhang
2013/06/03 06:01:35
style nit:
#if defined(OS_WIN)
...
#else
...
#endi
Greg Billock
2013/06/03 15:30:57
Done.
|
| + monitor_.reset(new test::TestStorageMonitor()); |
| + monitor_->Initialize(base::Bind(&base::DoNothing)); |
| + monitor_->MarkInitialized(); |
| + base::RunLoop().RunUntilIdle(); |
| +#else |
| test::TestPortableDeviceWatcherWin* portable_device_watcher = |
| new test::TestPortableDeviceWatcherWin; |
| test::TestVolumeMountWatcherWin* mount_watcher = |
| @@ -728,7 +741,7 @@ void MediaFileSystemRegistryTest::SetUp() { |
| portable_device_watcher->set_use_dummy_mtp_storage_info(true); |
| monitor_.reset(new test::TestStorageMonitorWin( |
| mount_watcher, portable_device_watcher)); |
| - monitor_->Init(); |
| + monitor_->Initialize(base::Bind(&base::DoNothing)); |
| // TODO(gbillock): Replace this with the correct event notification |
| // on the storage monitor finishing the startup scan when that exists. |
| base::RunLoop().RunUntilIdle(); |
| @@ -850,8 +863,7 @@ TEST_F(MediaFileSystemRegistryTest, |
| // Forget the device. |
| bool forget_gallery = false; |
| - MediaGalleriesPreferences* prefs = |
| - GetMediaFileSystemRegistry()->GetPreferences(profile_state->profile()); |
| + MediaGalleriesPreferences* prefs = GetPreferences(profile_state->profile()); |
| const MediaGalleriesPrefInfoMap& galleries = prefs->known_galleries(); |
| for (MediaGalleriesPrefInfoMap::const_iterator it = galleries.begin(); |
| it != galleries.end(); ++it) { |
| @@ -866,7 +878,7 @@ TEST_F(MediaFileSystemRegistryTest, |
| EXPECT_EQ(gallery_count, GetAutoAddedGalleries(profile_state).size()); |
| // Call GetPreferences() and the gallery count should not change. |
| - GetMediaFileSystemRegistry()->GetPreferences(profile_state->profile()); |
| + prefs = GetPreferences(profile_state->profile()); |
| EXPECT_EQ(gallery_count, GetAutoAddedGalleries(profile_state).size()); |
| } |
| @@ -884,7 +896,7 @@ TEST_F(MediaFileSystemRegistryTest, GalleryNameDefault) { |
| // TODO(gbillock): Put the platform-specific parts of this test in tests |
| // for those classes, not here. This test, internally, ends up creating an |
| -// MTP delegate. |
| +// MTP delegate. (Probably ./win/mtp_device_delegate_impl_win_unittest) |
| #if !defined(OS_MACOSX) |
| TEST_F(MediaFileSystemRegistryTest, GalleryNameMTP) { |
| FSInfoMap galleries_info; |