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

Unified Diff: webrtc/base/copyonwritebuffer_unittest.cc

Issue 1817753003: Revert of Use CopyOnWriteBuffer instead of Buffer to avoid unnecessary copies. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/copyonwritebuffer.h ('k') | webrtc/base/sslfingerprint.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/copyonwritebuffer_unittest.cc
diff --git a/webrtc/base/copyonwritebuffer_unittest.cc b/webrtc/base/copyonwritebuffer_unittest.cc
index dbf59f7718f2779f0dff9bc0c3c26d79918a00c5..a95ad67a03e6ec2c41ad1210d3ae241f590ed3e7 100644
--- a/webrtc/base/copyonwritebuffer_unittest.cc
+++ b/webrtc/base/copyonwritebuffer_unittest.cc
@@ -39,13 +39,6 @@
const uint8_t* data1 = buf1.cdata();
const uint8_t* data2 = buf2.cdata();
EXPECT_NE(data1, data2);
-}
-
-TEST(CopyOnWriteBufferTest, TestCreateEmptyData) {
- CopyOnWriteBuffer buf(static_cast<const uint8_t*>(nullptr), 0);
- EXPECT_EQ(buf.size(), 0u);
- EXPECT_EQ(buf.capacity(), 0u);
- EXPECT_EQ(buf.data(), nullptr);
}
TEST(CopyOnWriteBufferTest, TestMoveConstruct) {
@@ -132,21 +125,6 @@
EnsureBuffersDontShareData(buf1, buf3);
const int8_t exp[] = {'f', 'o', 'o', 0x0};
EXPECT_EQ(buf3, CopyOnWriteBuffer(exp));
-
- buf2.SetData(static_cast<const uint8_t*>(nullptr), 0u);
- EnsureBuffersDontShareData(buf1, buf2);
- EXPECT_EQ(buf1.size(), 3u);
- EXPECT_EQ(buf1.capacity(), 10u);
- EXPECT_EQ(buf2.size(), 0u);
- EXPECT_EQ(buf2.capacity(), 0u);
-}
-
-TEST(CopyOnWriteBufferTest, TestSetDataEmpty) {
- CopyOnWriteBuffer buf;
- buf.SetData(static_cast<const uint8_t*>(nullptr), 0u);
- EXPECT_EQ(buf.size(), 0u);
- EXPECT_EQ(buf.capacity(), 0u);
- EXPECT_EQ(buf.data(), nullptr);
}
TEST(CopyOnWriteBufferTest, TestEnsureCapacity) {
@@ -218,43 +196,4 @@
EXPECT_EQ(data2, cdata1);
}
-TEST(CopyOnWriteBufferTest, TestBacketRead) {
- CopyOnWriteBuffer buf1(kTestData, 3, 10);
- CopyOnWriteBuffer buf2(buf1);
-
- EnsureBuffersShareData(buf1, buf2);
- // Non-const reads clone the data if shared.
- for (size_t i = 0; i != 3u; ++i) {
- EXPECT_EQ(buf1[i], kTestData[i]);
- }
- EnsureBuffersDontShareData(buf1, buf2);
-}
-
-TEST(CopyOnWriteBufferTest, TestBacketReadConst) {
- CopyOnWriteBuffer buf1(kTestData, 3, 10);
- CopyOnWriteBuffer buf2(buf1);
-
- EnsureBuffersShareData(buf1, buf2);
- const CopyOnWriteBuffer& cbuf1 = buf1;
- for (size_t i = 0; i != 3u; ++i) {
- EXPECT_EQ(cbuf1[i], kTestData[i]);
- }
- EnsureBuffersShareData(buf1, buf2);
-}
-
-TEST(CopyOnWriteBufferTest, TestBacketWrite) {
- CopyOnWriteBuffer buf1(kTestData, 3, 10);
- CopyOnWriteBuffer buf2(buf1);
-
- EnsureBuffersShareData(buf1, buf2);
- for (size_t i = 0; i != 3u; ++i) {
- buf1[i] = kTestData[i] + 1;
- }
- EXPECT_EQ(buf1.size(), 3u);
- EXPECT_EQ(buf1.capacity(), 10u);
- EXPECT_EQ(buf2.size(), 3u);
- EXPECT_EQ(buf2.capacity(), 10u);
- EXPECT_EQ(0, memcmp(buf2.cdata(), kTestData, 3));
-}
-
} // namespace rtc
« no previous file with comments | « webrtc/base/copyonwritebuffer.h ('k') | webrtc/base/sslfingerprint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698