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

Side by Side Diff: content/renderer/media/midi_message_filter_unittest.cc

Issue 2422163002: Web MIDI: use midi_service.mojom for media::midi::PortState (Closed)
Patch Set: gn --check fix Created 4 years, 2 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 | « content/renderer/media/midi_message_filter.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "content/renderer/media/midi_message_filter.h" 5 #include "content/renderer/media/midi_message_filter.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "media/midi/midi_service.mojom.h"
8 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
9 10
10 namespace content { 11 namespace content {
11 12
12 namespace { 13 namespace {
13 using BlinkState = blink::WebMIDIAccessorClient::MIDIPortState; 14
14 } // namespace 15 using midi::mojom::PortState;
15 16
16 TEST(MidiMessageFilterTest, CastMidiPortState) { 17 TEST(MidiMessageFilterTest, CastMidiPortState) {
17 // Check if static_cast of ToMIDIPortState() just works fine for all states. 18 // Check if static_cast of ToMIDIPortState() just works fine for all states.
18 EXPECT_EQ( 19 EXPECT_EQ(PortState::DISCONNECTED,
19 BlinkState::MIDIPortStateDisconnected, 20 MidiMessageFilter::ToBlinkState(PortState::DISCONNECTED));
20 MidiMessageFilter::ToBlinkState(midi::MIDI_PORT_DISCONNECTED)); 21 EXPECT_EQ(PortState::CONNECTED,
21 EXPECT_EQ(BlinkState::MIDIPortStateConnected, 22 MidiMessageFilter::ToBlinkState(PortState::CONNECTED));
22 MidiMessageFilter::ToBlinkState(midi::MIDI_PORT_CONNECTED));
23 // Web MIDI API manages DeviceState and ConnectionState separately. 23 // Web MIDI API manages DeviceState and ConnectionState separately.
24 // "open", "pending", or "closed" are managed separately for ConnectionState 24 // "open", "pending", or "closed" are managed separately for ConnectionState
25 // by Blink per MIDIAccess instance. So, MIDI_PORT_OPENED in content can be 25 // by Blink per MIDIAccess instance. So, MIDI_PORT_OPENED in content can be
26 // converted to MIDIPortStateConnected. 26 // converted to MIDIPortStateConnected.
27 EXPECT_EQ(BlinkState::MIDIPortStateConnected, 27 EXPECT_EQ(PortState::CONNECTED,
28 MidiMessageFilter::ToBlinkState(midi::MIDI_PORT_OPENED)); 28 MidiMessageFilter::ToBlinkState(PortState::OPENED));
29 29
30 // Check if we do not have any unknown MidiPortState that is added later. 30 // Check if we do not have any unknown MidiPortState that is added later.
31 EXPECT_EQ(midi::MIDI_PORT_OPENED, midi::MIDI_PORT_STATE_LAST); 31 EXPECT_EQ(PortState::OPENED, PortState::LAST);
32 } 32 }
33 33
34 } // namespace
35
34 } // namespace content 36 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/midi_message_filter.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698