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

Unified Diff: content/renderer/media/midi_message_filter_unittest.cc

Issue 945263002: Web MIDI: chromium-side blink API update to support MIDIPortState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notify_to_blink
Patch Set: review #3 Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/midi_message_filter_unittest.cc
diff --git a/content/renderer/media/midi_message_filter_unittest.cc b/content/renderer/media/midi_message_filter_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5ac0d4ef903e3bb1bec46ccc4b33870036b71c53
--- /dev/null
+++ b/content/renderer/media/midi_message_filter_unittest.cc
@@ -0,0 +1,29 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/renderer/media/midi_message_filter.h"
+
+#include "base/message_loop/message_loop.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace content {
+
+namespace {
+using BlinkState = blink::WebMIDIAccessorClient::MIDIPortState;
+} // namespace
+
+TEST(MidiMessageFilterTest, CastMidiPortState) {
+ // Check if static_cast of ToMIDIPortState() just works fine for all states.
+ EXPECT_EQ(BlinkState::MIDIPortStateDisconnected,
+ MidiMessageFilter::ToBlinkState(media::MIDI_PORT_DISCONNECTED));
+ EXPECT_EQ(BlinkState::MIDIPortStateConnected,
+ MidiMessageFilter::ToBlinkState(media::MIDI_PORT_CONNECTED));
+ EXPECT_EQ(BlinkState::MIDIPortStateOpened,
+ MidiMessageFilter::ToBlinkState(media::MIDI_PORT_OPENED));
+
+ // Check if we do not have any unknown MidiPortState that is added later.
+ EXPECT_EQ(media::MIDI_PORT_OPENED, media::MIDI_PORT_STATE_LAST);
+}
+
+} // namespace content
« no previous file with comments | « content/renderer/media/midi_message_filter.cc ('k') | content/shell/renderer/test_runner/mock_web_midi_accessor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698