| Index: talk/app/webrtc/peerconnection_unittest.cc
|
| diff --git a/talk/app/webrtc/peerconnection_unittest.cc b/talk/app/webrtc/peerconnection_unittest.cc
|
| index 00100ac56773f90861d5d01005d31c64cc54d855..7edd03926e054d9427d15371f6262e0b0c1cba14 100644
|
| --- a/talk/app/webrtc/peerconnection_unittest.cc
|
| +++ b/talk/app/webrtc/peerconnection_unittest.cc
|
| @@ -145,31 +145,18 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
|
| public SignalingMessageReceiver,
|
| public ObserverInterface {
|
| public:
|
| - static PeerConnectionTestClient* CreateClientWithDtlsIdentityStore(
|
| + static PeerConnectionTestClient* CreateClient(
|
| const std::string& id,
|
| const MediaConstraintsInterface* constraints,
|
| - const PeerConnectionFactory::Options* options,
|
| - rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store) {
|
| + const PeerConnectionFactory::Options* options) {
|
| PeerConnectionTestClient* client(new PeerConnectionTestClient(id));
|
| - if (!client->Init(constraints, options, dtls_identity_store.Pass())) {
|
| + if (!client->Init(constraints, options)) {
|
| delete client;
|
| return nullptr;
|
| }
|
| return client;
|
| }
|
|
|
| - static PeerConnectionTestClient* CreateClient(
|
| - const std::string& id,
|
| - const MediaConstraintsInterface* constraints,
|
| - const PeerConnectionFactory::Options* options) {
|
| - rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store(
|
| - rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore()
|
| - : nullptr);
|
| -
|
| - return CreateClientWithDtlsIdentityStore(id, constraints, options,
|
| - dtls_identity_store.Pass());
|
| - }
|
| -
|
| ~PeerConnectionTestClient() {
|
| while (!fake_video_renderers_.empty()) {
|
| RenderMap::iterator it = fake_video_renderers_.begin();
|
| @@ -717,10 +704,8 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
|
|
|
| explicit PeerConnectionTestClient(const std::string& id) : id_(id) {}
|
|
|
| - bool Init(
|
| - const MediaConstraintsInterface* constraints,
|
| - const PeerConnectionFactory::Options* options,
|
| - rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store) {
|
| + bool Init(const MediaConstraintsInterface* constraints,
|
| + const PeerConnectionFactory::Options* options) {
|
| EXPECT_TRUE(!peer_connection_);
|
| EXPECT_TRUE(!peer_connection_factory_);
|
| allocator_factory_ = webrtc::FakePortAllocatorFactory::Create();
|
| @@ -744,21 +729,23 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
|
| if (options) {
|
| peer_connection_factory_->SetOptions(*options);
|
| }
|
| - peer_connection_ = CreatePeerConnection(
|
| - allocator_factory_.get(), constraints, dtls_identity_store.Pass());
|
| + peer_connection_ = CreatePeerConnection(allocator_factory_.get(),
|
| + constraints);
|
| return peer_connection_.get() != nullptr;
|
| }
|
|
|
| rtc::scoped_refptr<webrtc::PeerConnectionInterface> CreatePeerConnection(
|
| webrtc::PortAllocatorFactoryInterface* factory,
|
| - const MediaConstraintsInterface* constraints,
|
| - rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store) {
|
| + const MediaConstraintsInterface* constraints) {
|
| // CreatePeerConnection with IceServers.
|
| webrtc::PeerConnectionInterface::IceServers ice_servers;
|
| webrtc::PeerConnectionInterface::IceServer ice_server;
|
| ice_server.uri = "stun:stun.l.google.com:19302";
|
| ice_servers.push_back(ice_server);
|
|
|
| + rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store(
|
| + rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore()
|
| + : nullptr);
|
| return peer_connection_factory_->CreatePeerConnection(
|
| ice_servers, constraints, factory, dtls_identity_store.Pass(), this);
|
| }
|
| @@ -992,11 +979,6 @@ class MAYBE_JsepPeerConnectionP2PTestClient : public testing::Test {
|
| nullptr);
|
| }
|
|
|
| - void SetSignalingReceivers() {
|
| - initiating_client_->set_signaling_message_receiver(receiving_client_.get());
|
| - receiving_client_->set_signaling_message_receiver(initiating_client_.get());
|
| - }
|
| -
|
| bool CreateTestClients(MediaConstraintsInterface* init_constraints,
|
| PeerConnectionFactory::Options* init_options,
|
| MediaConstraintsInterface* recv_constraints,
|
| @@ -1008,7 +990,8 @@ class MAYBE_JsepPeerConnectionP2PTestClient : public testing::Test {
|
| if (!initiating_client_ || !receiving_client_) {
|
| return false;
|
| }
|
| - SetSignalingReceivers();
|
| + initiating_client_->set_signaling_message_receiver(receiving_client_.get());
|
| + receiving_client_->set_signaling_message_receiver(initiating_client_.get());
|
| return true;
|
| }
|
|
|
| @@ -1085,31 +1068,6 @@ class MAYBE_JsepPeerConnectionP2PTestClient : public testing::Test {
|
| kMaxWaitForFramesMs);
|
| }
|
|
|
| - void SetupAndVerifyDtlsCall() {
|
| - MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
|
| - FakeConstraints setup_constraints;
|
| - setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
|
| - true);
|
| - ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints));
|
| - LocalP2PTest();
|
| - VerifyRenderedSize(640, 480);
|
| - }
|
| -
|
| - PeerConnectionTestClient* CreateDtlsClientWithAlternateKey() {
|
| - FakeConstraints setup_constraints;
|
| - setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
|
| - true);
|
| -
|
| - rtc::scoped_ptr<FakeDtlsIdentityStore> dtls_identity_store(
|
| - rtc::SSLStreamAdapter::HaveDtlsSrtp() ? new FakeDtlsIdentityStore()
|
| - : nullptr);
|
| - dtls_identity_store->use_alternate_key();
|
| -
|
| - // Make sure the new client is using a different certificate.
|
| - return PeerConnectionTestClient::CreateClientWithDtlsIdentityStore(
|
| - "New Peer: ", &setup_constraints, nullptr, dtls_identity_store.Pass());
|
| - }
|
| -
|
| void SendRtpData(webrtc::DataChannelInterface* dc, const std::string& data) {
|
| // Messages may get lost on the unreliable DataChannel, so we send multiple
|
| // times to avoid test flakiness.
|
| @@ -1123,29 +1081,10 @@ class MAYBE_JsepPeerConnectionP2PTestClient : public testing::Test {
|
| PeerConnectionTestClient* initializing_client() {
|
| return initiating_client_.get();
|
| }
|
| -
|
| - // Set the |initiating_client_| to the |client| passed in and return the
|
| - // original |initiating_client_|.
|
| - PeerConnectionTestClient* set_initializing_client(
|
| - PeerConnectionTestClient* client) {
|
| - PeerConnectionTestClient* old = initiating_client_.release();
|
| - initiating_client_.reset(client);
|
| - return old;
|
| - }
|
| -
|
| PeerConnectionTestClient* receiving_client() {
|
| return receiving_client_.get();
|
| }
|
|
|
| - // Set the |receiving_client_| to the |client| passed in and return the
|
| - // original |receiving_client_|.
|
| - PeerConnectionTestClient* set_receiving_client(
|
| - PeerConnectionTestClient* client) {
|
| - PeerConnectionTestClient* old = receiving_client_.release();
|
| - receiving_client_.reset(client);
|
| - return old;
|
| - }
|
| -
|
| private:
|
| rtc::scoped_ptr<rtc::PhysicalSocketServer> pss_;
|
| rtc::scoped_ptr<rtc::VirtualSocketServer> ss_;
|
| @@ -1207,7 +1146,13 @@ TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, DISABLED_LocalP2PTest1280By720) {
|
| // This test sets up a call between two endpoints that are configured to use
|
| // DTLS key agreement. As a result, DTLS is negotiated and used for transport.
|
| TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, LocalP2PTestDtls) {
|
| - SetupAndVerifyDtlsCall();
|
| + MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
|
| + FakeConstraints setup_constraints;
|
| + setup_constraints.AddMandatory(MediaConstraintsInterface::kEnableDtlsSrtp,
|
| + true);
|
| + ASSERT_TRUE(CreateTestClients(&setup_constraints, &setup_constraints));
|
| + LocalP2PTest();
|
| + VerifyRenderedSize(640, 480);
|
| }
|
|
|
| // This test sets up a audio call initially and then upgrades to audio/video,
|
| @@ -1224,40 +1169,6 @@ TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, LocalP2PTestDtlsRenegotiate) {
|
| receiving_client()->Negotiate();
|
| }
|
|
|
| -// This test sets up a call transfer to a new caller with a different DTLS
|
| -// fingerprint.
|
| -TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, LocalP2PTestDtlsTransferCallee) {
|
| - MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
|
| - SetupAndVerifyDtlsCall();
|
| -
|
| - // Keeping the original peer around which will still send packets to the
|
| - // receiving client. These SRTP packets will be dropped.
|
| - rtc::scoped_ptr<PeerConnectionTestClient> original_peer(
|
| - set_initializing_client(CreateDtlsClientWithAlternateKey()));
|
| -
|
| - SetSignalingReceivers();
|
| - receiving_client()->SetExpectIceRestart(true);
|
| - LocalP2PTest();
|
| - VerifyRenderedSize(640, 480);
|
| -}
|
| -
|
| -// This test sets up a call transfer to a new callee with a different DTLS
|
| -// fingerprint.
|
| -TEST_F(MAYBE_JsepPeerConnectionP2PTestClient, LocalP2PTestDtlsTransferCaller) {
|
| - MAYBE_SKIP_TEST(rtc::SSLStreamAdapter::HaveDtlsSrtp);
|
| - SetupAndVerifyDtlsCall();
|
| -
|
| - // Keeping the original peer around which will still send packets to the
|
| - // receiving client. These SRTP packets will be dropped.
|
| - rtc::scoped_ptr<PeerConnectionTestClient> original_peer(
|
| - set_receiving_client(CreateDtlsClientWithAlternateKey()));
|
| -
|
| - SetSignalingReceivers();
|
| - initializing_client()->IceRestart();
|
| - LocalP2PTest();
|
| - VerifyRenderedSize(640, 480);
|
| -}
|
| -
|
| // This test sets up a call between two endpoints that are configured to use
|
| // DTLS key agreement. The offerer don't support SDES. As a result, DTLS is
|
| // negotiated and used for transport.
|
|
|