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_descriptor_parser.h" | 5 #include "media/midi/usb_midi_descriptor_parser.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace media { | 9 namespace media { |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 uint8 data[] = { | 33 uint8 data[] = { |
34 0x09, 0x04, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00, 0x00, 0x07, | 34 0x09, 0x04, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00, 0x00, 0x07, |
35 0x24, 0x01, 0x00, 0x01, 0x07, 0x00, 0x05, 0x25, 0x01, 0x01, | 35 0x24, 0x01, 0x00, 0x01, 0x07, 0x00, 0x05, 0x25, 0x01, 0x01, |
36 0x01, | 36 0x01, |
37 }; | 37 }; |
38 EXPECT_FALSE(parser.Parse(NULL, data, arraysize(data), &jacks)); | 38 EXPECT_FALSE(parser.Parse(NULL, data, arraysize(data), &jacks)); |
39 EXPECT_TRUE(jacks.empty()); | 39 EXPECT_TRUE(jacks.empty()); |
40 } | 40 } |
41 | 41 |
42 TEST(UsbMidiDescriptorParserTest, | 42 TEST(UsbMidiDescriptorParserTest, |
43 JacksShouldBeIgnoredWhenParserIsNotParsingMIDIInterface) { | 43 JacksShouldBeIgnoredWhenParserIsNotParsingMidiInterface) { |
44 UsbMidiDescriptorParser parser; | 44 UsbMidiDescriptorParser parser; |
45 std::vector<UsbMidiJack> jacks; | 45 std::vector<UsbMidiJack> jacks; |
46 // a NON-MIDI INTERFACE descriptor followed by ENDPOINT and CS_ENDPOINT | 46 // a NON-MIDI INTERFACE descriptor followed by ENDPOINT and CS_ENDPOINT |
47 // descriptors (Compare with the previous test case). | 47 // descriptors (Compare with the previous test case). |
48 uint8 data[] = { | 48 uint8 data[] = { |
49 0x09, 0x04, 0x01, 0x00, 0x02, 0x01, 0x02, 0x00, 0x00, 0x07, | 49 0x09, 0x04, 0x01, 0x00, 0x02, 0x01, 0x02, 0x00, 0x00, 0x07, |
50 0x24, 0x01, 0x00, 0x01, 0x07, 0x00, 0x05, 0x25, 0x01, 0x01, | 50 0x24, 0x01, 0x00, 0x01, 0x07, 0x00, 0x05, 0x25, 0x01, 0x01, |
51 0x01, | 51 0x01, |
52 }; | 52 }; |
53 EXPECT_TRUE(parser.Parse(NULL, data, arraysize(data), &jacks)); | 53 EXPECT_TRUE(parser.Parse(NULL, data, arraysize(data), &jacks)); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 EXPECT_EQ(7u, jacks[2].jack_id); | 92 EXPECT_EQ(7u, jacks[2].jack_id); |
93 EXPECT_EQ(0u, jacks[2].cable_number); | 93 EXPECT_EQ(0u, jacks[2].cable_number); |
94 EXPECT_EQ(2u, jacks[2].endpoint_number()); | 94 EXPECT_EQ(2u, jacks[2].endpoint_number()); |
95 EXPECT_EQ(UsbMidiJack::DIRECTION_IN, jacks[2].direction()); | 95 EXPECT_EQ(UsbMidiJack::DIRECTION_IN, jacks[2].direction()); |
96 EXPECT_EQ(NULL, jacks[2].device); | 96 EXPECT_EQ(NULL, jacks[2].device); |
97 } | 97 } |
98 | 98 |
99 } // namespace | 99 } // namespace |
100 | 100 |
101 } // namespace media | 101 } // namespace media |
OLD | NEW |