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

Side by Side Diff: chrome/browser/media_gallery/media_device_notifications_chromeos_unittest.cc

Issue 10873072: Rename SystemMonitor's MediaDevice calls to RemovableStorage. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
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 // chromeos::MediaDeviceNotifications unit tests. 5 // chromeos::MediaDeviceNotifications unit tests.
6 6
7 #include "chrome/browser/media_gallery/media_device_notifications_chromeos.h" 7 #include "chrome/browser/media_gallery/media_device_notifications_chromeos.h"
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 TEST_F(MediaDeviceNotificationsTest, BasicAttachDetach) { 156 TEST_F(MediaDeviceNotificationsTest, BasicAttachDetach) {
157 testing::Sequence mock_sequence; 157 testing::Sequence mock_sequence;
158 FilePath mount_path1 = CreateMountPoint(kMountPointA, true); 158 FilePath mount_path1 = CreateMountPoint(kMountPointA, true);
159 ASSERT_FALSE(mount_path1.empty()); 159 ASSERT_FALSE(mount_path1.empty());
160 DiskMountManager::MountPointInfo mount_info(kDevice1, 160 DiskMountManager::MountPointInfo mount_info(kDevice1,
161 mount_path1.value(), 161 mount_path1.value(),
162 MOUNT_TYPE_DEVICE, 162 MOUNT_TYPE_DEVICE,
163 disks::MOUNT_CONDITION_NONE); 163 disks::MOUNT_CONDITION_NONE);
164 const std::string kUniqueId0 = "FFFF-FFFF"; 164 const std::string kUniqueId0 = "FFFF-FFFF";
165 EXPECT_CALL(observer(), 165 EXPECT_CALL(observer(),
166 OnMediaDeviceAttached(GetDCIMDeviceId(kUniqueId0), 166 OnRemovableStorageAttached(GetDCIMDeviceId(kUniqueId0),
167 ASCIIToUTF16(kDevice1Name), 167 ASCIIToUTF16(kDevice1Name),
168 mount_path1.value())) 168 mount_path1.value()))
169 .InSequence(mock_sequence); 169 .InSequence(mock_sequence);
170 MountDevice(MOUNT_ERROR_NONE, mount_info, kUniqueId0); 170 MountDevice(MOUNT_ERROR_NONE, mount_info, kUniqueId0);
171 171
172 EXPECT_CALL(observer(), OnMediaDeviceDetached(GetDCIMDeviceId(kUniqueId0))) 172 EXPECT_CALL(observer(),
173 OnRemovableStorageDetached(GetDCIMDeviceId(kUniqueId0)))
173 .InSequence(mock_sequence); 174 .InSequence(mock_sequence);
174 UnmountDevice(MOUNT_ERROR_NONE, mount_info); 175 UnmountDevice(MOUNT_ERROR_NONE, mount_info);
175 176
176 FilePath mount_path2 = CreateMountPoint(kMountPointB, true); 177 FilePath mount_path2 = CreateMountPoint(kMountPointB, true);
177 ASSERT_FALSE(mount_path2.empty()); 178 ASSERT_FALSE(mount_path2.empty());
178 DiskMountManager::MountPointInfo mount_info2(kDevice2, 179 DiskMountManager::MountPointInfo mount_info2(kDevice2,
179 mount_path2.value(), 180 mount_path2.value(),
180 MOUNT_TYPE_DEVICE, 181 MOUNT_TYPE_DEVICE,
181 disks::MOUNT_CONDITION_NONE); 182 disks::MOUNT_CONDITION_NONE);
182 const std::string kUniqueId1 = "FFF0-FFF0"; 183 const std::string kUniqueId1 = "FFF0-FFF0";
183 184
184 EXPECT_CALL(observer(), 185 EXPECT_CALL(observer(),
185 OnMediaDeviceAttached(GetDCIMDeviceId(kUniqueId1), 186 OnRemovableStorageAttached(GetDCIMDeviceId(kUniqueId1),
186 ASCIIToUTF16(kDevice2Name), 187 ASCIIToUTF16(kDevice2Name),
187 mount_path2.value())) 188 mount_path2.value()))
188 .InSequence(mock_sequence); 189 .InSequence(mock_sequence);
189 MountDevice(MOUNT_ERROR_NONE, mount_info2, kUniqueId1); 190 MountDevice(MOUNT_ERROR_NONE, mount_info2, kUniqueId1);
190 191
191 EXPECT_CALL(observer(), OnMediaDeviceDetached(GetDCIMDeviceId(kUniqueId1))) 192 EXPECT_CALL(observer(),
193 OnRemovableStorageDetached(GetDCIMDeviceId(kUniqueId1)))
192 .InSequence(mock_sequence); 194 .InSequence(mock_sequence);
193 UnmountDevice(MOUNT_ERROR_NONE, mount_info2); 195 UnmountDevice(MOUNT_ERROR_NONE, mount_info2);
194 } 196 }
195 197
196 // Only mount points with DCIM directories are recognized. 198 // Only mount points with DCIM directories are recognized.
197 TEST_F(MediaDeviceNotificationsTest, DCIM) { 199 TEST_F(MediaDeviceNotificationsTest, DCIM) {
198 testing::Sequence mock_sequence; 200 testing::Sequence mock_sequence;
199 FilePath mount_path = CreateMountPoint(kMountPointA, false); 201 FilePath mount_path = CreateMountPoint(kMountPointA, false);
200 const std::string kUniqueId = "FFFF-FFFF"; 202 const std::string kUniqueId = "FFFF-FFFF";
201 ASSERT_FALSE(mount_path.empty()); 203 ASSERT_FALSE(mount_path.empty());
202 DiskMountManager::MountPointInfo mount_info(kDevice1, 204 DiskMountManager::MountPointInfo mount_info(kDevice1,
203 mount_path.value(), 205 mount_path.value(),
204 MOUNT_TYPE_DEVICE, 206 MOUNT_TYPE_DEVICE,
205 disks::MOUNT_CONDITION_NONE); 207 disks::MOUNT_CONDITION_NONE);
206 EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(0); 208 EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(0);
207 MountDevice(MOUNT_ERROR_NONE, mount_info, kUniqueId); 209 MountDevice(MOUNT_ERROR_NONE, mount_info, kUniqueId);
208 } 210 }
209 211
210 // Non device mounts and mount errors are ignored. 212 // Non device mounts and mount errors are ignored.
211 TEST_F(MediaDeviceNotificationsTest, Ignore) { 213 TEST_F(MediaDeviceNotificationsTest, Ignore) {
212 testing::Sequence mock_sequence; 214 testing::Sequence mock_sequence;
213 FilePath mount_path = CreateMountPoint(kMountPointA, true); 215 FilePath mount_path = CreateMountPoint(kMountPointA, true);
214 const std::string kUniqueId = "FFFF-FFFF"; 216 const std::string kUniqueId = "FFFF-FFFF";
215 ASSERT_FALSE(mount_path.empty()); 217 ASSERT_FALSE(mount_path.empty());
216 218
217 // Mount error. 219 // Mount error.
218 DiskMountManager::MountPointInfo mount_info(kDevice1, 220 DiskMountManager::MountPointInfo mount_info(kDevice1,
219 mount_path.value(), 221 mount_path.value(),
220 MOUNT_TYPE_DEVICE, 222 MOUNT_TYPE_DEVICE,
221 disks::MOUNT_CONDITION_NONE); 223 disks::MOUNT_CONDITION_NONE);
222 EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(0); 224 EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(0);
223 MountDevice(MOUNT_ERROR_UNKNOWN, mount_info, kUniqueId); 225 MountDevice(MOUNT_ERROR_UNKNOWN, mount_info, kUniqueId);
224 226
225 // Not a device 227 // Not a device
226 mount_info.mount_type = MOUNT_TYPE_ARCHIVE; 228 mount_info.mount_type = MOUNT_TYPE_ARCHIVE;
227 EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(0); 229 EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(0);
228 MountDevice(MOUNT_ERROR_NONE, mount_info, kUniqueId); 230 MountDevice(MOUNT_ERROR_NONE, mount_info, kUniqueId);
229 231
230 // Unsupported file system. 232 // Unsupported file system.
231 mount_info.mount_type = MOUNT_TYPE_DEVICE; 233 mount_info.mount_type = MOUNT_TYPE_DEVICE;
232 mount_info.mount_condition = disks::MOUNT_CONDITION_UNSUPPORTED_FILESYSTEM; 234 mount_info.mount_condition = disks::MOUNT_CONDITION_UNSUPPORTED_FILESYSTEM;
233 EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _)).Times(0); 235 EXPECT_CALL(observer(), OnRemovableStorageAttached(_, _, _)).Times(0);
234 MountDevice(MOUNT_ERROR_NONE, mount_info, kUniqueId); 236 MountDevice(MOUNT_ERROR_NONE, mount_info, kUniqueId);
235 } 237 }
236 238
237 } // namespace 239 } // namespace
238 240
239 } // namespace chrome 241 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698