Chromium Code Reviews| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 const gfx::Size& size, | 72 const gfx::Size& size, |
| 73 int buffer_id) override { | 73 int buffer_id) override { |
| 74 DoBufferCreated2(id); | 74 DoBufferCreated2(id); |
| 75 } | 75 } |
| 76 void OnBufferDestroyed(VideoCaptureControllerID id, int buffer_id) override { | 76 void OnBufferDestroyed(VideoCaptureControllerID id, int buffer_id) override { |
| 77 DoBufferDestroyed(id); | 77 DoBufferDestroyed(id); |
| 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, | 81 const scoped_refptr<media::VideoFrame>& frame, |
| 82 const base::TimeTicks& timestamp) override { | 82 base::TimeTicks reference_time) override { |
| 83 EXPECT_EQ(frame->format(), media::PIXEL_FORMAT_I420); | 83 EXPECT_EQ(frame->format(), media::PIXEL_FORMAT_I420); |
|
miu
2016/06/07 20:03:47
Up to you, but maybe there should also be:
EXPE
qiangchen
2016/06/08 18:04:30
Done.
| |
| 84 DoI420BufferReady(id, frame->coded_size()); | 84 DoI420BufferReady(id, frame->coded_size()); |
| 85 base::ThreadTaskRunnerHandle::Get()->PostTask( | 85 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 86 FROM_HERE, | 86 FROM_HERE, |
| 87 base::Bind(&VideoCaptureController::ReturnBuffer, | 87 base::Bind(&VideoCaptureController::ReturnBuffer, |
| 88 base::Unretained(controller_), id, this, buffer_id, | 88 base::Unretained(controller_), id, this, buffer_id, |
| 89 gpu::SyncToken(), resource_utilization_)); | 89 gpu::SyncToken(), resource_utilization_)); |
| 90 } | 90 } |
| 91 void OnEnded(VideoCaptureControllerID id) override { | 91 void OnEnded(VideoCaptureControllerID id) override { |
| 92 DoEnded(id); | 92 DoEnded(id); |
| 93 // OnEnded() must respond by (eventually) unregistering the client. | 93 // OnEnded() must respond by (eventually) unregistering the client. |
| 94 base::ThreadTaskRunnerHandle::Get()->PostTask( | 94 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 95 FROM_HERE, | 95 FROM_HERE, |
| 96 base::Bind(base::IgnoreResult(&VideoCaptureController::RemoveClient), | 96 base::Bind(base::IgnoreResult(&VideoCaptureController::RemoveClient), |
| 97 base::Unretained(controller_), id, this)); | 97 base::Unretained(controller_), id, this)); |
| 98 } | 98 } |
| 99 | 99 |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 572 | 572 |
| 573 // Second client connects after the error state. It also should get told of | 573 // Second client connects after the error state. It also should get told of |
| 574 // the error. | 574 // the error. |
| 575 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); | 575 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); |
| 576 controller_->AddClient( | 576 controller_->AddClient( |
| 577 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); | 577 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); |
| 578 Mock::VerifyAndClearExpectations(client_b_.get()); | 578 Mock::VerifyAndClearExpectations(client_b_.get()); |
| 579 } | 579 } |
| 580 | 580 |
| 581 } // namespace content | 581 } // namespace content |
| OLD | NEW |