Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(557)

Side by Side Diff: content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc

Issue 2606983002: Media Capture Depth Stream Extensions API: focal length and depth range. (Closed)
Patch Set: 80-char line fix in test html. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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. The number of fake
474 // devices is 2.
475 physical_video_devices_.clear();
476 video_capture_device_factory_->set_number_of_devices(2);
477 video_capture_device_factory_->GetDeviceDescriptors(&physical_video_devices_);
478 // We specify to generate both audio and video stream.
479 StreamControls controls(true, true);
480 std::string source_id = content::GetHMACForMediaDeviceID(
481 browser_context_.GetResourceContext()->GetMediaDeviceIDSalt(), origin_,
482 physical_video_devices_[1].device_id);
483 // |source_id| is related to depth device (the device on index 1). As we can
484 // generate only one video stream using GenerateStreamAndWaitForResult, we
485 // use controls.video.source_id to specify that the stream is depth video.
486 // See also MediaStreamManager::GenerateStream and other tests here.
487 controls.video.device_id = source_id;
488
489 SetupFakeUI(true);
490 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls);
491
492 // There are two fake devices. We specified the generation and expect to get
493 // one audio and one depth video stream.
494 EXPECT_EQ(host_->audio_devices_.size(), 1u);
495 EXPECT_EQ(host_->video_devices_.size(), 1u);
496 // host_->video_devices_[0] contains the information about generated video
497 // stream device (the depth device).
498 const base::Optional<CameraCalibration> calibration =
499 host_->video_devices_[0].device.camera_calibration;
500 EXPECT_TRUE(calibration);
501 EXPECT_EQ(calibration->focal_length_x, 135.0);
502 EXPECT_EQ(calibration->focal_length_y, 135.6);
503 EXPECT_EQ(calibration->depth_near, 0.0);
504 EXPECT_EQ(calibration->depth_far, 65.535);
505 }
506
472 // This test generates two streams with video only using the same render frame 507 // 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 508 // id. The same capture device with the same device and session id is expected
474 // to be used. 509 // to be used.
475 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsFromSameRenderId) { 510 TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsFromSameRenderId) {
476 StreamControls controls(false, true); 511 StreamControls controls(false, true);
477 512
478 // Generate first stream. 513 // Generate first stream.
479 SetupFakeUI(true); 514 SetupFakeUI(true);
480 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls); 515 GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls);
481 516
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 base::RunLoop run_loop; 842 base::RunLoop run_loop;
808 EXPECT_CALL(*host_.get(), OnDeviceStopped(kRenderId)) 843 EXPECT_CALL(*host_.get(), OnDeviceStopped(kRenderId))
809 .WillOnce(testing::InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); 844 .WillOnce(testing::InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
810 media_stream_manager_->media_devices_manager()->OnDevicesChanged( 845 media_stream_manager_->media_devices_manager()->OnDevicesChanged(
811 base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE); 846 base::SystemMonitor::DEVTYPE_VIDEO_CAPTURE);
812 847
813 run_loop.Run(); 848 run_loop.Run();
814 } 849 }
815 850
816 }; // namespace content 851 }; // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698