| 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 de69159af8573b710f34be96b1e4455756c68dd6..b02351d32c6fd3aa5c4b96e7043c6e6f02a8a1b2 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,8 @@
|
| #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/browser/system_monitor/test_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"
|
| @@ -307,6 +309,8 @@ class ProfileState {
|
| DISALLOW_COPY_AND_ASSIGN(ProfileState);
|
| };
|
|
|
| +} // namespace
|
| +
|
| class MediaFileSystemRegistryTest : public ChromeRenderViewHostTestHarness {
|
| public:
|
| MediaFileSystemRegistryTest();
|
| @@ -355,9 +359,20 @@ 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(
|
| + id, name, location);
|
| + }
|
| +
|
| + void ProcessDetach(const std::string& id) {
|
| + RemovableStorageNotifications::GetInstance()->ProcessDetach(id);
|
| + }
|
| +
|
| protected:
|
| - void SetUp();
|
| - void TearDown();
|
| + virtual void SetUp() OVERRIDE;
|
| + virtual void TearDown() OVERRIDE;
|
|
|
| private:
|
| // This makes sure that at least one default gallery exists on the file
|
| @@ -380,11 +395,10 @@ class MediaFileSystemRegistryTest : public ChromeRenderViewHostTestHarness {
|
|
|
| #if defined(OS_WIN)
|
| scoped_ptr<test::TestRemovableDeviceNotificationsWindowWin> window_;
|
| +#else
|
| + chrome::test::TestRemovableStorageNotifications notifications_;
|
| #endif
|
|
|
| - // For AttachDevice() and DetachDevice().
|
| - scoped_ptr<base::SystemMonitor> system_monitor_;
|
| -
|
| MockProfileSharedRenderProcessHostFactory rph_factory_;
|
|
|
| ScopedVector<ProfileState> profile_states_;
|
| @@ -392,6 +406,8 @@ class MediaFileSystemRegistryTest : public ChromeRenderViewHostTestHarness {
|
| DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistryTest);
|
| };
|
|
|
| +namespace {
|
| +
|
| bool MediaFileSystemInfoComparator(const MediaFileSystemInfo& a,
|
| const MediaFileSystemInfo& b) {
|
| CHECK_NE(a.name, b.name); // Name must be unique.
|
| @@ -588,6 +604,8 @@ int ProfileState::GetAndClearComparisonCount() {
|
| return result;
|
| }
|
|
|
| +} // namespace
|
| +
|
| /////////////////////////////////
|
| // MediaFileSystemRegistryTest //
|
| /////////////////////////////////
|
| @@ -630,8 +648,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(
|
| @@ -643,7 +660,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();
|
| }
|
|
|
| @@ -753,12 +770,6 @@ void MediaFileSystemRegistryTest::SetUp() {
|
| window_->Init();
|
| #endif
|
|
|
| -#if defined(OS_MACOSX)
|
| - // This needs to happen before SystemMonitor's ctor.
|
| - base::SystemMonitor::AllocateSystemIOPorts();
|
| -#endif
|
| - system_monitor_.reset(new base::SystemMonitor);
|
| -
|
| ChromeRenderViewHostTestHarness::SetUp();
|
| DeleteContents();
|
| SetRenderProcessHostFactory(&rph_factory_);
|
| @@ -914,6 +925,4 @@ TEST_F(MediaFileSystemRegistryTest, GalleryNameUserAddedPath) {
|
| false /*removable*/, false /* media device */);
|
| }
|
|
|
| -} // namespace
|
| -
|
| } // namespace chrome
|
|
|