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 10db660818ae92265d2333e66d6aab0e638ea5de..209df780ec700e8bf928da03af350ddd1bfa46c3 100644 |
--- a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc |
+++ b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc |
@@ -284,9 +284,6 @@ class ProfileState { |
class MediaFileSystemRegistryTest : public ChromeRenderViewHostTestHarness { |
public: |
- MediaFileSystemRegistryTest(); |
- virtual ~MediaFileSystemRegistryTest() {} |
- |
void CreateProfileState(size_t profile_count); |
ProfileState* GetProfileState(size_t i); |
@@ -369,13 +366,11 @@ class MediaFileSystemRegistryTest : public ChromeRenderViewHostTestHarness { |
TestMediaFileSystemContext* test_file_system_context_; |
// Needed for extension service & friends to work. |
- content::TestBrowserThread ui_thread_; |
- content::TestBrowserThread file_thread_; |
#if defined OS_CHROMEOS |
chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
chromeos::ScopedTestCrosSettings test_cros_settings_; |
- chromeos::ScopedTestUserManager test_user_manager_; |
+ scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_; |
#endif |
// TODO(gbillock): Eliminate windows-specific code from this test. |
@@ -388,8 +383,6 @@ class MediaFileSystemRegistryTest : public ChromeRenderViewHostTestHarness { |
MockProfileSharedRenderProcessHostFactory rph_factory_; |
ScopedVector<ProfileState> profile_states_; |
- |
- DISALLOW_COPY_AND_ASSIGN(MediaFileSystemRegistryTest); |
}; |
namespace { |
@@ -577,11 +570,6 @@ int ProfileState::GetAndClearComparisonCount() { |
// MediaFileSystemRegistryTest // |
///////////////////////////////// |
-MediaFileSystemRegistryTest::MediaFileSystemRegistryTest() |
- : ui_thread_(content::BrowserThread::UI, MessageLoop::current()), |
- file_thread_(content::BrowserThread::FILE, MessageLoop::current()) { |
-} |
- |
void MediaFileSystemRegistryTest::CreateProfileState(size_t profile_count) { |
for (size_t i = 0; i < profile_count; ++i) { |
ProfileState* state = new ProfileState(&rph_factory_); |
@@ -720,6 +708,7 @@ MediaFileSystemRegistryTest::GetAutoAddedGalleries( |
} |
void MediaFileSystemRegistryTest::SetUp() { |
+ ChromeRenderViewHostTestHarness::SetUp(); |
#if defined(OS_WIN) |
test::TestPortableDeviceWatcherWin* portable_device_watcher = |
new test::TestPortableDeviceWatcherWin; |
@@ -728,23 +717,22 @@ 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(); |
- // TODO(gbillock): Replace this with the correct event notification |
- // on the storage monitor finishing the startup scan when that exists. |
- base::RunLoop().RunUntilIdle(); |
- mount_watcher->FlushWorkerPoolForTesting(); |
- base::RunLoop().RunUntilIdle(); |
- mount_watcher->FlushWorkerPoolForTesting(); |
+ base::RunLoop runloop; |
+ monitor_->Initialize(runloop.QuitClosure()); |
+ runloop.Run(); |
base::RunLoop().RunUntilIdle(); |
#endif |
- ChromeRenderViewHostTestHarness::SetUp(); |
DeleteContents(); |
SetRenderProcessHostFactory(&rph_factory_); |
test_file_system_context_ = new TestMediaFileSystemContext( |
g_browser_process->media_file_system_registry()); |
+#if defined OS_CHROMEOS |
+ test_user_manager_.reset(new chromeos::ScopedTestUserManager()); |
+#endif |
+ |
ASSERT_TRUE(galleries_dir_.CreateUniqueTempDir()); |
empty_dir_ = galleries_dir_.path().AppendASCII("empty"); |
ASSERT_TRUE(file_util::CreateDirectory(empty_dir_)); |
@@ -755,12 +743,17 @@ void MediaFileSystemRegistryTest::SetUp() { |
void MediaFileSystemRegistryTest::TearDown() { |
profile_states_.clear(); |
- ChromeRenderViewHostTestHarness::TearDown(); |
MediaFileSystemRegistry* registry = |
g_browser_process->media_file_system_registry(); |
EXPECT_EQ(0U, registry->GetExtensionGalleriesHostCountForTests()); |
- BrowserThread::GetBlockingPool()->FlushForTesting(); |
- MessageLoop::current()->RunUntilIdle(); |
+#if defined OS_CHROMEOS |
+ test_user_manager_.reset(); |
+#endif |
+ |
+#if defined(OS_WIN) |
+ monitor_.reset(); |
+#endif |
+ ChromeRenderViewHostTestHarness::TearDown(); |
} |
/////////// |