All instances of addresses as void* are changed to uintptr_t in
[chromium-blink-merge.git] / media / midi / midi_message_util_unittest.cc
blob25dbf5e6b9c2d7df222d5225ad85423fa04e6cd3
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 midi {
11 namespace {
13 const uint8 kGMOn[] = { 0xf0, 0x7e, 0x7f, 0x09, 0x01, 0xf7 };
14 const uint8 kNoteOn[] = { 0x90, 0x3c, 0x7f };
15 const uint8 kChannelPressure[] = { 0xd0, 0x01 };
16 const uint8 kTimingClock[] = { 0xf8 };
18 TEST(GetMidiMessageLengthTest, BasicTest) {
19 // Check basic functionarity
20 EXPECT_EQ(arraysize(kNoteOn), GetMidiMessageLength(kNoteOn[0]));
21 EXPECT_EQ(arraysize(kChannelPressure),
22 GetMidiMessageLength(kChannelPressure[0]));
23 EXPECT_EQ(arraysize(kTimingClock), GetMidiMessageLength(kTimingClock[0]));
25 // SysEx message should be mapped to 0-length
26 EXPECT_EQ(0u, GetMidiMessageLength(kGMOn[0]));
28 // Any data byte should be mapped to 0-length
29 EXPECT_EQ(0u, GetMidiMessageLength(kGMOn[1]));
30 EXPECT_EQ(0u, GetMidiMessageLength(kNoteOn[1]));
31 EXPECT_EQ(0u, GetMidiMessageLength(kChannelPressure[1]));
34 } // namespace
35 } // namespace midi
36 } // namespace media