OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/base/bind_to_current_loop.h" | 5 #include "media/base/bind_to_current_loop.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/free_deleter.h" | 10 #include "base/memory/free_deleter.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 base::MakeUnique<ThreadRestrictionChecker>())); | 215 base::MakeUnique<ThreadRestrictionChecker>())); |
216 target_thread.task_runner()->PostTask( | 216 target_thread.task_runner()->PostTask( |
217 FROM_HERE, base::Bind(&ClearReference, base::Passed(&cb))); | 217 FROM_HERE, base::Bind(&ClearReference, base::Passed(&cb))); |
218 target_thread.FlushForTesting(); | 218 target_thread.FlushForTesting(); |
219 ASSERT_FALSE(cb); | 219 ASSERT_FALSE(cb); |
220 base::RunLoop().RunUntilIdle(); | 220 base::RunLoop().RunUntilIdle(); |
221 | 221 |
222 target_thread.Stop(); | 222 target_thread.Stop(); |
223 } | 223 } |
224 | 224 |
| 225 TEST_F(BindToCurrentLoopTest, SeveralCalls) { |
| 226 base::Closure cl = base::Bind([]() {}); |
| 227 base::Closure bound_cl = BindToCurrentLoop(std::move(cl)); |
| 228 bound_cl.Run(); |
| 229 bound_cl.Run(); |
| 230 base::RunLoop().RunUntilIdle(); |
| 231 } |
| 232 |
225 } // namespace media | 233 } // namespace media |
OLD | NEW |