| Index: content/renderer/media/webrtc_local_audio_track_unittest.cc
|
| diff --git a/content/renderer/media/webrtc_local_audio_track_unittest.cc b/content/renderer/media/webrtc_local_audio_track_unittest.cc
|
| index 82755ff771d5c41596d148ecbb58430a3b9475d3..7d125dcdf825e226b95ab1a842f5763ddce6b101 100644
|
| --- a/content/renderer/media/webrtc_local_audio_track_unittest.cc
|
| +++ b/content/renderer/media/webrtc_local_audio_track_unittest.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "base/synchronization/waitable_event.h"
|
| #include "base/test/test_timeouts.h"
|
| +#include "content/renderer/media/rtc_media_constraints.h"
|
| #include "content/renderer/media/webrtc_audio_capturer.h"
|
| #include "content/renderer/media/webrtc_local_audio_track.h"
|
| #include "media/audio/audio_parameters.h"
|
| @@ -164,8 +165,10 @@ class WebRtcLocalAudioTrackTest : public ::testing::Test {
|
| // the track is disconnected from the capturer.
|
| TEST_F(WebRtcLocalAudioTrackTest, ConnectAndDisconnectOneSink) {
|
| EXPECT_CALL(*capturer_source_.get(), Start()).WillOnce(Return());
|
| + RTCMediaConstraints constraints;
|
| scoped_refptr<WebRtcLocalAudioTrack> track =
|
| - WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL);
|
| + WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL,
|
| + &constraints);
|
| track->Start();
|
| EXPECT_TRUE(track->enabled());
|
|
|
| @@ -187,8 +190,7 @@ TEST_F(WebRtcLocalAudioTrackTest, ConnectAndDisconnectOneSink) {
|
| params.frames_per_buffer(),
|
| 0,
|
| 0,
|
| - // TODO(tommi): Change to |false| when issue 277134 is fixed.
|
| - _,
|
| + false,
|
| false)).Times(AtLeast(1))
|
| .WillRepeatedly(SignalEvent(&event));
|
| track->AddSink(sink.get());
|
| @@ -209,8 +211,10 @@ TEST_F(WebRtcLocalAudioTrackTest, ConnectAndDisconnectOneSink) {
|
| // reports on MediaStreamTrack::enabled();
|
| TEST_F(WebRtcLocalAudioTrackTest, DISABLED_DisableEnableAudioTrack) {
|
| EXPECT_CALL(*capturer_source_.get(), Start()).WillOnce(Return());
|
| + RTCMediaConstraints constraints;
|
| scoped_refptr<WebRtcLocalAudioTrack> track =
|
| - WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL);
|
| + WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL,
|
| + &constraints);
|
| track->Start();
|
| static_cast<webrtc::AudioTrackInterface*>(track.get())->
|
| GetRenderer()->AddChannel(0);
|
| @@ -257,8 +261,10 @@ TEST_F(WebRtcLocalAudioTrackTest, DISABLED_DisableEnableAudioTrack) {
|
| // callbacks appear/disappear.
|
| TEST_F(WebRtcLocalAudioTrackTest, MultipleAudioTracks) {
|
| EXPECT_CALL(*capturer_source_.get(), Start()).WillOnce(Return());
|
| + RTCMediaConstraints constraints;
|
| scoped_refptr<WebRtcLocalAudioTrack> track_1 =
|
| - WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL);
|
| + WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL,
|
| + &constraints);
|
| track_1->Start();
|
| static_cast<webrtc::AudioTrackInterface*>(track_1.get())->
|
| GetRenderer()->AddChannel(0);
|
| @@ -275,15 +281,15 @@ TEST_F(WebRtcLocalAudioTrackTest, MultipleAudioTracks) {
|
| params.frames_per_buffer(),
|
| 0,
|
| 0,
|
| - // TODO(tommi): Change to |false| when issue 277134 is fixed.
|
| - _,
|
| + false,
|
| false)).Times(AtLeast(1))
|
| .WillRepeatedly(SignalEvent(&event_1));
|
| track_1->AddSink(sink_1.get());
|
| EXPECT_TRUE(event_1.TimedWait(TestTimeouts::tiny_timeout()));
|
|
|
| scoped_refptr<WebRtcLocalAudioTrack> track_2 =
|
| - WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL);
|
| + WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL,
|
| + &constraints);
|
| track_2->Start();
|
| static_cast<webrtc::AudioTrackInterface*>(track_2.get())->
|
| GetRenderer()->AddChannel(1);
|
| @@ -303,8 +309,7 @@ TEST_F(WebRtcLocalAudioTrackTest, MultipleAudioTracks) {
|
| params.frames_per_buffer(),
|
| 0,
|
| 0,
|
| - // TODO(tommi): Change to |false| when issue 277134 is fixed.
|
| - _,
|
| + false,
|
| false)).Times(AtLeast(1))
|
| .WillRepeatedly(SignalEvent(&event_1));
|
| EXPECT_CALL(*sink_2,
|
| @@ -314,8 +319,7 @@ TEST_F(WebRtcLocalAudioTrackTest, MultipleAudioTracks) {
|
| params.frames_per_buffer(),
|
| 0,
|
| 0,
|
| - // TODO(tommi): Change to |false| when issue 277134 is fixed.
|
| - _,
|
| + false,
|
| false)).Times(AtLeast(1))
|
| .WillRepeatedly(SignalEvent(&event_2));
|
| track_2->AddSink(sink_2.get());
|
| @@ -337,8 +341,10 @@ TEST_F(WebRtcLocalAudioTrackTest, MultipleAudioTracks) {
|
| // And it should be fine to not to call Stop() explicitly.
|
| TEST_F(WebRtcLocalAudioTrackTest, StartOneAudioTrack) {
|
| EXPECT_CALL(*capturer_source_.get(), Start()).Times(1);
|
| + RTCMediaConstraints constraints;
|
| scoped_refptr<WebRtcLocalAudioTrack> track =
|
| - WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL);
|
| + WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL,
|
| + &constraints);
|
| track->Start();
|
|
|
| // When the track goes away, it will automatically stop the
|
| @@ -354,8 +360,10 @@ TEST_F(WebRtcLocalAudioTrackTest, StartAndStopAudioTracks) {
|
| // Starting the first audio track will start the |capturer_source_|.
|
| base::WaitableEvent event(false, false);
|
| EXPECT_CALL(*capturer_source_.get(), Start()).WillOnce(SignalEvent(&event));
|
| + RTCMediaConstraints constraints;
|
| scoped_refptr<WebRtcLocalAudioTrack> track_1 =
|
| - WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL);
|
| + WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL,
|
| + &constraints);
|
| static_cast<webrtc::AudioTrackInterface*>(track_1.get())->
|
| GetRenderer()->AddChannel(0);
|
| track_1->Start();
|
| @@ -365,10 +373,7 @@ TEST_F(WebRtcLocalAudioTrackTest, StartAndStopAudioTracks) {
|
| scoped_ptr<MockWebRtcAudioCapturerSink> sink(
|
| new MockWebRtcAudioCapturerSink());
|
| event.Reset();
|
| - EXPECT_CALL(*sink, CaptureData(_, _, _, _, 0, 0,
|
| - // TODO(tommi): Change to |false| when issue 277134 is fixed.
|
| - _,
|
| - false))
|
| + EXPECT_CALL(*sink, CaptureData(_, _, _, _, 0, 0, false, false))
|
| .Times(AnyNumber()).WillRepeatedly(Return());
|
| EXPECT_CALL(*sink, SetCaptureFormat(_)).Times(1);
|
| track_1->AddSink(sink.get());
|
| @@ -377,7 +382,8 @@ TEST_F(WebRtcLocalAudioTrackTest, StartAndStopAudioTracks) {
|
| // since it has been started.
|
| EXPECT_CALL(*capturer_source_.get(), Start()).Times(0);
|
| scoped_refptr<WebRtcLocalAudioTrack> track_2 =
|
| - WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL);
|
| + WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL,
|
| + &constraints);
|
| track_2->Start();
|
| static_cast<webrtc::AudioTrackInterface*>(track_2.get())->
|
| GetRenderer()->AddChannel(1);
|
| @@ -407,8 +413,10 @@ TEST_F(WebRtcLocalAudioTrackTest, StartAndStopAudioTracks) {
|
| TEST_F(WebRtcLocalAudioTrackTest, SetNewSourceForCapturerAfterStartTrack) {
|
| // Setup the audio track and start the track.
|
| EXPECT_CALL(*capturer_source_.get(), Start()).Times(1);
|
| + RTCMediaConstraints constraints;
|
| scoped_refptr<WebRtcLocalAudioTrack> track =
|
| - WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL);
|
| + WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL,
|
| + &constraints);
|
| track->Start();
|
|
|
| // Setting new source to the capturer and the track should still get packets.
|
| @@ -432,8 +440,10 @@ TEST_F(WebRtcLocalAudioTrackTest, SetNewSourceForCapturerAfterStartTrack) {
|
| TEST_F(WebRtcLocalAudioTrackTest, ConnectTracksToDifferentCapturers) {
|
| // Setup the first audio track and start it.
|
| EXPECT_CALL(*capturer_source_.get(), Start()).Times(1);
|
| + RTCMediaConstraints constraints;
|
| scoped_refptr<WebRtcLocalAudioTrack> track_1 =
|
| - WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL);
|
| + WebRtcLocalAudioTrack::Create(std::string(), capturer_, NULL,
|
| + &constraints);
|
| track_1->Start();
|
|
|
| // Connect a number of network channels to the |track_1|.
|
| @@ -448,10 +458,7 @@ TEST_F(WebRtcLocalAudioTrackTest, ConnectTracksToDifferentCapturers) {
|
| EXPECT_CALL(
|
| *sink_1.get(),
|
| CaptureData(
|
| - kNumberOfNetworkChannelsForTrack1, 48000, 2, _, 0, 0,
|
| - // TODO(tommi): Change to |false| when issue 277134 is fixed.
|
| - _,
|
| - false))
|
| + kNumberOfNetworkChannelsForTrack1, 48000, 2, _, 0, 0, false, false))
|
| .Times(AnyNumber()).WillRepeatedly(Return());
|
| EXPECT_CALL(*sink_1.get(), SetCaptureFormat(_)).Times(1);
|
| track_1->AddSink(sink_1.get());
|
| @@ -475,7 +482,8 @@ TEST_F(WebRtcLocalAudioTrackTest, ConnectTracksToDifferentCapturers) {
|
| // Setup the second audio track, connect it to the new capturer and start it.
|
| EXPECT_CALL(*new_source.get(), Start()).Times(1);
|
| scoped_refptr<WebRtcLocalAudioTrack> track_2 =
|
| - WebRtcLocalAudioTrack::Create(std::string(), new_capturer, NULL);
|
| + WebRtcLocalAudioTrack::Create(std::string(), new_capturer, NULL,
|
| + &constraints);
|
| track_2->Start();
|
|
|
| // Connect a number of network channels to the |track_2|.
|
|
|