diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /third_party/libwebrtc/rtc_base/copy_on_write_buffer_unittest.cc | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/rtc_base/copy_on_write_buffer_unittest.cc')
-rw-r--r-- | third_party/libwebrtc/rtc_base/copy_on_write_buffer_unittest.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/third_party/libwebrtc/rtc_base/copy_on_write_buffer_unittest.cc b/third_party/libwebrtc/rtc_base/copy_on_write_buffer_unittest.cc index 8a9fc4e2f4..8bf53c4d4c 100644 --- a/third_party/libwebrtc/rtc_base/copy_on_write_buffer_unittest.cc +++ b/third_party/libwebrtc/rtc_base/copy_on_write_buffer_unittest.cc @@ -46,11 +46,20 @@ void EnsureBuffersDontShareData(const CopyOnWriteBuffer& buf1, TEST(CopyOnWriteBufferTest, TestCreateEmptyData) { CopyOnWriteBuffer buf(static_cast<const uint8_t*>(nullptr), 0); + EXPECT_TRUE(buf.empty()); EXPECT_EQ(buf.size(), 0u); EXPECT_EQ(buf.capacity(), 0u); EXPECT_EQ(buf.data(), nullptr); } +TEST(CopyOnWriteBufferTest, CreateEmptyDataWithCapacity) { + CopyOnWriteBuffer buf(0, 16); + EXPECT_TRUE(buf.empty()); + EXPECT_EQ(buf.size(), 0u); + EXPECT_EQ(buf.capacity(), 16u); + EXPECT_NE(buf.MutableData(), nullptr); +} + TEST(CopyOnWriteBufferTest, TestMoveConstruct) { EXPECT_TRUE(std::is_nothrow_move_constructible_v<CopyOnWriteBuffer>); @@ -60,9 +69,11 @@ TEST(CopyOnWriteBufferTest, TestMoveConstruct) { const uint8_t* buf1_data = buf1.cdata(); CopyOnWriteBuffer buf2(std::move(buf1)); + EXPECT_TRUE(buf1.empty()); EXPECT_EQ(buf1.size(), 0u); EXPECT_EQ(buf1.capacity(), 0u); EXPECT_EQ(buf1.data(), nullptr); + EXPECT_FALSE(buf2.empty()); EXPECT_EQ(buf2.size(), buf1_size); EXPECT_EQ(buf2.capacity(), buf1_capacity); EXPECT_EQ(buf2.data(), buf1_data); @@ -127,6 +138,7 @@ TEST(CopyOnWriteBufferTest, SetEmptyData) { buf.SetData<uint8_t>(nullptr, 0); EXPECT_EQ(0u, buf.size()); + EXPECT_TRUE(buf.empty()); } TEST(CopyOnWriteBufferTest, SetDataNoMoreThanCapacityDoesntCauseReallocation) { |