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

Unified Diff: content/renderer/media/video_capture_impl_unittest.cc

Issue 2824193002: Enable use_once_callback for //content/common/*.mojom (Closed)
Patch Set: rebase Created 3 years, 8 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/renderer/media/video_capture_impl_unittest.cc
diff --git a/content/renderer/media/video_capture_impl_unittest.cc b/content/renderer/media/video_capture_impl_unittest.cc
index 562492b00667a60e4da291ea0a6acbc615ce5453..58b630a1d917919d1a12cae32759fd68ae27789a 100644
--- a/content/renderer/media/video_capture_impl_unittest.cc
+++ b/content/renderer/media/video_capture_impl_unittest.cc
@@ -25,9 +25,10 @@ namespace content {
const int kSessionId = 11;
-void RunEmptyFormatsCallback(const VideoCaptureDeviceFormatsCB& callback) {
+void RunEmptyFormatsCallback(
+ mojom::VideoCaptureHost::GetDeviceSupportedFormatsCallback& callback) {
media::VideoCaptureFormats formats;
- callback.Run(formats);
+ std::move(callback).Run(formats);
}
ACTION(DoNothing) {}
@@ -36,9 +37,9 @@ ACTION(DoNothing) {}
class MockMojoVideoCaptureHost : public mojom::VideoCaptureHost {
public:
MockMojoVideoCaptureHost() : released_buffer_count_(0) {
- ON_CALL(*this, GetDeviceSupportedFormats(_, _, _))
+ ON_CALL(*this, GetDeviceSupportedFormatsMock(_, _, _))
.WillByDefault(WithArgs<2>(Invoke(RunEmptyFormatsCallback)));
- ON_CALL(*this, GetDeviceFormatsInUse(_, _, _))
+ ON_CALL(*this, GetDeviceFormatsInUseMock(_, _, _))
.WillByDefault(WithArgs<2>(Invoke(RunEmptyFormatsCallback)));
ON_CALL(*this, ReleaseBuffer(_, _, _))
.WillByDefault(InvokeWithoutArgs(
@@ -60,12 +61,23 @@ class MockMojoVideoCaptureHost : public mojom::VideoCaptureHost {
void(int32_t, int32_t, const media::VideoCaptureParams&));
MOCK_METHOD1(RequestRefreshFrame, void(int32_t));
MOCK_METHOD3(ReleaseBuffer, void(int32_t, int32_t, double));
- MOCK_METHOD3(GetDeviceSupportedFormats,
- void(int32_t,
- int32_t,
- const GetDeviceSupportedFormatsCallback&));
- MOCK_METHOD3(GetDeviceFormatsInUse,
- void(int32_t, int32_t, const GetDeviceFormatsInUseCallback&));
+ MOCK_METHOD3(GetDeviceSupportedFormatsMock,
+ void(int32_t, int32_t, GetDeviceSupportedFormatsCallback&));
+ MOCK_METHOD3(GetDeviceFormatsInUseMock,
+ void(int32_t, int32_t, GetDeviceFormatsInUseCallback&));
+
+ void GetDeviceSupportedFormats(
+ int32_t arg1,
+ int32_t arg2,
+ GetDeviceSupportedFormatsCallback arg3) override {
+ GetDeviceSupportedFormatsMock(arg1, arg2, arg3);
+ }
+
+ void GetDeviceFormatsInUse(int32_t arg1,
+ int32_t arg2,
+ GetDeviceFormatsInUseCallback arg3) override {
+ GetDeviceFormatsInUseMock(arg1, arg2, arg3);
+ }
int released_buffer_count() const { return released_buffer_count_; }
void increase_released_buffer_count() { released_buffer_count_++; }
@@ -233,7 +245,7 @@ TEST_F(VideoCaptureImplTest, SmallAndLarge) {
TEST_F(VideoCaptureImplTest, GetDeviceFormats) {
EXPECT_CALL(*this, OnDeviceSupportedFormats(_));
EXPECT_CALL(mock_video_capture_host_,
- GetDeviceSupportedFormats(_, kSessionId, _));
+ GetDeviceSupportedFormatsMock(_, kSessionId, _));
GetDeviceSupportedFormats();
}
@@ -243,7 +255,7 @@ TEST_F(VideoCaptureImplTest, GetDeviceFormats) {
TEST_F(VideoCaptureImplTest, TwoClientsGetDeviceFormats) {
EXPECT_CALL(*this, OnDeviceSupportedFormats(_)).Times(2);
EXPECT_CALL(mock_video_capture_host_,
- GetDeviceSupportedFormats(_, kSessionId, _))
+ GetDeviceSupportedFormatsMock(_, kSessionId, _))
.Times(2);
GetDeviceSupportedFormats();
@@ -255,7 +267,7 @@ TEST_F(VideoCaptureImplTest, TwoClientsGetDeviceFormats) {
TEST_F(VideoCaptureImplTest, GetDeviceFormatsInUse) {
EXPECT_CALL(*this, OnDeviceFormatsInUse(_));
EXPECT_CALL(mock_video_capture_host_,
- GetDeviceFormatsInUse(_, kSessionId, _));
+ GetDeviceFormatsInUseMock(_, kSessionId, _));
GetDeviceFormatsInUse();
}

Powered by Google App Engine
This is Rietveld 408576698