| OLD | NEW |
| 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 |
| 11 TEST(MidiManagerAlsaTest, ExtractManufacturer) { | 11 TEST(MidiManagerAlsaTest, ExtractManufacturer) { |
| 12 ASSERT_EQ("My\\x20Vendor", | 12 ASSERT_EQ("My\\x20Vendor", |
| 13 MidiManagerAlsa::CardInfo::ExtractManufacturerString( | 13 MidiManagerAlsa::MidiDevice::ExtractManufacturerString( |
| 14 "My\\x20Vendor", | 14 "My\\x20Vendor", "1234", "My Vendor, Inc.", "Card", |
| 15 "1234", | |
| 16 "My Vendor, Inc.", | |
| 17 "Card", | |
| 18 "My Vendor Inc Card at bus")); | 15 "My Vendor Inc Card at bus")); |
| 19 ASSERT_EQ("My Vendor", | 16 ASSERT_EQ("My Vendor", MidiManagerAlsa::MidiDevice::ExtractManufacturerString( |
| 20 MidiManagerAlsa::CardInfo::ExtractManufacturerString( | 17 "My Vendor", "1234", "My Vendor, Inc.", "Card", |
| 21 "My Vendor", | 18 "My Vendor Inc Card at bus")); |
| 22 "1234", | |
| 23 "My Vendor, Inc.", | |
| 24 "Card", | |
| 25 "My Vendor Inc Card at bus")); | |
| 26 ASSERT_EQ("My Vendor, Inc.", | 19 ASSERT_EQ("My Vendor, Inc.", |
| 27 MidiManagerAlsa::CardInfo::ExtractManufacturerString( | 20 MidiManagerAlsa::MidiDevice::ExtractManufacturerString( |
| 28 "1234", | 21 "1234", "1234", "My Vendor, Inc.", "Card", |
| 29 "1234", | |
| 30 "My Vendor, Inc.", | |
| 31 "Card", | |
| 32 "My Vendor Inc Card at bus")); | 22 "My Vendor Inc Card at bus")); |
| 33 ASSERT_EQ("My Vendor Inc", | 23 ASSERT_EQ("My Vendor Inc", |
| 34 MidiManagerAlsa::CardInfo::ExtractManufacturerString( | 24 MidiManagerAlsa::MidiDevice::ExtractManufacturerString( |
| 35 "1234", | 25 "1234", "1234", "", "Card", "My Vendor Inc Card at bus")); |
| 36 "1234", | |
| 37 "", | |
| 38 "Card", | |
| 39 "My Vendor Inc Card at bus")); | |
| 40 ASSERT_EQ("My Vendor Inc", | 26 ASSERT_EQ("My Vendor Inc", |
| 41 MidiManagerAlsa::CardInfo::ExtractManufacturerString( | 27 MidiManagerAlsa::MidiDevice::ExtractManufacturerString( |
| 42 "", | 28 "", "", "", "Card", "My Vendor Inc Card at bus")); |
| 43 "", | 29 ASSERT_EQ("", MidiManagerAlsa::MidiDevice::ExtractManufacturerString( |
| 44 "", | 30 "1234", "1234", "", "Card", "Longname")); |
| 45 "Card", | |
| 46 "My Vendor Inc Card at bus")); | |
| 47 ASSERT_EQ("", | |
| 48 MidiManagerAlsa::CardInfo::ExtractManufacturerString("1234", | |
| 49 "1234", | |
| 50 "", | |
| 51 "Card", | |
| 52 "Longname")); | |
| 53 ASSERT_EQ("Keystation\\x20Mini\\x2032", | 31 ASSERT_EQ("Keystation\\x20Mini\\x2032", |
| 54 MidiManagerAlsa::CardInfo::ExtractManufacturerString( | 32 MidiManagerAlsa::MidiDevice::ExtractManufacturerString( |
| 55 "Keystation\\x20Mini\\x2032", | 33 "Keystation\\x20Mini\\x2032", "129d", |
| 56 "129d", | 34 "Evolution Electronics, Ltd", "Keystation Mini 32", |
| 57 "Evolution Electronics, Ltd", | 35 "Keystation Mini 32 Keystation Mini 32 at" |
| 36 " usb-0000:00:14.0-2.4.4, full speed")); |
| 37 ASSERT_EQ("Keystation Mini 32", |
| 38 MidiManagerAlsa::MidiDevice::ExtractManufacturerString( |
| 39 "Keystation Mini 32", "129d", "Evolution Electronics, Ltd", |
| 58 "Keystation Mini 32", | 40 "Keystation Mini 32", |
| 59 "Keystation Mini 32 Keystation Mini 32 at" | 41 "Keystation Mini 32 Keystation Mini 32 at" |
| 60 " usb-0000:00:14.0-2.4.4, full speed")); | 42 " usb-0000:00:14.0-2.4.4, full speed")); |
| 61 ASSERT_EQ("Keystation Mini 32", | 43 ASSERT_EQ("Keystation Mini 32", |
| 62 MidiManagerAlsa::CardInfo::ExtractManufacturerString( | 44 MidiManagerAlsa::MidiDevice::ExtractManufacturerString( |
| 63 "Keystation Mini 32", | 45 "", "", "", "Keystation Mini 32", |
| 64 "129d", | |
| 65 "Evolution Electronics, Ltd", | |
| 66 "Keystation Mini 32", | |
| 67 "Keystation Mini 32 Keystation Mini 32 at" | |
| 68 " usb-0000:00:14.0-2.4.4, full speed")); | |
| 69 ASSERT_EQ("Keystation Mini 32", | |
| 70 MidiManagerAlsa::CardInfo::ExtractManufacturerString( | |
| 71 "", | |
| 72 "", | |
| 73 "", | |
| 74 "Keystation Mini 32", | |
| 75 "Keystation Mini 32 Keystation Mini 32 at" | 46 "Keystation Mini 32 Keystation Mini 32 at" |
| 76 " usb-0000:00:14.0-2.4.4, full speed")); | 47 " usb-0000:00:14.0-2.4.4, full speed")); |
| 77 } | 48 } |
| 78 | 49 |
| 79 } // namespace media | 50 } // namespace media |
| OLD | NEW |