| Index: webrtc/p2p/base/dtlstransportchannel_unittest.cc
|
| diff --git a/webrtc/p2p/base/dtlstransportchannel_unittest.cc b/webrtc/p2p/base/dtlstransportchannel_unittest.cc
|
| index 8c1c21cd1e365928e12f6211334da7a00af521ad..46ab563be5e7f0853e2ba95c40e5c59becc2b666 100644
|
| --- a/webrtc/p2p/base/dtlstransportchannel_unittest.cc
|
| +++ b/webrtc/p2p/base/dtlstransportchannel_unittest.cc
|
| @@ -11,7 +11,7 @@
|
| #include <set>
|
|
|
| #include "webrtc/p2p/base/dtlstransport.h"
|
| -#include "webrtc/p2p/base/fakesession.h"
|
| +#include "webrtc/p2p/base/faketransportcontroller.h"
|
| #include "webrtc/base/common.h"
|
| #include "webrtc/base/dscp.h"
|
| #include "webrtc/base/gunit.h"
|
| @@ -21,7 +21,6 @@
|
| #include "webrtc/base/sslidentity.h"
|
| #include "webrtc/base/sslstreamadapter.h"
|
| #include "webrtc/base/stringutils.h"
|
| -#include "webrtc/base/thread.h"
|
|
|
| #define MAYBE_SKIP_TEST(feature) \
|
| if (!(rtc::SSLStreamAdapter::feature())) { \
|
| @@ -45,20 +44,15 @@ enum Flags { NF_REOFFER = 0x1, NF_EXPECT_FAILURE = 0x2 };
|
|
|
| class DtlsTestClient : public sigslot::has_slots<> {
|
| public:
|
| - DtlsTestClient(const std::string& name,
|
| - rtc::Thread* signaling_thread,
|
| - rtc::Thread* worker_thread) :
|
| - name_(name),
|
| - signaling_thread_(signaling_thread),
|
| - worker_thread_(worker_thread),
|
| - protocol_(cricket::ICEPROTO_GOOGLE),
|
| - packet_size_(0),
|
| - use_dtls_srtp_(false),
|
| - ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10),
|
| - negotiated_dtls_(false),
|
| - received_dtls_client_hello_(false),
|
| - received_dtls_server_hello_(false) {
|
| - }
|
| + DtlsTestClient(const std::string& name)
|
| + : name_(name),
|
| + protocol_(cricket::ICEPROTO_GOOGLE),
|
| + packet_size_(0),
|
| + use_dtls_srtp_(false),
|
| + ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10),
|
| + negotiated_dtls_(false),
|
| + received_dtls_client_hello_(false),
|
| + received_dtls_server_hello_(false) {}
|
| void SetIceProtocol(cricket::TransportProtocol proto) {
|
| protocol_ = proto;
|
| }
|
| @@ -76,8 +70,7 @@ class DtlsTestClient : public sigslot::has_slots<> {
|
| }
|
| void SetupChannels(int count, cricket::IceRole role) {
|
| transport_.reset(new cricket::DtlsTransport<cricket::FakeTransport>(
|
| - signaling_thread_, worker_thread_, "dtls content name", NULL,
|
| - identity_.get()));
|
| + "dtls content name", NULL, identity_.get()));
|
| transport_->SetAsync(true);
|
| transport_->SetIceRole(role);
|
| transport_->SetIceTiebreaker(
|
| @@ -201,7 +194,9 @@ class DtlsTestClient : public sigslot::has_slots<> {
|
| return true;
|
| }
|
|
|
| - bool writable() const { return transport_->writable(); }
|
| + bool all_channels_writable() const {
|
| + return transport_->all_channels_writable();
|
| + }
|
|
|
| void CheckRole(rtc::SSLRole role) {
|
| if (role == rtc::SSL_CLIENT) {
|
| @@ -374,8 +369,6 @@ class DtlsTestClient : public sigslot::has_slots<> {
|
|
|
| private:
|
| std::string name_;
|
| - rtc::Thread* signaling_thread_;
|
| - rtc::Thread* worker_thread_;
|
| cricket::TransportProtocol protocol_;
|
| rtc::scoped_ptr<rtc::SSLIdentity> identity_;
|
| rtc::scoped_ptr<cricket::FakeTransport> transport_;
|
| @@ -392,16 +385,13 @@ class DtlsTestClient : public sigslot::has_slots<> {
|
|
|
| class DtlsTransportChannelTest : public testing::Test {
|
| public:
|
| - DtlsTransportChannelTest() :
|
| - client1_("P1", rtc::Thread::Current(),
|
| - rtc::Thread::Current()),
|
| - client2_("P2", rtc::Thread::Current(),
|
| - rtc::Thread::Current()),
|
| - channel_ct_(1),
|
| - use_dtls_(false),
|
| - use_dtls_srtp_(false),
|
| - ssl_expected_version_(rtc::SSL_PROTOCOL_DTLS_10) {
|
| - }
|
| + DtlsTransportChannelTest()
|
| + : client1_("P1"),
|
| + client2_("P2"),
|
| + channel_ct_(1),
|
| + use_dtls_(false),
|
| + use_dtls_srtp_(false),
|
| + ssl_expected_version_(rtc::SSL_PROTOCOL_DTLS_10) {}
|
|
|
| void SetChannelCount(size_t channel_ct) {
|
| channel_ct_ = static_cast<int>(channel_ct);
|
| @@ -443,8 +433,10 @@ class DtlsTransportChannelTest : public testing::Test {
|
| if (!rv)
|
| return false;
|
|
|
| - EXPECT_TRUE_WAIT(client1_.writable() && client2_.writable(), 10000);
|
| - if (!client1_.writable() || !client2_.writable())
|
| + EXPECT_TRUE_WAIT(
|
| + client1_.all_channels_writable() && client2_.all_channels_writable(),
|
| + 10000);
|
| + if (!client1_.all_channels_writable() || !client2_.all_channels_writable())
|
| return false;
|
|
|
| // Check that we used the right roles.
|
| @@ -844,7 +836,9 @@ TEST_F(DtlsTransportChannelTest, TestRenegotiateBeforeConnect) {
|
| cricket::CONNECTIONROLE_ACTIVE, NF_REOFFER);
|
| bool rv = client1_.Connect(&client2_);
|
| EXPECT_TRUE(rv);
|
| - EXPECT_TRUE_WAIT(client1_.writable() && client2_.writable(), 10000);
|
| + EXPECT_TRUE_WAIT(
|
| + client1_.all_channels_writable() && client2_.all_channels_writable(),
|
| + 10000);
|
|
|
| TestTransfer(0, 1000, 100, true);
|
| TestTransfer(1, 1000, 100, true);
|
|
|