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

Side by Side Diff: webrtc/p2p/base/pseudotcp_unittest.cc

Issue 1835053002: Change default timestamp to 64 bits in all webrtc directories. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Add TODO for timestamp. Created 4 years, 7 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/p2p/base/pseudotcp.cc ('k') | webrtc/p2p/base/stunport.cc » ('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 2011 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2011 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 bool have_disconnected_; 201 bool have_disconnected_;
202 int local_mtu_; 202 int local_mtu_;
203 int remote_mtu_; 203 int remote_mtu_;
204 int delay_; 204 int delay_;
205 int loss_; 205 int loss_;
206 }; 206 };
207 207
208 class PseudoTcpTest : public PseudoTcpTestBase { 208 class PseudoTcpTest : public PseudoTcpTestBase {
209 public: 209 public:
210 void TestTransfer(int size) { 210 void TestTransfer(int size) {
211 uint32_t start, elapsed; 211 uint32_t start;
212 int32_t elapsed;
212 size_t received; 213 size_t received;
213 // Create some dummy data to send. 214 // Create some dummy data to send.
214 send_stream_.ReserveSize(size); 215 send_stream_.ReserveSize(size);
215 for (int i = 0; i < size; ++i) { 216 for (int i = 0; i < size; ++i) {
216 char ch = static_cast<char>(i); 217 char ch = static_cast<char>(i);
217 send_stream_.Write(&ch, 1, NULL, NULL); 218 send_stream_.Write(&ch, 1, NULL, NULL);
218 } 219 }
219 send_stream_.Rewind(); 220 send_stream_.Rewind();
220 // Prepare the receive stream. 221 // Prepare the receive stream.
221 recv_stream_.ReserveSize(size); 222 recv_stream_.ReserveSize(size);
222 // Connect and wait until connected. 223 // Connect and wait until connected.
223 start = rtc::Time(); 224 start = rtc::Time32();
224 EXPECT_EQ(0, Connect()); 225 EXPECT_EQ(0, Connect());
225 EXPECT_TRUE_WAIT(have_connected_, kConnectTimeoutMs); 226 EXPECT_TRUE_WAIT(have_connected_, kConnectTimeoutMs);
226 // Sending will start from OnTcpWriteable and complete when all data has 227 // Sending will start from OnTcpWriteable and complete when all data has
227 // been received. 228 // been received.
228 EXPECT_TRUE_WAIT(have_disconnected_, kTransferTimeoutMs); 229 EXPECT_TRUE_WAIT(have_disconnected_, kTransferTimeoutMs);
229 elapsed = rtc::TimeSince(start); 230 elapsed = rtc::Time32() - start;
230 recv_stream_.GetSize(&received); 231 recv_stream_.GetSize(&received);
231 // Ensure we closed down OK and we got the right data. 232 // Ensure we closed down OK and we got the right data.
232 // TODO: Ensure the errors are cleared properly. 233 // TODO: Ensure the errors are cleared properly.
233 //EXPECT_EQ(0, local_.GetError()); 234 //EXPECT_EQ(0, local_.GetError());
234 //EXPECT_EQ(0, remote_.GetError()); 235 //EXPECT_EQ(0, remote_.GetError());
235 EXPECT_EQ(static_cast<size_t>(size), received); 236 EXPECT_EQ(static_cast<size_t>(size), received);
236 EXPECT_EQ(0, memcmp(send_stream_.GetBuffer(), 237 EXPECT_EQ(0, memcmp(send_stream_.GetBuffer(),
237 recv_stream_.GetBuffer(), size)); 238 recv_stream_.GetBuffer(), size));
238 LOG(LS_INFO) << "Transferred " << received << " bytes in " << elapsed 239 LOG(LS_INFO) << "Transferred " << received << " bytes in " << elapsed
239 << " ms (" << size * 8 / elapsed << " Kbps)"; 240 << " ms (" << size * 8 / elapsed << " Kbps)";
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 // Create some dummy data to send. 333 // Create some dummy data to send.
333 send_stream_.ReserveSize(size); 334 send_stream_.ReserveSize(size);
334 for (int i = 0; i < size; ++i) { 335 for (int i = 0; i < size; ++i) {
335 char ch = static_cast<char>(i); 336 char ch = static_cast<char>(i);
336 send_stream_.Write(&ch, 1, NULL, NULL); 337 send_stream_.Write(&ch, 1, NULL, NULL);
337 } 338 }
338 send_stream_.Rewind(); 339 send_stream_.Rewind();
339 // Prepare the receive stream. 340 // Prepare the receive stream.
340 recv_stream_.ReserveSize(size); 341 recv_stream_.ReserveSize(size);
341 // Connect and wait until connected. 342 // Connect and wait until connected.
342 start = rtc::Time(); 343 start = rtc::Time32();
343 EXPECT_EQ(0, Connect()); 344 EXPECT_EQ(0, Connect());
344 EXPECT_TRUE_WAIT(have_connected_, kConnectTimeoutMs); 345 EXPECT_TRUE_WAIT(have_connected_, kConnectTimeoutMs);
345 // Sending will start from OnTcpWriteable and stop when the required 346 // Sending will start from OnTcpWriteable and stop when the required
346 // number of iterations have completed. 347 // number of iterations have completed.
347 EXPECT_TRUE_WAIT(have_disconnected_, kTransferTimeoutMs); 348 EXPECT_TRUE_WAIT(have_disconnected_, kTransferTimeoutMs);
348 elapsed = rtc::TimeSince(start); 349 elapsed = rtc::TimeSince(start);
349 LOG(LS_INFO) << "Performed " << iterations << " pings in " 350 LOG(LS_INFO) << "Performed " << iterations << " pings in "
350 << elapsed << " ms"; 351 << elapsed << " ms";
351 } 352 }
352 353
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 /* Test sending data with mismatched MTUs. We should detect this and reduce 832 /* Test sending data with mismatched MTUs. We should detect this and reduce
832 // our packet size accordingly. 833 // our packet size accordingly.
833 // TODO: This doesn't actually work right now. The current code 834 // TODO: This doesn't actually work right now. The current code
834 // doesn't detect if the MTU is set too high on either side. 835 // doesn't detect if the MTU is set too high on either side.
835 TEST_F(PseudoTcpTest, TestSendWithMismatchedMtus) { 836 TEST_F(PseudoTcpTest, TestSendWithMismatchedMtus) {
836 SetLocalMtu(1500); 837 SetLocalMtu(1500);
837 SetRemoteMtu(1280); 838 SetRemoteMtu(1280);
838 TestTransfer(1000000); 839 TestTransfer(1000000);
839 } 840 }
840 */ 841 */
OLDNEW
« no previous file with comments | « webrtc/p2p/base/pseudotcp.cc ('k') | webrtc/p2p/base/stunport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698