Delete unused classes AutoDetectProxy and SslSocketFactory.

SslSocketFactory is unused since https://codereview.webrtc.org/2506983002, and it's the last
user of AutoDetectProxy.

Also move HttpListenServer and SocksProxyServer to the rtc_base_tests_utils gn target, since they're used by tests only.

BUG=webrtc:6424

Review-Url: https://codereview.webrtc.org/2541453002
Cr-Commit-Position: refs/heads/master@{#16576}
This commit is contained in:
nisse
2017-02-13 04:33:28 -08:00
committed by Commit bot
parent 375b9ac4cc
commit 1458462303
10 changed files with 4 additions and 2351 deletions

View File

@ -10,7 +10,6 @@
#include <memory>
#include <string>
#include "webrtc/base/autodetectproxy.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/httpserver.h"
#include "webrtc/base/proxyserver.h"
@ -29,18 +28,6 @@ static const SocketAddress kHttpsProxyIntAddr("1.2.3.4", 443);
static const SocketAddress kHttpsProxyExtAddr("1.2.3.5", 0);
static const SocketAddress kBogusProxyIntAddr("1.2.3.4", 999);
// Used to run a proxy detect on the current thread. Otherwise we would need
// to make both threads share the same VirtualSocketServer.
class AutoDetectProxyRunner : public rtc::AutoDetectProxy {
public:
explicit AutoDetectProxyRunner(const std::string& agent)
: AutoDetectProxy(agent) {}
void Run() {
DoWork();
Thread::Current()->Restart(); // needed to reset the messagequeue
}
};
// Sets up a virtual socket server and HTTPS/SOCKS5 proxy servers.
class ProxyTest : public testing::Test {
public:
@ -57,16 +44,6 @@ class ProxyTest : public testing::Test {
rtc::SocketServer* ss() { return ss_.get(); }
rtc::ProxyType DetectProxyType(const SocketAddress& address) {
rtc::ProxyType type;
AutoDetectProxyRunner* detect = new AutoDetectProxyRunner("unittest/1.0");
detect->set_proxy(address);
detect->Run(); // blocks until done
type = detect->proxy().type;
detect->Destroy(false);
return type;
}
private:
std::unique_ptr<rtc::SocketServer> ss_;
std::unique_ptr<rtc::SocksProxyServer> socks_;
@ -99,38 +76,3 @@ TEST_F(ProxyTest, TestSocks5Connect) {
EXPECT_TRUE(client.CheckNextPacket("foo", 3, NULL));
EXPECT_TRUE(client.CheckNoPacket());
}
/*
// Tests whether we can use a HTTPS proxy to connect to a server.
TEST_F(ProxyTest, TestHttpsConnect) {
AsyncSocket* socket = ss()->CreateAsyncSocket(SOCK_STREAM);
AsyncHttpsProxySocket* proxy_socket = new AsyncHttpsProxySocket(
socket, "unittest/1.0", kHttpsProxyIntAddress, "", CryptString());
TestClient client(new AsyncTCPSocket(proxy_socket));
TestEchoServer server(Thread::Current(), SocketAddress());
EXPECT_TRUE(client.Connect(server.address()));
EXPECT_TRUE(client.CheckConnected());
EXPECT_EQ(server.address(), client.remote_address());
client.Send("foo", 3);
EXPECT_TRUE(client.CheckNextPacket("foo", 3, NULL));
EXPECT_TRUE(client.CheckNoPacket());
}
*/
// Tests whether we can autodetect a SOCKS5 proxy.
TEST_F(ProxyTest, TestAutoDetectSocks5) {
EXPECT_EQ(rtc::PROXY_SOCKS5, DetectProxyType(kSocksProxyIntAddr));
}
/*
// Tests whether we can autodetect a HTTPS proxy.
TEST_F(ProxyTest, TestAutoDetectHttps) {
EXPECT_EQ(rtc::PROXY_HTTPS, DetectProxyType(kHttpsProxyIntAddr));
}
*/
// Tests whether we fail properly for no proxy.
TEST_F(ProxyTest, TestAutoDetectBogus) {
EXPECT_EQ(rtc::PROXY_UNKNOWN, DetectProxyType(kBogusProxyIntAddr));
}