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/usb_midi_input_stream.h" | 5 #include "media/midi/usb_midi_input_stream.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "media/midi/usb_midi_device.h" | 13 #include "media/midi/usb_midi_device.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 using base::TimeTicks; | 16 using base::TimeTicks; |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 class TestUsbMidiDevice : public UsbMidiDevice { | 22 class TestUsbMidiDevice : public UsbMidiDevice { |
23 public: | 23 public: |
24 TestUsbMidiDevice() {} | 24 TestUsbMidiDevice() {} |
25 ~TestUsbMidiDevice() override {} | 25 ~TestUsbMidiDevice() override {} |
26 std::vector<uint8> GetDescriptor() override { return std::vector<uint8>(); } | 26 std::vector<uint8> GetDescriptors() override { return std::vector<uint8>(); } |
| 27 std::string GetManufacturer() override { return std::string(); } |
| 28 std::string GetProductName() override { return std::string(); } |
| 29 std::string GetDeviceVersion() override { return std::string(); } |
27 void Send(int endpoint_number, const std::vector<uint8>& data) override {} | 30 void Send(int endpoint_number, const std::vector<uint8>& data) override {} |
28 | 31 |
29 private: | 32 private: |
30 DISALLOW_COPY_AND_ASSIGN(TestUsbMidiDevice); | 33 DISALLOW_COPY_AND_ASSIGN(TestUsbMidiDevice); |
31 }; | 34 }; |
32 | 35 |
33 class MockDelegate : public UsbMidiInputStream::Delegate { | 36 class MockDelegate : public UsbMidiInputStream::Delegate { |
34 public: | 37 public: |
35 MockDelegate() {} | 38 MockDelegate() {} |
36 ~MockDelegate() override {} | 39 ~MockDelegate() override {} |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 TEST_F(UsbMidiInputStreamTest, DispatchForDevice2) { | 167 TEST_F(UsbMidiInputStreamTest, DispatchForDevice2) { |
165 uint8 data[] = { 0x4f, 0xf8, 0x00, 0x00 }; | 168 uint8 data[] = { 0x4f, 0xf8, 0x00, 0x00 }; |
166 | 169 |
167 stream_->OnReceivedData(&device2_, 7, data, arraysize(data), TimeTicks()); | 170 stream_->OnReceivedData(&device2_, 7, data, arraysize(data), TimeTicks()); |
168 EXPECT_EQ("0xf8 \n", delegate_.received_data()); | 171 EXPECT_EQ("0xf8 \n", delegate_.received_data()); |
169 } | 172 } |
170 | 173 |
171 } // namespace | 174 } // namespace |
172 | 175 |
173 } // namespace media | 176 } // namespace media |
OLD | NEW |