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

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

Issue 1944683002: Read recv timestamps from socket (posix only). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix win build. 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
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 server->Bind(SocketAddress(dst, 0)) != 0) { 188 server->Bind(SocketAddress(dst, 0)) != 0) {
189 return false; 189 return false;
190 } 190 }
191 const char* buf = "hello other socket"; 191 const char* buf = "hello other socket";
192 size_t len = strlen(buf); 192 size_t len = strlen(buf);
193 int sent = client->SendTo(buf, len, server->GetLocalAddress()); 193 int sent = client->SendTo(buf, len, server->GetLocalAddress());
194 SocketAddress addr; 194 SocketAddress addr;
195 const size_t kRecvBufSize = 64; 195 const size_t kRecvBufSize = 64;
196 char recvbuf[kRecvBufSize]; 196 char recvbuf[kRecvBufSize];
197 Thread::Current()->SleepMs(100); 197 Thread::Current()->SleepMs(100);
198 int received = server->RecvFrom(recvbuf, kRecvBufSize, &addr); 198 int64_t timestamp;
199 int received = server->RecvFrom(recvbuf, kRecvBufSize, &addr, &timestamp);
199 return received == sent && ::memcmp(buf, recvbuf, len) == 0; 200 return received == sent && ::memcmp(buf, recvbuf, len) == 0;
200 } 201 }
201 202
202 void TestPhysicalInternal(const SocketAddress& int_addr) { 203 void TestPhysicalInternal(const SocketAddress& int_addr) {
203 BasicNetworkManager network_manager; 204 BasicNetworkManager network_manager;
204 network_manager.set_ipv6_enabled(true); 205 network_manager.set_ipv6_enabled(true);
205 network_manager.StartUpdating(); 206 network_manager.StartUpdating();
206 // Process pending messages so the network list is updated. 207 // Process pending messages so the network list is updated.
207 Thread::Current()->ProcessMessages(0); 208 Thread::Current()->ProcessMessages(0);
208 209
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 size_t len = strlen(buf); 387 size_t len = strlen(buf);
387 388
388 in->Send(buf, len); 389 in->Send(buf, len);
389 SocketAddress trans_addr; 390 SocketAddress trans_addr;
390 EXPECT_TRUE(out->CheckNextPacket(buf, len, &trans_addr)); 391 EXPECT_TRUE(out->CheckNextPacket(buf, len, &trans_addr));
391 392
392 out->Send(buf, len); 393 out->Send(buf, len);
393 EXPECT_TRUE(in->CheckNextPacket(buf, len, &trans_addr)); 394 EXPECT_TRUE(in->CheckNextPacket(buf, len, &trans_addr));
394 } 395 }
395 // #endif 396 // #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698