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/test_storage_monitor.h" | 5 #include "components/storage_monitor/test_storage_monitor.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 return monitor; | 56 return monitor; |
57 } | 57 } |
58 | 58 |
59 // static | 59 // static |
60 void TestStorageMonitor::SyncInitialize() { | 60 void TestStorageMonitor::SyncInitialize() { |
61 StorageMonitor* monitor = StorageMonitor::GetInstance(); | 61 StorageMonitor* monitor = StorageMonitor::GetInstance(); |
62 if (monitor->IsInitialized()) | 62 if (monitor->IsInitialized()) |
63 return; | 63 return; |
64 | 64 |
65 base::WaitableEvent event(true, false); | 65 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL, |
| 66 base::WaitableEvent::InitialState::NOT_SIGNALED); |
66 monitor->EnsureInitialized(base::Bind(&base::WaitableEvent::Signal, | 67 monitor->EnsureInitialized(base::Bind(&base::WaitableEvent::Signal, |
67 base::Unretained(&event))); | 68 base::Unretained(&event))); |
68 while (!event.IsSignaled()) { | 69 while (!event.IsSignaled()) { |
69 base::RunLoop().RunUntilIdle(); | 70 base::RunLoop().RunUntilIdle(); |
70 } | 71 } |
71 DCHECK(monitor->IsInitialized()); | 72 DCHECK(monitor->IsInitialized()); |
72 } | 73 } |
73 | 74 |
74 void TestStorageMonitor::Init() { | 75 void TestStorageMonitor::Init() { |
75 init_called_ = true; | 76 init_called_ = true; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 ejected_device_ = device_id; | 132 ejected_device_ = device_id; |
132 callback.Run(EJECT_OK); | 133 callback.Run(EJECT_OK); |
133 } | 134 } |
134 | 135 |
135 void TestStorageMonitor::AddRemovablePath(const base::FilePath& path) { | 136 void TestStorageMonitor::AddRemovablePath(const base::FilePath& path) { |
136 CHECK(path.IsAbsolute()); | 137 CHECK(path.IsAbsolute()); |
137 removable_paths_.push_back(path); | 138 removable_paths_.push_back(path); |
138 } | 139 } |
139 | 140 |
140 } // namespace storage_monitor | 141 } // namespace storage_monitor |
OLD | NEW |