| 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 // TestVolumeMountWatcherWin implementation. | 5 // TestVolumeMountWatcherWin implementation. |
| 6 | 6 |
| 7 #include "components/storage_monitor/test_volume_mount_watcher_win.h" | 7 #include "components/storage_monitor/test_volume_mount_watcher_win.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 void TestVolumeMountWatcherWin::DeviceCheckComplete( | 116 void TestVolumeMountWatcherWin::DeviceCheckComplete( |
| 117 const base::FilePath& device_path) { | 117 const base::FilePath& device_path) { |
| 118 devices_checked_.push_back(device_path); | 118 devices_checked_.push_back(device_path); |
| 119 if (device_check_complete_event_.get()) | 119 if (device_check_complete_event_.get()) |
| 120 device_check_complete_event_->Wait(); | 120 device_check_complete_event_->Wait(); |
| 121 VolumeMountWatcherWin::DeviceCheckComplete(device_path); | 121 VolumeMountWatcherWin::DeviceCheckComplete(device_path); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void TestVolumeMountWatcherWin::BlockDeviceCheckForTesting() { | 124 void TestVolumeMountWatcherWin::BlockDeviceCheckForTesting() { |
| 125 device_check_complete_event_.reset(new base::WaitableEvent(false, false)); | 125 device_check_complete_event_.reset( |
| 126 new base::WaitableEvent(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 127 base::WaitableEvent::InitialState::NOT_SIGNALED)); |
| 126 devices_checked_.clear(); | 128 devices_checked_.clear(); |
| 127 } | 129 } |
| 128 | 130 |
| 129 void TestVolumeMountWatcherWin::ReleaseDeviceCheck() { | 131 void TestVolumeMountWatcherWin::ReleaseDeviceCheck() { |
| 130 device_check_complete_event_->Signal(); | 132 device_check_complete_event_->Signal(); |
| 131 } | 133 } |
| 132 | 134 |
| 133 // static | 135 // static |
| 134 bool TestVolumeMountWatcherWin::GetDeviceRemovable( | 136 bool TestVolumeMountWatcherWin::GetDeviceRemovable( |
| 135 const base::FilePath& device_path, | 137 const base::FilePath& device_path, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 146 } | 148 } |
| 147 | 149 |
| 148 VolumeMountWatcherWin::GetAttachedDevicesCallbackType | 150 VolumeMountWatcherWin::GetAttachedDevicesCallbackType |
| 149 TestVolumeMountWatcherWin::GetAttachedDevicesCallback() const { | 151 TestVolumeMountWatcherWin::GetAttachedDevicesCallback() const { |
| 150 if (attached_devices_fake_) | 152 if (attached_devices_fake_) |
| 151 return base::Bind(&FakeGetAttachedDevices); | 153 return base::Bind(&FakeGetAttachedDevices); |
| 152 return base::Bind(&FakeGetSingleAttachedDevice); | 154 return base::Bind(&FakeGetSingleAttachedDevice); |
| 153 } | 155 } |
| 154 | 156 |
| 155 } // namespace storage_monitor | 157 } // namespace storage_monitor |
| OLD | NEW |