OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/media/midi_host.h" | 5 #include "content/browser/media/midi_host.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 timestamp(in_timestamp) {} | 41 timestamp(in_timestamp) {} |
42 | 42 |
43 MidiEventType type; | 43 MidiEventType type; |
44 uint32_t port_index; | 44 uint32_t port_index; |
45 std::vector<uint8_t> data; | 45 std::vector<uint8_t> data; |
46 double timestamp; | 46 double timestamp; |
47 }; | 47 }; |
48 | 48 |
49 class FakeMidiManager : public midi::MidiManager { | 49 class FakeMidiManager : public midi::MidiManager { |
50 public: | 50 public: |
| 51 FakeMidiManager() : MidiManager(nullptr) {} |
51 void DispatchSendMidiData(midi::MidiManagerClient* client, | 52 void DispatchSendMidiData(midi::MidiManagerClient* client, |
52 uint32_t port_index, | 53 uint32_t port_index, |
53 const std::vector<uint8_t>& data, | 54 const std::vector<uint8_t>& data, |
54 double timestamp) override { | 55 double timestamp) override { |
55 events_.push_back(MidiEvent(DISPATCH_SEND_MIDI_DATA, | 56 events_.push_back(MidiEvent(DISPATCH_SEND_MIDI_DATA, |
56 port_index, | 57 port_index, |
57 data, | 58 data, |
58 timestamp)); | 59 timestamp)); |
59 } | 60 } |
60 std::vector<MidiEvent> events_; | 61 std::vector<MidiEvent> events_; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Sending data to port 0 and 1 should be delivered now. | 162 // Sending data to port 0 and 1 should be delivered now. |
162 OnSendData(port0); | 163 OnSendData(port0); |
163 OnSendData(port1); | 164 OnSendData(port1); |
164 RunLoopUntilIdle(); | 165 RunLoopUntilIdle(); |
165 EXPECT_EQ(3U, GetEventSize()); | 166 EXPECT_EQ(3U, GetEventSize()); |
166 CheckSendEventAt(1, port0); | 167 CheckSendEventAt(1, port0); |
167 CheckSendEventAt(2, port1); | 168 CheckSendEventAt(2, port1); |
168 } | 169 } |
169 | 170 |
170 } // namespace conent | 171 } // namespace conent |
OLD | NEW |