Chromium Code Reviews| Index: chrome/browser/media_gallery/media_file_system_registry_unittest.cc |
| diff --git a/chrome/browser/media_gallery/media_file_system_registry_unittest.cc b/chrome/browser/media_gallery/media_file_system_registry_unittest.cc |
| index 72c2f496eb571bab8f5ddaf8e81dfbd3e6971ebe..4be3cb1410f86a3319d4deb9f9015fbfbb646663 100644 |
| --- a/chrome/browser/media_gallery/media_file_system_registry_unittest.cc |
| +++ b/chrome/browser/media_gallery/media_file_system_registry_unittest.cc |
| @@ -29,6 +29,7 @@ |
| #include "chrome/browser/media_gallery/media_galleries_test_util.h" |
| #include "chrome/browser/system_monitor/media_storage_util.h" |
| #include "chrome/browser/system_monitor/removable_device_constants.h" |
| +#include "chrome/browser/system_monitor/removable_storage_notifications.h" |
| #include "chrome/common/extensions/extension.h" |
| #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| #include "chrome/test/base/testing_browser_process.h" |
| @@ -189,6 +190,8 @@ void CheckGalleryJSONName(const std::string& name, bool removable) { |
| EXPECT_FALSE(gallery_name.empty()) << name; |
| } |
| +} // namespace |
| + |
| class TestMediaStorageUtil : public MediaStorageUtil { |
| public: |
| static void SetTestingMode(); |
| @@ -312,6 +315,17 @@ class MediaFileSystemRegistryTest : public ChromeRenderViewHostTestHarness { |
| std::vector<MediaFileSystemInfo> GetAutoAddedGalleries( |
| ProfileState* profile_state); |
| + void ProcessAttach(const std::string& id, |
| + const string16& name, |
| + const FilePath::StringType& location) { |
| + RemovableStorageNotifications::GetInstance()->ProcessAttach( |
|
Hongbo Min
2013/01/17 09:38:03
Is RemovableStorageNotifications instance always c
Greg Billock
2013/01/17 22:10:45
Good question. This test isn't fully converted yet
|
| + id, name, location); |
| + } |
| + |
| + void ProcessDetach(const std::string& id) { |
| + RemovableStorageNotifications::GetInstance()->ProcessDetach(id); |
| + } |
| + |
| protected: |
| void SetUp(); |
| void TearDown(); |
| @@ -587,8 +601,7 @@ std::string MediaFileSystemRegistryTest::AttachDevice( |
| std::string device_id = MediaStorageUtil::MakeDeviceId(type, unique_id); |
| DCHECK(MediaStorageUtil::IsRemovableDevice(device_id)); |
| string16 name = location.LossyDisplayName(); |
| - base::SystemMonitor::Get()->ProcessRemovableStorageAttached(device_id, name, |
| - location.value()); |
| + ProcessAttach(device_id, name, location.value()); |
| bool user_added = (type == MediaStorageUtil::REMOVABLE_MASS_STORAGE_NO_DCIM); |
| for (size_t i = 0; i < profile_states_.size(); ++i) { |
| profile_states_[i]->GetMediaGalleriesPrefs()->AddGallery( |
| @@ -600,7 +613,7 @@ std::string MediaFileSystemRegistryTest::AttachDevice( |
| void MediaFileSystemRegistryTest::DetachDevice(const std::string& device_id) { |
| DCHECK(MediaStorageUtil::IsRemovableDevice(device_id)); |
| - base::SystemMonitor::Get()->ProcessRemovableStorageDetached(device_id); |
| + ProcessDetach(device_id); |
| MessageLoop::current()->RunUntilIdle(); |
| } |
| @@ -846,6 +859,4 @@ TEST_F(MediaFileSystemRegistryTest, GalleryNameUserAddedPath) { |
| CheckNewGallery(profile_state, gallery_names, false /*not removable*/); |
| } |
| -} // namespace |
| - |
| } // namespace chrome |