OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/storage_monitor/storage_monitor_mac.h" | 5 #include "components/storage_monitor/storage_monitor_mac.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 EXPECT_EQ(device_id_, mock_storage_observer_->last_attached().device_id()); | 116 EXPECT_EQ(device_id_, mock_storage_observer_->last_attached().device_id()); |
117 EXPECT_EQ(kTestSize * 2, | 117 EXPECT_EQ(kTestSize * 2, |
118 mock_storage_observer_->last_attached().total_size_in_bytes()); | 118 mock_storage_observer_->last_attached().total_size_in_bytes()); |
119 EXPECT_EQ(mount_point_.value(), | 119 EXPECT_EQ(mount_point_.value(), |
120 mock_storage_observer_->last_attached().location()); | 120 mock_storage_observer_->last_attached().location()); |
121 } | 121 } |
122 | 122 |
123 TEST_F(StorageMonitorMacTest, DCIM) { | 123 TEST_F(StorageMonitorMacTest, DCIM) { |
124 base::ScopedTempDir temp_dir; | 124 base::ScopedTempDir temp_dir; |
125 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 125 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
126 ASSERT_TRUE(base::CreateDirectory( | 126 ASSERT_TRUE( |
127 temp_dir.path().Append(kDCIMDirectoryName))); | 127 base::CreateDirectory(temp_dir.GetPath().Append(kDCIMDirectoryName))); |
128 | 128 |
129 base::FilePath mount_point = temp_dir.path(); | 129 base::FilePath mount_point = temp_dir.GetPath(); |
130 std::string device_id = StorageInfo::MakeDeviceId( | 130 std::string device_id = StorageInfo::MakeDeviceId( |
131 StorageInfo::REMOVABLE_MASS_STORAGE_WITH_DCIM, unique_id_); | 131 StorageInfo::REMOVABLE_MASS_STORAGE_WITH_DCIM, unique_id_); |
132 StorageInfo info = CreateStorageInfo(device_id, "", mount_point, kTestSize); | 132 StorageInfo info = CreateStorageInfo(device_id, "", mount_point, kTestSize); |
133 | 133 |
134 UpdateDisk(info, StorageMonitorMac::UPDATE_DEVICE_ADDED); | 134 UpdateDisk(info, StorageMonitorMac::UPDATE_DEVICE_ADDED); |
135 | 135 |
136 EXPECT_EQ(1, mock_storage_observer_->attach_calls()); | 136 EXPECT_EQ(1, mock_storage_observer_->attach_calls()); |
137 EXPECT_EQ(0, mock_storage_observer_->detach_calls()); | 137 EXPECT_EQ(0, mock_storage_observer_->detach_calls()); |
138 EXPECT_EQ(device_id, mock_storage_observer_->last_attached().device_id()); | 138 EXPECT_EQ(device_id, mock_storage_observer_->last_attached().device_id()); |
139 EXPECT_EQ(mount_point.value(), | 139 EXPECT_EQ(mount_point.value(), |
(...skipping 22 matching lines...) Expand all Loading... |
162 | 162 |
163 // Test that mounting a DMG doesn't send a notification. | 163 // Test that mounting a DMG doesn't send a notification. |
164 TEST_F(StorageMonitorMacTest, DMG) { | 164 TEST_F(StorageMonitorMacTest, DMG) { |
165 StorageInfo info = CreateStorageInfo( | 165 StorageInfo info = CreateStorageInfo( |
166 device_id_, "Disk Image", mount_point_, kTestSize); | 166 device_id_, "Disk Image", mount_point_, kTestSize); |
167 UpdateDisk(info, StorageMonitorMac::UPDATE_DEVICE_ADDED); | 167 UpdateDisk(info, StorageMonitorMac::UPDATE_DEVICE_ADDED); |
168 EXPECT_EQ(0, mock_storage_observer_->attach_calls()); | 168 EXPECT_EQ(0, mock_storage_observer_->attach_calls()); |
169 } | 169 } |
170 | 170 |
171 } // namespace storage_monitor | 171 } // namespace storage_monitor |
OLD | NEW |