| 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 "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 device_id, mount_point.value(), base::string16(), base::string16(), | 34 device_id, mount_point.value(), base::string16(), base::string16(), |
| 35 base::UTF8ToUTF16(model_name), size_bytes); | 35 base::UTF8ToUTF16(model_name), size_bytes); |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 class StorageMonitorMacTest : public testing::Test { | 40 class StorageMonitorMacTest : public testing::Test { |
| 41 public: | 41 public: |
| 42 StorageMonitorMacTest() {} | 42 StorageMonitorMacTest() {} |
| 43 | 43 |
| 44 virtual void SetUp() override { | 44 void SetUp() override { |
| 45 monitor_.reset(new StorageMonitorMac); | 45 monitor_.reset(new StorageMonitorMac); |
| 46 | 46 |
| 47 mock_storage_observer_.reset(new MockRemovableStorageObserver); | 47 mock_storage_observer_.reset(new MockRemovableStorageObserver); |
| 48 monitor_->AddObserver(mock_storage_observer_.get()); | 48 monitor_->AddObserver(mock_storage_observer_.get()); |
| 49 | 49 |
| 50 unique_id_ = "test_id"; | 50 unique_id_ = "test_id"; |
| 51 mount_point_ = base::FilePath("/unused_test_directory"); | 51 mount_point_ = base::FilePath("/unused_test_directory"); |
| 52 device_id_ = StorageInfo::MakeDeviceId( | 52 device_id_ = StorageInfo::MakeDeviceId( |
| 53 StorageInfo::REMOVABLE_MASS_STORAGE_NO_DCIM, unique_id_); | 53 StorageInfo::REMOVABLE_MASS_STORAGE_NO_DCIM, unique_id_); |
| 54 disk_info_ = CreateStorageInfo(device_id_, "", | 54 disk_info_ = CreateStorageInfo(device_id_, "", |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 // Test that mounting a DMG doesn't send a notification. | 162 // Test that mounting a DMG doesn't send a notification. |
| 163 TEST_F(StorageMonitorMacTest, DMG) { | 163 TEST_F(StorageMonitorMacTest, DMG) { |
| 164 StorageInfo info = CreateStorageInfo( | 164 StorageInfo info = CreateStorageInfo( |
| 165 device_id_, "Disk Image", mount_point_, kTestSize); | 165 device_id_, "Disk Image", mount_point_, kTestSize); |
| 166 UpdateDisk(info, StorageMonitorMac::UPDATE_DEVICE_ADDED); | 166 UpdateDisk(info, StorageMonitorMac::UPDATE_DEVICE_ADDED); |
| 167 EXPECT_EQ(0, mock_storage_observer_->attach_calls()); | 167 EXPECT_EQ(0, mock_storage_observer_->attach_calls()); |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace storage_monitor | 170 } // namespace storage_monitor |
| OLD | NEW |