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

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: Fix embarrassing mistake that broke driver and manufacturer 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
(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("", 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) {
25 ASSERT_EQ("My Vendor",
26 MidiManagerAlsa::CardInfo::ExtractManufacturerString(
27 "My\\x20Vendor",
28 "1234",
29 "My Vendor, Inc.",
30 "Card",
31 "My Vendor Inc Card at bus"));
32 ASSERT_EQ("My Vendor, Inc.",
33 MidiManagerAlsa::CardInfo::ExtractManufacturerString(
34 "1234",
35 "1234",
36 "My Vendor, Inc.",
37 "Card",
38 "My Vendor Inc Card at bus"));
39 ASSERT_EQ("My Vendor Inc",
40 MidiManagerAlsa::CardInfo::ExtractManufacturerString(
41 "1234",
42 "1234",
43 "",
44 "Card",
45 "My Vendor Inc Card at bus"));
46 ASSERT_EQ("My Vendor Inc",
47 MidiManagerAlsa::CardInfo::ExtractManufacturerString(
48 "",
49 "",
50 "",
51 "Card",
52 "My Vendor Inc Card at bus"));
53 ASSERT_EQ("",
54 MidiManagerAlsa::CardInfo::ExtractManufacturerString("1234",
55 "1234",
56 "",
57 "Card",
58 "Longname"));
59 ASSERT_EQ("Keystation Mini 32",
60 MidiManagerAlsa::CardInfo::ExtractManufacturerString(
61 "Keystation\\x20Mini\\x2032",
62 "129d",
63 "Evolution Electronics, Ltd",
64 "Keystation Mini 32",
65 "Keystation Mini 32 Keystation Mini 32 at"
66 " usb-0000:00:14.0-2.4.4, full speed"));
67 ASSERT_EQ("Keystation Mini 32",
68 MidiManagerAlsa::CardInfo::ExtractManufacturerString(
69 "",
70 "",
71 "",
72 "Keystation Mini 32",
73 "Keystation Mini 32 Keystation Mini 32 at"
74 " usb-0000:00:14.0-2.4.4, full speed"));
75 }
76
77 } // 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