| 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/storage_monitor/storage_monitor_mac.h" | 5 #include "chrome/browser/storage_monitor/storage_monitor_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/files/scoped_temp_dir.h" |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 EXPECT_EQ(string16(), mock_storage_observer_->last_attached().name()); | 121 EXPECT_EQ(string16(), mock_storage_observer_->last_attached().name()); |
| 122 EXPECT_EQ(kTestSize * 2, | 122 EXPECT_EQ(kTestSize * 2, |
| 123 mock_storage_observer_->last_attached().total_size_in_bytes()); | 123 mock_storage_observer_->last_attached().total_size_in_bytes()); |
| 124 EXPECT_EQ(mount_point_.value(), | 124 EXPECT_EQ(mount_point_.value(), |
| 125 mock_storage_observer_->last_attached().location()); | 125 mock_storage_observer_->last_attached().location()); |
| 126 } | 126 } |
| 127 | 127 |
| 128 TEST_F(StorageMonitorMacTest, DCIM) { | 128 TEST_F(StorageMonitorMacTest, DCIM) { |
| 129 base::ScopedTempDir temp_dir; | 129 base::ScopedTempDir temp_dir; |
| 130 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 130 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 131 ASSERT_TRUE(file_util::CreateDirectory( | 131 ASSERT_TRUE(base::CreateDirectory( |
| 132 temp_dir.path().Append(kDCIMDirectoryName))); | 132 temp_dir.path().Append(kDCIMDirectoryName))); |
| 133 | 133 |
| 134 base::FilePath mount_point = temp_dir.path(); | 134 base::FilePath mount_point = temp_dir.path(); |
| 135 std::string device_id = StorageInfo::MakeDeviceId( | 135 std::string device_id = StorageInfo::MakeDeviceId( |
| 136 StorageInfo::REMOVABLE_MASS_STORAGE_WITH_DCIM, unique_id_); | 136 StorageInfo::REMOVABLE_MASS_STORAGE_WITH_DCIM, unique_id_); |
| 137 StorageInfo info = CreateStorageInfo(device_id, "", mount_point, kTestSize); | 137 StorageInfo info = CreateStorageInfo(device_id, "", mount_point, kTestSize); |
| 138 | 138 |
| 139 UpdateDisk(info, StorageMonitorMac::UPDATE_DEVICE_ADDED); | 139 UpdateDisk(info, StorageMonitorMac::UPDATE_DEVICE_ADDED); |
| 140 | 140 |
| 141 EXPECT_EQ(1, mock_storage_observer_->attach_calls()); | 141 EXPECT_EQ(1, mock_storage_observer_->attach_calls()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 168 base::FilePath("/non/matching/path"), &info)); | 168 base::FilePath("/non/matching/path"), &info)); |
| 169 } | 169 } |
| 170 | 170 |
| 171 // Test that mounting a DMG doesn't send a notification. | 171 // Test that mounting a DMG doesn't send a notification. |
| 172 TEST_F(StorageMonitorMacTest, DMG) { | 172 TEST_F(StorageMonitorMacTest, DMG) { |
| 173 StorageInfo info = CreateStorageInfo( | 173 StorageInfo info = CreateStorageInfo( |
| 174 device_id_, "Disk Image", mount_point_, kTestSize); | 174 device_id_, "Disk Image", mount_point_, kTestSize); |
| 175 UpdateDisk(info, StorageMonitorMac::UPDATE_DEVICE_ADDED); | 175 UpdateDisk(info, StorageMonitorMac::UPDATE_DEVICE_ADDED); |
| 176 EXPECT_EQ(0, mock_storage_observer_->attach_calls()); | 176 EXPECT_EQ(0, mock_storage_observer_->attach_calls()); |
| 177 } | 177 } |
| OLD | NEW |