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 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_PICTURES, &path)); | 1039 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_PICTURES, &path)); |
1040 profile_state->AddNameForAllCompare(GetExpectedFolderName(path)); | 1040 profile_state->AddNameForAllCompare(GetExpectedFolderName(path)); |
1041 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_VIDEOS, &path)); | 1041 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_VIDEOS, &path)); |
1042 profile_state->AddNameForAllCompare(GetExpectedFolderName(path)); | 1042 profile_state->AddNameForAllCompare(GetExpectedFolderName(path)); |
1043 | 1043 |
1044 profile_state->CheckGalleries("names-dir", one_expectation, auto_galleries); | 1044 profile_state->CheckGalleries("names-dir", one_expectation, auto_galleries); |
1045 } else { | 1045 } else { |
1046 profile_state->CheckGalleries("names", one_expectation, one_expectation); | 1046 profile_state->CheckGalleries("names", one_expectation, one_expectation); |
1047 } | 1047 } |
1048 } | 1048 } |
| 1049 |
| 1050 TEST_F(MediaFileSystemRegistryTest, PreferenceListener) { |
| 1051 CreateProfileState(1); |
| 1052 AssertAllAutoAddedGalleries(); |
| 1053 |
| 1054 // Add a user gallery to the regular permission extension. |
| 1055 std::string device_id = AddUserGallery(StorageInfo::FIXED_MASS_STORAGE, |
| 1056 empty_dir().AsUTF8Unsafe(), |
| 1057 empty_dir()); |
| 1058 ProfileState* profile_state = GetProfileState(0); |
| 1059 SetGalleryPermission(profile_state, |
| 1060 profile_state->regular_permission_extension(), |
| 1061 device_id, |
| 1062 true /*has access*/); |
| 1063 |
| 1064 FSInfoMap fs_info = profile_state->GetGalleriesInfo( |
| 1065 profile_state->regular_permission_extension()); |
| 1066 ASSERT_EQ(1U, fs_info.size()); |
| 1067 EXPECT_FALSE(test_file_system_context()->GetPathForId( |
| 1068 fs_info.begin()->second.fsid).empty()); |
| 1069 |
| 1070 // Revoke permission and ensure that the file system is revoked. |
| 1071 SetGalleryPermission(profile_state, |
| 1072 profile_state->regular_permission_extension(), |
| 1073 device_id, |
| 1074 false /*has access*/); |
| 1075 EXPECT_TRUE(test_file_system_context()->GetPathForId( |
| 1076 fs_info.begin()->second.fsid).empty()); |
| 1077 } |
OLD | NEW |