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/browser/renderer_host/media/media_stream_dispatcher_host.h" | 5 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <memory> | 8 #include <memory> |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithAudioAndVideo) { | 462 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithAudioAndVideo) { |
463 StreamControls controls(true, true); | 463 StreamControls controls(true, true); |
464 | 464 |
465 SetupFakeUI(true); | 465 SetupFakeUI(true); |
466 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls); | 466 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls); |
467 | 467 |
468 EXPECT_EQ(host_->audio_devices_.size(), 1u); | 468 EXPECT_EQ(host_->audio_devices_.size(), 1u); |
469 EXPECT_EQ(host_->video_devices_.size(), 1u); | 469 EXPECT_EQ(host_->video_devices_.size(), 1u); |
470 } | 470 } |
471 | 471 |
| 472 // Test that we generate video stream when video kind is specified. |
| 473 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamFromVideoKind) { |
| 474 StreamControls controls(false, true); |
| 475 controls.video_kind = VIDEO_KIND_COLOR; |
| 476 |
| 477 // Fake capture has one color capture device and doesn't have a depth device. |
| 478 SetupFakeUI(true); |
| 479 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls); |
| 480 |
| 481 EXPECT_EQ(host_->audio_devices_.size(), 0u); |
| 482 EXPECT_EQ(host_->video_devices_.size(), 1u); |
| 483 |
| 484 controls.video_kind = VIDEO_KIND_DEPTH; |
| 485 GenerateStreamAndWaitForFailure(kRenderId, kPageRequestId, controls, |
| 486 MEDIA_DEVICE_NO_HARDWARE); |
| 487 } |
| 488 |
472 // This test generates two streams with video only using the same render frame | 489 // This test generates two streams with video only using the same render frame |
473 // id. The same capture device with the same device and session id is expected | 490 // id. The same capture device with the same device and session id is expected |
474 // to be used. | 491 // to be used. |
475 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsFromSameRenderId) { | 492 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsFromSameRenderId) { |
476 StreamControls controls(false, true); | 493 StreamControls controls(false, true); |
477 | 494 |
478 // Generate first stream. | 495 // Generate first stream. |
479 SetupFakeUI(true); | 496 SetupFakeUI(true); |
480 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls); | 497 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls); |
481 | 498 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 base::RunLoop run_loop; | 824 base::RunLoop run_loop; |
808 EXPECT_CALL(*host_.get(), OnDeviceStopped(kRenderId)) | 825 EXPECT_CALL(*host_.get(), OnDeviceStopped(kRenderId)) |
809 .WillOnce(testing::InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 826 .WillOnce(testing::InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
810 media_stream_manager_->media_devices_manager()->OnDevicesChanged( | 827 media_stream_manager_->media_devices_manager()->OnDevicesChanged( |
811 base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE); | 828 base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE); |
812 | 829 |
813 run_loop.Run(); | 830 run_loop.Run(); |
814 } | 831 } |
815 | 832 |
816 }; // namespace content | 833 }; // namespace content |
OLD | NEW |