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

Side by Side Diff: webrtc/base/buffer_unittest.cc

Issue 1778243006: Remove the (previosly deprecated) Pass methods (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 unified diff | Download patch
« no previous file with comments | « webrtc/base/buffer.h ('k') | webrtc/base/scoped_ptr.h » ('j') | 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 const int8_t* data = buf.data<int8_t>(); 131 const int8_t* data = buf.data<int8_t>();
132 EXPECT_EQ(buf.capacity(), 10u); 132 EXPECT_EQ(buf.capacity(), 10u);
133 buf.AppendData(kTestData + 5, 5); 133 buf.AppendData(kTestData + 5, 5);
134 EXPECT_EQ(buf.data<int8_t>(), data); // No reallocation. 134 EXPECT_EQ(buf.data<int8_t>(), data); // No reallocation.
135 EXPECT_EQ(buf, Buffer(kTestData, 10)); 135 EXPECT_EQ(buf, Buffer(kTestData, 10));
136 } 136 }
137 137
138 TEST(BufferTest, TestMoveConstruct) { 138 TEST(BufferTest, TestMoveConstruct) {
139 Buffer buf1(kTestData, 3, 40); 139 Buffer buf1(kTestData, 3, 40);
140 const uint8_t* data = buf1.data(); 140 const uint8_t* data = buf1.data();
141 Buffer buf2(buf1.DEPRECATED_Pass()); 141 Buffer buf2(std::move(buf1));
142 EXPECT_EQ(buf2.size(), 3u); 142 EXPECT_EQ(buf2.size(), 3u);
143 EXPECT_EQ(buf2.capacity(), 40u); 143 EXPECT_EQ(buf2.capacity(), 40u);
144 EXPECT_EQ(buf2.data(), data); 144 EXPECT_EQ(buf2.data(), data);
145 buf1.Clear(); 145 buf1.Clear();
146 EXPECT_EQ(buf1.size(), 0u); 146 EXPECT_EQ(buf1.size(), 0u);
147 EXPECT_EQ(buf1.capacity(), 0u); 147 EXPECT_EQ(buf1.capacity(), 0u);
148 EXPECT_EQ(buf1.data(), nullptr); 148 EXPECT_EQ(buf1.data(), nullptr);
149 } 149 }
150 150
151 TEST(BufferTest, TestMoveAssign) { 151 TEST(BufferTest, TestMoveAssign) {
152 Buffer buf1(kTestData, 3, 40); 152 Buffer buf1(kTestData, 3, 40);
153 const uint8_t* data = buf1.data(); 153 const uint8_t* data = buf1.data();
154 Buffer buf2(kTestData); 154 Buffer buf2(kTestData);
155 buf2 = buf1.DEPRECATED_Pass(); 155 buf2 = std::move(buf1);
156 EXPECT_EQ(buf2.size(), 3u); 156 EXPECT_EQ(buf2.size(), 3u);
157 EXPECT_EQ(buf2.capacity(), 40u); 157 EXPECT_EQ(buf2.capacity(), 40u);
158 EXPECT_EQ(buf2.data(), data); 158 EXPECT_EQ(buf2.data(), data);
159 buf1.Clear(); 159 buf1.Clear();
160 EXPECT_EQ(buf1.size(), 0u); 160 EXPECT_EQ(buf1.size(), 0u);
161 EXPECT_EQ(buf1.capacity(), 0u); 161 EXPECT_EQ(buf1.capacity(), 0u);
162 EXPECT_EQ(buf1.data(), nullptr); 162 EXPECT_EQ(buf1.data(), nullptr);
163 } 163 }
164 164
165 TEST(BufferTest, TestSwap) { 165 TEST(BufferTest, TestSwap) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 for (size_t i = 0; i != 7u; ++i) { 312 for (size_t i = 0; i != 7u; ++i) {
313 buf[i] = kTestData[i]; 313 buf[i] = kTestData[i];
314 } 314 }
315 315
316 for (size_t i = 0; i != 7u; ++i) { 316 for (size_t i = 0; i != 7u; ++i) {
317 EXPECT_EQ(buf[i], kTestData[i]); 317 EXPECT_EQ(buf[i], kTestData[i]);
318 } 318 }
319 } 319 }
320 320
321 } // namespace rtc 321 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/buffer.h ('k') | webrtc/base/scoped_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698