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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithAudioAndVideo) { | 469 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithAudioAndVideo) { |
470 StreamControls controls(true, true); | 470 StreamControls controls(true, true); |
471 | 471 |
472 SetupFakeUI(true); | 472 SetupFakeUI(true); |
473 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls); | 473 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls); |
474 | 474 |
475 EXPECT_EQ(host_->audio_devices_.size(), 1u); | 475 EXPECT_EQ(host_->audio_devices_.size(), 1u); |
476 EXPECT_EQ(host_->video_devices_.size(), 1u); | 476 EXPECT_EQ(host_->video_devices_.size(), 1u); |
477 } | 477 } |
478 | 478 |
| 479 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithDepthVideo) { |
| 480 // Video device on index 1 is depth video capture device. |
| 481 physical_video_devices_.clear(); |
| 482 video_capture_device_factory_->set_number_of_devices(2); |
| 483 video_capture_device_factory_->GetDeviceDescriptors(&physical_video_devices_); |
| 484 StreamControls controls(true, true); |
| 485 std::string source_id = content::GetHMACForMediaDeviceID( |
| 486 browser_context_.GetResourceContext()->GetMediaDeviceIDSalt(), origin_, |
| 487 physical_video_devices_[1].device_id); |
| 488 controls.video.device_id = source_id; |
| 489 |
| 490 SetupFakeUI(true); |
| 491 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls); |
| 492 |
| 493 EXPECT_EQ(host_->audio_devices_.size(), 1u); |
| 494 EXPECT_EQ(host_->video_devices_.size(), 1u); |
| 495 const MediaStreamDevice::CameraCalibration& calibration = |
| 496 host_->video_devices_[0].device.camera_calibration; |
| 497 EXPECT_TRUE(calibration.valid); |
| 498 EXPECT_EQ(calibration.focal_length_x, 135.0); |
| 499 EXPECT_EQ(calibration.focal_length_y, 135.6); |
| 500 EXPECT_EQ(calibration.depth_near, 0.0); |
| 501 EXPECT_EQ(calibration.depth_far, 65.535); |
| 502 } |
| 503 |
479 // This test generates two streams with video only using the same render frame | 504 // This test generates two streams with video only using the same render frame |
480 // id. The same capture device with the same device and session id is expected | 505 // id. The same capture device with the same device and session id is expected |
481 // to be used. | 506 // to be used. |
482 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsFromSameRenderId) { | 507 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsFromSameRenderId) { |
483 StreamControls controls(false, true); | 508 StreamControls controls(false, true); |
484 | 509 |
485 // Generate first stream. | 510 // Generate first stream. |
486 SetupFakeUI(true); | 511 SetupFakeUI(true); |
487 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls); | 512 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls); |
488 | 513 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 base::RunLoop run_loop; | 839 base::RunLoop run_loop; |
815 EXPECT_CALL(*host_.get(), OnDeviceStopped(kRenderId)) | 840 EXPECT_CALL(*host_.get(), OnDeviceStopped(kRenderId)) |
816 .WillOnce(testing::InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 841 .WillOnce(testing::InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
817 media_stream_manager_->media_devices_manager()->OnDevicesChanged( | 842 media_stream_manager_->media_devices_manager()->OnDevicesChanged( |
818 base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE); | 843 base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE); |
819 | 844 |
820 run_loop.Run(); | 845 run_loop.Run(); |
821 } | 846 } |
822 | 847 |
823 }; // namespace content | 848 }; // namespace content |
OLD | NEW |