Make RelayServerTest use VirtualSocketServer.
Permits running the tests in parallel. R=juberti@webrtc.org BUG=2597 TEST=third_party/gtest-parallel/gtest-parallel -w64 out/Debug/rtc_unittests --gtest_filter=RelayServerTest.* Review URL: https://webrtc-codereview.appspot.com/38479004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7974 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
086c8d5a02
commit
53cb74107f
@ -19,6 +19,7 @@
|
|||||||
#include "webrtc/base/ssladapter.h"
|
#include "webrtc/base/ssladapter.h"
|
||||||
#include "webrtc/base/testclient.h"
|
#include "webrtc/base/testclient.h"
|
||||||
#include "webrtc/base/thread.h"
|
#include "webrtc/base/thread.h"
|
||||||
|
#include "webrtc/base/virtualsocketserver.h"
|
||||||
|
|
||||||
using rtc::SocketAddress;
|
using rtc::SocketAddress;
|
||||||
using namespace cricket;
|
using namespace cricket;
|
||||||
@ -37,23 +38,25 @@ static const char* msg2 = "Lobster Thermidor a Crevette with a mornay sauce...";
|
|||||||
class RelayServerTest : public testing::Test {
|
class RelayServerTest : public testing::Test {
|
||||||
public:
|
public:
|
||||||
RelayServerTest()
|
RelayServerTest()
|
||||||
: main_(rtc::Thread::Current()), ss_(main_->socketserver()),
|
: pss_(new rtc::PhysicalSocketServer),
|
||||||
|
ss_(new rtc::VirtualSocketServer(pss_.get())),
|
||||||
|
ss_scope_(ss_.get()),
|
||||||
username_(rtc::CreateRandomString(12)),
|
username_(rtc::CreateRandomString(12)),
|
||||||
password_(rtc::CreateRandomString(12)) {
|
password_(rtc::CreateRandomString(12)) {}
|
||||||
}
|
|
||||||
protected:
|
protected:
|
||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
server_.reset(new RelayServer(main_));
|
server_.reset(new RelayServer(rtc::Thread::Current()));
|
||||||
|
|
||||||
server_->AddInternalSocket(
|
server_->AddInternalSocket(
|
||||||
rtc::AsyncUDPSocket::Create(ss_, server_int_addr));
|
rtc::AsyncUDPSocket::Create(ss_.get(), server_int_addr));
|
||||||
server_->AddExternalSocket(
|
server_->AddExternalSocket(
|
||||||
rtc::AsyncUDPSocket::Create(ss_, server_ext_addr));
|
rtc::AsyncUDPSocket::Create(ss_.get(), server_ext_addr));
|
||||||
|
|
||||||
client1_.reset(new rtc::TestClient(
|
client1_.reset(new rtc::TestClient(
|
||||||
rtc::AsyncUDPSocket::Create(ss_, client1_addr)));
|
rtc::AsyncUDPSocket::Create(ss_.get(), client1_addr)));
|
||||||
client2_.reset(new rtc::TestClient(
|
client2_.reset(new rtc::TestClient(
|
||||||
rtc::AsyncUDPSocket::Create(ss_, client2_addr)));
|
rtc::AsyncUDPSocket::Create(ss_.get(), client2_addr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Allocate() {
|
void Allocate() {
|
||||||
@ -159,8 +162,9 @@ class RelayServerTest : public testing::Test {
|
|||||||
msg->AddAttribute(attr);
|
msg->AddAttribute(attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Thread* main_;
|
rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
|
||||||
rtc::SocketServer* ss_;
|
rtc::scoped_ptr<rtc::VirtualSocketServer> ss_;
|
||||||
|
rtc::SocketServerScope ss_scope_;
|
||||||
rtc::scoped_ptr<RelayServer> server_;
|
rtc::scoped_ptr<RelayServer> server_;
|
||||||
rtc::scoped_ptr<rtc::TestClient> client1_;
|
rtc::scoped_ptr<rtc::TestClient> client1_;
|
||||||
rtc::scoped_ptr<rtc::TestClient> client2_;
|
rtc::scoped_ptr<rtc::TestClient> client2_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user