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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "media/midi/usb_midi_device.h" | 18 #include "media/midi/usb_midi_device.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
21 namespace midi { | 21 namespace midi { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
| 25 using mojom::PortState; |
25 using mojom::Result; | 26 using mojom::Result; |
26 | 27 |
27 template<typename T, size_t N> | 28 template<typename T, size_t N> |
28 std::vector<T> ToVector(const T (&array)[N]) { | 29 std::vector<T> ToVector(const T (&array)[N]) { |
29 return std::vector<T>(array, array + N); | 30 return std::vector<T>(array, array + N); |
30 } | 31 } |
31 | 32 |
32 class Logger { | 33 class Logger { |
33 public: | 34 public: |
34 Logger() {} | 35 Logger() {} |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 ~FakeMidiManagerClient() override {} | 103 ~FakeMidiManagerClient() override {} |
103 | 104 |
104 void AddInputPort(const MidiPortInfo& info) override { | 105 void AddInputPort(const MidiPortInfo& info) override { |
105 input_ports_.push_back(info); | 106 input_ports_.push_back(info); |
106 } | 107 } |
107 | 108 |
108 void AddOutputPort(const MidiPortInfo& info) override { | 109 void AddOutputPort(const MidiPortInfo& info) override { |
109 output_ports_.push_back(info); | 110 output_ports_.push_back(info); |
110 } | 111 } |
111 | 112 |
112 void SetInputPortState(uint32_t port_index, MidiPortState state) override {} | 113 void SetInputPortState(uint32_t port_index, PortState state) override {} |
113 | 114 |
114 void SetOutputPortState(uint32_t port_index, MidiPortState state) override {} | 115 void SetOutputPortState(uint32_t port_index, PortState state) override {} |
115 | 116 |
116 void CompleteStartSession(Result result) override { | 117 void CompleteStartSession(Result result) override { |
117 complete_start_session_ = true; | 118 complete_start_session_ = true; |
118 result_ = result; | 119 result_ = result; |
119 } | 120 } |
120 | 121 |
121 void ReceiveMidiData(uint32_t port_index, | 122 void ReceiveMidiData(uint32_t port_index, |
122 const uint8_t* data, | 123 const uint8_t* data, |
123 size_t size, | 124 size_t size, |
124 double timestamp) override { | 125 double timestamp) override { |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 EXPECT_EQ(2u, manager_->output_streams()[0]->jack().jack_id); | 569 EXPECT_EQ(2u, manager_->output_streams()[0]->jack().jack_id); |
569 EXPECT_EQ(3u, manager_->output_streams()[1]->jack().jack_id); | 570 EXPECT_EQ(3u, manager_->output_streams()[1]->jack().jack_id); |
570 ASSERT_EQ(1u, jacks.size()); | 571 ASSERT_EQ(1u, jacks.size()); |
571 EXPECT_EQ(2, jacks[0].endpoint_number()); | 572 EXPECT_EQ(2, jacks[0].endpoint_number()); |
572 EXPECT_EQ("UsbMidiDevice::GetDescriptors\n", logger_.TakeLog()); | 573 EXPECT_EQ("UsbMidiDevice::GetDescriptors\n", logger_.TakeLog()); |
573 } | 574 } |
574 | 575 |
575 } // namespace | 576 } // namespace |
576 | 577 |
577 } // namespace midi | 578 } // namespace midi |
OLD | NEW |