Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(721)

Side by Side Diff: chrome/browser/media_galleries/media_file_system_registry_unittest.cc

Issue 15511009: Picasa import: MediaFileSystemRegistry and misc. plumbing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0021-picasa-import-add-picasa-finder-to-preferences
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698