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 |