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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « webrtc/base/buffer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 using std::swap; 170 using std::swap;
171 swap(buf1, buf2); 171 swap(buf1, buf2);
172 EXPECT_EQ(buf1.size(), 6u); 172 EXPECT_EQ(buf1.size(), 6u);
173 EXPECT_EQ(buf1.capacity(), 40u); 173 EXPECT_EQ(buf1.capacity(), 40u);
174 EXPECT_EQ(buf1.data(), data2); 174 EXPECT_EQ(buf1.data(), data2);
175 EXPECT_EQ(buf2.size(), 3u); 175 EXPECT_EQ(buf2.size(), 3u);
176 EXPECT_EQ(buf2.capacity(), 3u); 176 EXPECT_EQ(buf2.capacity(), 3u);
177 EXPECT_EQ(buf2.data(), data1); 177 EXPECT_EQ(buf2.data(), data1);
178 } 178 }
179 179
180 TEST(BufferTest, TestClear) {
181 Buffer buf;
182 buf.SetData(kTestData, 15);
183 EXPECT_EQ(buf.size(), 15u);
184 EXPECT_EQ(buf.capacity(), 15u);
185 const char *data = buf.data<char>();
186 buf.Clear();
187 EXPECT_EQ(buf.size(), 0u);
188 EXPECT_EQ(buf.capacity(), 15u); // Hasn't shrunk.
189 EXPECT_EQ(buf.data<char>(), data); // No reallocation.
190 }
191
180 } // namespace rtc 192 } // namespace rtc
OLDNEW
« 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