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 "media/midi/midi_manager_usb.h" | 5 #include "media/midi/midi_manager_usb.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 return client_->complete_start_session_; | 172 return client_->complete_start_session_; |
173 } | 173 } |
174 | 174 |
175 MidiResult GetInitializationResult() { | 175 MidiResult GetInitializationResult() { |
176 return client_->result_; | 176 return client_->result_; |
177 } | 177 } |
178 | 178 |
179 void RunCallbackUntilCallbackInvoked( | 179 void RunCallbackUntilCallbackInvoked( |
180 bool result, UsbMidiDevice::Devices* devices) { | 180 bool result, UsbMidiDevice::Devices* devices) { |
181 factory_->callback_.Run(result, devices); | 181 factory_->callback_.Run(result, devices); |
182 base::RunLoop run_loop; | 182 while (!client_->complete_start_session_) { |
183 while (!client_->complete_start_session_) | 183 base::RunLoop run_loop; |
184 run_loop.RunUntilIdle(); | 184 run_loop.RunUntilIdle(); |
| 185 } |
185 } | 186 } |
186 | 187 |
187 scoped_ptr<MidiManagerUsbForTesting> manager_; | 188 scoped_ptr<MidiManagerUsbForTesting> manager_; |
188 scoped_ptr<FakeMidiManagerClient> client_; | 189 scoped_ptr<FakeMidiManagerClient> client_; |
189 // Owned by manager_. | 190 // Owned by manager_. |
190 TestUsbMidiDeviceFactory* factory_; | 191 TestUsbMidiDeviceFactory* factory_; |
191 Logger logger_; | 192 Logger logger_; |
192 | 193 |
193 private: | 194 private: |
194 scoped_ptr<base::MessageLoop> message_loop_; | 195 scoped_ptr<base::MessageLoop> message_loop_; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 "data = 0x90 0x45 0x7f\n" | 349 "data = 0x90 0x45 0x7f\n" |
349 "MidiManagerClient::ReceiveMidiData port_index = 0 " | 350 "MidiManagerClient::ReceiveMidiData port_index = 0 " |
350 "data = 0xf0 0x00 0x01\n" | 351 "data = 0xf0 0x00 0x01\n" |
351 "MidiManagerClient::ReceiveMidiData port_index = 0 data = 0xf7\n", | 352 "MidiManagerClient::ReceiveMidiData port_index = 0 data = 0xf7\n", |
352 logger_.TakeLog()); | 353 logger_.TakeLog()); |
353 } | 354 } |
354 | 355 |
355 } // namespace | 356 } // namespace |
356 | 357 |
357 } // namespace media | 358 } // namespace media |
OLD | NEW |