| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // MediaFileSystemRegistry unit tests. | 5 // MediaFileSystemRegistry unit tests. |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 TestMediaFileSystemContext* test_file_system_context_; | 371 TestMediaFileSystemContext* test_file_system_context_; |
| 372 | 372 |
| 373 // Needed for extension service & friends to work. | 373 // Needed for extension service & friends to work. |
| 374 | 374 |
| 375 #if defined OS_CHROMEOS | 375 #if defined OS_CHROMEOS |
| 376 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 376 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
| 377 chromeos::ScopedTestCrosSettings test_cros_settings_; | 377 chromeos::ScopedTestCrosSettings test_cros_settings_; |
| 378 scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_; | 378 scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_; |
| 379 #endif | 379 #endif |
| 380 | 380 |
| 381 scoped_ptr<chrome::test::TestStorageMonitor> monitor_; | |
| 382 | |
| 383 MockProfileSharedRenderProcessHostFactory rph_factory_; | 381 MockProfileSharedRenderProcessHostFactory rph_factory_; |
| 384 | 382 |
| 385 ScopedVector<ProfileState> profile_states_; | 383 ScopedVector<ProfileState> profile_states_; |
| 386 }; | 384 }; |
| 387 | 385 |
| 388 namespace { | 386 namespace { |
| 389 | 387 |
| 390 bool MediaFileSystemInfoComparator(const MediaFileSystemInfo& a, | 388 bool MediaFileSystemInfoComparator(const MediaFileSystemInfo& a, |
| 391 const MediaFileSystemInfo& b) { | 389 const MediaFileSystemInfo& b) { |
| 392 CHECK_NE(a.name, b.name); // Name must be unique. | 390 CHECK_NE(a.name, b.name); // Name must be unique. |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 it != registry->extension_hosts_map_.end(); | 738 it != registry->extension_hosts_map_.end(); |
| 741 ++it) { | 739 ++it) { |
| 742 extension_galleries_host_count += it->second.size(); | 740 extension_galleries_host_count += it->second.size(); |
| 743 } | 741 } |
| 744 return extension_galleries_host_count; | 742 return extension_galleries_host_count; |
| 745 } | 743 } |
| 746 | 744 |
| 747 | 745 |
| 748 void MediaFileSystemRegistryTest::SetUp() { | 746 void MediaFileSystemRegistryTest::SetUp() { |
| 749 ChromeRenderViewHostTestHarness::SetUp(); | 747 ChromeRenderViewHostTestHarness::SetUp(); |
| 750 monitor_.reset(new test::TestStorageMonitor()); | 748 ASSERT_TRUE(test::TestStorageMonitor::CreateAndInstall()); |
| 751 monitor_->MarkInitialized(); | |
| 752 base::RunLoop runloop; | |
| 753 monitor_->EnsureInitialized(runloop.QuitClosure()); | |
| 754 runloop.Run(); | |
| 755 | 749 |
| 756 DeleteContents(); | 750 DeleteContents(); |
| 757 SetRenderProcessHostFactory(&rph_factory_); | 751 SetRenderProcessHostFactory(&rph_factory_); |
| 758 | 752 |
| 759 test_file_system_context_ = new TestMediaFileSystemContext( | 753 test_file_system_context_ = new TestMediaFileSystemContext( |
| 760 g_browser_process->media_file_system_registry()); | 754 g_browser_process->media_file_system_registry()); |
| 761 | 755 |
| 762 #if defined(OS_CHROMEOS) | 756 #if defined(OS_CHROMEOS) |
| 763 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); | 757 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); |
| 764 #endif | 758 #endif |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_VIDEOS, &path)); | 1024 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_VIDEOS, &path)); |
| 1031 profile_state->AddNameForAllCompare(path.BaseName().LossyDisplayName()); | 1025 profile_state->AddNameForAllCompare(path.BaseName().LossyDisplayName()); |
| 1032 | 1026 |
| 1033 profile_state->CheckGalleries("names-dir", one_expectation, auto_galleries); | 1027 profile_state->CheckGalleries("names-dir", one_expectation, auto_galleries); |
| 1034 } else { | 1028 } else { |
| 1035 profile_state->CheckGalleries("names", one_expectation, one_expectation); | 1029 profile_state->CheckGalleries("names", one_expectation, one_expectation); |
| 1036 } | 1030 } |
| 1037 } | 1031 } |
| 1038 | 1032 |
| 1039 } // namespace chrome | 1033 } // namespace chrome |
| OLD | NEW |