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 #include "chrome/browser/system_monitor/removable_device_notifications_mac.h" | 5 #include "chrome/browser/system_monitor/removable_device_notifications_mac.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" |
8 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
9 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
10 #include "base/scoped_temp_dir.h" | |
11 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
12 #include "base/system_monitor/system_monitor.h" | 12 #include "base/system_monitor/system_monitor.h" |
13 #include "base/test/mock_devices_changed_observer.h" | 13 #include "base/test/mock_devices_changed_observer.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/system_monitor/media_storage_util.h" | 15 #include "chrome/browser/system_monitor/media_storage_util.h" |
16 #include "chrome/browser/system_monitor/removable_device_constants.h" | 16 #include "chrome/browser/system_monitor/removable_device_constants.h" |
17 #include "content/public/test/test_browser_thread.h" | 17 #include "content/public/test/test_browser_thread.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 namespace chrome { | 20 namespace chrome { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 OnRemovableStorageAttached(device_id_, | 131 OnRemovableStorageAttached(device_id_, |
132 new_display_name, | 132 new_display_name, |
133 mount_point_.value())); | 133 mount_point_.value())); |
134 notifications_->UpdateDisk( | 134 notifications_->UpdateDisk( |
135 info2, RemovableDeviceNotificationsMac::UPDATE_DEVICE_CHANGED); | 135 info2, RemovableDeviceNotificationsMac::UPDATE_DEVICE_CHANGED); |
136 message_loop_.RunAllPending(); | 136 message_loop_.RunAllPending(); |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 TEST_F(RemovableDeviceNotificationsMacTest, DCIM) { | 140 TEST_F(RemovableDeviceNotificationsMacTest, DCIM) { |
141 ScopedTempDir temp_dir; | 141 base::ScopedTempDir temp_dir; |
142 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 142 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
143 file_util::CreateDirectory(temp_dir.path().Append(kDCIMDirectoryName)); | 143 file_util::CreateDirectory(temp_dir.path().Append(kDCIMDirectoryName)); |
144 | 144 |
145 FilePath mount_point = temp_dir.path(); | 145 FilePath mount_point = temp_dir.path(); |
146 DiskInfoMac info = CreateDiskInfoMac( | 146 DiskInfoMac info = CreateDiskInfoMac( |
147 unique_id_, "", display_name_, mount_point); | 147 unique_id_, "", display_name_, mount_point); |
148 std::string device_id = MediaStorageUtil::MakeDeviceId( | 148 std::string device_id = MediaStorageUtil::MakeDeviceId( |
149 MediaStorageUtil::REMOVABLE_MASS_STORAGE_WITH_DCIM, unique_id_); | 149 MediaStorageUtil::REMOVABLE_MASS_STORAGE_WITH_DCIM, unique_id_); |
150 | 150 |
151 { | 151 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 testing::_, | 188 testing::_, |
189 testing::_)).Times(0); | 189 testing::_)).Times(0); |
190 DiskInfoMac info = CreateDiskInfoMac( | 190 DiskInfoMac info = CreateDiskInfoMac( |
191 unique_id_, "Disk Image", display_name_, mount_point_); | 191 unique_id_, "Disk Image", display_name_, mount_point_); |
192 notifications_->UpdateDisk( | 192 notifications_->UpdateDisk( |
193 info, RemovableDeviceNotificationsMac::UPDATE_DEVICE_ADDED); | 193 info, RemovableDeviceNotificationsMac::UPDATE_DEVICE_ADDED); |
194 message_loop_.RunAllPending(); | 194 message_loop_.RunAllPending(); |
195 } | 195 } |
196 | 196 |
197 } // namespace chrome | 197 } // namespace chrome |
OLD | NEW |