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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 60 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
61 base::Bind(&StorageMonitorMac::UpdateDisk, | 61 base::Bind(&StorageMonitorMac::UpdateDisk, |
62 base::Unretained(monitor_.get()), | 62 base::Unretained(monitor_.get()), |
63 "dummy_bsd_name", info, update_type)); | 63 "dummy_bsd_name", info, update_type)); |
64 base::RunLoop().RunUntilIdle(); | 64 base::RunLoop().RunUntilIdle(); |
65 } | 65 } |
66 | 66 |
67 protected: | 67 protected: |
68 content::TestBrowserThreadBundle thread_bundle_; | 68 content::TestBrowserThreadBundle thread_bundle_; |
69 | 69 |
70 scoped_ptr<MockRemovableStorageObserver> mock_storage_observer_; | 70 std::unique_ptr<MockRemovableStorageObserver> mock_storage_observer_; |
71 | 71 |
72 // Information about the disk. | 72 // Information about the disk. |
73 std::string unique_id_; | 73 std::string unique_id_; |
74 base::FilePath mount_point_; | 74 base::FilePath mount_point_; |
75 std::string device_id_; | 75 std::string device_id_; |
76 StorageInfo disk_info_; | 76 StorageInfo disk_info_; |
77 | 77 |
78 scoped_ptr<StorageMonitorMac> monitor_; | 78 std::unique_ptr<StorageMonitorMac> monitor_; |
79 }; | 79 }; |
80 | 80 |
81 TEST_F(StorageMonitorMacTest, AddRemove) { | 81 TEST_F(StorageMonitorMacTest, AddRemove) { |
82 UpdateDisk(disk_info_, StorageMonitorMac::UPDATE_DEVICE_ADDED); | 82 UpdateDisk(disk_info_, StorageMonitorMac::UPDATE_DEVICE_ADDED); |
83 | 83 |
84 EXPECT_EQ(1, mock_storage_observer_->attach_calls()); | 84 EXPECT_EQ(1, mock_storage_observer_->attach_calls()); |
85 EXPECT_EQ(0, mock_storage_observer_->detach_calls()); | 85 EXPECT_EQ(0, mock_storage_observer_->detach_calls()); |
86 EXPECT_EQ(device_id_, mock_storage_observer_->last_attached().device_id()); | 86 EXPECT_EQ(device_id_, mock_storage_observer_->last_attached().device_id()); |
87 EXPECT_EQ(mount_point_.value(), | 87 EXPECT_EQ(mount_point_.value(), |
88 mock_storage_observer_->last_attached().location()); | 88 mock_storage_observer_->last_attached().location()); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |