Commit 469ce706 authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Convert HidConnectionClient to new Mojo types

This CL converts HidConnectionClientRequest in services and content
to the new Mojo type.

Bug: 955171
Change-Id: I993ee59359700e0cd87db38d777db3df1a288a83
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1804708Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Cr-Commit-Position: refs/heads/master@{#697126}
parent 366ca01b
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/test/test_render_view_host.h" #include "content/test/test_render_view_host.h"
#include "content/test/test_web_contents.h" #include "content/test/test_web_contents.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "services/device/public/cpp/hid/fake_hid_manager.h" #include "services/device/public/cpp/hid/fake_hid_manager.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -25,10 +27,12 @@ const char kTestGuid[] = "test-guid"; ...@@ -25,10 +27,12 @@ const char kTestGuid[] = "test-guid";
class FakeHidConnectionClient : public device::mojom::HidConnectionClient { class FakeHidConnectionClient : public device::mojom::HidConnectionClient {
public: public:
FakeHidConnectionClient() : binding_(this) {} FakeHidConnectionClient() = default;
~FakeHidConnectionClient() override = default;
void Bind(device::mojom::HidConnectionClientRequest request) { void Bind(
binding_.Bind(std::move(request)); mojo::PendingReceiver<device::mojom::HidConnectionClient> receiver) {
receiver_.Bind(std::move(receiver));
} }
// mojom::HidConnectionClient: // mojom::HidConnectionClient:
...@@ -36,7 +40,7 @@ class FakeHidConnectionClient : public device::mojom::HidConnectionClient { ...@@ -36,7 +40,7 @@ class FakeHidConnectionClient : public device::mojom::HidConnectionClient {
const std::vector<uint8_t>& buffer) override {} const std::vector<uint8_t>& buffer) override {}
private: private:
mojo::Binding<device::mojom::HidConnectionClient> binding_; mojo::Receiver<device::mojom::HidConnectionClient> receiver_{this};
DISALLOW_COPY_AND_ASSIGN(FakeHidConnectionClient); DISALLOW_COPY_AND_ASSIGN(FakeHidConnectionClient);
}; };
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/memory/ref_counted_memory.h" #include "base/memory/ref_counted_memory.h"
#include "build/build_config.h" #include "build/build_config.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/device/device_service_test_base.h" #include "services/device/device_service_test_base.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -65,10 +66,11 @@ class FakeHidConnection : public HidConnection { ...@@ -65,10 +66,11 @@ class FakeHidConnection : public HidConnection {
// report has been received. The contents of the input report are saved. // report has been received. The contents of the input report are saved.
class TestHidConnectionClient : public mojom::HidConnectionClient { class TestHidConnectionClient : public mojom::HidConnectionClient {
public: public:
TestHidConnectionClient() : binding_(this) {} TestHidConnectionClient() = default;
~TestHidConnectionClient() override = default;
void Bind(mojom::HidConnectionClientRequest request) { void Bind(mojo::PendingReceiver<mojom::HidConnectionClient> receiver) {
binding_.Bind(std::move(request)); receiver_.Bind(std::move(receiver));
} }
// mojom::HidConnectionClient implementation. // mojom::HidConnectionClient implementation.
...@@ -86,7 +88,7 @@ class TestHidConnectionClient : public mojom::HidConnectionClient { ...@@ -86,7 +88,7 @@ class TestHidConnectionClient : public mojom::HidConnectionClient {
private: private:
base::RunLoop run_loop_; base::RunLoop run_loop_;
mojo::Binding<mojom::HidConnectionClient> binding_; mojo::Receiver<mojom::HidConnectionClient> receiver_{this};
uint8_t report_id_ = 0; uint8_t report_id_ = 0;
std::vector<uint8_t> buffer_; std::vector<uint8_t> buffer_;
......
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