| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/net/bit_stream_reader.h" | 5 #include "components/packed_ct_ev_whitelist/bit_stream_reader.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace packed_ct_ev_whitelist { |
| 12 namespace internal { | 13 namespace internal { |
| 13 | 14 |
| 14 const uint8_t kSomeData[] = {0xd5, 0xe2, 0xaf, 0xe5, 0xbb, 0x10, 0x7c, 0xd1}; | 15 const uint8_t kSomeData[] = {0xd5, 0xe2, 0xaf, 0xe5, 0xbb, 0x10, 0x7c, 0xd1}; |
| 15 | 16 |
| 16 TEST(BitStreamReaderTest, CanReadSingleByte) { | 17 TEST(BitStreamReaderTest, CanReadSingleByte) { |
| 17 BitStreamReader reader( | 18 BitStreamReader reader( |
| 18 base::StringPiece(reinterpret_cast<const char*>(kSomeData), 1)); | 19 base::StringPiece(reinterpret_cast<const char*>(kSomeData), 1)); |
| 19 uint64_t v(0); | 20 uint64_t v(0); |
| 20 | 21 |
| 21 EXPECT_EQ(8u, reader.BitsLeft()); | 22 EXPECT_EQ(8u, reader.BitsLeft()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 BitStreamReader reader(base::StringPiece( | 87 BitStreamReader reader(base::StringPiece( |
| 87 reinterpret_cast<const char*>(kSomeData), static_cast<size_t>(0u))); | 88 reinterpret_cast<const char*>(kSomeData), static_cast<size_t>(0u))); |
| 88 uint64_t v(0); | 89 uint64_t v(0); |
| 89 | 90 |
| 90 EXPECT_EQ(0u, reader.BitsLeft()); | 91 EXPECT_EQ(0u, reader.BitsLeft()); |
| 91 EXPECT_FALSE(reader.ReadBits(1, &v)); | 92 EXPECT_FALSE(reader.ReadBits(1, &v)); |
| 92 EXPECT_FALSE(reader.ReadUnaryEncoding(&v)); | 93 EXPECT_FALSE(reader.ReadUnaryEncoding(&v)); |
| 93 } | 94 } |
| 94 | 95 |
| 95 } // namespace internal | 96 } // namespace internal |
| 97 } // namespace packed_ct_ev_whitelist |
| OLD | NEW |