| 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/video_capture_controller.h" | 5 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 // second frame. Since the new |device_client_| is still alive, the second | 796 // second frame. Since the new |device_client_| is still alive, the second |
| 797 // buffer is expected to stay alive. | 797 // buffer is expected to stay alive. |
| 798 EXPECT_CALL(*client_a_, DoBufferDestroyed(_, first_buffer_id)).Times(0); | 798 EXPECT_CALL(*client_a_, DoBufferDestroyed(_, first_buffer_id)).Times(0); |
| 799 EXPECT_CALL(*client_a_, DoBufferDestroyed(_, second_buffer_id)).Times(0); | 799 EXPECT_CALL(*client_a_, DoBufferDestroyed(_, second_buffer_id)).Times(0); |
| 800 controller_->ReturnBuffer(arbitrary_route_id_, client_a_.get(), | 800 controller_->ReturnBuffer(arbitrary_route_id_, client_a_.get(), |
| 801 second_buffer_id, arbitrary_utilization); | 801 second_buffer_id, arbitrary_utilization); |
| 802 base::RunLoop().RunUntilIdle(); | 802 base::RunLoop().RunUntilIdle(); |
| 803 Mock::VerifyAndClearExpectations(client_a_.get()); | 803 Mock::VerifyAndClearExpectations(client_a_.get()); |
| 804 } | 804 } |
| 805 | 805 |
| 806 // Tests that the VideoCaptureController reports OnStarted() to all clients, |
| 807 // even if they connect after VideoCaptureController::OnStarted() has been |
| 808 // invoked. |
| 809 TEST_F(VideoCaptureControllerTest, OnStartedForMultipleClients) { |
| 810 media::VideoCaptureParams session_100; |
| 811 session_100.requested_format = media::VideoCaptureFormat( |
| 812 gfx::Size(320, 240), 30, media::PIXEL_FORMAT_I420); |
| 813 media::VideoCaptureParams session_200 = session_100; |
| 814 media::VideoCaptureParams session_300 = session_100; |
| 815 |
| 816 const VideoCaptureControllerID client_a_route_1(1); |
| 817 const VideoCaptureControllerID client_a_route_2(2); |
| 818 const VideoCaptureControllerID client_b_route_1(3); |
| 819 |
| 820 controller_->AddClient(client_a_route_1, client_a_.get(), 100, session_100); |
| 821 controller_->AddClient(client_b_route_1, client_b_.get(), 300, session_300); |
| 822 ASSERT_EQ(2, controller_->GetClientCount()); |
| 823 |
| 824 { |
| 825 InSequence s; |
| 826 // Simulate the OnStarted event from device. |
| 827 EXPECT_CALL(*client_a_, OnStarted(_)); |
| 828 EXPECT_CALL(*client_b_, OnStarted(_)); |
| 829 device_client_->OnStarted(); |
| 830 |
| 831 // VideoCaptureController will take care of the OnStarted event for the |
| 832 // clients who join later. |
| 833 EXPECT_CALL(*client_a_, OnStarted(_)); |
| 834 controller_->AddClient(client_a_route_2, client_a_.get(), 200, session_200); |
| 835 } |
| 836 } |
| 806 } // namespace content | 837 } // namespace content |
| OLD | NEW |