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

Side by Side Diff: content/renderer/media/webrtc/processed_local_audio_source_unittest.cc

Issue 2416123002: Stop media stream source when audio capture error occurs. (Closed)
Patch Set: Fix unit tests. Created 4 years, 2 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
OLDNEW
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
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:
140 MockAudioDeviceFactory mock_audio_device_factory_; 141 MockAudioDeviceFactory mock_audio_device_factory_;
141 MockPeerConnectionDependencyFactory mock_dependency_factory_; 142 MockPeerConnectionDependencyFactory mock_dependency_factory_;
142 blink::WebMediaStreamSource blink_audio_source_; 143 blink::WebMediaStreamSource blink_audio_source_;
143 blink::WebMediaStreamTrack blink_audio_track_; 144 blink::WebMediaStreamTrack blink_audio_track_;
145 base::MessageLoop message_loop_;
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.
150 TEST_F(ProcessedLocalAudioSourceTest, VerifyAudioFlowWithoutAudioProcessing) { 152 TEST_F(ProcessedLocalAudioSourceTest, VerifyAudioFlowWithoutAudioProcessing) {
151 using ThisTest = 153 using ThisTest =
152 ProcessedLocalAudioSourceTest_VerifyAudioFlowWithoutAudioProcessing_Test; 154 ProcessedLocalAudioSourceTest_VerifyAudioFlowWithoutAudioProcessing_Test;
153 155
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698