OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 EXPECT_EQ(4u, bit_offset); | 159 EXPECT_EQ(4u, bit_offset); |
160 EXPECT_TRUE(buffer.Seek(4, 0)); | 160 EXPECT_TRUE(buffer.Seek(4, 0)); |
161 EXPECT_FALSE(buffer.Seek(5, 0)); | 161 EXPECT_FALSE(buffer.Seek(5, 0)); |
162 buffer.GetCurrentOffset(&byte_offset, &bit_offset); | 162 buffer.GetCurrentOffset(&byte_offset, &bit_offset); |
163 EXPECT_EQ(4u, byte_offset); | 163 EXPECT_EQ(4u, byte_offset); |
164 EXPECT_EQ(0u, bit_offset); | 164 EXPECT_EQ(0u, bit_offset); |
165 EXPECT_FALSE(buffer.Seek(4, 1)); | 165 EXPECT_FALSE(buffer.Seek(4, 1)); |
166 | 166 |
167 // Disable death test on Android because it relies on fork() and doesn't play | 167 // Disable death test on Android because it relies on fork() and doesn't play |
168 // nicely. | 168 // nicely. |
| 169 #if defined(GTEST_HAS_DEATH_TEST) |
169 #if !defined(WEBRTC_ANDROID) | 170 #if !defined(WEBRTC_ANDROID) |
170 // Passing a NULL out parameter is death. | 171 // Passing a NULL out parameter is death. |
171 EXPECT_DEATH(buffer.GetCurrentOffset(&byte_offset, NULL), ""); | 172 EXPECT_DEATH(buffer.GetCurrentOffset(&byte_offset, NULL), ""); |
172 #endif | 173 #endif |
| 174 #endif |
173 } | 175 } |
174 | 176 |
175 uint64 GolombEncoded(uint32 val) { | 177 uint64 GolombEncoded(uint32 val) { |
176 val++; | 178 val++; |
177 uint32 bit_counter = val; | 179 uint32 bit_counter = val; |
178 uint64 bit_count = 0; | 180 uint64 bit_count = 0; |
179 while (bit_counter > 0) { | 181 while (bit_counter > 0) { |
180 bit_count++; | 182 bit_count++; |
181 bit_counter >>= 1; | 183 bit_counter >>= 1; |
182 } | 184 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 EXPECT_TRUE(buffer.WriteBits(0, 1)); | 300 EXPECT_TRUE(buffer.WriteBits(0, 1)); |
299 EXPECT_EQ(0xEFu, bytes[0]); | 301 EXPECT_EQ(0xEFu, bytes[0]); |
300 EXPECT_TRUE(buffer.WriteBits(0, 3)); | 302 EXPECT_TRUE(buffer.WriteBits(0, 3)); |
301 EXPECT_EQ(0xE1u, bytes[0]); | 303 EXPECT_EQ(0xE1u, bytes[0]); |
302 EXPECT_TRUE(buffer.WriteBits(0, 2)); | 304 EXPECT_TRUE(buffer.WriteBits(0, 2)); |
303 EXPECT_EQ(0xE0u, bytes[0]); | 305 EXPECT_EQ(0xE0u, bytes[0]); |
304 EXPECT_EQ(0x7F, bytes[1]); | 306 EXPECT_EQ(0x7F, bytes[1]); |
305 } | 307 } |
306 | 308 |
307 } // namespace rtc | 309 } // namespace rtc |
OLD | NEW |