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

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

Issue 2425353002: Data race fix: Replace use of MessageLoop raw pointer in MSAudioProcessor. (Closed)
Patch Set: Fix unit tests: They all need a MessageLoop instantiated. 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
« no previous file with comments | « content/renderer/media/media_stream_audio_processor_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
« no previous file with comments | « content/renderer/media/media_stream_audio_processor_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698