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 "chrome/browser/media_galleries/media_file_system_registry.h" | 7 #include "chrome/browser/media_galleries/media_file_system_registry.h" |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 ASSERT_TRUE(base::CreateDirectory(dcim_dir_)); | 783 ASSERT_TRUE(base::CreateDirectory(dcim_dir_)); |
784 ASSERT_TRUE(base::CreateDirectory( | 784 ASSERT_TRUE(base::CreateDirectory( |
785 dcim_dir_.Append(storage_monitor::kDCIMDirectoryName))); | 785 dcim_dir_.Append(storage_monitor::kDCIMDirectoryName))); |
786 } | 786 } |
787 | 787 |
788 void MediaFileSystemRegistryTest::TearDown() { | 788 void MediaFileSystemRegistryTest::TearDown() { |
789 profile_states_.clear(); | 789 profile_states_.clear(); |
790 MediaFileSystemRegistry* registry = | 790 MediaFileSystemRegistry* registry = |
791 g_browser_process->media_file_system_registry(); | 791 g_browser_process->media_file_system_registry(); |
792 EXPECT_EQ(0U, GetExtensionGalleriesHostCount(registry)); | 792 EXPECT_EQ(0U, GetExtensionGalleriesHostCount(registry)); |
793 TestStorageMonitor::Destroy(); | 793 |
794 #if defined(OS_CHROMEOS) | 794 #if defined(OS_CHROMEOS) |
795 test_user_manager_.reset(); | 795 test_user_manager_.reset(); |
796 #endif | 796 #endif |
797 | 797 |
| 798 // The TestingProfile must be destroyed before the TestingBrowserProcess |
| 799 // because it uses it in its destructor. |
798 ChromeRenderViewHostTestHarness::TearDown(); | 800 ChromeRenderViewHostTestHarness::TearDown(); |
| 801 |
| 802 // The MediaFileSystemRegistry owned by the TestingBrowserProcess must be |
| 803 // destroyed before the StorageMonitor because it calls |
| 804 // StorageMonitor::RemoveObserver() in its destructor. |
| 805 TestingBrowserProcess::DeleteInstance(); |
| 806 |
| 807 TestStorageMonitor::Destroy(); |
799 } | 808 } |
800 | 809 |
801 /////////// | 810 /////////// |
802 // Tests // | 811 // Tests // |
803 /////////// | 812 /////////// |
804 | 813 |
805 TEST_F(MediaFileSystemRegistryTest, Basic) { | 814 TEST_F(MediaFileSystemRegistryTest, Basic) { |
806 CreateProfileState(1); | 815 CreateProfileState(1); |
807 AssertAllAutoAddedGalleries(); | 816 AssertAllAutoAddedGalleries(); |
808 | 817 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 fs_info.begin()->second.fsid).empty()); | 1080 fs_info.begin()->second.fsid).empty()); |
1072 | 1081 |
1073 // Revoke permission and ensure that the file system is revoked. | 1082 // Revoke permission and ensure that the file system is revoked. |
1074 SetGalleryPermission(profile_state, | 1083 SetGalleryPermission(profile_state, |
1075 profile_state->regular_permission_extension(), | 1084 profile_state->regular_permission_extension(), |
1076 device_id, | 1085 device_id, |
1077 false /*has access*/); | 1086 false /*has access*/); |
1078 EXPECT_TRUE(test_file_system_context()->GetRegisteredPath( | 1087 EXPECT_TRUE(test_file_system_context()->GetRegisteredPath( |
1079 fs_info.begin()->second.fsid).empty()); | 1088 fs_info.begin()->second.fsid).empty()); |
1080 } | 1089 } |
OLD | NEW |