| Index: webrtc/api/peerconnectioninterface_unittest.cc
|
| diff --git a/webrtc/api/peerconnectioninterface_unittest.cc b/webrtc/api/peerconnectioninterface_unittest.cc
|
| index 0b24fcb7cfc4d119af78dacd4258d84f6188aa76..419f69c5636705843bee89cf7078af3a51c79cb1 100644
|
| --- a/webrtc/api/peerconnectioninterface_unittest.cc
|
| +++ b/webrtc/api/peerconnectioninterface_unittest.cc
|
| @@ -242,6 +242,7 @@
|
|
|
| using ::testing::Exactly;
|
| using cricket::StreamParams;
|
| +using rtc::scoped_refptr;
|
| using webrtc::AudioSourceInterface;
|
| using webrtc::AudioTrack;
|
| using webrtc::AudioTrackInterface;
|
| @@ -534,18 +535,18 @@
|
| return "";
|
| }
|
|
|
| - rtc::scoped_refptr<PeerConnectionInterface> pc_;
|
| + scoped_refptr<PeerConnectionInterface> pc_;
|
| PeerConnectionInterface::SignalingState state_;
|
| std::unique_ptr<IceCandidateInterface> last_candidate_;
|
| - rtc::scoped_refptr<DataChannelInterface> last_datachannel_;
|
| + scoped_refptr<DataChannelInterface> last_datachannel_;
|
| rtc::scoped_refptr<StreamCollection> remote_streams_;
|
| bool renegotiation_needed_ = false;
|
| bool ice_complete_ = false;
|
| bool callback_triggered = false;
|
|
|
| private:
|
| - rtc::scoped_refptr<MediaStreamInterface> last_added_stream_;
|
| - rtc::scoped_refptr<MediaStreamInterface> last_removed_stream_;
|
| + scoped_refptr<MediaStreamInterface> last_added_stream_;
|
| + scoped_refptr<MediaStreamInterface> last_removed_stream_;
|
| };
|
|
|
| } // namespace
|
| @@ -663,7 +664,7 @@
|
| server.uri = uri;
|
| config.servers.push_back(server);
|
|
|
| - rtc::scoped_refptr<PeerConnectionInterface> pc;
|
| + scoped_refptr<PeerConnectionInterface> pc;
|
| pc = pc_factory_->CreatePeerConnection(config, nullptr, nullptr, nullptr,
|
| &observer_);
|
| EXPECT_EQ(nullptr, pc);
|
| @@ -699,11 +700,11 @@
|
|
|
| void AddVideoStream(const std::string& label) {
|
| // Create a local stream.
|
| - rtc::scoped_refptr<MediaStreamInterface> stream(
|
| + scoped_refptr<MediaStreamInterface> stream(
|
| pc_factory_->CreateLocalMediaStream(label));
|
| - rtc::scoped_refptr<VideoTrackSourceInterface> video_source(
|
| + scoped_refptr<VideoTrackSourceInterface> video_source(
|
| pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer(), NULL));
|
| - rtc::scoped_refptr<VideoTrackInterface> video_track(
|
| + scoped_refptr<VideoTrackInterface> video_track(
|
| pc_factory_->CreateVideoTrack(label + "v0", video_source));
|
| stream->AddTrack(video_track.get());
|
| EXPECT_TRUE(pc_->AddStream(stream));
|
| @@ -713,9 +714,9 @@
|
|
|
| void AddVoiceStream(const std::string& label) {
|
| // Create a local stream.
|
| - rtc::scoped_refptr<MediaStreamInterface> stream(
|
| + scoped_refptr<MediaStreamInterface> stream(
|
| pc_factory_->CreateLocalMediaStream(label));
|
| - rtc::scoped_refptr<AudioTrackInterface> audio_track(
|
| + scoped_refptr<AudioTrackInterface> audio_track(
|
| pc_factory_->CreateAudioTrack(label + "a0", NULL));
|
| stream->AddTrack(audio_track.get());
|
| EXPECT_TRUE(pc_->AddStream(stream));
|
| @@ -727,13 +728,13 @@
|
| const std::string& audio_track_label,
|
| const std::string& video_track_label) {
|
| // Create a local stream.
|
| - rtc::scoped_refptr<MediaStreamInterface> stream(
|
| + scoped_refptr<MediaStreamInterface> stream(
|
| pc_factory_->CreateLocalMediaStream(stream_label));
|
| - rtc::scoped_refptr<AudioTrackInterface> audio_track(
|
| + scoped_refptr<AudioTrackInterface> audio_track(
|
| pc_factory_->CreateAudioTrack(
|
| audio_track_label, static_cast<AudioSourceInterface*>(NULL)));
|
| stream->AddTrack(audio_track.get());
|
| - rtc::scoped_refptr<VideoTrackInterface> video_track(
|
| + scoped_refptr<VideoTrackInterface> video_track(
|
| pc_factory_->CreateVideoTrack(
|
| video_track_label,
|
| pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer())));
|
| @@ -1041,9 +1042,9 @@
|
| }
|
|
|
| cricket::FakePortAllocator* port_allocator_ = nullptr;
|
| - rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_;
|
| - rtc::scoped_refptr<PeerConnectionFactoryForTest> pc_factory_for_test_;
|
| - rtc::scoped_refptr<PeerConnectionInterface> pc_;
|
| + scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_;
|
| + scoped_refptr<PeerConnectionFactoryForTest> pc_factory_for_test_;
|
| + scoped_refptr<PeerConnectionInterface> pc_;
|
| MockPeerConnectionObserver observer_;
|
| rtc::scoped_refptr<StreamCollection> reference_collection_;
|
| };
|
| @@ -1051,7 +1052,7 @@
|
| // Test that no callbacks on the PeerConnectionObserver are called after the
|
| // PeerConnection is closed.
|
| TEST_F(PeerConnectionInterfaceTest, CloseAndTestCallbackFunctions) {
|
| - rtc::scoped_refptr<PeerConnectionInterface> pc(
|
| + scoped_refptr<PeerConnectionInterface> pc(
|
| pc_factory_for_test_->CreatePeerConnection(
|
| PeerConnectionInterface::RTCConfiguration(), nullptr, nullptr,
|
| nullptr, &observer_));
|
| @@ -1169,11 +1170,11 @@
|
| ASSERT_EQ(2u, pc_->local_streams()->count());
|
|
|
| // Test we can add multiple local streams to one peerconnection.
|
| - rtc::scoped_refptr<MediaStreamInterface> stream(
|
| + scoped_refptr<MediaStreamInterface> stream(
|
| pc_factory_->CreateLocalMediaStream(kStreamLabel3));
|
| - rtc::scoped_refptr<AudioTrackInterface> audio_track(
|
| - pc_factory_->CreateAudioTrack(kStreamLabel3,
|
| - static_cast<AudioSourceInterface*>(NULL)));
|
| + scoped_refptr<AudioTrackInterface> audio_track(
|
| + pc_factory_->CreateAudioTrack(
|
| + kStreamLabel3, static_cast<AudioSourceInterface*>(NULL)));
|
| stream->AddTrack(audio_track.get());
|
| EXPECT_TRUE(pc_->AddStream(stream));
|
| EXPECT_EQ(3u, pc_->local_streams()->count());
|
| @@ -1251,16 +1252,15 @@
|
| TEST_F(PeerConnectionInterfaceTest, AddTrackRemoveTrack) {
|
| CreatePeerConnection();
|
| // Create a dummy stream, so tracks share a stream label.
|
| - rtc::scoped_refptr<MediaStreamInterface> stream(
|
| + scoped_refptr<MediaStreamInterface> stream(
|
| pc_factory_->CreateLocalMediaStream(kStreamLabel1));
|
| std::vector<MediaStreamInterface*> stream_list;
|
| stream_list.push_back(stream.get());
|
| - rtc::scoped_refptr<AudioTrackInterface> audio_track(
|
| + scoped_refptr<AudioTrackInterface> audio_track(
|
| pc_factory_->CreateAudioTrack("audio_track", nullptr));
|
| - rtc::scoped_refptr<VideoTrackInterface> video_track(
|
| - pc_factory_->CreateVideoTrack(
|
| - "video_track",
|
| - pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer())));
|
| + scoped_refptr<VideoTrackInterface> video_track(pc_factory_->CreateVideoTrack(
|
| + "video_track",
|
| + pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer())));
|
| auto audio_sender = pc_->AddTrack(audio_track, stream_list);
|
| auto video_sender = pc_->AddTrack(video_track, stream_list);
|
| EXPECT_EQ(1UL, audio_sender->stream_ids().size());
|
| @@ -1326,12 +1326,11 @@
|
| TEST_F(PeerConnectionInterfaceTest, AddTrackWithoutStream) {
|
| CreatePeerConnection();
|
| // Create a dummy stream, so tracks share a stream label.
|
| - rtc::scoped_refptr<AudioTrackInterface> audio_track(
|
| + scoped_refptr<AudioTrackInterface> audio_track(
|
| pc_factory_->CreateAudioTrack("audio_track", nullptr));
|
| - rtc::scoped_refptr<VideoTrackInterface> video_track(
|
| - pc_factory_->CreateVideoTrack(
|
| - "video_track",
|
| - pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer())));
|
| + scoped_refptr<VideoTrackInterface> video_track(pc_factory_->CreateVideoTrack(
|
| + "video_track",
|
| + pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer())));
|
| auto audio_sender =
|
| pc_->AddTrack(audio_track, std::vector<MediaStreamInterface*>());
|
| auto video_sender =
|
| @@ -1490,10 +1489,9 @@
|
| MediaStreamInterface* stream = pc_->local_streams()->at(0);
|
|
|
| // Add video track to the audio-only stream.
|
| - rtc::scoped_refptr<VideoTrackInterface> video_track(
|
| - pc_factory_->CreateVideoTrack(
|
| - "video_label",
|
| - pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer())));
|
| + scoped_refptr<VideoTrackInterface> video_track(pc_factory_->CreateVideoTrack(
|
| + "video_label",
|
| + pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer())));
|
| stream->AddTrack(video_track.get());
|
|
|
| std::unique_ptr<SessionDescriptionInterface> offer;
|
| @@ -1545,7 +1543,7 @@
|
| InitiateCall();
|
| ASSERT_LT(0u, pc_->remote_streams()->count());
|
| ASSERT_LT(0u, pc_->remote_streams()->at(0)->GetAudioTracks().size());
|
| - rtc::scoped_refptr<MediaStreamTrackInterface> remote_audio =
|
| + scoped_refptr<MediaStreamTrackInterface> remote_audio =
|
| pc_->remote_streams()->at(0)->GetAudioTracks()[0];
|
| EXPECT_TRUE(DoGetStats(remote_audio));
|
|
|
| @@ -1567,7 +1565,7 @@
|
| InitiateCall();
|
| ASSERT_LT(0u, pc_->remote_streams()->count());
|
| ASSERT_LT(0u, pc_->remote_streams()->at(0)->GetVideoTracks().size());
|
| - rtc::scoped_refptr<MediaStreamTrackInterface> remote_video =
|
| + scoped_refptr<MediaStreamTrackInterface> remote_video =
|
| pc_->remote_streams()->at(0)->GetVideoTracks()[0];
|
| EXPECT_TRUE(DoGetStats(remote_video));
|
| }
|
| @@ -1578,7 +1576,7 @@
|
| // data is returned for the track.
|
| TEST_F(PeerConnectionInterfaceTest, DISABLED_GetStatsForInvalidTrack) {
|
| InitiateCall();
|
| - rtc::scoped_refptr<AudioTrackInterface> unknown_audio_track(
|
| + scoped_refptr<AudioTrackInterface> unknown_audio_track(
|
| pc_factory_->CreateAudioTrack("unknown track", NULL));
|
| EXPECT_FALSE(DoGetStats(unknown_audio_track));
|
| }
|
| @@ -1588,9 +1586,9 @@
|
| FakeConstraints constraints;
|
| constraints.SetAllowRtpDataChannels();
|
| CreatePeerConnection(&constraints);
|
| - rtc::scoped_refptr<DataChannelInterface> data1 =
|
| + scoped_refptr<DataChannelInterface> data1 =
|
| pc_->CreateDataChannel("test1", NULL);
|
| - rtc::scoped_refptr<DataChannelInterface> data2 =
|
| + scoped_refptr<DataChannelInterface> data2 =
|
| pc_->CreateDataChannel("test2", NULL);
|
| ASSERT_TRUE(data1 != NULL);
|
| std::unique_ptr<MockDataChannelObserver> observer1(
|
| @@ -1635,9 +1633,9 @@
|
| FakeConstraints constraints;
|
| constraints.SetAllowRtpDataChannels();
|
| CreatePeerConnection(&constraints);
|
| - rtc::scoped_refptr<DataChannelInterface> data1 =
|
| + scoped_refptr<DataChannelInterface> data1 =
|
| pc_->CreateDataChannel("test1", NULL);
|
| - rtc::scoped_refptr<DataChannelInterface> data2 =
|
| + scoped_refptr<DataChannelInterface> data2 =
|
| pc_->CreateDataChannel("test2", NULL);
|
| ASSERT_TRUE(data1 != NULL);
|
| std::unique_ptr<MockDataChannelObserver> observer1(
|
| @@ -1665,7 +1663,7 @@
|
| FakeConstraints constraints;
|
| constraints.SetAllowRtpDataChannels();
|
| CreatePeerConnection(&constraints);
|
| - rtc::scoped_refptr<DataChannelInterface> data1 =
|
| + scoped_refptr<DataChannelInterface> data1 =
|
| pc_->CreateDataChannel("test1", NULL);
|
| std::unique_ptr<MockDataChannelObserver> observer1(
|
| new MockDataChannelObserver(data1));
|
| @@ -1689,7 +1687,7 @@
|
| CreatePeerConnection(&constraints);
|
|
|
| std::string offer_label = "offer_channel";
|
| - rtc::scoped_refptr<DataChannelInterface> offer_channel =
|
| + scoped_refptr<DataChannelInterface> offer_channel =
|
| pc_->CreateDataChannel(offer_label, NULL);
|
|
|
| CreateOfferAsLocalDescription();
|
| @@ -1732,7 +1730,7 @@
|
| std::string label = "test";
|
| webrtc::DataChannelInit config;
|
| config.reliable = true;
|
| - rtc::scoped_refptr<DataChannelInterface> channel =
|
| + scoped_refptr<DataChannelInterface> channel =
|
| pc_->CreateDataChannel(label, &config);
|
| EXPECT_TRUE(channel == NULL);
|
| }
|
| @@ -1744,11 +1742,11 @@
|
| CreatePeerConnection(&constraints);
|
|
|
| std::string label = "test";
|
| - rtc::scoped_refptr<DataChannelInterface> channel =
|
| + scoped_refptr<DataChannelInterface> channel =
|
| pc_->CreateDataChannel(label, nullptr);
|
| EXPECT_NE(channel, nullptr);
|
|
|
| - rtc::scoped_refptr<DataChannelInterface> dup_channel =
|
| + scoped_refptr<DataChannelInterface> dup_channel =
|
| pc_->CreateDataChannel(label, nullptr);
|
| EXPECT_EQ(dup_channel, nullptr);
|
| }
|
| @@ -1762,7 +1760,7 @@
|
|
|
| webrtc::DataChannelInit config;
|
|
|
| - rtc::scoped_refptr<DataChannelInterface> channel =
|
| + scoped_refptr<DataChannelInterface> channel =
|
| pc_->CreateDataChannel("1", &config);
|
| EXPECT_TRUE(channel != NULL);
|
| EXPECT_TRUE(channel->reliable());
|
| @@ -1803,7 +1801,7 @@
|
| config.maxRetransmits = 0;
|
| config.maxRetransmitTime = 0;
|
|
|
| - rtc::scoped_refptr<DataChannelInterface> channel =
|
| + scoped_refptr<DataChannelInterface> channel =
|
| pc_->CreateDataChannel(label, &config);
|
| EXPECT_TRUE(channel == NULL);
|
| }
|
| @@ -1817,7 +1815,7 @@
|
| CreatePeerConnection(&constraints);
|
|
|
| webrtc::DataChannelInit config;
|
| - rtc::scoped_refptr<DataChannelInterface> channel;
|
| + scoped_refptr<DataChannelInterface> channel;
|
|
|
| config.id = 1;
|
| channel = pc_->CreateDataChannel("1", &config);
|
| @@ -1845,11 +1843,11 @@
|
| CreatePeerConnection(&constraints);
|
|
|
| std::string label = "test";
|
| - rtc::scoped_refptr<DataChannelInterface> channel =
|
| + scoped_refptr<DataChannelInterface> channel =
|
| pc_->CreateDataChannel(label, nullptr);
|
| EXPECT_NE(channel, nullptr);
|
|
|
| - rtc::scoped_refptr<DataChannelInterface> dup_channel =
|
| + scoped_refptr<DataChannelInterface> dup_channel =
|
| pc_->CreateDataChannel(label, nullptr);
|
| EXPECT_NE(dup_channel, nullptr);
|
| }
|
| @@ -1861,12 +1859,12 @@
|
| constraints.SetAllowRtpDataChannels();
|
| CreatePeerConnection(&constraints);
|
|
|
| - rtc::scoped_refptr<DataChannelInterface> dc1 =
|
| + scoped_refptr<DataChannelInterface> dc1 =
|
| pc_->CreateDataChannel("test1", NULL);
|
| EXPECT_TRUE(observer_.renegotiation_needed_);
|
| observer_.renegotiation_needed_ = false;
|
|
|
| - rtc::scoped_refptr<DataChannelInterface> dc2 =
|
| + scoped_refptr<DataChannelInterface> dc2 =
|
| pc_->CreateDataChannel("test2", NULL);
|
| EXPECT_TRUE(observer_.renegotiation_needed_);
|
| }
|
| @@ -1877,9 +1875,9 @@
|
| constraints.SetAllowRtpDataChannels();
|
| CreatePeerConnection(&constraints);
|
|
|
| - rtc::scoped_refptr<DataChannelInterface> data1 =
|
| + scoped_refptr<DataChannelInterface> data1 =
|
| pc_->CreateDataChannel("test1", NULL);
|
| - rtc::scoped_refptr<DataChannelInterface> data2 =
|
| + scoped_refptr<DataChannelInterface> data2 =
|
| pc_->CreateDataChannel("test2", NULL);
|
| ASSERT_TRUE(data1 != NULL);
|
| std::unique_ptr<MockDataChannelObserver> observer1(
|
| @@ -1902,7 +1900,7 @@
|
| constraints.SetAllowRtpDataChannels();
|
| CreatePeerConnection(&constraints);
|
|
|
| - rtc::scoped_refptr<DataChannelInterface> offer_channel(
|
| + scoped_refptr<DataChannelInterface> offer_channel(
|
| pc_->CreateDataChannel("offer_channel", NULL));
|
|
|
| CreateOfferAsLocalDescription();
|
| @@ -2108,8 +2106,8 @@
|
| EXPECT_EQ(1u, pc_->local_streams()->count());
|
| EXPECT_EQ(1u, pc_->remote_streams()->count());
|
|
|
| - rtc::scoped_refptr<MediaStreamInterface> remote_stream =
|
| - pc_->remote_streams()->at(0);
|
| + scoped_refptr<MediaStreamInterface> remote_stream =
|
| + pc_->remote_streams()->at(0);
|
| // Track state may be updated asynchronously.
|
| EXPECT_EQ_WAIT(MediaStreamTrackInterface::kEnded,
|
| remote_stream->GetAudioTracks()[0]->state(), kTimeout);
|
| @@ -2126,7 +2124,7 @@
|
| CreateAnswerAsLocalDescription();
|
|
|
| ASSERT_EQ(1u, pc_->local_streams()->count());
|
| - rtc::scoped_refptr<MediaStreamInterface> local_stream =
|
| + scoped_refptr<MediaStreamInterface> local_stream =
|
| pc_->local_streams()->at(0);
|
|
|
| pc_->Close();
|
| @@ -2219,10 +2217,10 @@
|
| EXPECT_TRUE(DoSetRemoteDescription(desc_ms1_two_tracks.release()));
|
| EXPECT_TRUE(CompareStreamCollections(observer_.remote_streams(),
|
| reference_collection_));
|
| - rtc::scoped_refptr<AudioTrackInterface> audio_track2 =
|
| + scoped_refptr<AudioTrackInterface> audio_track2 =
|
| observer_.remote_streams()->at(0)->GetAudioTracks()[1];
|
| EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, audio_track2->state());
|
| - rtc::scoped_refptr<VideoTrackInterface> video_track2 =
|
| + scoped_refptr<VideoTrackInterface> video_track2 =
|
| observer_.remote_streams()->at(0)->GetVideoTracks()[1];
|
| EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, video_track2->state());
|
|
|
| @@ -2643,14 +2641,15 @@
|
| const MediaConstraintsInterface *constraints) {
|
| pcf_->create_media_controller_called_ = false;
|
|
|
| - rtc::scoped_refptr<PeerConnectionInterface> pc(pcf_->CreatePeerConnection(
|
| - config, constraints, nullptr, nullptr, &observer_));
|
| + scoped_refptr<PeerConnectionInterface> pc(
|
| + pcf_->CreatePeerConnection(config, constraints, nullptr, nullptr,
|
| + &observer_));
|
| EXPECT_TRUE(pc.get());
|
| EXPECT_TRUE(pcf_->create_media_controller_called_);
|
| return pcf_->create_media_controller_config_;
|
| }
|
|
|
| - rtc::scoped_refptr<PeerConnectionFactoryForTest> pcf_;
|
| + scoped_refptr<PeerConnectionFactoryForTest> pcf_;
|
| MockPeerConnectionObserver observer_;
|
| };
|
|
|
|
|