OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2006 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 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 | 33 |
34 void TestTcpInternal(const SocketAddress& loopback) { | 34 void TestTcpInternal(const SocketAddress& loopback) { |
35 Thread *main = Thread::Current(); | 35 Thread *main = Thread::Current(); |
36 TestEchoServer server(main, loopback); | 36 TestEchoServer server(main, loopback); |
37 | 37 |
38 AsyncSocket* socket = main->socketserver() | 38 AsyncSocket* socket = main->socketserver() |
39 ->CreateAsyncSocket(loopback.family(), SOCK_STREAM); | 39 ->CreateAsyncSocket(loopback.family(), SOCK_STREAM); |
40 AsyncTCPSocket* tcp_socket = AsyncTCPSocket::Create( | 40 AsyncTCPSocket* tcp_socket = AsyncTCPSocket::Create( |
41 socket, loopback, server.address()); | 41 socket, loopback, server.address()); |
42 ASSERT_TRUE(tcp_socket != NULL); | 42 ASSERT_TRUE(tcp_socket != nullptr); |
43 | 43 |
44 TestClient client(tcp_socket); | 44 TestClient client(tcp_socket); |
45 SocketAddress addr = client.address(), from; | 45 SocketAddress addr = client.address(), from; |
46 EXPECT_TRUE(client.CheckConnected()); | 46 EXPECT_TRUE(client.CheckConnected()); |
47 EXPECT_EQ(3, client.Send("foo", 3)); | 47 EXPECT_EQ(3, client.Send("foo", 3)); |
48 EXPECT_TRUE(client.CheckNextPacket("foo", 3, &from)); | 48 EXPECT_TRUE(client.CheckNextPacket("foo", 3, &from)); |
49 EXPECT_EQ(from, server.address()); | 49 EXPECT_EQ(from, server.address()); |
50 EXPECT_TRUE(client.CheckNoPacket()); | 50 EXPECT_TRUE(client.CheckNoPacket()); |
51 } | 51 } |
52 | 52 |
(...skipping 25 matching lines...) Expand all Loading... |
78 #else | 78 #else |
79 #define MAYBE_TestTcpIPv6 TestTcpIPv6 | 79 #define MAYBE_TestTcpIPv6 TestTcpIPv6 |
80 #endif | 80 #endif |
81 TEST(TestClientTest, MAYBE_TestTcpIPv6) { | 81 TEST(TestClientTest, MAYBE_TestTcpIPv6) { |
82 if (HasIPv6Enabled()) { | 82 if (HasIPv6Enabled()) { |
83 TestTcpInternal(SocketAddress("::1", 0)); | 83 TestTcpInternal(SocketAddress("::1", 0)); |
84 } else { | 84 } else { |
85 LOG(LS_INFO) << "Skipping IPv6 test."; | 85 LOG(LS_INFO) << "Skipping IPv6 test."; |
86 } | 86 } |
87 } | 87 } |
OLD | NEW |