Commit 1217066c authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Commit Bot

Convert Producer from producer.mojom to new Mojo types

This CL converts Producer for VideoCaptureServiceTest
and MockProducer to new Mojo types using PendingReceiver
and Receiver.

Bug: 955171
Change-Id: Iccc4ad2e500c6a2dc55fa0467b851cb63efe2836
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1882264Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#710120}
parent d145944c
......@@ -6,8 +6,8 @@
namespace video_capture {
MockProducer::MockProducer(mojom::ProducerRequest request)
: binding_(this, std::move(request)) {}
MockProducer::MockProducer(mojo::PendingReceiver<mojom::Producer> receiver)
: receiver_(this, std::move(receiver)) {}
MockProducer::~MockProducer() = default;
......
......@@ -7,7 +7,8 @@
#include "media/capture/mojom/video_capture_types.mojom.h"
#include "media/mojo/mojom/media_types.mojom.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "services/video_capture/public/mojom/producer.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
......@@ -15,7 +16,7 @@ namespace video_capture {
class MockProducer : public mojom::Producer {
public:
MockProducer(mojom::ProducerRequest request);
MockProducer(mojo::PendingReceiver<mojom::Producer> receiver);
~MockProducer() override;
// Use forwarding method to work around gmock not supporting move-only types.
......@@ -30,7 +31,7 @@ class MockProducer : public mojom::Producer {
MOCK_METHOD1(OnBufferRetired, void(int32_t));
private:
const mojo::Binding<mojom::Producer> binding_;
const mojo::Receiver<mojom::Producer> receiver_;
};
} // namespace video_capture
......
......@@ -14,9 +14,10 @@
namespace video_capture {
VideoCaptureServiceTest::SharedMemoryVirtualDeviceContext::
SharedMemoryVirtualDeviceContext(mojom::ProducerRequest producer_request)
SharedMemoryVirtualDeviceContext(
mojo::PendingReceiver<mojom::Producer> producer_receiver)
: mock_producer(
std::make_unique<MockProducer>(std::move(producer_request))) {}
std::make_unique<MockProducer>(std::move(producer_receiver))) {}
VideoCaptureServiceTest::SharedMemoryVirtualDeviceContext::
~SharedMemoryVirtualDeviceContext() = default;
......
......@@ -8,6 +8,7 @@
#include "base/macros.h"
#include "base/test/mock_callback.h"
#include "base/test/task_environment.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/video_capture/public/mojom/device_factory.mojom.h"
#include "services/video_capture/public/mojom/video_capture_service.mojom.h"
......@@ -29,7 +30,8 @@ class VideoCaptureServiceTest : public testing::Test {
protected:
struct SharedMemoryVirtualDeviceContext {
SharedMemoryVirtualDeviceContext(mojom::ProducerRequest producer_request);
SharedMemoryVirtualDeviceContext(
mojo::PendingReceiver<mojom::Producer> producer_receiver);
~SharedMemoryVirtualDeviceContext();
std::unique_ptr<MockProducer> mock_producer;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment