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

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

Issue 2859373003: Refactor TestClient to use std::unique_ptr, and fix VirtualSocketServerTest leaks. (Closed)
Patch Set: Comment fix, 0 -> null. Created 3 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 2009 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2009 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 rtc::AsyncSocket* socket = 54 rtc::AsyncSocket* socket =
55 ss()->CreateAsyncSocket(kSocksProxyIntAddr.family(), SOCK_STREAM); 55 ss()->CreateAsyncSocket(kSocksProxyIntAddr.family(), SOCK_STREAM);
56 rtc::AsyncSocksProxySocket* proxy_socket = 56 rtc::AsyncSocksProxySocket* proxy_socket =
57 new rtc::AsyncSocksProxySocket(socket, kSocksProxyIntAddr, 57 new rtc::AsyncSocksProxySocket(socket, kSocksProxyIntAddr,
58 "", rtc::CryptString()); 58 "", rtc::CryptString());
59 // TODO: IPv6-ize these tests when proxy supports IPv6. 59 // TODO: IPv6-ize these tests when proxy supports IPv6.
60 60
61 rtc::TestEchoServer server(Thread::Current(), 61 rtc::TestEchoServer server(Thread::Current(),
62 SocketAddress(INADDR_ANY, 0)); 62 SocketAddress(INADDR_ANY, 0));
63 63
64 rtc::AsyncTCPSocket* packet_socket = rtc::AsyncTCPSocket::Create( 64 std::unique_ptr<rtc::AsyncTCPSocket> packet_socket(
65 proxy_socket, SocketAddress(INADDR_ANY, 0), server.address()); 65 rtc::AsyncTCPSocket::Create(proxy_socket, SocketAddress(INADDR_ANY, 0),
66 server.address()));
66 EXPECT_TRUE(packet_socket != nullptr); 67 EXPECT_TRUE(packet_socket != nullptr);
67 rtc::TestClient client(packet_socket); 68 rtc::TestClient client(std::move(packet_socket));
68 69
69 EXPECT_EQ(Socket::CS_CONNECTING, proxy_socket->GetState()); 70 EXPECT_EQ(Socket::CS_CONNECTING, proxy_socket->GetState());
70 EXPECT_TRUE(client.CheckConnected()); 71 EXPECT_TRUE(client.CheckConnected());
71 EXPECT_EQ(Socket::CS_CONNECTED, proxy_socket->GetState()); 72 EXPECT_EQ(Socket::CS_CONNECTED, proxy_socket->GetState());
72 EXPECT_EQ(server.address(), client.remote_address()); 73 EXPECT_EQ(server.address(), client.remote_address());
73 client.Send("foo", 3); 74 client.Send("foo", 3);
74 EXPECT_TRUE(client.CheckNextPacket("foo", 3, nullptr)); 75 EXPECT_TRUE(client.CheckNextPacket("foo", 3, nullptr));
75 EXPECT_TRUE(client.CheckNoPacket()); 76 EXPECT_TRUE(client.CheckNoPacket());
76 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698