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

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

Issue 968663004: Improve MidiManagerAlsa manufacturer reporting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@udev
Patch Set: Address reviewer comments 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
OLDNEW
(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 TEST(MidiManagerAlsaTest, UdevEscape) {
12 ASSERT_EQ(R"()", MidiManagerAlsa::UnescapeUdev(R"()"));
13 ASSERT_EQ(R"(\)", MidiManagerAlsa::UnescapeUdev(R"(\x5c)"));
14 ASSERT_EQ(R"(\x5)", MidiManagerAlsa::UnescapeUdev(R"(\x5)"));
15 ASSERT_EQ(R"(049f)", MidiManagerAlsa::UnescapeUdev(R"(049f)"));
16 ASSERT_EQ(R"(HD Pro Webcam C920)",
17 MidiManagerAlsa::UnescapeUdev(R"(HD\x20Pro\x20Webcam\x20C920)"));
18 ASSERT_EQ(R"(E-MU Systems,Inc.)",
19 MidiManagerAlsa::UnescapeUdev(R"(E-MU\x20Systems\x2cInc.)"));
20 }
21
22 TEST(MidiManagerAlsaTest, ExtractManufacturer) {
23 ASSERT_EQ("My Vendor",
24 MidiManagerAlsa::ExtractManufacturer(R"(My\x20Vendor)",
25 "1234",
26 "My Vendor, Inc.",
27 "Card",
28 "My Vendor Inc Card at bus"));
29 ASSERT_EQ("My Vendor, Inc.",
30 MidiManagerAlsa::ExtractManufacturer("1234",
31 "1234",
32 "My Vendor, Inc.",
33 "Card",
34 "My Vendor Inc Card at bus"));
35 ASSERT_EQ("My Vendor Inc",
36 MidiManagerAlsa::ExtractManufacturer("1234",
37 "1234",
38 "",
39 "Card",
40 "My Vendor Inc Card at bus"));
41 ASSERT_EQ("My Vendor Inc",
42 MidiManagerAlsa::ExtractManufacturer("",
43 "",
44 "",
45 "Card",
46 "My Vendor Inc Card at bus"));
47 ASSERT_EQ("",
48 MidiManagerAlsa::ExtractManufacturer("1234",
49 "1234",
50 "",
51 "Card",
52 "Longname"));
53 ASSERT_EQ("Keystation Mini 32",
54 MidiManagerAlsa::ExtractManufacturer(
55 R"(Keystation\x20Mini\x2032)",
56 "129d",
57 "Evolution Electronics, Ltd",
58 "Keystation Mini 32",
59 "Keystation Mini 32 Keystation Mini 32 at"
60 " usb-0000:00:14.0-2.4.4, full speed"));
61 ASSERT_EQ("Keystation Mini 32",
62 MidiManagerAlsa::ExtractManufacturer(
63 "",
64 "",
65 "",
66 "Keystation Mini 32",
67 "Keystation Mini 32 Keystation Mini 32 at"
68 " usb-0000:00:14.0-2.4.4, full speed"));
69 }
70
71 } // namespace media
OLDNEW
« media/midi/midi_manager_alsa.cc ('K') | « media/midi/midi_manager_alsa.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698