Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: media/base/bind_to_current_loop_unittest.cc

Issue 2869733005: Convert some audio code to OnceCallback. (Closed)
Patch Set: Fix BindToCurrentLoop issues Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698