OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "media/midi/midi_manager_alsa.h" |
| 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 |
| 9 namespace media { |
| 10 |
| 11 namespace internal { |
| 12 |
| 13 namespace { |
| 14 |
| 15 TEST(MidiManagerAlsaTest, UdevEscape) { |
| 16 ASSERT_EQ(R"()", UnescapeUdev(R"()")); |
| 17 ASSERT_EQ(R"(\)", UnescapeUdev(R"(\x5c)")); |
| 18 ASSERT_EQ(R"(\x5)", UnescapeUdev(R"(\x5)")); |
| 19 ASSERT_EQ(R"(049f)", UnescapeUdev(R"(049f)")); |
| 20 ASSERT_EQ( |
| 21 R"(HD Pro Webcam C920)", UnescapeUdev(R"(HD\x20Pro\x20Webcam\x20C920)")); |
| 22 ASSERT_EQ( |
| 23 R"(E-MU Systems,Inc.)", UnescapeUdev(R"(E-MU\x20Systems\x2cInc.)")); |
| 24 } |
| 25 |
| 26 TEST(MidiManagerAlsaTest, ExtractManufacturer) { |
| 27 ASSERT_EQ("My Vendor", |
| 28 ExtractManufacturer(R"(My\x20Vendor)", |
| 29 "1234", |
| 30 "My Vendor, Inc.", |
| 31 "Card", |
| 32 "My Vendor Inc Card at bus")); |
| 33 ASSERT_EQ("My Vendor, Inc.", |
| 34 ExtractManufacturer("1234", |
| 35 "1234", |
| 36 "My Vendor, Inc.", |
| 37 "Card", |
| 38 "My Vendor Inc Card at bus")); |
| 39 ASSERT_EQ("My Vendor Inc", |
| 40 ExtractManufacturer("1234", |
| 41 "1234", |
| 42 "", |
| 43 "Card", |
| 44 "My Vendor Inc Card at bus")); |
| 45 ASSERT_EQ("My Vendor Inc", |
| 46 ExtractManufacturer("", |
| 47 "", |
| 48 "", |
| 49 "Card", |
| 50 "My Vendor Inc Card at bus")); |
| 51 ASSERT_EQ("", |
| 52 ExtractManufacturer("1234", |
| 53 "1234", |
| 54 "", |
| 55 "Card", |
| 56 "Longname")); |
| 57 ASSERT_EQ("Keystation Mini 32", |
| 58 ExtractManufacturer(R"(Keystation\x20Mini\x2032)", |
| 59 "129d", |
| 60 "Evolution Electronics, Ltd", |
| 61 "Keystation Mini 32", |
| 62 "Keystation Mini 32 Keystation Mini 32 at" |
| 63 " usb-0000:00:14.0-2.4.4, full speed")); |
| 64 ASSERT_EQ("Keystation Mini 32", |
| 65 ExtractManufacturer("", |
| 66 "", |
| 67 "", |
| 68 "Keystation Mini 32", |
| 69 "Keystation Mini 32 Keystation Mini 32 at" |
| 70 " usb-0000:00:14.0-2.4.4, full speed")); |
| 71 } |
| 72 |
| 73 } // namespace |
| 74 |
| 75 } // namespace internal |
| 76 |
| 77 } // namespace media |
OLD | NEW |