| Index: webrtc/base/socket_unittest.cc
|
| diff --git a/webrtc/base/socket_unittest.cc b/webrtc/base/socket_unittest.cc
|
| index 5f6de42a2f13074a6b96bf9eeec5d8dfd31137c4..8a470fc1f5934715628a645a3128818a82c8f3e9 100644
|
| --- a/webrtc/base/socket_unittest.cc
|
| +++ b/webrtc/base/socket_unittest.cc
|
| @@ -156,11 +156,20 @@ void SocketTest::TestUdpIPv4() {
|
| UdpInternal(kIPv4Loopback);
|
| }
|
|
|
| +void SocketTest::TestUdpIpv4Interval() {
|
| + SendUdpInterval(kIPv4Loopback, 5000);
|
| +}
|
| +
|
| void SocketTest::TestUdpIPv6() {
|
| MAYBE_SKIP_IPV6;
|
| UdpInternal(kIPv6Loopback);
|
| }
|
|
|
| +void SocketTest::TestUdpIpv6Interval() {
|
| + MAYBE_SKIP_IPV6;
|
| + SendUdpInterval(kIPv6Loopback, 5000);
|
| +}
|
| +
|
| void SocketTest::TestUdpReadyToSendIPv4() {
|
| #if !defined(WEBRTC_MAC)
|
| // TODO(ronghuawu): Enable this test on mac/ios.
|
| @@ -542,7 +551,7 @@ void SocketTest::ServerCloseInternal(const IPAddress& loopback) {
|
|
|
| // Ensure the data can be read.
|
| char buffer[10];
|
| - EXPECT_EQ(1, client->Recv(buffer, sizeof(buffer)));
|
| + EXPECT_EQ(1, client->Recv(buffer, sizeof(buffer), nullptr));
|
| EXPECT_EQ('a', buffer[0]);
|
|
|
| // Now we should close, but the remote address will remain.
|
| @@ -674,7 +683,7 @@ void SocketTest::SocketServerWaitInternal(const IPAddress& loopback) {
|
|
|
| // But should signal when process_io is true.
|
| EXPECT_TRUE_WAIT((sink.Check(accepted.get(), testing::SSE_READ)), kTimeout);
|
| - EXPECT_LT(0, accepted->Recv(buf, 1024));
|
| + EXPECT_LT(0, accepted->Recv(buf, 1024, nullptr));
|
| }
|
|
|
| void SocketTest::TcpInternal(const IPAddress& loopback, size_t data_size,
|
| @@ -764,7 +773,7 @@ void SocketTest::TcpInternal(const IPAddress& loopback, size_t data_size,
|
|
|
| // Receive as much as we can get in a single recv call.
|
| char recved_data[data_size];
|
| - int recved_size = receiver->Recv(recved_data, data_size);
|
| + int recved_size = receiver->Recv(recved_data, data_size, nullptr);
|
|
|
| if (!recv_called) {
|
| // The first Recv() after getting readability should succeed and receive
|
| @@ -851,7 +860,7 @@ void SocketTest::SingleFlowControlCallbackInternal(const IPAddress& loopback) {
|
|
|
| // Pull data.
|
| for (int i = 0; i < sends; ++i) {
|
| - client->Recv(buf, arraysize(buf));
|
| + client->Recv(buf, arraysize(buf), nullptr);
|
| }
|
|
|
| // Expect at least one additional writable callback.
|
| @@ -920,6 +929,26 @@ void SocketTest::UdpInternal(const IPAddress& loopback) {
|
| }
|
| }
|
|
|
| +void SocketTest::SendUdpInterval(const IPAddress& loopback,
|
| + int64_t time_interval_ms) {
|
| + SocketAddress empty = EmptySocketAddressWithFamily(loopback.family());
|
| + AsyncSocket* socket = ss_->CreateAsyncSocket(loopback.family(), SOCK_DGRAM);
|
| + EXPECT_EQ(AsyncSocket::CS_CLOSED, socket->GetState());
|
| + EXPECT_EQ(0, socket->Bind(SocketAddress(loopback, 0)));
|
| + SocketAddress address = socket->GetLocalAddress();
|
| + delete socket;
|
| +
|
| + // Test send/receive behavior.
|
| + std::unique_ptr<TestClient> client1(
|
| + new TestClient(AsyncUDPSocket::Create(ss_, address)));
|
| +
|
| + int64_t start_ms = rtc::TimeMillis();
|
| + while (rtc::TimeMillis() - start_ms < time_interval_ms) {
|
| + EXPECT_EQ(3, client1->SendTo("foo", 3, address));
|
| + EXPECT_TRUE(client1->CheckNextPacket("foo", 3, nullptr));
|
| + }
|
| +}
|
| +
|
| void SocketTest::UdpReadyToSend(const IPAddress& loopback) {
|
| SocketAddress empty = EmptySocketAddressWithFamily(loopback.family());
|
| // RFC 5737 - The blocks 192.0.2.0/24 (TEST-NET-1) ... are provided for use in
|
|
|