| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 disks::MOUNT_CONDITION_NONE); | 148 disks::MOUNT_CONDITION_NONE); |
| 149 const std::string kDeviceId0 = "0"; | 149 const std::string kDeviceId0 = "0"; |
| 150 EXPECT_CALL(observer(), | 150 EXPECT_CALL(observer(), |
| 151 OnMediaDeviceAttached(kDeviceId0, | 151 OnMediaDeviceAttached(kDeviceId0, |
| 152 ASCIIToUTF16(kDevice1Name), | 152 ASCIIToUTF16(kDevice1Name), |
| 153 base::SystemMonitor::TYPE_PATH, | 153 base::SystemMonitor::TYPE_PATH, |
| 154 mount_path1.value())) | 154 mount_path1.value())) |
| 155 .InSequence(mock_sequence); | 155 .InSequence(mock_sequence); |
| 156 MountDevice(MOUNT_ERROR_NONE, mount_info); | 156 MountDevice(MOUNT_ERROR_NONE, mount_info); |
| 157 | 157 |
| 158 EXPECT_CALL(observer(), OnMediaDeviceDetached(kDeviceId0)) | 158 EXPECT_CALL(observer(), OnMediaDeviceDetached(kDeviceId0, |
| 159 .InSequence(mock_sequence); | 159 mount_path1.value())).InSequence(mock_sequence); |
| 160 UnmountDevice(MOUNT_ERROR_NONE, mount_info); | 160 UnmountDevice(MOUNT_ERROR_NONE, mount_info); |
| 161 | 161 |
| 162 FilePath mount_path2 = CreateMountPoint(kMountPointB, true); | 162 FilePath mount_path2 = CreateMountPoint(kMountPointB, true); |
| 163 ASSERT_FALSE(mount_path2.empty()); | 163 ASSERT_FALSE(mount_path2.empty()); |
| 164 DiskMountManager::MountPointInfo mount_info2(kDevice2, | 164 DiskMountManager::MountPointInfo mount_info2(kDevice2, |
| 165 mount_path2.value(), | 165 mount_path2.value(), |
| 166 MOUNT_TYPE_DEVICE, | 166 MOUNT_TYPE_DEVICE, |
| 167 disks::MOUNT_CONDITION_NONE); | 167 disks::MOUNT_CONDITION_NONE); |
| 168 const std::string kDeviceId1 = "1"; | 168 const std::string kDeviceId1 = "1"; |
| 169 | 169 |
| 170 EXPECT_CALL(observer(), | 170 EXPECT_CALL(observer(), |
| 171 OnMediaDeviceAttached(kDeviceId1, | 171 OnMediaDeviceAttached(kDeviceId1, |
| 172 ASCIIToUTF16(kDevice2Name), | 172 ASCIIToUTF16(kDevice2Name), |
| 173 base::SystemMonitor::TYPE_PATH, | 173 base::SystemMonitor::TYPE_PATH, |
| 174 mount_path2.value())) | 174 mount_path2.value())) |
| 175 .InSequence(mock_sequence); | 175 .InSequence(mock_sequence); |
| 176 MountDevice(MOUNT_ERROR_NONE, mount_info2); | 176 MountDevice(MOUNT_ERROR_NONE, mount_info2); |
| 177 | 177 |
| 178 EXPECT_CALL(observer(), OnMediaDeviceDetached(kDeviceId1)) | 178 EXPECT_CALL(observer(), OnMediaDeviceDetached(kDeviceId1, |
| 179 .InSequence(mock_sequence); | 179 mount_path2.value())).InSequence(mock_sequence); |
| 180 UnmountDevice(MOUNT_ERROR_NONE, mount_info2); | 180 UnmountDevice(MOUNT_ERROR_NONE, mount_info2); |
| 181 } | 181 } |
| 182 | 182 |
| 183 // Only mount points with DCIM directories are recognized. | 183 // Only mount points with DCIM directories are recognized. |
| 184 TEST_F(MediaDeviceNotificationsTest, DCIM) { | 184 TEST_F(MediaDeviceNotificationsTest, DCIM) { |
| 185 testing::Sequence mock_sequence; | 185 testing::Sequence mock_sequence; |
| 186 FilePath mount_path = CreateMountPoint(kMountPointA, false); | 186 FilePath mount_path = CreateMountPoint(kMountPointA, false); |
| 187 ASSERT_FALSE(mount_path.empty()); | 187 ASSERT_FALSE(mount_path.empty()); |
| 188 DiskMountManager::MountPointInfo mount_info(kDevice1, | 188 DiskMountManager::MountPointInfo mount_info(kDevice1, |
| 189 mount_path.value(), | 189 mount_path.value(), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 215 // Unsupported file system. | 215 // Unsupported file system. |
| 216 mount_info.mount_type = MOUNT_TYPE_DEVICE; | 216 mount_info.mount_type = MOUNT_TYPE_DEVICE; |
| 217 mount_info.mount_condition = disks::MOUNT_CONDITION_UNSUPPORTED_FILESYSTEM; | 217 mount_info.mount_condition = disks::MOUNT_CONDITION_UNSUPPORTED_FILESYSTEM; |
| 218 EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _, _)).Times(0); | 218 EXPECT_CALL(observer(), OnMediaDeviceAttached(_, _, _, _)).Times(0); |
| 219 MountDevice(MOUNT_ERROR_NONE, mount_info); | 219 MountDevice(MOUNT_ERROR_NONE, mount_info); |
| 220 } | 220 } |
| 221 | 221 |
| 222 } // namespace | 222 } // namespace |
| 223 | 223 |
| 224 } // namespace chrome | 224 } // namespace chrome |
| OLD | NEW |