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

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

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 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/socket.h ('k') | webrtc/base/socketadapters.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 2007 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2007 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 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 memset(test_packet.get(), 0, test_packet_size); 922 memset(test_packet.get(), 0, test_packet_size);
923 // Set the send buffer size to the same size as the test packet to have a 923 // Set the send buffer size to the same size as the test packet to have a
924 // better chance to get EWOULDBLOCK. 924 // better chance to get EWOULDBLOCK.
925 int send_buffer_size = test_packet_size; 925 int send_buffer_size = test_packet_size;
926 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) 926 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
927 send_buffer_size /= 2; 927 send_buffer_size /= 2;
928 #endif 928 #endif
929 client->SetOption(rtc::Socket::OPT_SNDBUF, send_buffer_size); 929 client->SetOption(rtc::Socket::OPT_SNDBUF, send_buffer_size);
930 930
931 int error = 0; 931 int error = 0;
932 uint32 start_ms = Time(); 932 uint32_t start_ms = Time();
933 int sent_packet_num = 0; 933 int sent_packet_num = 0;
934 int expected_error = EWOULDBLOCK; 934 int expected_error = EWOULDBLOCK;
935 while (start_ms + kTimeout > Time()) { 935 while (start_ms + kTimeout > Time()) {
936 int ret = client->SendTo(test_packet.get(), test_packet_size, test_addr); 936 int ret = client->SendTo(test_packet.get(), test_packet_size, test_addr);
937 ++sent_packet_num; 937 ++sent_packet_num;
938 if (ret != test_packet_size) { 938 if (ret != test_packet_size) {
939 error = client->GetError(); 939 error = client->GetError();
940 if (error == expected_error) { 940 if (error == expected_error) {
941 LOG(LS_INFO) << "Got expected error code after sending " 941 LOG(LS_INFO) << "Got expected error code after sending "
942 << sent_packet_num << " packets."; 942 << sent_packet_num << " packets.";
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 ASSERT_EQ(-1, socket->GetOption(Socket::OPT_NODELAY, &current_nd)); 983 ASSERT_EQ(-1, socket->GetOption(Socket::OPT_NODELAY, &current_nd));
984 ASSERT_EQ(-1, socket->SetOption(Socket::OPT_NODELAY, desired_nd)); 984 ASSERT_EQ(-1, socket->SetOption(Socket::OPT_NODELAY, desired_nd));
985 985
986 // Skip the esimate MTU test for IPv6 for now. 986 // Skip the esimate MTU test for IPv6 for now.
987 if (loopback.family() != AF_INET6) { 987 if (loopback.family() != AF_INET6) {
988 // Try estimating MTU. 988 // Try estimating MTU.
989 rtc::scoped_ptr<AsyncSocket> 989 rtc::scoped_ptr<AsyncSocket>
990 mtu_socket( 990 mtu_socket(
991 ss_->CreateAsyncSocket(loopback.family(), SOCK_DGRAM)); 991 ss_->CreateAsyncSocket(loopback.family(), SOCK_DGRAM));
992 mtu_socket->Bind(SocketAddress(loopback, 0)); 992 mtu_socket->Bind(SocketAddress(loopback, 0));
993 uint16 mtu; 993 uint16_t mtu;
994 // should fail until we connect 994 // should fail until we connect
995 ASSERT_EQ(-1, mtu_socket->EstimateMTU(&mtu)); 995 ASSERT_EQ(-1, mtu_socket->EstimateMTU(&mtu));
996 mtu_socket->Connect(SocketAddress(loopback, 0)); 996 mtu_socket->Connect(SocketAddress(loopback, 0));
997 #if defined(WEBRTC_WIN) 997 #if defined(WEBRTC_WIN)
998 // now it should succeed 998 // now it should succeed
999 ASSERT_NE(-1, mtu_socket->EstimateMTU(&mtu)); 999 ASSERT_NE(-1, mtu_socket->EstimateMTU(&mtu));
1000 ASSERT_GE(mtu, 1492); // should be at least the 1492 "plateau" on localhost 1000 ASSERT_GE(mtu, 1492); // should be at least the 1492 "plateau" on localhost
1001 #elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) 1001 #elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
1002 // except on WEBRTC_MAC && !WEBRTC_IOS, where it's not yet implemented 1002 // except on WEBRTC_MAC && !WEBRTC_IOS, where it's not yet implemented
1003 ASSERT_EQ(-1, mtu_socket->EstimateMTU(&mtu)); 1003 ASSERT_EQ(-1, mtu_socket->EstimateMTU(&mtu));
1004 #else 1004 #else
1005 // and the behavior seems unpredictable on Linux, 1005 // and the behavior seems unpredictable on Linux,
1006 // failing on the build machine 1006 // failing on the build machine
1007 // but succeeding on my Ubiquity instance. 1007 // but succeeding on my Ubiquity instance.
1008 #endif 1008 #endif
1009 } 1009 }
1010 } 1010 }
1011 1011
1012 } // namespace rtc 1012 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/socket.h ('k') | webrtc/base/socketadapters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698