| 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, UdevEscape) { | |
| 12 ASSERT_EQ("", MidiManagerAlsa::CardInfo::UnescapeUdev("")); | |
| 13 ASSERT_EQ("\\", MidiManagerAlsa::CardInfo::UnescapeUdev("\\x5c")); | |
| 14 ASSERT_EQ("\\x5", MidiManagerAlsa::CardInfo::UnescapeUdev("\\x5")); | |
| 15 ASSERT_EQ("049f", MidiManagerAlsa::CardInfo::UnescapeUdev("049f")); | |
| 16 ASSERT_EQ("HD Pro Webcam C920", | |
| 17 MidiManagerAlsa::CardInfo::UnescapeUdev( | |
| 18 "HD\\x20Pro\\x20Webcam\\x20C920")); | |
| 19 ASSERT_EQ("E-MU Systems,Inc.", | |
| 20 MidiManagerAlsa::CardInfo::UnescapeUdev( | |
| 21 "E-MU\\x20Systems\\x2cInc.")); | |
| 22 } | |
| 23 | |
| 24 TEST(MidiManagerAlsaTest, ExtractManufacturer) { | 11 TEST(MidiManagerAlsaTest, ExtractManufacturer) { |
| 12 ASSERT_EQ("My\\x20Vendor", |
| 13 MidiManagerAlsa::CardInfo::ExtractManufacturerString( |
| 14 "My\\x20Vendor", |
| 15 "1234", |
| 16 "My Vendor, Inc.", |
| 17 "Card", |
| 18 "My Vendor Inc Card at bus")); |
| 25 ASSERT_EQ("My Vendor", | 19 ASSERT_EQ("My Vendor", |
| 26 MidiManagerAlsa::CardInfo::ExtractManufacturerString( | 20 MidiManagerAlsa::CardInfo::ExtractManufacturerString( |
| 27 "My\\x20Vendor", | 21 "My Vendor", |
| 28 "1234", | 22 "1234", |
| 29 "My Vendor, Inc.", | 23 "My Vendor, Inc.", |
| 30 "Card", | 24 "Card", |
| 31 "My Vendor Inc Card at bus")); | 25 "My Vendor Inc Card at bus")); |
| 32 ASSERT_EQ("My Vendor, Inc.", | 26 ASSERT_EQ("My Vendor, Inc.", |
| 33 MidiManagerAlsa::CardInfo::ExtractManufacturerString( | 27 MidiManagerAlsa::CardInfo::ExtractManufacturerString( |
| 34 "1234", | 28 "1234", |
| 35 "1234", | 29 "1234", |
| 36 "My Vendor, Inc.", | 30 "My Vendor, Inc.", |
| 37 "Card", | 31 "Card", |
| (...skipping 11 matching lines...) Expand all Loading... |
| 49 "", | 43 "", |
| 50 "", | 44 "", |
| 51 "Card", | 45 "Card", |
| 52 "My Vendor Inc Card at bus")); | 46 "My Vendor Inc Card at bus")); |
| 53 ASSERT_EQ("", | 47 ASSERT_EQ("", |
| 54 MidiManagerAlsa::CardInfo::ExtractManufacturerString("1234", | 48 MidiManagerAlsa::CardInfo::ExtractManufacturerString("1234", |
| 55 "1234", | 49 "1234", |
| 56 "", | 50 "", |
| 57 "Card", | 51 "Card", |
| 58 "Longname")); | 52 "Longname")); |
| 59 ASSERT_EQ("Keystation Mini 32", | 53 ASSERT_EQ("Keystation\\x20Mini\\x2032", |
| 60 MidiManagerAlsa::CardInfo::ExtractManufacturerString( | 54 MidiManagerAlsa::CardInfo::ExtractManufacturerString( |
| 61 "Keystation\\x20Mini\\x2032", | 55 "Keystation\\x20Mini\\x2032", |
| 62 "129d", | 56 "129d", |
| 63 "Evolution Electronics, Ltd", | 57 "Evolution Electronics, Ltd", |
| 64 "Keystation Mini 32", | 58 "Keystation Mini 32", |
| 65 "Keystation Mini 32 Keystation Mini 32 at" | 59 "Keystation Mini 32 Keystation Mini 32 at" |
| 66 " usb-0000:00:14.0-2.4.4, full speed")); | 60 " usb-0000:00:14.0-2.4.4, full speed")); |
| 67 ASSERT_EQ("Keystation Mini 32", | 61 ASSERT_EQ("Keystation Mini 32", |
| 68 MidiManagerAlsa::CardInfo::ExtractManufacturerString( | 62 MidiManagerAlsa::CardInfo::ExtractManufacturerString( |
| 63 "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( |
| 69 "", | 71 "", |
| 70 "", | 72 "", |
| 71 "", | 73 "", |
| 72 "Keystation Mini 32", | 74 "Keystation Mini 32", |
| 73 "Keystation Mini 32 Keystation Mini 32 at" | 75 "Keystation Mini 32 Keystation Mini 32 at" |
| 74 " usb-0000:00:14.0-2.4.4, full speed")); | 76 " usb-0000:00:14.0-2.4.4, full speed")); |
| 75 } | 77 } |
| 76 | 78 |
| 77 } // namespace media | 79 } // namespace media |
| OLD | NEW |