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

Unified Diff: media/midi/midi_manager_unittest.cc

Issue 656793004: Use RunLoop, but do not call RunUntilIdle() multiple times (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/midi/midi_manager_usb_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/midi/midi_manager_unittest.cc
diff --git a/media/midi/midi_manager_unittest.cc b/media/midi/midi_manager_unittest.cc
index 5782b725ada5731298504e03d3f0bbaddaf4804f..cd81770e62dbf2d48cb647a97830bfcab09b4cbd 100644
--- a/media/midi/midi_manager_unittest.cc
+++ b/media/midi/midi_manager_unittest.cc
@@ -75,24 +75,11 @@ class FakeMidiManagerClient : public MidiManagerClient {
int client_id() const { return client_id_; }
MidiResult result() const { return result_; }
- void HandleContinuationMessage() {
- // Stop posting a dummy message once CompleteStartSession() is invoked.
- if (!wait_for_result_)
- return;
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&FakeMidiManagerClient::HandleContinuationMessage,
- base::Unretained(this)));
- }
-
-
MidiResult WaitForResult() {
- base::RunLoop run_loop;
- // Post a dummy task not to stop the following event loop.
- HandleContinuationMessage();
- // CompleteStartSession() is called inside the message loop on the same
- // thread. Protection for |wait_for_result_| is not needed.
- run_loop.RunUntilIdle();
+ while (wait_for_result_) {
+ base::RunLoop run_loop;
+ run_loop.RunUntilIdle();
+ }
return result();
}
« no previous file with comments | « no previous file | media/midi/midi_manager_usb_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698