Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: media/midi/usb_midi_descriptor_parser_unittest.cc

Issue 151343002: Web MIDI: make naming convention be consistent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review boliu #2 Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/midi/midi_port_info.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « media/midi/midi_port_info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698