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_chromeos.h" | 5 #include "components/storage_monitor/storage_monitor_chromeos.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
16 #include "chromeos/disks/mock_disk_mount_manager.h" | 17 #include "chromeos/disks/mock_disk_mount_manager.h" |
17 #include "components/storage_monitor/mock_removable_storage_observer.h" | 18 #include "components/storage_monitor/mock_removable_storage_observer.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 disk_mount_manager_mock_ = new chromeos::disks::MockDiskMountManager(); | 167 disk_mount_manager_mock_ = new chromeos::disks::MockDiskMountManager(); |
167 DiskMountManager::InitializeForTesting(disk_mount_manager_mock_); | 168 DiskMountManager::InitializeForTesting(disk_mount_manager_mock_); |
168 disk_mount_manager_mock_->SetupDefaultReplies(); | 169 disk_mount_manager_mock_->SetupDefaultReplies(); |
169 | 170 |
170 mock_storage_observer_.reset(new MockRemovableStorageObserver); | 171 mock_storage_observer_.reset(new MockRemovableStorageObserver); |
171 | 172 |
172 // Initialize the test subject. | 173 // Initialize the test subject. |
173 TestStorageMonitor::Destroy(); | 174 TestStorageMonitor::Destroy(); |
174 monitor_ = new TestStorageMonitorCros(); | 175 monitor_ = new TestStorageMonitorCros(); |
175 scoped_ptr<StorageMonitor> pass_monitor(monitor_); | 176 scoped_ptr<StorageMonitor> pass_monitor(monitor_); |
176 StorageMonitor::SetStorageMonitorForTesting(pass_monitor.Pass()); | 177 StorageMonitor::SetStorageMonitorForTesting(std::move(pass_monitor)); |
177 | 178 |
178 monitor_->Init(); | 179 monitor_->Init(); |
179 monitor_->AddObserver(mock_storage_observer_.get()); | 180 monitor_->AddObserver(mock_storage_observer_.get()); |
180 } | 181 } |
181 | 182 |
182 void StorageMonitorCrosTest::TearDown() { | 183 void StorageMonitorCrosTest::TearDown() { |
183 monitor_->RemoveObserver(mock_storage_observer_.get()); | 184 monitor_->RemoveObserver(mock_storage_observer_.get()); |
184 monitor_ = NULL; | 185 monitor_ = NULL; |
185 | 186 |
186 disk_mount_manager_mock_ = NULL; | 187 disk_mount_manager_mock_ = NULL; |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 base::Bind(&StorageMonitorCrosTest::EjectNotify, | 549 base::Bind(&StorageMonitorCrosTest::EjectNotify, |
549 base::Unretained(this))); | 550 base::Unretained(this))); |
550 base::RunLoop().RunUntilIdle(); | 551 base::RunLoop().RunUntilIdle(); |
551 | 552 |
552 EXPECT_EQ(StorageMonitor::EJECT_OK, status_); | 553 EXPECT_EQ(StorageMonitor::EJECT_OK, status_); |
553 } | 554 } |
554 | 555 |
555 } // namespace | 556 } // namespace |
556 | 557 |
557 } // namespace storage_monitor | 558 } // namespace storage_monitor |
OLD | NEW |