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 // Unit test for VideoCaptureManager. | 5 // Unit test for VideoCaptureManager. |
6 | 6 |
7 #include "content/browser/renderer_host/media/video_capture_manager.h" | 7 #include "content/browser/renderer_host/media/video_capture_manager.h" |
8 | 8 |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 MOCK_METHOD2(Opened, void(MediaStreamType, int)); | 144 MOCK_METHOD2(Opened, void(MediaStreamType, int)); |
145 MOCK_METHOD2(Closed, void(MediaStreamType, int)); | 145 MOCK_METHOD2(Closed, void(MediaStreamType, int)); |
146 MOCK_METHOD2(Aborted, void(MediaStreamType, int)); | 146 MOCK_METHOD2(Aborted, void(MediaStreamType, int)); |
147 }; // class MockMediaStreamProviderListener | 147 }; // class MockMediaStreamProviderListener |
148 | 148 |
149 // Needed as an input argument to StartCaptureForClient(). | 149 // Needed as an input argument to StartCaptureForClient(). |
150 class MockFrameObserver : public VideoCaptureControllerEventHandler { | 150 class MockFrameObserver : public VideoCaptureControllerEventHandler { |
151 public: | 151 public: |
152 MOCK_METHOD1(OnError, void(VideoCaptureControllerID id)); | 152 MOCK_METHOD1(OnError, void(VideoCaptureControllerID id)); |
| 153 MOCK_METHOD1(OnStarted, void(VideoCaptureControllerID id)); |
153 | 154 |
154 void OnBufferCreated(VideoCaptureControllerID id, | 155 void OnBufferCreated(VideoCaptureControllerID id, |
155 mojo::ScopedSharedBufferHandle handle, | 156 mojo::ScopedSharedBufferHandle handle, |
156 int length, int buffer_id) override {} | 157 int length, int buffer_id) override {} |
157 void OnBufferDestroyed(VideoCaptureControllerID id, int buffer_id) override {} | 158 void OnBufferDestroyed(VideoCaptureControllerID id, int buffer_id) override {} |
158 void OnBufferReady( | 159 void OnBufferReady( |
159 VideoCaptureControllerID id, | 160 VideoCaptureControllerID id, |
160 int buffer_id, | 161 int buffer_id, |
161 const media::mojom::VideoFrameInfoPtr& frame_info) override {} | 162 const media::mojom::VideoFrameInfoPtr& frame_info) override {} |
162 void OnEnded(VideoCaptureControllerID id) override {} | 163 void OnEnded(VideoCaptureControllerID id) override {} |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 private: | 296 private: |
296 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManagerTest); | 297 DISALLOW_COPY_AND_ASSIGN(VideoCaptureManagerTest); |
297 }; | 298 }; |
298 | 299 |
299 // Test cases | 300 // Test cases |
300 | 301 |
301 // Try to open, start, stop and close a device. | 302 // Try to open, start, stop and close a device. |
302 TEST_F(VideoCaptureManagerTest, CreateAndClose) { | 303 TEST_F(VideoCaptureManagerTest, CreateAndClose) { |
303 InSequence s; | 304 InSequence s; |
304 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)); | 305 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)); |
| 306 EXPECT_CALL(*frame_observer_, OnStarted(_)); |
305 EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, _)); | 307 EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, _)); |
306 | 308 |
307 int video_session_id = vcm_->Open(devices_.front()); | 309 int video_session_id = vcm_->Open(devices_.front()); |
308 VideoCaptureControllerID client_id = StartClient(video_session_id, true); | 310 VideoCaptureControllerID client_id = StartClient(video_session_id, true); |
309 | 311 |
310 StopClient(client_id); | 312 StopClient(client_id); |
311 vcm_->Close(video_session_id); | 313 vcm_->Close(video_session_id); |
312 | 314 |
313 // Wait to check callbacks before removing the listener. | 315 // Wait to check callbacks before removing the listener. |
314 base::RunLoop().RunUntilIdle(); | 316 base::RunLoop().RunUntilIdle(); |
315 vcm_->UnregisterListener(); | 317 vcm_->UnregisterListener(); |
316 } | 318 } |
317 | 319 |
318 TEST_F(VideoCaptureManagerTest, CreateAndCloseMultipleTimes) { | 320 TEST_F(VideoCaptureManagerTest, CreateAndCloseMultipleTimes) { |
319 InSequence s; | 321 InSequence s; |
320 for (int i = 1 ; i < 3 ; ++i) { | 322 for (int i = 1 ; i < 3 ; ++i) { |
321 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, i)); | 323 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, i)); |
| 324 EXPECT_CALL(*frame_observer_, OnStarted(_)); |
322 EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, i)); | 325 EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, i)); |
323 int video_session_id = vcm_->Open(devices_.front()); | 326 int video_session_id = vcm_->Open(devices_.front()); |
324 VideoCaptureControllerID client_id = StartClient(video_session_id, true); | 327 VideoCaptureControllerID client_id = StartClient(video_session_id, true); |
325 | 328 |
326 StopClient(client_id); | 329 StopClient(client_id); |
327 vcm_->Close(video_session_id); | 330 vcm_->Close(video_session_id); |
328 } | 331 } |
329 | 332 |
330 // Wait to check callbacks before removing the listener. | 333 // Wait to check callbacks before removing the listener. |
331 base::RunLoop().RunUntilIdle(); | 334 base::RunLoop().RunUntilIdle(); |
332 vcm_->UnregisterListener(); | 335 vcm_->UnregisterListener(); |
333 } | 336 } |
334 | 337 |
335 // Try to open, start, and abort a device. | 338 // Try to open, start, and abort a device. |
336 TEST_F(VideoCaptureManagerTest, CreateAndAbort) { | 339 TEST_F(VideoCaptureManagerTest, CreateAndAbort) { |
337 InSequence s; | 340 InSequence s; |
338 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)); | 341 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)); |
| 342 EXPECT_CALL(*frame_observer_, OnStarted(_)); |
339 EXPECT_CALL(*listener_, Aborted(MEDIA_DEVICE_VIDEO_CAPTURE, _)); | 343 EXPECT_CALL(*listener_, Aborted(MEDIA_DEVICE_VIDEO_CAPTURE, _)); |
340 | 344 |
341 int video_session_id = vcm_->Open(devices_.front()); | 345 int video_session_id = vcm_->Open(devices_.front()); |
342 VideoCaptureControllerID client_id = StartClient(video_session_id, true); | 346 VideoCaptureControllerID client_id = StartClient(video_session_id, true); |
343 | 347 |
344 // Wait for device opened. | 348 // Wait for device opened. |
345 base::RunLoop().RunUntilIdle(); | 349 base::RunLoop().RunUntilIdle(); |
346 | 350 |
347 vcm_->StopCaptureForClient(controllers_[client_id], client_id, | 351 vcm_->StopCaptureForClient(controllers_[client_id], client_id, |
348 frame_observer_.get(), true); | 352 frame_observer_.get(), true); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 EXPECT_TRUE( | 446 EXPECT_TRUE( |
443 vcm_->GetDeviceSupportedFormats(video_session_id, &supported_formats)); | 447 vcm_->GetDeviceSupportedFormats(video_session_id, &supported_formats)); |
444 ASSERT_GT(supported_formats.size(), 1u); | 448 ASSERT_GT(supported_formats.size(), 1u); |
445 EXPECT_GT(supported_formats[0].frame_size.width(), 1); | 449 EXPECT_GT(supported_formats[0].frame_size.width(), 1); |
446 EXPECT_GT(supported_formats[0].frame_size.height(), 1); | 450 EXPECT_GT(supported_formats[0].frame_size.height(), 1); |
447 EXPECT_GT(supported_formats[0].frame_rate, 1); | 451 EXPECT_GT(supported_formats[0].frame_rate, 1); |
448 EXPECT_GT(supported_formats[1].frame_size.width(), 1); | 452 EXPECT_GT(supported_formats[1].frame_size.width(), 1); |
449 EXPECT_GT(supported_formats[1].frame_size.height(), 1); | 453 EXPECT_GT(supported_formats[1].frame_size.height(), 1); |
450 EXPECT_GT(supported_formats[1].frame_rate, 1); | 454 EXPECT_GT(supported_formats[1].frame_rate, 1); |
451 | 455 |
| 456 EXPECT_CALL(*frame_observer_, OnStarted(_)); |
452 VideoCaptureControllerID client_id = StartClient(video_session_id, true); | 457 VideoCaptureControllerID client_id = StartClient(video_session_id, true); |
453 base::RunLoop().RunUntilIdle(); | 458 base::RunLoop().RunUntilIdle(); |
454 // After StartClient(), device's supported formats should stay the same. | 459 // After StartClient(), device's supported formats should stay the same. |
455 supported_formats.clear(); | 460 supported_formats.clear(); |
456 EXPECT_TRUE( | 461 EXPECT_TRUE( |
457 vcm_->GetDeviceSupportedFormats(video_session_id, &supported_formats)); | 462 vcm_->GetDeviceSupportedFormats(video_session_id, &supported_formats)); |
458 ASSERT_GE(supported_formats.size(), 2u); | 463 ASSERT_GE(supported_formats.size(), 2u); |
459 EXPECT_GT(supported_formats[0].frame_size.width(), 1); | 464 EXPECT_GT(supported_formats[0].frame_size.width(), 1); |
460 EXPECT_GT(supported_formats[0].frame_size.height(), 1); | 465 EXPECT_GT(supported_formats[0].frame_size.height(), 1); |
461 EXPECT_GT(supported_formats[0].frame_rate, 1); | 466 EXPECT_GT(supported_formats[0].frame_rate, 1); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 supported_formats.clear(); | 513 supported_formats.clear(); |
509 EXPECT_TRUE(vcm_->GetDeviceSupportedFormats(device_id, &supported_formats)); | 514 EXPECT_TRUE(vcm_->GetDeviceSupportedFormats(device_id, &supported_formats)); |
510 ASSERT_GE(supported_formats.size(), 2u); | 515 ASSERT_GE(supported_formats.size(), 2u); |
511 EXPECT_GT(supported_formats[0].frame_size.width(), 1); | 516 EXPECT_GT(supported_formats[0].frame_size.width(), 1); |
512 EXPECT_GT(supported_formats[0].frame_size.height(), 1); | 517 EXPECT_GT(supported_formats[0].frame_size.height(), 1); |
513 EXPECT_GT(supported_formats[0].frame_rate, 1); | 518 EXPECT_GT(supported_formats[0].frame_rate, 1); |
514 EXPECT_GT(supported_formats[1].frame_size.width(), 1); | 519 EXPECT_GT(supported_formats[1].frame_size.width(), 1); |
515 EXPECT_GT(supported_formats[1].frame_size.height(), 1); | 520 EXPECT_GT(supported_formats[1].frame_size.height(), 1); |
516 EXPECT_GT(supported_formats[1].frame_rate, 1); | 521 EXPECT_GT(supported_formats[1].frame_rate, 1); |
517 | 522 |
| 523 EXPECT_CALL(*frame_observer_, OnStarted(_)); |
518 VideoCaptureControllerID client_id = StartClient(video_session_id, true); | 524 VideoCaptureControllerID client_id = StartClient(video_session_id, true); |
519 base::RunLoop().RunUntilIdle(); | 525 base::RunLoop().RunUntilIdle(); |
520 // After StartClient(), device's supported formats should stay the same. | 526 // After StartClient(), device's supported formats should stay the same. |
521 supported_formats.clear(); | 527 supported_formats.clear(); |
522 EXPECT_TRUE(vcm_->GetDeviceSupportedFormats(device_id, &supported_formats)); | 528 EXPECT_TRUE(vcm_->GetDeviceSupportedFormats(device_id, &supported_formats)); |
523 ASSERT_GE(supported_formats.size(), 2u); | 529 ASSERT_GE(supported_formats.size(), 2u); |
524 EXPECT_GT(supported_formats[0].frame_size.width(), 1); | 530 EXPECT_GT(supported_formats[0].frame_size.width(), 1); |
525 EXPECT_GT(supported_formats[0].frame_size.height(), 1); | 531 EXPECT_GT(supported_formats[0].frame_size.height(), 1); |
526 EXPECT_GT(supported_formats[0].frame_rate, 1); | 532 EXPECT_GT(supported_formats[0].frame_rate, 1); |
527 EXPECT_GT(supported_formats[1].frame_size.width(), 1); | 533 EXPECT_GT(supported_formats[1].frame_size.width(), 1); |
(...skipping 26 matching lines...) Expand all Loading... |
554 InSequence s; | 560 InSequence s; |
555 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)); | 561 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)); |
556 int video_session_id = vcm_->Open(devices_.front()); | 562 int video_session_id = vcm_->Open(devices_.front()); |
557 base::RunLoop().RunUntilIdle(); | 563 base::RunLoop().RunUntilIdle(); |
558 | 564 |
559 // Right after opening the device, we should see no format in use. | 565 // Right after opening the device, we should see no format in use. |
560 media::VideoCaptureFormats formats_in_use; | 566 media::VideoCaptureFormats formats_in_use; |
561 EXPECT_TRUE(vcm_->GetDeviceFormatsInUse(video_session_id, &formats_in_use)); | 567 EXPECT_TRUE(vcm_->GetDeviceFormatsInUse(video_session_id, &formats_in_use)); |
562 EXPECT_TRUE(formats_in_use.empty()); | 568 EXPECT_TRUE(formats_in_use.empty()); |
563 | 569 |
| 570 EXPECT_CALL(*frame_observer_, OnStarted(_)); |
564 VideoCaptureControllerID client_id = StartClient(video_session_id, true); | 571 VideoCaptureControllerID client_id = StartClient(video_session_id, true); |
565 base::RunLoop().RunUntilIdle(); | 572 base::RunLoop().RunUntilIdle(); |
566 // After StartClient(), |formats_in_use| should contain one valid format. | 573 // After StartClient(), |formats_in_use| should contain one valid format. |
567 EXPECT_TRUE(vcm_->GetDeviceFormatsInUse(video_session_id, &formats_in_use)); | 574 EXPECT_TRUE(vcm_->GetDeviceFormatsInUse(video_session_id, &formats_in_use)); |
568 EXPECT_EQ(formats_in_use.size(), 1u); | 575 EXPECT_EQ(formats_in_use.size(), 1u); |
569 if (formats_in_use.size()) { | 576 if (formats_in_use.size()) { |
570 media::VideoCaptureFormat& format_in_use = formats_in_use.front(); | 577 media::VideoCaptureFormat& format_in_use = formats_in_use.front(); |
571 EXPECT_TRUE(format_in_use.IsValid()); | 578 EXPECT_TRUE(format_in_use.IsValid()); |
572 EXPECT_GT(format_in_use.frame_size.width(), 1); | 579 EXPECT_GT(format_in_use.frame_size.width(), 1); |
573 EXPECT_GT(format_in_use.frame_size.height(), 1); | 580 EXPECT_GT(format_in_use.frame_size.height(), 1); |
(...skipping 25 matching lines...) Expand all Loading... |
599 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)); | 606 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)); |
600 int video_session_id = vcm_->Open(devices_.front()); | 607 int video_session_id = vcm_->Open(devices_.front()); |
601 base::RunLoop().RunUntilIdle(); | 608 base::RunLoop().RunUntilIdle(); |
602 | 609 |
603 // Right after opening the device, we should see no format in use. | 610 // Right after opening the device, we should see no format in use. |
604 media::VideoCaptureFormats formats_in_use; | 611 media::VideoCaptureFormats formats_in_use; |
605 EXPECT_TRUE(vcm_->GetDeviceFormatsInUse(MEDIA_DEVICE_VIDEO_CAPTURE, device_id, | 612 EXPECT_TRUE(vcm_->GetDeviceFormatsInUse(MEDIA_DEVICE_VIDEO_CAPTURE, device_id, |
606 &formats_in_use)); | 613 &formats_in_use)); |
607 EXPECT_TRUE(formats_in_use.empty()); | 614 EXPECT_TRUE(formats_in_use.empty()); |
608 | 615 |
| 616 EXPECT_CALL(*frame_observer_, OnStarted(_)); |
609 VideoCaptureControllerID client_id = StartClient(video_session_id, true); | 617 VideoCaptureControllerID client_id = StartClient(video_session_id, true); |
610 base::RunLoop().RunUntilIdle(); | 618 base::RunLoop().RunUntilIdle(); |
611 // After StartClient(), |formats_in_use| should contain one valid format. | 619 // After StartClient(), |formats_in_use| should contain one valid format. |
612 EXPECT_TRUE(vcm_->GetDeviceFormatsInUse(MEDIA_DEVICE_VIDEO_CAPTURE, device_id, | 620 EXPECT_TRUE(vcm_->GetDeviceFormatsInUse(MEDIA_DEVICE_VIDEO_CAPTURE, device_id, |
613 &formats_in_use)); | 621 &formats_in_use)); |
614 EXPECT_EQ(formats_in_use.size(), 1u); | 622 EXPECT_EQ(formats_in_use.size(), 1u); |
615 if (formats_in_use.size()) { | 623 if (formats_in_use.size()) { |
616 media::VideoCaptureFormat& format_in_use = formats_in_use.front(); | 624 media::VideoCaptureFormat& format_in_use = formats_in_use.front(); |
617 EXPECT_TRUE(format_in_use.IsValid()); | 625 EXPECT_TRUE(format_in_use.IsValid()); |
618 EXPECT_GT(format_in_use.frame_size.width(), 1); | 626 EXPECT_GT(format_in_use.frame_size.width(), 1); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 | 692 |
685 // Wait to check callbacks before removing the listener. | 693 // Wait to check callbacks before removing the listener. |
686 base::RunLoop().RunUntilIdle(); | 694 base::RunLoop().RunUntilIdle(); |
687 vcm_->UnregisterListener(); | 695 vcm_->UnregisterListener(); |
688 } | 696 } |
689 | 697 |
690 // Open and start a device, close it before calling Stop. | 698 // Open and start a device, close it before calling Stop. |
691 TEST_F(VideoCaptureManagerTest, CloseWithoutStop) { | 699 TEST_F(VideoCaptureManagerTest, CloseWithoutStop) { |
692 InSequence s; | 700 InSequence s; |
693 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)); | 701 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)); |
| 702 EXPECT_CALL(*frame_observer_, OnStarted(_)); |
694 EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, _)); | 703 EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, _)); |
695 | 704 |
696 int video_session_id = vcm_->Open(devices_.front()); | 705 int video_session_id = vcm_->Open(devices_.front()); |
697 | 706 |
698 VideoCaptureControllerID client_id = StartClient(video_session_id, true); | 707 VideoCaptureControllerID client_id = StartClient(video_session_id, true); |
699 | 708 |
700 // Close will stop the running device, an assert will be triggered in | 709 // Close will stop the running device, an assert will be triggered in |
701 // VideoCaptureManager destructor otherwise. | 710 // VideoCaptureManager destructor otherwise. |
702 vcm_->Close(video_session_id); | 711 vcm_->Close(video_session_id); |
703 StopClient(client_id); | 712 StopClient(client_id); |
704 | 713 |
705 // Wait to check callbacks before removing the listener | 714 // Wait to check callbacks before removing the listener |
706 base::RunLoop().RunUntilIdle(); | 715 base::RunLoop().RunUntilIdle(); |
707 vcm_->UnregisterListener(); | 716 vcm_->UnregisterListener(); |
708 } | 717 } |
709 | 718 |
710 // Try to open, start, pause and resume a device. Confirm the device is | 719 // Try to open, start, pause and resume a device. Confirm the device is |
711 // paused/resumed at the correct times in both single-client and multiple-client | 720 // paused/resumed at the correct times in both single-client and multiple-client |
712 // scenarios. | 721 // scenarios. |
713 TEST_F(VideoCaptureManagerTest, PauseAndResumeClient) { | 722 TEST_F(VideoCaptureManagerTest, PauseAndResumeClient) { |
714 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)); | 723 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)); |
| 724 EXPECT_CALL(*frame_observer_, OnStarted(_)); |
715 | 725 |
716 const int video_session_id = vcm_->Open(devices_.front()); | 726 const int video_session_id = vcm_->Open(devices_.front()); |
717 const VideoCaptureControllerID client_id = | 727 const VideoCaptureControllerID client_id = |
718 StartClient(video_session_id, true); | 728 StartClient(video_session_id, true); |
719 | 729 |
720 // Test pause/resume when only one client is present. | 730 // Test pause/resume when only one client is present. |
721 EXPECT_CALL(*video_capture_device_factory_, WillSuspendDevice()).Times(1); | 731 EXPECT_CALL(*video_capture_device_factory_, WillSuspendDevice()).Times(1); |
722 PauseClient(client_id); | 732 PauseClient(client_id); |
723 EXPECT_CALL(*video_capture_device_factory_, WillResumeDevice()).Times(1); | 733 EXPECT_CALL(*video_capture_device_factory_, WillResumeDevice()).Times(1); |
724 ResumeClient(video_session_id, client_id); | 734 ResumeClient(video_session_id, client_id); |
(...skipping 19 matching lines...) Expand all Loading... |
744 // Wait to check callbacks before removing the listener. | 754 // Wait to check callbacks before removing the listener. |
745 base::RunLoop().RunUntilIdle(); | 755 base::RunLoop().RunUntilIdle(); |
746 vcm_->UnregisterListener(); | 756 vcm_->UnregisterListener(); |
747 } | 757 } |
748 | 758 |
749 #if defined(OS_ANDROID) | 759 #if defined(OS_ANDROID) |
750 // Try to open, start, pause and resume a device. | 760 // Try to open, start, pause and resume a device. |
751 TEST_F(VideoCaptureManagerTest, PauseAndResumeDevice) { | 761 TEST_F(VideoCaptureManagerTest, PauseAndResumeDevice) { |
752 InSequence s; | 762 InSequence s; |
753 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)); | 763 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)); |
| 764 EXPECT_CALL(*frame_observer_, OnStarted(_)); |
754 EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, _)); | 765 EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, _)); |
755 | 766 |
756 int video_session_id = vcm_->Open(devices_.front()); | 767 int video_session_id = vcm_->Open(devices_.front()); |
757 VideoCaptureControllerID client_id = StartClient(video_session_id, true); | 768 VideoCaptureControllerID client_id = StartClient(video_session_id, true); |
758 | 769 |
759 // Release/ResumeDevices according to ApplicationStatus. Should cause no | 770 // Release/ResumeDevices according to ApplicationStatus. Should cause no |
760 // problem in any order. Check https://crbug.com/615557 for more details. | 771 // problem in any order. Check https://crbug.com/615557 for more details. |
761 ApplicationStateChange( | 772 ApplicationStateChange( |
762 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES); | 773 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES); |
763 ApplicationStateChange( | 774 ApplicationStateChange( |
(...skipping 11 matching lines...) Expand all Loading... |
775 // Wait to check callbacks before removing the listener. | 786 // Wait to check callbacks before removing the listener. |
776 base::RunLoop().RunUntilIdle(); | 787 base::RunLoop().RunUntilIdle(); |
777 vcm_->UnregisterListener(); | 788 vcm_->UnregisterListener(); |
778 } | 789 } |
779 #endif | 790 #endif |
780 | 791 |
781 // TODO(mcasas): Add a test to check consolidation of the supported formats | 792 // TODO(mcasas): Add a test to check consolidation of the supported formats |
782 // provided by the device when http://crbug.com/323913 is closed. | 793 // provided by the device when http://crbug.com/323913 is closed. |
783 | 794 |
784 } // namespace content | 795 } // namespace content |
OLD | NEW |