Chromium Code Reviews| 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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 616 EXPECT_EQ(blink::WebSourceInfo::VideoFacingModeEnvironment, source->facing()); | 616 EXPECT_EQ(blink::WebSourceInfo::VideoFacingModeEnvironment, source->facing()); |
| 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. |
|
hta - Chromium
2016/05/08 11:45:33
can you add a comment here as to why it's currentl
| |
| 627 MockConstraintFactory factory; | 627 MockConstraintFactory factory; |
| 628 blink::WebMediaConstraints audio_constraints = | 628 blink::WebMediaConstraints audio_constraints = |
| 629 factory.CreateWebMediaConstraints(); | 629 factory.CreateWebMediaConstraints(); |
| 630 EXPECT_TRUE(AudioRequestHasAutomaticDeviceSelection( | 630 EXPECT_FALSE(AudioRequestHasAutomaticDeviceSelection( |
| 631 factory.CreateWebMediaConstraints())); | 631 factory.CreateWebMediaConstraints())); |
| 632 | 632 |
| 633 // If the constraint is present, it should dictate the result. | 633 // If the constraint is present, it should dictate the result. |
| 634 factory.Reset(); | 634 factory.Reset(); |
| 635 factory.AddAdvanced().renderToAssociatedSink.setExact(true); | 635 factory.AddAdvanced().renderToAssociatedSink.setExact(true); |
| 636 EXPECT_TRUE(AudioRequestHasAutomaticDeviceSelection( | 636 EXPECT_TRUE(AudioRequestHasAutomaticDeviceSelection( |
| 637 factory.CreateWebMediaConstraints())); | 637 factory.CreateWebMediaConstraints())); |
| 638 | 638 |
| 639 factory.Reset(); | 639 factory.Reset(); |
| 640 factory.AddAdvanced().renderToAssociatedSink.setExact(false); | 640 factory.AddAdvanced().renderToAssociatedSink.setExact(false); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 678 // Now we close the web frame, if in the above Stop() call, | 678 // Now we close the web frame, if in the above Stop() call, |
| 679 // UserMediaClientImpl accidentally removed audio track, then video track will | 679 // UserMediaClientImpl accidentally removed audio track, then video track will |
| 680 // be removed again here, which is incorrect. | 680 // be removed again here, which is incorrect. |
| 681 used_media_impl_->FrameWillClose(); | 681 used_media_impl_->FrameWillClose(); |
| 682 blink::WebHeap::collectAllGarbageForTesting(); | 682 blink::WebHeap::collectAllGarbageForTesting(); |
| 683 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); | 683 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); |
| 684 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); | 684 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); |
| 685 } | 685 } |
| 686 | 686 |
| 687 } // namespace content | 687 } // namespace content |
| OLD | NEW |