| 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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 } | 617 } |
| 618 | 618 |
| 619 TEST_F(UserMediaClientImplTest, RenderToAssociatedSinkConstraint) { | 619 TEST_F(UserMediaClientImplTest, RenderToAssociatedSinkConstraint) { |
| 620 // For a null UserMediaRequest (no audio requested), we expect false. | 620 // For a null UserMediaRequest (no audio requested), we expect false. |
| 621 used_media_impl_->RequestUserMedia(); | 621 used_media_impl_->RequestUserMedia(); |
| 622 EXPECT_FALSE(used_media_impl_->UserMediaRequestHasAutomaticDeviceSelection( | 622 EXPECT_FALSE(used_media_impl_->UserMediaRequestHasAutomaticDeviceSelection( |
| 623 ms_dispatcher_->audio_input_request_id())); | 623 ms_dispatcher_->audio_input_request_id())); |
| 624 used_media_impl_->DeleteRequest(ms_dispatcher_->audio_input_request_id()); | 624 used_media_impl_->DeleteRequest(ms_dispatcher_->audio_input_request_id()); |
| 625 | 625 |
| 626 // If audio is requested, but no constraint, it should be true. | 626 // If audio is requested, but no constraint, it should be true. |
| 627 // Currently we expect it to be false due to a suspected bug in the |
| 628 // device-matching code causing issues with some sound adapters. |
| 629 // See crbug.com/604523 |
| 627 MockConstraintFactory factory; | 630 MockConstraintFactory factory; |
| 628 blink::WebMediaConstraints audio_constraints = | 631 blink::WebMediaConstraints audio_constraints = |
| 629 factory.CreateWebMediaConstraints(); | 632 factory.CreateWebMediaConstraints(); |
| 630 EXPECT_FALSE(AudioRequestHasAutomaticDeviceSelection( | 633 EXPECT_FALSE(AudioRequestHasAutomaticDeviceSelection( |
| 631 factory.CreateWebMediaConstraints())); | 634 factory.CreateWebMediaConstraints())); |
| 632 | 635 |
| 633 // If the constraint is present, it should dictate the result. | 636 // If the constraint is present, it should dictate the result. |
| 634 factory.Reset(); | 637 factory.Reset(); |
| 635 factory.AddAdvanced().renderToAssociatedSink.setExact(true); | 638 factory.AddAdvanced().renderToAssociatedSink.setExact(true); |
| 636 EXPECT_TRUE(AudioRequestHasAutomaticDeviceSelection( | 639 EXPECT_TRUE(AudioRequestHasAutomaticDeviceSelection( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 // Now we close the web frame, if in the above Stop() call, | 681 // Now we close the web frame, if in the above Stop() call, |
| 679 // UserMediaClientImpl accidentally removed audio track, then video track will | 682 // UserMediaClientImpl accidentally removed audio track, then video track will |
| 680 // be removed again here, which is incorrect. | 683 // be removed again here, which is incorrect. |
| 681 used_media_impl_->FrameWillClose(); | 684 used_media_impl_->FrameWillClose(); |
| 682 blink::WebHeap::collectAllGarbageForTesting(); | 685 blink::WebHeap::collectAllGarbageForTesting(); |
| 683 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); | 686 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); |
| 684 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); | 687 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); |
| 685 } | 688 } |
| 686 | 689 |
| 687 } // namespace content | 690 } // namespace content |
| OLD | NEW |