| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" |
| 9 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 10 #include "content/public/renderer/media_stream_audio_sink.h" | 11 #include "content/public/renderer/media_stream_audio_sink.h" |
| 11 #include "content/renderer/media/media_stream_audio_track.h" | 12 #include "content/renderer/media/media_stream_audio_track.h" |
| 12 #include "content/renderer/media/mock_audio_device_factory.h" | 13 #include "content/renderer/media/mock_audio_device_factory.h" |
| 13 #include "content/renderer/media/mock_constraint_factory.h" | 14 #include "content/renderer/media/mock_constraint_factory.h" |
| 14 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.
h" | 15 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.
h" |
| 15 #include "content/renderer/media/webrtc/processed_local_audio_source.h" | 16 #include "content/renderer/media/webrtc/processed_local_audio_source.h" |
| 16 #include "media/base/audio_bus.h" | 17 #include "media/base/audio_bus.h" |
| 17 #include "media/base/audio_parameters.h" | 18 #include "media/base/audio_parameters.h" |
| 18 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 131 |
| 131 MediaStreamAudioSource* audio_source() const { | 132 MediaStreamAudioSource* audio_source() const { |
| 132 return MediaStreamAudioSource::From(blink_audio_source_); | 133 return MediaStreamAudioSource::From(blink_audio_source_); |
| 133 } | 134 } |
| 134 | 135 |
| 135 const blink::WebMediaStreamTrack& blink_audio_track() { | 136 const blink::WebMediaStreamTrack& blink_audio_track() { |
| 136 return blink_audio_track_; | 137 return blink_audio_track_; |
| 137 } | 138 } |
| 138 | 139 |
| 139 private: | 140 private: |
| 141 base::MessageLoop main_thread_message_loop_; // Needed for MSAudioProcessor. |
| 140 MockAudioDeviceFactory mock_audio_device_factory_; | 142 MockAudioDeviceFactory mock_audio_device_factory_; |
| 141 MockPeerConnectionDependencyFactory mock_dependency_factory_; | 143 MockPeerConnectionDependencyFactory mock_dependency_factory_; |
| 142 blink::WebMediaStreamSource blink_audio_source_; | 144 blink::WebMediaStreamSource blink_audio_source_; |
| 143 blink::WebMediaStreamTrack blink_audio_track_; | 145 blink::WebMediaStreamTrack blink_audio_track_; |
| 144 }; | 146 }; |
| 145 | 147 |
| 146 // Tests a basic end-to-end start-up, track+sink connections, audio flow, and | 148 // Tests a basic end-to-end start-up, track+sink connections, audio flow, and |
| 147 // shut-down. The unit tests in media_stream_audio_unittest.cc provide more | 149 // shut-down. The unit tests in media_stream_audio_unittest.cc provide more |
| 148 // comprehensive testing of the object graph connections and multi-threading | 150 // comprehensive testing of the object graph connections and multi-threading |
| 149 // concerns. | 151 // concerns. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 // Even though ConnectToTrack() failed, there should still have been a new | 222 // Even though ConnectToTrack() failed, there should still have been a new |
| 221 // MediaStreamAudioTrack instance created, owned by the | 223 // MediaStreamAudioTrack instance created, owned by the |
| 222 // blink::WebMediaStreamTrack. | 224 // blink::WebMediaStreamTrack. |
| 223 EXPECT_TRUE(MediaStreamAudioTrack::From(blink_audio_track())); | 225 EXPECT_TRUE(MediaStreamAudioTrack::From(blink_audio_track())); |
| 224 } | 226 } |
| 225 | 227 |
| 226 // TODO(miu): There's a lot of logic in ProcessedLocalAudioSource around | 228 // TODO(miu): There's a lot of logic in ProcessedLocalAudioSource around |
| 227 // constraints processing and validation that should have unit testing. | 229 // constraints processing and validation that should have unit testing. |
| 228 | 230 |
| 229 } // namespace content | 231 } // namespace content |
| OLD | NEW |