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

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

Issue 1027643003: Web MIDI Linux: Omit empty values in JSON, to make id generation more robust (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@h3
Patch Set: Improve use of scoped_ptr in AlsaPortMetadata::Value() 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
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
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 address.port = 2; 67 address.port = 2;
68 68
69 MidiManagerAlsa::AlsaPortMetadata input( 69 MidiManagerAlsa::AlsaPortMetadata input(
70 "path", "bus", "id", &address, "client_name", "port_name", "card_name", 70 "path", "bus", "id", &address, "client_name", "port_name", "card_name",
71 "card_longname", MidiManagerAlsa::AlsaPortMetadata::Type::kInput); 71 "card_longname", MidiManagerAlsa::AlsaPortMetadata::Type::kInput);
72 72
73 MidiManagerAlsa::AlsaPortMetadata output( 73 MidiManagerAlsa::AlsaPortMetadata output(
74 "path", "bus", "id", &address, "client_name", "port_name", "card_name", 74 "path", "bus", "id", &address, "client_name", "port_name", "card_name",
75 "card_longname", MidiManagerAlsa::AlsaPortMetadata::Type::kOutput); 75 "card_longname", MidiManagerAlsa::AlsaPortMetadata::Type::kOutput);
76 76
77 MidiManagerAlsa::AlsaPortMetadata partial(
78 "", "", "", &address, "client_name", "port_name", "card_name",
79 "card_longname", MidiManagerAlsa::AlsaPortMetadata::Type::kOutput);
80
77 ASSERT_EQ( 81 ASSERT_EQ(
78 "{\"bus\":\"bus\",\"cardLongname\":\"card_longname\",\"cardName\":\"card_" 82 "{\"bus\":\"bus\",\"cardLongname\":\"card_longname\",\"cardName\":\"card_"
79 "name\"," 83 "name\","
80 "\"clientAddr\":1,\"clientName\":\"client_name\",\"id\":\"id\",\"path\":" 84 "\"clientAddr\":1,\"clientName\":\"client_name\",\"id\":\"id\",\"path\":"
81 "\"path\"," 85 "\"path\","
82 "\"portAddr\":2,\"portName\":\"port_name\",\"type\":\"input\"}", 86 "\"portAddr\":2,\"portName\":\"port_name\",\"type\":\"input\"}",
83 input.JSONValue()); 87 input.JSONValue());
84 88
85 ASSERT_EQ("6D6186ACF60BB2FD26B5D2E21881CF0541FDB80FAC5BDFFA95CD55739E3BC526", 89 ASSERT_EQ("6D6186ACF60BB2FD26B5D2E21881CF0541FDB80FAC5BDFFA95CD55739E3BC526",
86 input.OpaqueKey()); 90 input.OpaqueKey());
87 91
88 ASSERT_EQ( 92 ASSERT_EQ(
89 "{\"bus\":\"bus\",\"cardLongname\":\"card_longname\",\"cardName\":\"card_" 93 "{\"bus\":\"bus\",\"cardLongname\":\"card_longname\",\"cardName\":\"card_"
90 "name\"," 94 "name\","
91 "\"clientAddr\":1,\"clientName\":\"client_name\",\"id\":\"id\",\"path\":" 95 "\"clientAddr\":1,\"clientName\":\"client_name\",\"id\":\"id\",\"path\":"
92 "\"path\"," 96 "\"path\","
93 "\"portAddr\":2,\"portName\":\"port_name\",\"type\":\"output\"}", 97 "\"portAddr\":2,\"portName\":\"port_name\",\"type\":\"output\"}",
94 output.JSONValue()); 98 output.JSONValue());
95 ASSERT_EQ("747E553D40F8388A0C1C51261B82869D5EFA8A54860AAFB2F4F7437744982495", 99 ASSERT_EQ("747E553D40F8388A0C1C51261B82869D5EFA8A54860AAFB2F4F7437744982495",
96 output.OpaqueKey()); 100 output.OpaqueKey());
101
102 ASSERT_EQ(
103 "{\"cardLongname\":\"card_longname\",\"cardName\":\"card_"
104 "name\","
105 "\"clientAddr\":1,\"clientName\":\"client_name\","
106 "\"portAddr\":2,\"portName\":\"port_name\",\"type\":\"output\"}",
107 partial.JSONValue());
108 ASSERT_EQ("51DF7AF543B5BDF83C0B8DE3A00A0BC588DDFCA8600671EF7D59828B40DFF6D3",
109 partial.OpaqueKey());
97 } 110 }
98 111
99 } // namespace media 112 } // 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