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 04355985afdbd0d52ced49eaea7edb205375432a..f8775dd3f1c941f4635ba2889a328aa19a9b9afb 100644 |
--- a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc |
+++ b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc |
@@ -17,6 +17,7 @@ |
#include "base/run_loop.h" |
#include "base/stl_util.h" |
#include "base/stringprintf.h" |
+#include "base/synchronization/waitable_event.h" |
#include "base/threading/sequenced_worker_pool.h" |
#include "base/utf_string_conversions.h" |
#include "base/values.h" |
@@ -392,7 +393,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_; |
@@ -560,6 +561,7 @@ void ProfileState::CompareResults( |
const std::string& test, |
const std::vector<MediaFileSystemInfo>& expected, |
const std::vector<MediaFileSystemInfo>& actual) { |
+LOG(INFO) << "CompareResults " << expected.size() << " vs " << actual.size(); |
// Order isn't important, so sort the results. Assume that expected |
// is already sorted. |
std::vector<MediaFileSystemInfo> sorted(actual); |
@@ -731,7 +733,15 @@ MediaFileSystemRegistryTest::GetAutoAddedGalleries( |
} |
void MediaFileSystemRegistryTest::SetUp() { |
-#if defined(OS_WIN) |
+#if !defined(OS_WIN) |
+ monitor_.reset(new test::TestStorageMonitor()); |
+ base::WaitableEvent wait_for_init(false, false); |
+ monitor_->Initialize(base::Bind(&base::WaitableEvent::Signal, |
+ base::Unretained(&wait_for_init))); |
+ monitor_->MarkInitialized(); |
+ base::RunLoop().RunUntilIdle(); |
+ DCHECK(wait_for_init.IsSignaled()); |
+#else |
test::TestPortableDeviceWatcherWin* portable_device_watcher = |
new test::TestPortableDeviceWatcherWin; |
test::TestVolumeMountWatcherWin* mount_watcher = |
@@ -739,7 +749,10 @@ 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(); |
+ base::WaitableEvent wait_for_init(false, false); |
+ wait_for_init.Reset(); |
+ monitor_->Initialize(base::Bind(&base::WaitableEvent::Signal, |
+ base::Unretained(&wait_for_init))); |
// TODO(gbillock): Replace this with the correct event notification |
// on the storage monitor finishing the startup scan when that exists. |
base::RunLoop().RunUntilIdle(); |
@@ -747,6 +760,7 @@ void MediaFileSystemRegistryTest::SetUp() { |
base::RunLoop().RunUntilIdle(); |
mount_watcher->FlushWorkerPoolForTesting(); |
base::RunLoop().RunUntilIdle(); |
+ DCHECK(wait_for_init.IsSignaled()); |
#endif |
ChromeRenderViewHostTestHarness::SetUp(); |
@@ -898,7 +912,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(SUPPORT_MTP_DEVICE_FILESYSTEM) |
#if !defined(OS_MACOSX) |
TEST_F(MediaFileSystemRegistryTest, GalleryNameMTP) { |