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

Side by Side Diff: media/base/bit_reader_unittest.cc

Issue 14495010: Add UMA stats for audio/video containers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 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/base/bit_reader.cc ('k') | media/base/container_names.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/base/bit_reader.h" 5 #include "media/base/bit_reader.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace media { 9 namespace media {
10 10
(...skipping 27 matching lines...) Expand all
38 uint8 value8; 38 uint8 value8;
39 uint8 buffer[] = {0x12}; 39 uint8 buffer[] = {0x12};
40 BitReader reader1(buffer, sizeof(buffer)); 40 BitReader reader1(buffer, sizeof(buffer));
41 41
42 EXPECT_TRUE(reader1.ReadBits(4, &value8)); 42 EXPECT_TRUE(reader1.ReadBits(4, &value8));
43 EXPECT_FALSE(reader1.ReadBits(5, &value8)); 43 EXPECT_FALSE(reader1.ReadBits(5, &value8));
44 EXPECT_FALSE(reader1.ReadBits(1, &value8)); 44 EXPECT_FALSE(reader1.ReadBits(1, &value8));
45 EXPECT_TRUE(reader1.ReadBits(0, &value8)); 45 EXPECT_TRUE(reader1.ReadBits(0, &value8));
46 } 46 }
47 47
48 TEST(BitReaderTest, SkipBitsTest) {
49 uint8 value8;
50 uint8 buffer[] = { 0x0a, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
51 BitReader reader1(buffer, sizeof(buffer));
52
53 EXPECT_TRUE(reader1.SkipBits(2));
54 EXPECT_TRUE(reader1.ReadBits(3, &value8));
55 EXPECT_EQ(value8, 1);
56 EXPECT_TRUE(reader1.SkipBits(11));
57 EXPECT_TRUE(reader1.ReadBits(8, &value8));
58 EXPECT_EQ(value8, 3);
59 EXPECT_TRUE(reader1.SkipBits(76));
60 EXPECT_TRUE(reader1.ReadBits(4, &value8));
61 EXPECT_EQ(value8, 13);
62 EXPECT_FALSE(reader1.SkipBits(100));
63 EXPECT_TRUE(reader1.SkipBits(0));
64 EXPECT_FALSE(reader1.SkipBits(1));
65 }
66
48 } // namespace media 67 } // namespace media
OLDNEW
« no previous file with comments | « media/base/bit_reader.cc ('k') | media/base/container_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698