In media/ and modules/video_coding replace mock macros with unified MOCK_METHOD macro

Bug: webrtc:11564
Change-Id: I5c7f5dc99e62619403ed726c23201ab4fbd37cbe
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175647
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31340}
diff --git a/media/base/media_engine_unittest.cc b/media/base/media_engine_unittest.cc
index f4c6f5f..83f80c4 100644
--- a/media/base/media_engine_unittest.cc
+++ b/media/base/media_engine_unittest.cc
@@ -26,8 +26,10 @@
 class MockRtpHeaderExtensionQueryInterface
     : public RtpHeaderExtensionQueryInterface {
  public:
-  MOCK_CONST_METHOD0(GetRtpHeaderExtensions,
-                     std::vector<RtpHeaderExtensionCapability>());
+  MOCK_METHOD(std::vector<RtpHeaderExtensionCapability>,
+              GetRtpHeaderExtensions,
+              (),
+              (const, override));
 };
 
 }  // namespace
diff --git a/media/engine/simulcast_encoder_adapter_unittest.cc b/media/engine/simulcast_encoder_adapter_unittest.cc
index b467c49..075cb83 100644
--- a/media/engine/simulcast_encoder_adapter_unittest.cc
+++ b/media/engine/simulcast_encoder_adapter_unittest.cc
@@ -199,8 +199,10 @@
         video_format_("unknown"),
         callback_(nullptr) {}
 
-  MOCK_METHOD1(SetFecControllerOverride,
-               void(FecControllerOverride* fec_controller_override));
+  MOCK_METHOD(void,
+              SetFecControllerOverride,
+              (FecControllerOverride * fec_controller_override),
+              (override));
 
   // TODO(nisse): Valid overrides commented out, because the gmock
   // methods don't use any override declarations, and we want to avoid
@@ -212,10 +214,11 @@
     return init_encode_return_value_;
   }
 
-  MOCK_METHOD2(
-      Encode,
-      int32_t(const VideoFrame& inputImage,
-              const std::vector<VideoFrameType>* frame_types) /* override */);
+  MOCK_METHOD(int32_t,
+              Encode,
+              (const VideoFrame& inputImage,
+               const std::vector<VideoFrameType>* frame_types),
+              (override));
 
   int32_t RegisterEncodeCompleteCallback(
       EncodedImageCallback* callback) override {
@@ -223,7 +226,7 @@
     return 0;
   }
 
-  MOCK_METHOD0(Release, int32_t() /* override */);
+  MOCK_METHOD(int32_t, Release, (), (override));
 
   void SetRates(const RateControlParameters& parameters) {
     last_set_rates_ = parameters;
@@ -334,8 +337,7 @@
 
 std::unique_ptr<VideoEncoder> MockVideoEncoderFactory::CreateVideoEncoder(
     const SdpVideoFormat& format) {
-  std::unique_ptr<MockVideoEncoder> encoder(
-      new ::testing::NiceMock<MockVideoEncoder>(this));
+  auto encoder = std::make_unique<::testing::NiceMock<MockVideoEncoder>>(this);
   encoder->set_init_encode_return_value(init_encode_return_value_);
   const char* encoder_name = encoder_names_.empty()
                                  ? "codec_implementation_name"
diff --git a/media/engine/webrtc_video_engine_unittest.cc b/media/engine/webrtc_video_engine_unittest.cc
index ce36073..1b839e9 100644
--- a/media/engine/webrtc_video_engine_unittest.cc
+++ b/media/engine/webrtc_video_engine_unittest.cc
@@ -209,11 +209,15 @@
 
 class MockVideoSource : public rtc::VideoSourceInterface<webrtc::VideoFrame> {
  public:
-  MOCK_METHOD2(AddOrUpdateSink,
-               void(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink,
-                    const rtc::VideoSinkWants& wants));
-  MOCK_METHOD1(RemoveSink,
-               void(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink));
+  MOCK_METHOD(void,
+              AddOrUpdateSink,
+              (rtc::VideoSinkInterface<webrtc::VideoFrame> * sink,
+               const rtc::VideoSinkWants& wants),
+              (override));
+  MOCK_METHOD(void,
+              RemoveSink,
+              (rtc::VideoSinkInterface<webrtc::VideoFrame> * sink),
+              (override));
 };
 
 }  // namespace
diff --git a/modules/video_coding/codecs/vp8/test/mock_libvpx_interface.h b/modules/video_coding/codecs/vp8/test/mock_libvpx_interface.h
index dcff1e6..1ac927d 100644
--- a/modules/video_coding/codecs/vp8/test/mock_libvpx_interface.h
+++ b/modules/video_coding/codecs/vp8/test/mock_libvpx_interface.h
@@ -19,74 +19,86 @@
 
 class MockLibvpxVp8Interface : public LibvpxInterface {
  public:
-  MOCK_CONST_METHOD5(img_alloc,
-                     vpx_image_t*(vpx_image_t*,
-                                  vpx_img_fmt_t,
-                                  unsigned int,
-                                  unsigned int,
-                                  unsigned int));
-  MOCK_CONST_METHOD6(img_wrap,
-                     vpx_image_t*(vpx_image_t*,
-                                  vpx_img_fmt_t,
-                                  unsigned int,
-                                  unsigned int,
-                                  unsigned int,
-                                  unsigned char*));
-  MOCK_CONST_METHOD1(img_free, void(vpx_image_t* img));
-  MOCK_CONST_METHOD2(codec_enc_config_set,
-                     vpx_codec_err_t(vpx_codec_ctx_t*,
-                                     const vpx_codec_enc_cfg_t*));
-  MOCK_CONST_METHOD3(codec_enc_config_default,
-                     vpx_codec_err_t(vpx_codec_iface_t*,
-                                     vpx_codec_enc_cfg_t*,
-                                     unsigned int));
-  MOCK_CONST_METHOD4(codec_enc_init,
-                     vpx_codec_err_t(vpx_codec_ctx_t*,
-                                     vpx_codec_iface_t*,
-                                     const vpx_codec_enc_cfg_t*,
-                                     vpx_codec_flags_t));
-  MOCK_CONST_METHOD6(codec_enc_init_multi,
-                     vpx_codec_err_t(vpx_codec_ctx_t*,
-                                     vpx_codec_iface_t*,
-                                     vpx_codec_enc_cfg_t*,
-                                     int,
-                                     vpx_codec_flags_t,
-                                     vpx_rational_t*));
-  MOCK_CONST_METHOD1(codec_destroy, vpx_codec_err_t(vpx_codec_ctx_t*));
-  MOCK_CONST_METHOD3(codec_control,
-                     vpx_codec_err_t(vpx_codec_ctx_t*,
-                                     vp8e_enc_control_id,
-                                     uint32_t));
-  MOCK_CONST_METHOD3(codec_control,
-                     vpx_codec_err_t(vpx_codec_ctx_t*,
-                                     vp8e_enc_control_id,
-                                     int));
-  MOCK_CONST_METHOD3(codec_control,
-                     vpx_codec_err_t(vpx_codec_ctx_t*,
-                                     vp8e_enc_control_id,
-                                     int*));
-  MOCK_CONST_METHOD3(codec_control,
-                     vpx_codec_err_t(vpx_codec_ctx_t*,
-                                     vp8e_enc_control_id,
-                                     vpx_roi_map*));
-  MOCK_CONST_METHOD3(codec_control,
-                     vpx_codec_err_t(vpx_codec_ctx_t*,
-                                     vp8e_enc_control_id,
-                                     vpx_active_map*));
-  MOCK_CONST_METHOD3(codec_control,
-                     vpx_codec_err_t(vpx_codec_ctx_t*,
-                                     vp8e_enc_control_id,
-                                     vpx_scaling_mode*));
-  MOCK_CONST_METHOD6(codec_encode,
-                     vpx_codec_err_t(vpx_codec_ctx_t*,
-                                     const vpx_image_t*,
-                                     vpx_codec_pts_t,
-                                     uint64_t,
-                                     vpx_enc_frame_flags_t,
-                                     uint64_t));
-  MOCK_CONST_METHOD2(codec_get_cx_data,
-                     const vpx_codec_cx_pkt_t*(vpx_codec_ctx_t*,
-                                               vpx_codec_iter_t*));
+  MOCK_METHOD(
+      vpx_image_t*,
+      img_alloc,
+      (vpx_image_t*, vpx_img_fmt_t, unsigned int, unsigned int, unsigned int),
+      (const, override));
+  MOCK_METHOD(vpx_image_t*,
+              img_wrap,
+              (vpx_image_t*,
+               vpx_img_fmt_t,
+               unsigned int,
+               unsigned int,
+               unsigned int,
+               unsigned char*),
+              (const, override));
+  MOCK_METHOD(void, img_free, (vpx_image_t * img), (const, override));
+  MOCK_METHOD(vpx_codec_err_t,
+              codec_enc_config_set,
+              (vpx_codec_ctx_t*, const vpx_codec_enc_cfg_t*),
+              (const, override));
+  MOCK_METHOD(vpx_codec_err_t,
+              codec_enc_config_default,
+              (vpx_codec_iface_t*, vpx_codec_enc_cfg_t*, unsigned int),
+              (const, override));
+  MOCK_METHOD(vpx_codec_err_t,
+              codec_enc_init,
+              (vpx_codec_ctx_t*,
+               vpx_codec_iface_t*,
+               const vpx_codec_enc_cfg_t*,
+               vpx_codec_flags_t),
+              (const, override));
+  MOCK_METHOD(vpx_codec_err_t,
+              codec_enc_init_multi,
+              (vpx_codec_ctx_t*,
+               vpx_codec_iface_t*,
+               vpx_codec_enc_cfg_t*,
+               int,
+               vpx_codec_flags_t,
+               vpx_rational_t*),
+              (const, override));
+  MOCK_METHOD(vpx_codec_err_t,
+              codec_destroy,
+              (vpx_codec_ctx_t*),
+              (const, override));
+  MOCK_METHOD(vpx_codec_err_t,
+              codec_control,
+              (vpx_codec_ctx_t*, vp8e_enc_control_id, uint32_t),
+              (const, override));
+  MOCK_METHOD(vpx_codec_err_t,
+              codec_control,
+              (vpx_codec_ctx_t*, vp8e_enc_control_id, int),
+              (const, override));
+  MOCK_METHOD(vpx_codec_err_t,
+              codec_control,
+              (vpx_codec_ctx_t*, vp8e_enc_control_id, int*),
+              (const, override));
+  MOCK_METHOD(vpx_codec_err_t,
+              codec_control,
+              (vpx_codec_ctx_t*, vp8e_enc_control_id, vpx_roi_map*),
+              (const, override));
+  MOCK_METHOD(vpx_codec_err_t,
+              codec_control,
+              (vpx_codec_ctx_t*, vp8e_enc_control_id, vpx_active_map*),
+              (const, override));
+  MOCK_METHOD(vpx_codec_err_t,
+              codec_control,
+              (vpx_codec_ctx_t*, vp8e_enc_control_id, vpx_scaling_mode*),
+              (const, override));
+  MOCK_METHOD(vpx_codec_err_t,
+              codec_encode,
+              (vpx_codec_ctx_t*,
+               const vpx_image_t*,
+               vpx_codec_pts_t,
+               uint64_t,
+               vpx_enc_frame_flags_t,
+               uint64_t),
+              (const, override));
+  MOCK_METHOD(const vpx_codec_cx_pkt_t*,
+              codec_get_cx_data,
+              (vpx_codec_ctx_t*, vpx_codec_iter_t*),
+              (const, override));
 };
 
 }  // namespace webrtc
diff --git a/modules/video_coding/frame_buffer2_unittest.cc b/modules/video_coding/frame_buffer2_unittest.cc
index b4d663e..2de3f33 100644
--- a/modules/video_coding/frame_buffer2_unittest.cc
+++ b/modules/video_coding/frame_buffer2_unittest.cc
@@ -108,21 +108,26 @@
 
 class VCMReceiveStatisticsCallbackMock : public VCMReceiveStatisticsCallback {
  public:
-  MOCK_METHOD3(OnCompleteFrame,
-               void(bool is_keyframe,
-                    size_t size_bytes,
-                    VideoContentType content_type));
-  MOCK_METHOD1(OnDroppedFrames, void(uint32_t frames_dropped));
-  MOCK_METHOD1(OnDiscardedPacketsUpdated, void(int discarded_packets));
-  MOCK_METHOD1(OnFrameCountsUpdated, void(const FrameCounts& frame_counts));
-  MOCK_METHOD6(OnFrameBufferTimingsUpdated,
-               void(int max_decode_ms,
-                    int current_delay_ms,
-                    int target_delay_ms,
-                    int jitter_buffer_ms,
-                    int min_playout_delay_ms,
-                    int render_delay_ms));
-  MOCK_METHOD1(OnTimingFrameInfoUpdated, void(const TimingFrameInfo& info));
+  MOCK_METHOD(void,
+              OnCompleteFrame,
+              (bool is_keyframe,
+               size_t size_bytes,
+               VideoContentType content_type),
+              (override));
+  MOCK_METHOD(void, OnDroppedFrames, (uint32_t frames_dropped), (override));
+  MOCK_METHOD(void,
+              OnFrameBufferTimingsUpdated,
+              (int max_decode_ms,
+               int current_delay_ms,
+               int target_delay_ms,
+               int jitter_buffer_ms,
+               int min_playout_delay_ms,
+               int render_delay_ms),
+              (override));
+  MOCK_METHOD(void,
+              OnTimingFrameInfoUpdated,
+              (const TimingFrameInfo& info),
+              (override));
 };
 
 class TestFrameBuffer2 : public ::testing::Test {
diff --git a/modules/video_coding/utility/simulcast_rate_allocator_unittest.cc b/modules/video_coding/utility/simulcast_rate_allocator_unittest.cc
index db104c4..871e5a1 100644
--- a/modules/video_coding/utility/simulcast_rate_allocator_unittest.cc
+++ b/modules/video_coding/utility/simulcast_rate_allocator_unittest.cc
@@ -38,14 +38,16 @@
 
 class MockTemporalLayers : public Vp8FrameBufferController {
  public:
-  MOCK_METHOD2(NextFrameConfig, Vp8FrameConfig(size_t, uint32_t));
-  MOCK_METHOD3(OnRatesUpdated, void(size_t, const std::vector<uint32_t>&, int));
-  MOCK_METHOD1(UpdateConfiguration, Vp8EncoderConfig(size_t));
-  MOCK_METHOD6(OnEncodeDone,
-               void(size_t, uint32_t, size_t, bool, int, CodecSpecificInfo*));
-  MOCK_METHOD4(FrameEncoded, void(size_t, uint32_t, size_t, int));
-  MOCK_CONST_METHOD0(Tl0PicIdx, uint8_t());
-  MOCK_CONST_METHOD1(GetTemporalLayerId, int(const Vp8FrameConfig&));
+  MOCK_METHOD(Vp8FrameConfig, NextFrameConfig, (size_t, uint32_t), (override));
+  MOCK_METHOD(void,
+              OnRatesUpdated,
+              (size_t, const std::vector<uint32_t>&, int),
+              (override));
+  MOCK_METHOD(Vp8EncoderConfig, UpdateConfiguration, (size_t), (override));
+  MOCK_METHOD(void,
+              OnEncodeDone,
+              (size_t, uint32_t, size_t, bool, int, CodecSpecificInfo*),
+              (override));
 };
 }  // namespace
 
diff --git a/modules/video_coding/video_receiver_unittest.cc b/modules/video_coding/video_receiver_unittest.cc
index 363838b8..2872c8d 100644
--- a/modules/video_coding/video_receiver_unittest.cc
+++ b/modules/video_coding/video_receiver_unittest.cc
@@ -26,8 +26,10 @@
 
 class MockPacketRequestCallback : public VCMPacketRequestCallback {
  public:
-  MOCK_METHOD2(ResendPackets,
-               int32_t(const uint16_t* sequenceNumbers, uint16_t length));
+  MOCK_METHOD(int32_t,
+              ResendPackets,
+              (const uint16_t* sequenceNumbers, uint16_t length),
+              (override));
 };
 
 class MockVCMReceiveCallback : public VCMReceiveCallback {
@@ -35,11 +37,12 @@
   MockVCMReceiveCallback() {}
   virtual ~MockVCMReceiveCallback() {}
 
-  MOCK_METHOD4(
-      FrameToRender,
-      int32_t(VideoFrame&, absl::optional<uint8_t>, int32_t, VideoContentType));
-  MOCK_METHOD1(OnIncomingPayloadType, void(int));
-  MOCK_METHOD1(OnDecoderImplementationName, void(const char*));
+  MOCK_METHOD(int32_t,
+              FrameToRender,
+              (VideoFrame&, absl::optional<uint8_t>, int32_t, VideoContentType),
+              (override));
+  MOCK_METHOD(void, OnIncomingPayloadType, (int), (override));
+  MOCK_METHOD(void, OnDecoderImplementationName, (const char*), (override));
 };
 
 class TestVideoReceiver : public ::testing::Test {