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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 }; | 174 }; |
175 | 175 |
176 class MidiManagerUsbTest : public ::testing::Test { | 176 class MidiManagerUsbTest : public ::testing::Test { |
177 public: | 177 public: |
178 MidiManagerUsbTest() : message_loop_(new base::MessageLoop) { | 178 MidiManagerUsbTest() : message_loop_(new base::MessageLoop) { |
179 scoped_ptr<TestUsbMidiDeviceFactory> factory(new TestUsbMidiDeviceFactory); | 179 scoped_ptr<TestUsbMidiDeviceFactory> factory(new TestUsbMidiDeviceFactory); |
180 factory_ = factory.get(); | 180 factory_ = factory.get(); |
181 manager_.reset(new MidiManagerUsbForTesting(factory.Pass())); | 181 manager_.reset(new MidiManagerUsbForTesting(factory.Pass())); |
182 } | 182 } |
183 ~MidiManagerUsbTest() override { | 183 ~MidiManagerUsbTest() override { |
| 184 manager_->Shutdown(); |
| 185 base::RunLoop run_loop; |
| 186 run_loop.RunUntilIdle(); |
| 187 |
184 std::string leftover_logs = logger_.TakeLog(); | 188 std::string leftover_logs = logger_.TakeLog(); |
185 if (!leftover_logs.empty()) { | 189 if (!leftover_logs.empty()) { |
186 ADD_FAILURE() << "Log should be empty: " << leftover_logs; | 190 ADD_FAILURE() << "Log should be empty: " << leftover_logs; |
187 } | 191 } |
188 } | 192 } |
189 | 193 |
190 protected: | 194 protected: |
191 void Initialize() { | 195 void Initialize() { |
192 client_.reset(new FakeMidiManagerClient(&logger_)); | 196 client_.reset(new FakeMidiManagerClient(&logger_)); |
193 manager_->StartSession(client_.get()); | 197 manager_->StartSession(client_.get()); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 EXPECT_EQ(3u, manager_->output_streams()[1]->jack().jack_id); | 570 EXPECT_EQ(3u, manager_->output_streams()[1]->jack().jack_id); |
567 ASSERT_EQ(1u, jacks.size()); | 571 ASSERT_EQ(1u, jacks.size()); |
568 EXPECT_EQ(2, jacks[0].endpoint_number()); | 572 EXPECT_EQ(2, jacks[0].endpoint_number()); |
569 EXPECT_EQ("UsbMidiDevice::GetDescriptors\n", logger_.TakeLog()); | 573 EXPECT_EQ("UsbMidiDevice::GetDescriptors\n", logger_.TakeLog()); |
570 } | 574 } |
571 | 575 |
572 } // namespace | 576 } // namespace |
573 | 577 |
574 } // namespace midi | 578 } // namespace midi |
575 } // namespace media | 579 } // namespace media |
OLD | NEW |