Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1513)

Unified Diff: content/browser/renderer_host/media/video_capture_device_client_unittest.cc

Issue 2308533003: Break tight coupling of VideoCaptureDeviceClient to renderer_host (Closed)
Patch Set: miu's comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/video_capture_device_client_unittest.cc
diff --git a/content/browser/renderer_host/media/video_capture_device_client_unittest.cc b/content/browser/renderer_host/media/video_capture_device_client_unittest.cc
index c944647d6b99889ff76fd991ecf1f7c03eabb6ab..2260efb653576641f74f42bc6acbd52dde993135 100644
--- a/content/browser/renderer_host/media/video_capture_device_client_unittest.cc
+++ b/content/browser/renderer_host/media/video_capture_device_client_unittest.cc
@@ -37,16 +37,15 @@ class MockVideoCaptureController : public VideoCaptureController {
: VideoCaptureController(max_buffers) {}
~MockVideoCaptureController() override {}
- MOCK_METHOD1(MockDoIncomingCapturedVideoFrameOnIOThread,
- void(const gfx::Size&));
- MOCK_METHOD0(DoErrorOnIOThread, void());
- MOCK_METHOD1(DoLogOnIOThread, void(const std::string& message));
- MOCK_METHOD1(DoBufferDestroyedOnIOThread, void(int buffer_id_to_drop));
+ MOCK_METHOD1(MockOnIncomingCapturedVideoFrame, void(const gfx::Size&));
+ MOCK_METHOD0(OnError, void());
+ MOCK_METHOD1(OnLog, void(const std::string& message));
+ MOCK_METHOD1(OnBufferDestroyed, void(int buffer_id_to_drop));
- void DoIncomingCapturedVideoFrameOnIOThread(
+ void OnIncomingCapturedVideoFrame(
std::unique_ptr<media::VideoCaptureDevice::Client::Buffer> buffer,
const scoped_refptr<media::VideoFrame>& frame) override {
- MockDoIncomingCapturedVideoFrameOnIOThread(frame->coded_size());
+ MockOnIncomingCapturedVideoFrame(frame->coded_size());
}
};
@@ -81,9 +80,8 @@ TEST_F(VideoCaptureDeviceClientTest, Minimal) {
media::PIXEL_FORMAT_I420,
media::PIXEL_STORAGE_CPU);
DCHECK(device_client_.get());
- EXPECT_CALL(*controller_, DoLogOnIOThread(_)).Times(1);
- EXPECT_CALL(*controller_, MockDoIncomingCapturedVideoFrameOnIOThread(_))
- .Times(1);
+ EXPECT_CALL(*controller_, OnLog(_)).Times(1);
+ EXPECT_CALL(*controller_, MockOnIncomingCapturedVideoFrame(_)).Times(1);
device_client_->OnIncomingCapturedData(data, kScratchpadSizeInBytes,
kFrameFormat, 0 /*clockwise rotation*/,
base::TimeTicks(), base::TimeDelta());
@@ -103,9 +101,8 @@ TEST_F(VideoCaptureDeviceClientTest, FailsSilentlyGivenInvalidFrameFormat) {
media::VideoPixelStorage::PIXEL_STORAGE_CPU);
DCHECK(device_client_.get());
// Expect the the call to fail silently inside the VideoCaptureDeviceClient.
- EXPECT_CALL(*controller_, DoLogOnIOThread(_)).Times(1);
- EXPECT_CALL(*controller_, MockDoIncomingCapturedVideoFrameOnIOThread(_))
- .Times(0);
+ EXPECT_CALL(*controller_, OnLog(_)).Times(1);
+ EXPECT_CALL(*controller_, MockOnIncomingCapturedVideoFrame(_)).Times(0);
device_client_->OnIncomingCapturedData(data, kScratchpadSizeInBytes,
kFrameFormat, 0 /*clockwise rotation*/,
base::TimeTicks(), base::TimeDelta());
@@ -123,9 +120,8 @@ TEST_F(VideoCaptureDeviceClientTest, DropsFrameIfNoBuffer) {
media::PIXEL_STORAGE_CPU);
// We expect the second frame to be silently dropped, so these should
// only be called once despite the two frames.
- EXPECT_CALL(*controller_, DoLogOnIOThread(_)).Times(1);
- EXPECT_CALL(*controller_, MockDoIncomingCapturedVideoFrameOnIOThread(_))
- .Times(1);
+ EXPECT_CALL(*controller_, OnLog(_)).Times(1);
+ EXPECT_CALL(*controller_, MockOnIncomingCapturedVideoFrame(_)).Times(1);
// Pass two frames. The second will be dropped.
device_client_->OnIncomingCapturedData(data, kScratchpadSizeInBytes,
kFrameFormat, 0 /*clockwise rotation*/,
@@ -172,9 +168,8 @@ TEST_F(VideoCaptureDeviceClientTest, DataCaptureGoodPixelFormats) {
for (media::VideoPixelFormat format : kSupportedFormats) {
params.requested_format.pixel_format = format;
- EXPECT_CALL(*controller_, DoLogOnIOThread(_)).Times(1);
- EXPECT_CALL(*controller_, MockDoIncomingCapturedVideoFrameOnIOThread(_))
- .Times(1);
+ EXPECT_CALL(*controller_, OnLog(_)).Times(1);
+ EXPECT_CALL(*controller_, MockOnIncomingCapturedVideoFrame(_)).Times(1);
device_client_->OnIncomingCapturedData(
data, params.requested_format.ImageAllocationSize(),
params.requested_format, 0 /* clockwise_rotation */, base::TimeTicks(),
@@ -207,7 +202,7 @@ TEST_F(VideoCaptureDeviceClientTest, CheckRotationsAndCrops) {
const size_t kScratchpadSizeInBytes = 400;
unsigned char data[kScratchpadSizeInBytes] = {};
- EXPECT_CALL(*controller_, DoLogOnIOThread(_)).Times(1);
+ EXPECT_CALL(*controller_, OnLog(_)).Times(1);
media::VideoCaptureParams params;
for (const auto& size_and_rotation : kSizeAndRotations) {
@@ -218,7 +213,7 @@ TEST_F(VideoCaptureDeviceClientTest, CheckRotationsAndCrops) {
media::VideoCaptureFormat(size_and_rotation.input_resolution, 30.0f,
media::PIXEL_FORMAT_ARGB);
gfx::Size coded_size;
- EXPECT_CALL(*controller_, MockDoIncomingCapturedVideoFrameOnIOThread(_))
+ EXPECT_CALL(*controller_, MockOnIncomingCapturedVideoFrame(_))
.Times(1)
.WillOnce(SaveArg<0>(&coded_size));
device_client_->OnIncomingCapturedData(

Powered by Google App Engine
This is Rietveld 408576698