| 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/mock_media_constraint_factory.h" |
| 5 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" | 6 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" |
| 6 #include "content/renderer/media/webrtc_local_audio_track.h" | 7 #include "content/renderer/media/webrtc_local_audio_track.h" |
| 7 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 10 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
| 10 | 11 |
| 11 using ::testing::_; | 12 using ::testing::_; |
| 12 using ::testing::AnyNumber; | 13 using ::testing::AnyNumber; |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 26 int number_of_frames)); | 27 int number_of_frames)); |
| 27 }; | 28 }; |
| 28 | 29 |
| 29 } // namespace | 30 } // namespace |
| 30 | 31 |
| 31 class WebRtcLocalAudioTrackAdapterTest : public ::testing::Test { | 32 class WebRtcLocalAudioTrackAdapterTest : public ::testing::Test { |
| 32 public: | 33 public: |
| 33 WebRtcLocalAudioTrackAdapterTest() | 34 WebRtcLocalAudioTrackAdapterTest() |
| 34 : params_(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, | 35 : params_(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 35 media::CHANNEL_LAYOUT_STEREO, 48000, 16, 480), | 36 media::CHANNEL_LAYOUT_STEREO, 48000, 16, 480), |
| 36 adapter_(WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)), | 37 adapter_(WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)) { |
| 37 capturer_(WebRtcAudioCapturer::CreateCapturer( | 38 MockMediaConstraintFactory constraint_factory; |
| 38 -1, StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "", ""), | 39 capturer_ = WebRtcAudioCapturer::CreateCapturer( |
| 39 blink::WebMediaConstraints(), NULL)), | 40 -1, StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "", ""), |
| 40 track_(new WebRtcLocalAudioTrack(adapter_, capturer_, NULL)) {} | 41 constraint_factory.CreateWebMediaConstraints(), NULL); |
| 42 track_.reset(new WebRtcLocalAudioTrack(adapter_, capturer_, NULL)); |
| 43 } |
| 41 | 44 |
| 42 protected: | 45 protected: |
| 43 virtual void SetUp() OVERRIDE { | 46 virtual void SetUp() OVERRIDE { |
| 44 track_->OnSetFormat(params_); | 47 track_->OnSetFormat(params_); |
| 45 EXPECT_TRUE(track_->GetAudioAdapter()->enabled()); | 48 EXPECT_TRUE(track_->GetAudioAdapter()->enabled()); |
| 46 } | 49 } |
| 47 | 50 |
| 48 media::AudioParameters params_; | 51 media::AudioParameters params_; |
| 49 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_; | 52 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter_; |
| 50 scoped_refptr<WebRtcAudioCapturer> capturer_; | 53 scoped_refptr<WebRtcAudioCapturer> capturer_; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 73 | 76 |
| 74 // Remove the sink from the webrtc track. | 77 // Remove the sink from the webrtc track. |
| 75 webrtc_track->RemoveSink(sink.get()); | 78 webrtc_track->RemoveSink(sink.get()); |
| 76 sink.reset(); | 79 sink.reset(); |
| 77 | 80 |
| 78 // Verify that no more callback gets into the sink. | 81 // Verify that no more callback gets into the sink. |
| 79 track_->Capture(data.get(), base::TimeDelta(), 255, false, false); | 82 track_->Capture(data.get(), base::TimeDelta(), 255, false, false); |
| 80 } | 83 } |
| 81 | 84 |
| 82 } // namespace content | 85 } // namespace content |
| OLD | NEW |