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

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

Issue 1025863002: Web MIDI Linux: Fix enumeration when OPL3 devices are present, and fix manufacturer extraction bugs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments about why we special case OPL3, reformat Created 5 years, 9 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
« no previous file with comments | « media/midi/midi_manager_alsa.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_alsa.h" 5 #include "media/midi/midi_manager_alsa.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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 ASSERT_EQ("Keystation Mini 32", 44 ASSERT_EQ("Keystation Mini 32",
45 MidiManagerAlsa::AlsaRawmidi::ExtractManufacturerString( 45 MidiManagerAlsa::AlsaRawmidi::ExtractManufacturerString(
46 "", "", "", "Keystation Mini 32", 46 "", "", "", "Keystation Mini 32",
47 "Keystation Mini 32 Keystation Mini 32 at" 47 "Keystation Mini 32 Keystation Mini 32 at"
48 " usb-0000:00:14.0-2.4.4, full speed")); 48 " usb-0000:00:14.0-2.4.4, full speed"));
49 ASSERT_EQ("", MidiManagerAlsa::AlsaRawmidi::ExtractManufacturerString( 49 ASSERT_EQ("", MidiManagerAlsa::AlsaRawmidi::ExtractManufacturerString(
50 "", "", "", "Serial MIDI (UART16550A)", 50 "", "", "", "Serial MIDI (UART16550A)",
51 "Serial MIDI (UART16550A) [Soundcanvas] at 0x3f8, irq 4")); 51 "Serial MIDI (UART16550A) [Soundcanvas] at 0x3f8, irq 4"));
52 ASSERT_EQ("", MidiManagerAlsa::AlsaRawmidi::ExtractManufacturerString( 52 ASSERT_EQ("", MidiManagerAlsa::AlsaRawmidi::ExtractManufacturerString(
53 "", "", "", "VirMIDI", "Virtual MIDI Card 1")); 53 "", "", "", "VirMIDI", "Virtual MIDI Card 1"));
54 ASSERT_EQ("C-Media Electronics Inc",
55 MidiManagerAlsa::AlsaRawmidi::ExtractManufacturerString(
56 "", "0x13f6", "C-Media Electronics Inc", "C-Media CMI8738 MIDI",
57 "C-Media CMI8738 (model 55) at 0xd000, irq 19"));
58 ASSERT_EQ("C-Media Electronics Inc",
59 MidiManagerAlsa::AlsaRawmidi::ExtractManufacturerString(
60 "", "0x13f6", "C-Media Electronics Inc", "C-Media CMI8738 FM",
61 "C-Media CMI8738 (model 55) at 0xd000, irq 19"));
54 } 62 }
55 63
56 TEST(MidiManagerAlsaTest, JSONPortMetadata) { 64 TEST(MidiManagerAlsaTest, JSONPortMetadata) {
57 snd_seq_addr_t address; 65 snd_seq_addr_t address;
58 address.client = 1; 66 address.client = 1;
59 address.port = 2; 67 address.port = 2;
60 68
61 MidiManagerAlsa::AlsaPortMetadata input( 69 MidiManagerAlsa::AlsaPortMetadata input(
62 "path", "bus", "id", &address, "client_name", "port_name", "card_name", 70 "path", "bus", "id", &address, "client_name", "port_name", "card_name",
63 "card_longname", MidiManagerAlsa::AlsaPortMetadata::Type::kInput); 71 "card_longname", MidiManagerAlsa::AlsaPortMetadata::Type::kInput);
(...skipping 18 matching lines...) Expand all
82 "name\"," 90 "name\","
83 "\"clientAddr\":1,\"clientName\":\"client_name\",\"id\":\"id\",\"path\":" 91 "\"clientAddr\":1,\"clientName\":\"client_name\",\"id\":\"id\",\"path\":"
84 "\"path\"," 92 "\"path\","
85 "\"portAddr\":2,\"portName\":\"port_name\",\"type\":\"output\"}", 93 "\"portAddr\":2,\"portName\":\"port_name\",\"type\":\"output\"}",
86 output.JSONValue()); 94 output.JSONValue());
87 ASSERT_EQ("747E553D40F8388A0C1C51261B82869D5EFA8A54860AAFB2F4F7437744982495", 95 ASSERT_EQ("747E553D40F8388A0C1C51261B82869D5EFA8A54860AAFB2F4F7437744982495",
88 output.OpaqueKey()); 96 output.OpaqueKey());
89 } 97 }
90 98
91 } // namespace media 99 } // namespace media
OLDNEW
« no previous file with comments | « media/midi/midi_manager_alsa.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698