| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 void OnBufferReady(VideoCaptureControllerID id, | 79 void OnBufferReady(VideoCaptureControllerID id, |
| 80 int buffer_id, | 80 int buffer_id, |
| 81 const scoped_refptr<media::VideoFrame>& frame) override { | 81 const scoped_refptr<media::VideoFrame>& frame) override { |
| 82 EXPECT_EQ(expected_pixel_format_, frame->format()); | 82 EXPECT_EQ(expected_pixel_format_, frame->format()); |
| 83 base::TimeTicks reference_time; | 83 base::TimeTicks reference_time; |
| 84 EXPECT_TRUE(frame->metadata()->GetTimeTicks( | 84 EXPECT_TRUE(frame->metadata()->GetTimeTicks( |
| 85 media::VideoFrameMetadata::REFERENCE_TIME, &reference_time)); | 85 media::VideoFrameMetadata::REFERENCE_TIME, &reference_time)); |
| 86 DoBufferReady(id, frame->coded_size()); | 86 DoBufferReady(id, frame->coded_size()); |
| 87 base::ThreadTaskRunnerHandle::Get()->PostTask( | 87 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 88 FROM_HERE, | 88 FROM_HERE, base::Bind(&VideoCaptureController::ReturnBuffer, |
| 89 base::Bind(&VideoCaptureController::ReturnBuffer, | 89 base::Unretained(controller_), id, this, |
| 90 base::Unretained(controller_), id, this, buffer_id, | 90 buffer_id, resource_utilization_)); |
| 91 gpu::SyncToken(), resource_utilization_)); | |
| 92 } | 91 } |
| 93 void OnEnded(VideoCaptureControllerID id) override { | 92 void OnEnded(VideoCaptureControllerID id) override { |
| 94 DoEnded(id); | 93 DoEnded(id); |
| 95 // OnEnded() must respond by (eventually) unregistering the client. | 94 // OnEnded() must respond by (eventually) unregistering the client. |
| 96 base::ThreadTaskRunnerHandle::Get()->PostTask( | 95 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 97 FROM_HERE, | 96 FROM_HERE, |
| 98 base::Bind(base::IgnoreResult(&VideoCaptureController::RemoveClient), | 97 base::Bind(base::IgnoreResult(&VideoCaptureController::RemoveClient), |
| 99 base::Unretained(controller_), id, this)); | 98 base::Unretained(controller_), id, this)); |
| 100 } | 99 } |
| 101 | 100 |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 Mock::VerifyAndClearExpectations(client_a_.get()); | 634 Mock::VerifyAndClearExpectations(client_a_.get()); |
| 636 | 635 |
| 637 // Second client connects after the error state. It also should get told of | 636 // Second client connects after the error state. It also should get told of |
| 638 // the error. | 637 // the error. |
| 639 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); | 638 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); |
| 640 controller_->AddClient(route_id, client_b_.get(), 200, session_200); | 639 controller_->AddClient(route_id, client_b_.get(), 200, session_200); |
| 641 Mock::VerifyAndClearExpectations(client_b_.get()); | 640 Mock::VerifyAndClearExpectations(client_b_.get()); |
| 642 } | 641 } |
| 643 | 642 |
| 644 } // namespace content | 643 } // namespace content |
| OLD | NEW |