| 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 VideoCaptureController. | 5 // Unit test for VideoCaptureController. |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/media/video_capture_controller.h" | 7 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 8 | 8 |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 71 } |
| 72 void OnBufferReady(VideoCaptureControllerID id, | 72 void OnBufferReady(VideoCaptureControllerID id, |
| 73 int buffer_id, | 73 int buffer_id, |
| 74 const scoped_refptr<media::VideoFrame>& frame) override { | 74 const scoped_refptr<media::VideoFrame>& frame) override { |
| 75 EXPECT_EQ(expected_pixel_format_, frame->format()); | 75 EXPECT_EQ(expected_pixel_format_, frame->format()); |
| 76 base::TimeTicks reference_time; | 76 base::TimeTicks reference_time; |
| 77 EXPECT_TRUE(frame->metadata()->GetTimeTicks( | 77 EXPECT_TRUE(frame->metadata()->GetTimeTicks( |
| 78 media::VideoFrameMetadata::REFERENCE_TIME, &reference_time)); | 78 media::VideoFrameMetadata::REFERENCE_TIME, &reference_time)); |
| 79 DoBufferReady(id, frame->coded_size()); | 79 DoBufferReady(id, frame->coded_size()); |
| 80 base::ThreadTaskRunnerHandle::Get()->PostTask( | 80 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 81 FROM_HERE, | 81 FROM_HERE, base::Bind(&VideoCaptureController::ReturnBuffer, |
| 82 base::Bind(&VideoCaptureController::ReturnBuffer, | 82 base::Unretained(controller_), id, this, |
| 83 base::Unretained(controller_), id, this, buffer_id, | 83 buffer_id, resource_utilization_)); |
| 84 gpu::SyncToken(), resource_utilization_)); | |
| 85 } | 84 } |
| 86 void OnEnded(VideoCaptureControllerID id) override { | 85 void OnEnded(VideoCaptureControllerID id) override { |
| 87 DoEnded(id); | 86 DoEnded(id); |
| 88 // OnEnded() must respond by (eventually) unregistering the client. | 87 // OnEnded() must respond by (eventually) unregistering the client. |
| 89 base::ThreadTaskRunnerHandle::Get()->PostTask( | 88 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 90 FROM_HERE, | 89 FROM_HERE, |
| 91 base::Bind(base::IgnoreResult(&VideoCaptureController::RemoveClient), | 90 base::Bind(base::IgnoreResult(&VideoCaptureController::RemoveClient), |
| 92 base::Unretained(controller_), id, this)); | 91 base::Unretained(controller_), id, this)); |
| 93 } | 92 } |
| 94 | 93 |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 Mock::VerifyAndClearExpectations(client_a_.get()); | 585 Mock::VerifyAndClearExpectations(client_a_.get()); |
| 587 | 586 |
| 588 // Second client connects after the error state. It also should get told of | 587 // Second client connects after the error state. It also should get told of |
| 589 // the error. | 588 // the error. |
| 590 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); | 589 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); |
| 591 controller_->AddClient(route_id, client_b_.get(), 200, session_200); | 590 controller_->AddClient(route_id, client_b_.get(), 200, session_200); |
| 592 Mock::VerifyAndClearExpectations(client_b_.get()); | 591 Mock::VerifyAndClearExpectations(client_b_.get()); |
| 593 } | 592 } |
| 594 | 593 |
| 595 } // namespace content | 594 } // namespace content |
| OLD | NEW |