OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 #include <utility> | 13 #include <utility> |
14 | 14 |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "webrtc/api/audiotrack.h" | 16 #include "webrtc/api/audiotrack.h" |
17 #include "webrtc/api/jsepsessiondescription.h" | 17 #include "webrtc/api/jsepsessiondescription.h" |
18 #include "webrtc/api/mediastream.h" | 18 #include "webrtc/api/mediastream.h" |
19 #include "webrtc/api/mediastreaminterface.h" | 19 #include "webrtc/api/mediastreaminterface.h" |
20 #include "webrtc/api/peerconnection.h" | 20 #include "webrtc/api/peerconnection.h" |
21 #include "webrtc/api/peerconnectioninterface.h" | 21 #include "webrtc/api/peerconnectioninterface.h" |
22 #include "webrtc/api/rtpreceiverinterface.h" | 22 #include "webrtc/api/rtpreceiverinterface.h" |
23 #include "webrtc/api/rtpsenderinterface.h" | 23 #include "webrtc/api/rtpsenderinterface.h" |
24 #include "webrtc/api/streamcollection.h" | 24 #include "webrtc/api/streamcollection.h" |
25 #ifdef WEBRTC_ANDROID | 25 #ifdef WEBRTC_ANDROID |
26 #include "webrtc/api/test/androidtestinitializer.h" | 26 #include "webrtc/api/test/androidtestinitializer.h" |
27 #endif | 27 #endif |
28 #include "webrtc/api/test/fakeconstraints.h" | 28 #include "webrtc/api/test/fakeconstraints.h" |
29 #include "webrtc/api/test/fakedtlsidentitystore.h" | 29 #include "webrtc/api/test/fakertccertificategenerator.h" |
30 #include "webrtc/api/test/fakevideotracksource.h" | 30 #include "webrtc/api/test/fakevideotracksource.h" |
31 #include "webrtc/api/test/mockpeerconnectionobservers.h" | 31 #include "webrtc/api/test/mockpeerconnectionobservers.h" |
32 #include "webrtc/api/test/testsdpstrings.h" | 32 #include "webrtc/api/test/testsdpstrings.h" |
33 #include "webrtc/api/videocapturertracksource.h" | 33 #include "webrtc/api/videocapturertracksource.h" |
34 #include "webrtc/api/videotrack.h" | 34 #include "webrtc/api/videotrack.h" |
35 #include "webrtc/base/gunit.h" | 35 #include "webrtc/base/gunit.h" |
36 #include "webrtc/base/ssladapter.h" | 36 #include "webrtc/base/ssladapter.h" |
37 #include "webrtc/base/sslstreamadapter.h" | 37 #include "webrtc/base/sslstreamadapter.h" |
38 #include "webrtc/base/stringutils.h" | 38 #include "webrtc/base/stringutils.h" |
39 #include "webrtc/base/thread.h" | 39 #include "webrtc/base/thread.h" |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 // tests in this file. We only create a FakeIdentityService if the test | 588 // tests in this file. We only create a FakeIdentityService if the test |
589 // explicitly sets the constraint. | 589 // explicitly sets the constraint. |
590 FakeConstraints default_constraints; | 590 FakeConstraints default_constraints; |
591 if (!constraints) { | 591 if (!constraints) { |
592 constraints = &default_constraints; | 592 constraints = &default_constraints; |
593 | 593 |
594 default_constraints.AddMandatory( | 594 default_constraints.AddMandatory( |
595 webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, false); | 595 webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, false); |
596 } | 596 } |
597 | 597 |
598 std::unique_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store; | 598 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator; |
599 bool dtls; | 599 bool dtls; |
600 if (FindConstraint(constraints, | 600 if (FindConstraint(constraints, |
601 webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, | 601 webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, |
602 &dtls, | 602 &dtls, |
603 nullptr) && dtls) { | 603 nullptr) && dtls) { |
604 dtls_identity_store.reset(new FakeDtlsIdentityStore()); | 604 cert_generator.reset(new FakeRTCCertificateGenerator()); |
605 } | 605 } |
606 pc_ = pc_factory_->CreatePeerConnectionWithStore( | 606 pc_ = pc_factory_->CreatePeerConnection( |
607 config, constraints, std::move(port_allocator), | 607 config, constraints, std::move(port_allocator), |
608 std::move(dtls_identity_store), &observer_); | 608 std::move(cert_generator), &observer_); |
609 ASSERT_TRUE(pc_.get() != NULL); | 609 ASSERT_TRUE(pc_.get() != NULL); |
610 observer_.SetPeerConnectionInterface(pc_.get()); | 610 observer_.SetPeerConnectionInterface(pc_.get()); |
611 EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_); | 611 EXPECT_EQ(PeerConnectionInterface::kStable, observer_.state_); |
612 } | 612 } |
613 | 613 |
614 void CreatePeerConnectionExpectFail(const std::string& uri) { | 614 void CreatePeerConnectionExpectFail(const std::string& uri) { |
615 PeerConnectionInterface::RTCConfiguration config; | 615 PeerConnectionInterface::RTCConfiguration config; |
616 PeerConnectionInterface::IceServer server; | 616 PeerConnectionInterface::IceServer server; |
617 server.uri = uri; | 617 server.uri = uri; |
618 config.servers.push_back(server); | 618 config.servers.push_back(server); |
(...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2810 FakeConstraints updated_answer_c; | 2810 FakeConstraints updated_answer_c; |
2811 answer_c.SetMandatoryReceiveAudio(false); | 2811 answer_c.SetMandatoryReceiveAudio(false); |
2812 answer_c.SetMandatoryReceiveVideo(false); | 2812 answer_c.SetMandatoryReceiveVideo(false); |
2813 | 2813 |
2814 cricket::MediaSessionOptions updated_answer_options; | 2814 cricket::MediaSessionOptions updated_answer_options; |
2815 EXPECT_TRUE( | 2815 EXPECT_TRUE( |
2816 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); | 2816 ParseConstraintsForAnswer(&updated_answer_c, &updated_answer_options)); |
2817 EXPECT_TRUE(updated_answer_options.has_audio()); | 2817 EXPECT_TRUE(updated_answer_options.has_audio()); |
2818 EXPECT_TRUE(updated_answer_options.has_video()); | 2818 EXPECT_TRUE(updated_answer_options.has_video()); |
2819 } | 2819 } |
OLD | NEW |