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

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

Issue 1531013003: Slap deprecation notices on Pass methods (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@std-move
Patch Set: rebase Created 4 years, 11 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.Pass()); 141 Buffer buf2(buf1.DEPRECATED_Pass());
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.Pass(); 155 buf2 = buf1.DEPRECATED_Pass();
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) {
166 Buffer buf1(kTestData, 3); 166 Buffer buf1(kTestData, 3);
167 Buffer buf2(kTestData, 6, 40); 167 Buffer buf2(kTestData, 6, 40);
168 uint8_t* data1 = buf1.data(); 168 uint8_t* data1 = buf1.data();
169 uint8_t* data2 = buf2.data(); 169 uint8_t* data2 = buf2.data();
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 } // namespace rtc 180 } // 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