OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/user_media_client_impl.h" | 5 #include "content/renderer/media/user_media_client_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 277 |
278 static void SignalSourceReady( | 278 static void SignalSourceReady( |
279 const MediaStreamSource::ConstraintsCallback& source_ready, | 279 const MediaStreamSource::ConstraintsCallback& source_ready, |
280 MediaStreamSource* source) { | 280 MediaStreamSource* source) { |
281 source_ready.Run(source, MEDIA_DEVICE_OK, ""); | 281 source_ready.Run(source, MEDIA_DEVICE_OK, ""); |
282 } | 282 } |
283 | 283 |
284 MediaStreamAudioSource* CreateAudioSource( | 284 MediaStreamAudioSource* CreateAudioSource( |
285 const StreamDeviceInfo& device, | 285 const StreamDeviceInfo& device, |
286 const blink::WebMediaConstraints& constraints, | 286 const blink::WebMediaConstraints& constraints, |
287 const MediaStreamSource::ConstraintsCallback& source_ready) override { | 287 const MediaStreamSource::ConstraintsCallback& source_ready, |
| 288 bool* has_sw_echo_cancellation) override { |
288 MediaStreamAudioSource* source; | 289 MediaStreamAudioSource* source; |
289 if (create_source_that_fails_) { | 290 if (create_source_that_fails_) { |
290 class FailedAtLifeAudioSource : public MediaStreamAudioSource { | 291 class FailedAtLifeAudioSource : public MediaStreamAudioSource { |
291 public: | 292 public: |
292 FailedAtLifeAudioSource() : MediaStreamAudioSource(true) {} | 293 FailedAtLifeAudioSource() : MediaStreamAudioSource(true) {} |
293 ~FailedAtLifeAudioSource() override {} | 294 ~FailedAtLifeAudioSource() override {} |
294 protected: | 295 protected: |
295 bool EnsureSourceIsStarted() override { | 296 bool EnsureSourceIsStarted() override { |
296 return false; | 297 return false; |
297 } | 298 } |
298 }; | 299 }; |
299 source = new FailedAtLifeAudioSource(); | 300 source = new FailedAtLifeAudioSource(); |
300 } else { | 301 } else { |
301 source = new MediaStreamAudioSource(true); | 302 source = new MediaStreamAudioSource(true); |
302 } | 303 } |
303 source->SetDeviceInfo(device); | 304 source->SetDeviceInfo(device); |
304 | 305 |
305 if (!create_source_that_fails_) { | 306 if (!create_source_that_fails_) { |
306 // RunUntilIdle is required for this task to complete. | 307 // RunUntilIdle is required for this task to complete. |
307 base::ThreadTaskRunnerHandle::Get()->PostTask( | 308 base::ThreadTaskRunnerHandle::Get()->PostTask( |
308 FROM_HERE, | 309 FROM_HERE, |
309 base::Bind(&UserMediaClientImplUnderTest::SignalSourceReady, | 310 base::Bind(&UserMediaClientImplUnderTest::SignalSourceReady, |
310 source_ready, source)); | 311 source_ready, source)); |
311 } | 312 } |
312 | 313 |
| 314 *has_sw_echo_cancellation = false; |
313 return source; | 315 return source; |
314 } | 316 } |
315 | 317 |
316 MediaStreamVideoSource* CreateVideoSource( | 318 MediaStreamVideoSource* CreateVideoSource( |
317 const StreamDeviceInfo& device, | 319 const StreamDeviceInfo& device, |
318 const MediaStreamSource::SourceStoppedCallback& stop_callback) override { | 320 const MediaStreamSource::SourceStoppedCallback& stop_callback) override { |
319 video_source_ = new MockMediaStreamVideoCapturerSource(device, | 321 video_source_ = new MockMediaStreamVideoCapturerSource(device, |
320 stop_callback, | 322 stop_callback, |
321 factory_); | 323 factory_); |
322 return video_source_; | 324 return video_source_; |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 TestValidRequestWithConstraints(audio_constraints, video_constraints, | 1242 TestValidRequestWithConstraints(audio_constraints, video_constraints, |
1241 kFakeAudioInputDeviceId1, | 1243 kFakeAudioInputDeviceId1, |
1242 kFakeVideoInputDeviceId2); | 1244 kFakeVideoInputDeviceId2); |
1243 } | 1245 } |
1244 | 1246 |
1245 INSTANTIATE_TEST_CASE_P(, | 1247 INSTANTIATE_TEST_CASE_P(, |
1246 UserMediaClientImplTest, | 1248 UserMediaClientImplTest, |
1247 testing::Values(true, false)); | 1249 testing::Values(true, false)); |
1248 | 1250 |
1249 } // namespace content | 1251 } // namespace content |
OLD | NEW |