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 // 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 disks::MOUNT_CONDITION_NONE); | 157 disks::MOUNT_CONDITION_NONE); |
158 const std::string kDeviceId0 = "FFFF-FFFF"; | 158 const std::string kDeviceId0 = "FFFF-FFFF"; |
159 EXPECT_CALL(observer(), | 159 EXPECT_CALL(observer(), |
160 OnMediaDeviceAttached(kDeviceId0, | 160 OnMediaDeviceAttached(kDeviceId0, |
161 ASCIIToUTF16(kDevice1Name), | 161 ASCIIToUTF16(kDevice1Name), |
162 base::SystemMonitor::TYPE_PATH, | 162 base::SystemMonitor::TYPE_PATH, |
163 mount_path1.value())) | 163 mount_path1.value())) |
164 .InSequence(mock_sequence); | 164 .InSequence(mock_sequence); |
165 MountDevice(MOUNT_ERROR_NONE, mount_info, kDeviceId0); | 165 MountDevice(MOUNT_ERROR_NONE, mount_info, kDeviceId0); |
166 | 166 |
167 EXPECT_CALL(observer(), OnMediaDeviceDetached(kDeviceId0)) | 167 EXPECT_CALL(observer(), OnMediaDeviceDetached(kDeviceId0, |
168 .InSequence(mock_sequence); | 168 mount_path1.value())).InSequence(mock_sequence); |
169 UnmountDevice(MOUNT_ERROR_NONE, mount_info); | 169 UnmountDevice(MOUNT_ERROR_NONE, mount_info); |
170 | 170 |
171 FilePath mount_path2 = CreateMountPoint(kMountPointB, true); | 171 FilePath mount_path2 = CreateMountPoint(kMountPointB, true); |
172 ASSERT_FALSE(mount_path2.empty()); | 172 ASSERT_FALSE(mount_path2.empty()); |
173 DiskMountManager::MountPointInfo mount_info2(kDevice2, | 173 DiskMountManager::MountPointInfo mount_info2(kDevice2, |
174 mount_path2.value(), | 174 mount_path2.value(), |
175 MOUNT_TYPE_DEVICE, | 175 MOUNT_TYPE_DEVICE, |
176 disks::MOUNT_CONDITION_NONE); | 176 disks::MOUNT_CONDITION_NONE); |
177 const std::string kDeviceId1 = "FFF0-FFF0"; | 177 const std::string kDeviceId1 = "FFF0-FFF0"; |
178 | 178 |
179 EXPECT_CALL(observer(), | 179 EXPECT_CALL(observer(), |
180 OnMediaDeviceAttached(kDeviceId1, | 180 OnMediaDeviceAttached(kDeviceId1, |
181 ASCIIToUTF16(kDevice2Name), | 181 ASCIIToUTF16(kDevice2Name), |
182 base::SystemMonitor::TYPE_PATH, | 182 base::SystemMonitor::TYPE_PATH, |
183 mount_path2.value())) | 183 mount_path2.value())) |
184 .InSequence(mock_sequence); | 184 .InSequence(mock_sequence); |
185 MountDevice(MOUNT_ERROR_NONE, mount_info2, kDeviceId1); | 185 MountDevice(MOUNT_ERROR_NONE, mount_info2, kDeviceId1); |
186 | 186 |
187 EXPECT_CALL(observer(), OnMediaDeviceDetached(kDeviceId1)) | 187 EXPECT_CALL(observer(), OnMediaDeviceDetached(kDeviceId1, |
188 .InSequence(mock_sequence); | 188 mount_path2.value())).InSequence(mock_sequence); |
189 UnmountDevice(MOUNT_ERROR_NONE, mount_info2); | 189 UnmountDevice(MOUNT_ERROR_NONE, mount_info2); |
190 } | 190 } |
191 | 191 |
192 // Only mount points with DCIM directories are recognized. | 192 // Only mount points with DCIM directories are recognized. |
193 TEST_F(MediaDeviceNotificationsTest, DCIM) { | 193 TEST_F(MediaDeviceNotificationsTest, DCIM) { |
194 testing::Sequence mock_sequence; | 194 testing::Sequence mock_sequence; |
195 FilePath mount_path = CreateMountPoint(kMountPointA, false); | 195 FilePath mount_path = CreateMountPoint(kMountPointA, false); |
196 const std::string kDeviceId = "FFFF-FFFF"; | 196 const std::string kDeviceId = "FFFF-FFFF"; |
197 ASSERT_FALSE(mount_path.empty()); | 197 ASSERT_FALSE(mount_path.empty()); |
198 DiskMountManager::MountPointInfo mount_info(kDevice1, | 198 DiskMountManager::MountPointInfo mount_info(kDevice1, |
(...skipping 27 matching lines...) Expand all Loading... |
226 // Unsupported file system. | 226 // Unsupported file system. |
227 mount_info.mount_type = MOUNT_TYPE_DEVICE; | 227 mount_info.mount_type = MOUNT_TYPE_DEVICE; |
228 mount_info.mount_condition = disks::MOUNT_CONDITION_UNSUPPORTED_FILESYSTEM; | 228 mount_info.mount_condition = disks::MOUNT_CONDITION_UNSUPPORTED_FILESYSTEM; |
229 EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _, _)).Times(0); | 229 EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _, _)).Times(0); |
230 MountDevice(MOUNT_ERROR_NONE, mount_info, kDeviceId); | 230 MountDevice(MOUNT_ERROR_NONE, mount_info, kDeviceId); |
231 } | 231 } |
232 | 232 |
233 } // namespace | 233 } // namespace |
234 | 234 |
235 } // namespace chrome | 235 } // namespace chrome |
OLD | NEW |