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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 virtual ~TestMediaFileSystemContext() {} | 78 virtual ~TestMediaFileSystemContext() {} |
79 | 79 |
80 // MediaFileSystemContext implementation. | 80 // MediaFileSystemContext implementation. |
81 virtual std::string RegisterFileSystemForMassStorage( | 81 virtual std::string RegisterFileSystemForMassStorage( |
82 const std::string& device_id, const base::FilePath& path) OVERRIDE; | 82 const std::string& device_id, const base::FilePath& path) OVERRIDE; |
83 | 83 |
84 virtual std::string RegisterFileSystemForMTPDevice( | 84 virtual std::string RegisterFileSystemForMTPDevice( |
85 const std::string& device_id, const base::FilePath& path, | 85 const std::string& device_id, const base::FilePath& path, |
86 scoped_refptr<ScopedMTPDeviceMapEntry>* entry) OVERRIDE; | 86 scoped_refptr<ScopedMTPDeviceMapEntry>* entry) OVERRIDE; |
87 | 87 |
| 88 virtual std::string RegisterFileSystemForPicasa( |
| 89 const std::string& device_id, const base::FilePath& path) OVERRIDE; |
| 90 |
88 virtual void RevokeFileSystem(const std::string& fsid) OVERRIDE; | 91 virtual void RevokeFileSystem(const std::string& fsid) OVERRIDE; |
89 | 92 |
90 virtual MediaFileSystemRegistry* GetMediaFileSystemRegistry() OVERRIDE; | 93 virtual MediaFileSystemRegistry* GetMediaFileSystemRegistry() OVERRIDE; |
91 | 94 |
92 base::FilePath GetPathForId(const std::string& fsid) const; | 95 base::FilePath GetPathForId(const std::string& fsid) const; |
93 | 96 |
94 private: | 97 private: |
95 std::string AddFSEntry(const std::string& device_id, | 98 std::string AddFSEntry(const std::string& device_id, |
96 const base::FilePath& path); | 99 const base::FilePath& path); |
97 | 100 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 138 |
136 std::string TestMediaFileSystemContext::RegisterFileSystemForMTPDevice( | 139 std::string TestMediaFileSystemContext::RegisterFileSystemForMTPDevice( |
137 const std::string& device_id, const base::FilePath& path, | 140 const std::string& device_id, const base::FilePath& path, |
138 scoped_refptr<ScopedMTPDeviceMapEntry>* entry) { | 141 scoped_refptr<ScopedMTPDeviceMapEntry>* entry) { |
139 CHECK(!StorageInfo::IsMassStorageDevice(device_id)); | 142 CHECK(!StorageInfo::IsMassStorageDevice(device_id)); |
140 DCHECK(entry); | 143 DCHECK(entry); |
141 *entry = registry_->GetOrCreateScopedMTPDeviceMapEntry(path.value()); | 144 *entry = registry_->GetOrCreateScopedMTPDeviceMapEntry(path.value()); |
142 return AddFSEntry(device_id, path); | 145 return AddFSEntry(device_id, path); |
143 } | 146 } |
144 | 147 |
| 148 std::string TestMediaFileSystemContext::RegisterFileSystemForPicasa( |
| 149 const std::string& device_id, const base::FilePath& path) { |
| 150 CHECK(!StorageInfo::IsMassStorageDevice(device_id)); |
| 151 return AddFSEntry(device_id, path); |
| 152 } |
| 153 |
145 void TestMediaFileSystemContext::RevokeFileSystem(const std::string& fsid) { | 154 void TestMediaFileSystemContext::RevokeFileSystem(const std::string& fsid) { |
146 if (!ContainsKey(file_systems_by_id_, fsid)) | 155 if (!ContainsKey(file_systems_by_id_, fsid)) |
147 return; | 156 return; |
148 EXPECT_EQ(1U, file_systems_by_id_.erase(fsid)); | 157 EXPECT_EQ(1U, file_systems_by_id_.erase(fsid)); |
149 } | 158 } |
150 | 159 |
151 MediaFileSystemRegistry* | 160 MediaFileSystemRegistry* |
152 TestMediaFileSystemContext::GetMediaFileSystemRegistry() { | 161 TestMediaFileSystemContext::GetMediaFileSystemRegistry() { |
153 return registry_; | 162 return registry_; |
154 } | 163 } |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 pref_info_with_relpath.device_id = device_id; | 979 pref_info_with_relpath.device_id = device_id; |
971 EXPECT_EQ(dcim_dir().Append(pref_info_with_relpath.path).value(), | 980 EXPECT_EQ(dcim_dir().Append(pref_info_with_relpath.path).value(), |
972 pref_info_with_relpath.AbsolutePath().value()); | 981 pref_info_with_relpath.AbsolutePath().value()); |
973 | 982 |
974 DetachDevice(device_id); | 983 DetachDevice(device_id); |
975 EXPECT_TRUE(pref_info.AbsolutePath().empty()); | 984 EXPECT_TRUE(pref_info.AbsolutePath().empty()); |
976 EXPECT_TRUE(pref_info_with_relpath.AbsolutePath().empty()); | 985 EXPECT_TRUE(pref_info_with_relpath.AbsolutePath().empty()); |
977 } | 986 } |
978 | 987 |
979 } // namespace chrome | 988 } // namespace chrome |
OLD | NEW |