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

Side by Side Diff: media/filters/vp9_raw_bits_reader_unittest.cc

Issue 1258083004: Add a Vp9Parser implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ReadBool, fix compile warning Created 5 years, 4 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 | « media/filters/vp9_raw_bits_reader.cc ('k') | media/media.gyp » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 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 "media/filters/vp9_raw_bits_reader.h" 5 #include "media/filters/vp9_raw_bits_reader.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace media { 8 namespace media {
9 9
10 TEST(Vp9RawBitsReaderTest, ReadBit) { 10 TEST(Vp9RawBitsReaderTest, ReadBool) {
11 uint8_t data[] = {0xf1}; 11 uint8_t data[] = {0xf1};
12 Vp9RawBitsReader reader; 12 Vp9RawBitsReader reader;
13 reader.Initialize(data, 1); 13 reader.Initialize(data, 1);
14 14
15 EXPECT_TRUE(reader.IsValid()); 15 EXPECT_TRUE(reader.IsValid());
16 EXPECT_EQ(0u, reader.GetBytesRead()); 16 EXPECT_EQ(0u, reader.GetBytesRead());
17 EXPECT_EQ(1, reader.ReadBit()); 17 EXPECT_TRUE(reader.ReadBool());
18 EXPECT_EQ(1u, reader.GetBytesRead()); 18 EXPECT_EQ(1u, reader.GetBytesRead());
19 EXPECT_EQ(1, reader.ReadBit()); 19 EXPECT_TRUE(reader.ReadBool());
20 EXPECT_EQ(1, reader.ReadBit()); 20 EXPECT_TRUE(reader.ReadBool());
21 EXPECT_EQ(1, reader.ReadBit()); 21 EXPECT_TRUE(reader.ReadBool());
22 EXPECT_EQ(0, reader.ReadBit()); 22 EXPECT_FALSE(reader.ReadBool());
23 EXPECT_EQ(0, reader.ReadBit()); 23 EXPECT_FALSE(reader.ReadBool());
24 EXPECT_EQ(0, reader.ReadBit()); 24 EXPECT_FALSE(reader.ReadBool());
25 EXPECT_EQ(1, reader.ReadBit()); 25 EXPECT_TRUE(reader.ReadBool());
26 EXPECT_TRUE(reader.IsValid()); 26 EXPECT_TRUE(reader.IsValid());
27 27
28 // The return value is undefined. 28 // The return value is undefined.
29 ignore_result(reader.ReadBit()); 29 ignore_result(reader.ReadBool());
30 EXPECT_FALSE(reader.IsValid()); 30 EXPECT_FALSE(reader.IsValid());
31 EXPECT_EQ(1u, reader.GetBytesRead()); 31 EXPECT_EQ(1u, reader.GetBytesRead());
32 } 32 }
33 33
34 TEST(Vp9RawBitsReader, ReadLiteral) { 34 TEST(Vp9RawBitsReader, ReadLiteral) {
35 uint8_t data[] = {0x3d, 0x67, 0x9a}; 35 uint8_t data[] = {0x3d, 0x67, 0x9a};
36 Vp9RawBitsReader reader; 36 Vp9RawBitsReader reader;
37 reader.Initialize(data, 3); 37 reader.Initialize(data, 3);
38 38
39 EXPECT_TRUE(reader.IsValid()); 39 EXPECT_TRUE(reader.IsValid());
(...skipping 17 matching lines...) Expand all
57 EXPECT_EQ(-0x5679, reader.ReadSignedLiteral(15)); 57 EXPECT_EQ(-0x5679, reader.ReadSignedLiteral(15));
58 EXPECT_TRUE(reader.IsValid()); 58 EXPECT_TRUE(reader.IsValid());
59 59
60 // The return value is undefined. 60 // The return value is undefined.
61 ignore_result(reader.ReadSignedLiteral(7)); 61 ignore_result(reader.ReadSignedLiteral(7));
62 EXPECT_FALSE(reader.IsValid()); 62 EXPECT_FALSE(reader.IsValid());
63 EXPECT_EQ(3u, reader.GetBytesRead()); 63 EXPECT_EQ(3u, reader.GetBytesRead());
64 } 64 }
65 65
66 } // namespace media 66 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/vp9_raw_bits_reader.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698