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

Unified Diff: webrtc/base/buffer_unittest.cc

Issue 1707693002: Changed the semantics of Buffer::Clear to not alter the capacity (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@noogle-encode
Patch Set: Rebase onto correct branch. Created 4 years, 10 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/buffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/buffer_unittest.cc
diff --git a/webrtc/base/buffer_unittest.cc b/webrtc/base/buffer_unittest.cc
index 0b93b9b56e8d54afdd4b5d89964023f75c0cbb5f..f917bc6181e3a1394e0c08208d6febb50441ffca 100644
--- a/webrtc/base/buffer_unittest.cc
+++ b/webrtc/base/buffer_unittest.cc
@@ -177,4 +177,16 @@ TEST(BufferTest, TestSwap) {
EXPECT_EQ(buf2.data(), data1);
}
+TEST(BufferTest, TestClear) {
+ Buffer buf;
+ buf.SetData(kTestData, 15);
+ EXPECT_EQ(buf.size(), 15u);
+ EXPECT_EQ(buf.capacity(), 15u);
+ const char *data = buf.data<char>();
+ buf.Clear();
+ EXPECT_EQ(buf.size(), 0u);
+ EXPECT_EQ(buf.capacity(), 15u); // Hasn't shrunk.
+ EXPECT_EQ(buf.data<char>(), data); // No reallocation.
+}
+
} // namespace rtc
« no previous file with comments | « webrtc/base/buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698