Move IPC::MessageFilter and router to a separate file
[chromium-blink-merge.git] / media / midi / midi_message_util_unittest.cc
blob529efbf9586d8adcebd7df6ff1e8a67be42c2539
1 // Copyright 2013 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.
5 #include "media/midi/midi_message_util.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 namespace media {
10 namespace {
12 const uint8 kGMOn[] = { 0xf0, 0x7e, 0x7f, 0x09, 0x01, 0xf7 };
13 const uint8 kNoteOn[] = { 0x90, 0x3c, 0x7f };
14 const uint8 kChannelPressure[] = { 0xd0, 0x01 };
15 const uint8 kTimingClock[] = { 0xf8 };
17 TEST(GetMidiMessageLengthTest, BasicTest) {
18 // Check basic functionarity
19 EXPECT_EQ(arraysize(kNoteOn), GetMidiMessageLength(kNoteOn[0]));
20 EXPECT_EQ(arraysize(kChannelPressure),
21 GetMidiMessageLength(kChannelPressure[0]));
22 EXPECT_EQ(arraysize(kTimingClock), GetMidiMessageLength(kTimingClock[0]));
24 // SysEx message should be mapped to 0-length
25 EXPECT_EQ(0u, GetMidiMessageLength(kGMOn[0]));
27 // Any data byte should be mapped to 0-length
28 EXPECT_EQ(0u, GetMidiMessageLength(kGMOn[1]));
29 EXPECT_EQ(0u, GetMidiMessageLength(kNoteOn[1]));
30 EXPECT_EQ(0u, GetMidiMessageLength(kChannelPressure[1]));
33 } // namespace
34 } // namespace media