| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" | 5 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" |
| 6 #include "content/renderer/media/webrtc_local_audio_track.h" | 6 #include "content/renderer/media/webrtc_local_audio_track.h" |
| 7 #include "testing/gmock/include/gmock/gmock.h" | 7 #include "testing/gmock/include/gmock/gmock.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 9 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 class WebRtcLocalAudioTrackAdapterTest : public ::testing::Test { | 31 class WebRtcLocalAudioTrackAdapterTest : public ::testing::Test { |
| 32 public: | 32 public: |
| 33 WebRtcLocalAudioTrackAdapterTest() | 33 WebRtcLocalAudioTrackAdapterTest() |
| 34 : params_(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, | 34 : params_(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 35 media::CHANNEL_LAYOUT_STEREO, 48000, 16, 480), | 35 media::CHANNEL_LAYOUT_STEREO, 48000, 16, 480), |
| 36 adapter_(WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)), | 36 adapter_(WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)), |
| 37 capturer_(WebRtcAudioCapturer::CreateCapturer( | 37 capturer_(WebRtcAudioCapturer::CreateCapturer( |
| 38 -1, StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "", ""), | 38 -1, StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "", ""), |
| 39 blink::WebMediaConstraints(), NULL)), | 39 blink::WebMediaConstraints(), NULL, NULL)), |
| 40 track_(new WebRtcLocalAudioTrack(adapter_, capturer_, NULL)) {} | 40 track_(new WebRtcLocalAudioTrack(adapter_, capturer_, NULL)) {} |
| 41 | 41 |
| 42 protected: | 42 protected: |
| 43 virtual void SetUp() OVERRIDE { | 43 virtual void SetUp() OVERRIDE { |
| 44 static_cast<WebRtcLocalAudioSourceProvider*>( | 44 static_cast<WebRtcLocalAudioSourceProvider*>( |
| 45 track_->audio_source_provider())->SetSinkParamsForTesting(params_); | 45 track_->audio_source_provider())->SetSinkParamsForTesting(params_); |
| 46 track_->OnSetFormat(params_); | 46 track_->OnSetFormat(params_); |
| 47 EXPECT_TRUE(track_->GetAudioAdapter()->enabled()); | 47 EXPECT_TRUE(track_->GetAudioAdapter()->enabled()); |
| 48 } | 48 } |
| 49 | 49 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 75 | 75 |
| 76 // Remove the sink from the webrtc track. | 76 // Remove the sink from the webrtc track. |
| 77 webrtc_track->RemoveSink(sink.get()); | 77 webrtc_track->RemoveSink(sink.get()); |
| 78 sink.reset(); | 78 sink.reset(); |
| 79 | 79 |
| 80 // Verify that no more callback gets into the sink. | 80 // Verify that no more callback gets into the sink. |
| 81 track_->Capture(data.get(), base::TimeDelta(), 255, false, false); | 81 track_->Capture(data.get(), base::TimeDelta(), 255, false, false); |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace content | 84 } // namespace content |
| OLD | NEW |