OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_mac.h" | 5 #include "media/midi/midi_manager_mac.h" |
6 | 6 |
7 #include <CoreMIDI/MIDIServices.h> | 7 #include <CoreMIDI/MIDIServices.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 if (!wait_for_result_) | 54 if (!wait_for_result_) |
55 unexpected_callback_ = true; | 55 unexpected_callback_ = true; |
56 | 56 |
57 result_ = result; | 57 result_ = result; |
58 wait_for_result_ = false; | 58 wait_for_result_ = false; |
59 } | 59 } |
60 | 60 |
61 void ReceiveMidiData(uint32 port_index, const uint8* data, size_t size, | 61 void ReceiveMidiData(uint32 port_index, const uint8* data, size_t size, |
62 double timestamp) override {} | 62 double timestamp) override {} |
63 void AccumulateMidiBytesSent(size_t size) override {} | 63 void AccumulateMidiBytesSent(size_t size) override {} |
| 64 void Detach() override {} |
64 | 65 |
65 bool GetWaitForResult() { | 66 bool GetWaitForResult() { |
66 base::AutoLock lock(lock_); | 67 base::AutoLock lock(lock_); |
67 return wait_for_result_; | 68 return wait_for_result_; |
68 } | 69 } |
69 | 70 |
70 bool GetWaitForPort() { | 71 bool GetWaitForPort() { |
71 base::AutoLock lock(lock_); | 72 base::AutoLock lock(lock_); |
72 return wait_for_port_; | 73 return wait_for_port_; |
73 } | 74 } |
(...skipping 24 matching lines...) Expand all Loading... |
98 bool unexpected_callback_; | 99 bool unexpected_callback_; |
99 | 100 |
100 DISALLOW_COPY_AND_ASSIGN(FakeMidiManagerClient); | 101 DISALLOW_COPY_AND_ASSIGN(FakeMidiManagerClient); |
101 }; | 102 }; |
102 | 103 |
103 class MidiManagerMacTest : public ::testing::Test { | 104 class MidiManagerMacTest : public ::testing::Test { |
104 public: | 105 public: |
105 MidiManagerMacTest() | 106 MidiManagerMacTest() |
106 : manager_(new MidiManagerMac), | 107 : manager_(new MidiManagerMac), |
107 message_loop_(new base::MessageLoop) {} | 108 message_loop_(new base::MessageLoop) {} |
| 109 ~MidiManagerMacTest() override { |
| 110 manager_->Shutdown(); |
| 111 base::RunLoop run_loop; |
| 112 run_loop.RunUntilIdle(); |
| 113 } |
108 | 114 |
109 protected: | 115 protected: |
110 void StartSession(MidiManagerClient* client) { | 116 void StartSession(MidiManagerClient* client) { |
111 manager_->StartSession(client); | 117 manager_->StartSession(client); |
112 } | 118 } |
113 void EndSession(MidiManagerClient* client) { | 119 void EndSession(MidiManagerClient* client) { |
114 manager_->EndSession(client); | 120 manager_->EndSession(client); |
115 } | 121 } |
116 | 122 |
117 private: | 123 private: |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 if (ep) | 159 if (ep) |
154 MIDIEndpointDispose(ep); | 160 MIDIEndpointDispose(ep); |
155 if (midi_client) | 161 if (midi_client) |
156 MIDIClientDispose(midi_client); | 162 MIDIClientDispose(midi_client); |
157 } | 163 } |
158 | 164 |
159 } // namespace | 165 } // namespace |
160 | 166 |
161 } // namespace midi | 167 } // namespace midi |
162 } // namespace media | 168 } // namespace media |
OLD | NEW |