Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: webrtc/pc/peerconnectioninterface_unittest.cc

Issue 2977493002: When a track is added/removed directly to MediaStream notify observer->OnRenegotionNeeded (Closed)
Patch Set: When removing stream, do not remove tracks if pc is closed Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/pc/peerconnection.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 3684 matching lines...) Expand 10 before | Expand all | Expand 10 after
3695 EXPECT_NE(a, f); 3695 EXPECT_NE(a, f);
3696 3696
3697 PeerConnectionInterface::RTCConfiguration g; 3697 PeerConnectionInterface::RTCConfiguration g;
3698 g.disable_ipv6 = true; 3698 g.disable_ipv6 = true;
3699 EXPECT_NE(a, g); 3699 EXPECT_NE(a, g);
3700 3700
3701 PeerConnectionInterface::RTCConfiguration h( 3701 PeerConnectionInterface::RTCConfiguration h(
3702 PeerConnectionInterface::RTCConfigurationType::kAggressive); 3702 PeerConnectionInterface::RTCConfigurationType::kAggressive);
3703 EXPECT_NE(a, h); 3703 EXPECT_NE(a, h);
3704 } 3704 }
3705
3706 // This test ensures OnRenegotiationNeeded is called when we add track with
3707 // MediaStream -> AddTrack in the same way it is called when we add track with
3708 // PeerConnection -> AddTrack.
3709 // The test can be removed once addStream is rewritten in terms of addTrack
3710 // https://bugs.chromium.org/p/webrtc/issues/detail?id=7815
3711 TEST_F(PeerConnectionInterfaceTest, MediaStreamAddTrackRemoveTrackRenegotiate) {
3712 CreatePeerConnectionWithoutDtls();
3713 rtc::scoped_refptr<MediaStreamInterface> stream(
3714 pc_factory_->CreateLocalMediaStream(kStreamLabel1));
3715 pc_->AddStream(stream);
3716 rtc::scoped_refptr<AudioTrackInterface> audio_track(
3717 pc_factory_->CreateAudioTrack("audio_track", nullptr));
3718 rtc::scoped_refptr<VideoTrackInterface> video_track(
3719 pc_factory_->CreateVideoTrack(
3720 "video_track", pc_factory_->CreateVideoSource(
3721 std::unique_ptr<cricket::VideoCapturer>(
3722 new cricket::FakeVideoCapturer()))));
3723 stream->AddTrack(audio_track);
3724 EXPECT_TRUE_WAIT(observer_.renegotiation_needed_, kTimeout);
3725 observer_.renegotiation_needed_ = false;
3726
3727 stream->AddTrack(video_track);
3728 EXPECT_TRUE_WAIT(observer_.renegotiation_needed_, kTimeout);
3729 observer_.renegotiation_needed_ = false;
3730
3731 stream->RemoveTrack(audio_track);
3732 EXPECT_TRUE_WAIT(observer_.renegotiation_needed_, kTimeout);
3733 observer_.renegotiation_needed_ = false;
3734
3735 stream->RemoveTrack(video_track);
3736 EXPECT_TRUE_WAIT(observer_.renegotiation_needed_, kTimeout);
3737 observer_.renegotiation_needed_ = false;
3738 }
OLDNEW
« no previous file with comments | « webrtc/pc/peerconnection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698