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_F(MediaStreamDispatcherHostTest, GenerateStreamWithDepthVideo) { | |
473 // Video device on index 1 is depth video capture device. | |
mcasas
2017/01/11 23:18:20
Because of the '<=' in FakeVCDFactory, this commen
aleksandar.stojiljkovic
2017/01/12 14:13:59
I added more comments to this method, explaining 2
| |
474 physical_video_devices_.clear(); | |
475 video_capture_device_factory_->set_number_of_devices(2); | |
476 video_capture_device_factory_->GetDeviceDescriptors(&physical_video_devices_); | |
477 StreamControls controls(true, true); | |
478 std::string source_id = content::GetHMACForMediaDeviceID( | |
479 browser_context_.GetResourceContext()->GetMediaDeviceIDSalt(), origin_, | |
480 physical_video_devices_[1].device_id); | |
481 controls.video.device_id = source_id; | |
482 | |
483 SetupFakeUI(true); | |
484 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls); | |
485 | |
486 EXPECT_EQ(host_->audio_devices_.size(), 1u); | |
487 EXPECT_EQ(host_->video_devices_.size(), 1u); | |
488 const base::Optional<CameraCalibration> calibration = | |
489 host_->video_devices_[0].device.camera_calibration; | |
490 EXPECT_TRUE(calibration); | |
491 EXPECT_EQ(calibration->focal_length_x, 135.0); | |
492 EXPECT_EQ(calibration->focal_length_y, 135.6); | |
493 EXPECT_EQ(calibration->depth_near, 0.0); | |
494 EXPECT_EQ(calibration->depth_far, 65.535); | |
495 } | |
496 | |
472 // This test generates two streams with video only using the same render frame | 497 // 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 | 498 // id. The same capture device with the same device and session id is expected |
474 // to be used. | 499 // to be used. |
475 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsFromSameRenderId) { | 500 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsFromSameRenderId) { |
476 StreamControls controls(false, true); | 501 StreamControls controls(false, true); |
477 | 502 |
478 // Generate first stream. | 503 // Generate first stream. |
479 SetupFakeUI(true); | 504 SetupFakeUI(true); |
480 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls); | 505 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls); |
481 | 506 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
807 base::RunLoop run_loop; | 832 base::RunLoop run_loop; |
808 EXPECT_CALL(*host_.get(), OnDeviceStopped(kRenderId)) | 833 EXPECT_CALL(*host_.get(), OnDeviceStopped(kRenderId)) |
809 .WillOnce(testing::InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 834 .WillOnce(testing::InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
810 media_stream_manager_->media_devices_manager()->OnDevicesChanged( | 835 media_stream_manager_->media_devices_manager()->OnDevicesChanged( |
811 base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE); | 836 base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE); |
812 | 837 |
813 run_loop.Run(); | 838 run_loop.Run(); |
814 } | 839 } |
815 | 840 |
816 }; // namespace content | 841 }; // namespace content |
OLD | NEW |