Delete method MessageQueue::set_socketserver
Instead, make the pointer to the associated socket server a
construction time const, and delete its lock.
Introduces a helper class AutoSocketServerThread for code
(mainly tests) which need a socket server associated with
the current thread.
BUG=webrtc:7501
Review-Url: https://codereview.webrtc.org/2828223002
Cr-Commit-Position: refs/heads/master@{#18047}
diff --git a/webrtc/base/proxy_unittest.cc b/webrtc/base/proxy_unittest.cc
index 631d91b..7e040b7 100644
--- a/webrtc/base/proxy_unittest.cc
+++ b/webrtc/base/proxy_unittest.cc
@@ -31,19 +31,19 @@
// Sets up a virtual socket server and HTTPS/SOCKS5 proxy servers.
class ProxyTest : public testing::Test {
public:
- ProxyTest() : ss_(new rtc::VirtualSocketServer(nullptr)) {
- Thread::Current()->set_socketserver(ss_.get());
+ ProxyTest() : ss_(new rtc::VirtualSocketServer(nullptr)), thread_(ss_.get()) {
socks_.reset(new rtc::SocksProxyServer(
ss_.get(), kSocksProxyIntAddr, ss_.get(), kSocksProxyExtAddr));
https_.reset(new rtc::HttpListenServer());
https_->Listen(kHttpsProxyIntAddr);
}
- ~ProxyTest() { Thread::Current()->set_socketserver(nullptr); }
+ ~ProxyTest() {}
rtc::SocketServer* ss() { return ss_.get(); }
private:
std::unique_ptr<rtc::SocketServer> ss_;
+ rtc::AutoSocketServerThread thread_;
std::unique_ptr<rtc::SocksProxyServer> socks_;
// TODO: Make this a real HTTPS proxy server.
std::unique_ptr<rtc::HttpListenServer> https_;