Fix parallelization in libjingle_p2p_unittest.

Adding VirtualSocketServers to SessionTest and RelayServerTest to avoid
contention on real ports.

R=juberti@webrtc.org
BUG=2597
TEST=third_party/gtest-parallel/gtest-parallel -w 64 out/Debug/libjingle_p2p_unittest

Review URL: https://webrtc-codereview.appspot.com/26679004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7355 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org
2014-10-01 12:31:31 +00:00
parent c86e45d7c4
commit fd29205e6e
2 changed files with 24 additions and 10 deletions

View File

@ -54,7 +54,9 @@
#include "webrtc/base/logging.h"
#include "webrtc/base/natserver.h"
#include "webrtc/base/natsocketfactory.h"
#include "webrtc/base/physicalsocketserver.h"
#include "webrtc/base/stringencode.h"
#include "webrtc/base/virtualsocketserver.h"
using cricket::SignalingProtocol;
using cricket::PROTOCOL_HYBRID;
@ -1121,6 +1123,10 @@ class TestClient : public sigslot::has_slots<> {
class SessionTest : public testing::Test {
protected:
SessionTest()
: pss_(new rtc::PhysicalSocketServer),
ss_(new rtc::VirtualSocketServer(pss_.get())),
ss_scope_(ss_.get()) {}
virtual void SetUp() {
// Seed needed for each test to satisfy expectations.
rtc::SetRandomTestMode(true);
@ -2276,6 +2282,10 @@ class SessionTest : public testing::Test {
EXPECT_EQ(2ul, stats.proxy_to_transport.size());
EXPECT_EQ(2ul, stats.transport_stats.size());
}
rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
rtc::scoped_ptr<rtc::VirtualSocketServer> ss_;
rtc::SocketServerScope ss_scope_;
};
// For each of these, "X => Y = Z" means "if a client with protocol X