Commit 4afab2e1 authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Commit Bot

Migrate WebTestBluetoothFakeAdapterSetter to the new Mojo types

Convert the implementation and all users of the
content::mojom::WebTestBluetoothFakeAdapterSetter interface.

Bug: 955171
Change-Id: Id2bafecb0801db9b6f2e2ae7f3af9bb17084090c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1800867Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Cr-Commit-Position: refs/heads/master@{#696059}
parent 1ef8699c
...@@ -4,13 +4,16 @@ ...@@ -4,13 +4,16 @@
#include "content/shell/browser/web_test/web_test_bluetooth_fake_adapter_setter_impl.h" #include "content/shell/browser/web_test/web_test_bluetooth_fake_adapter_setter_impl.h"
#include <memory>
#include <string> #include <string>
#include <utility> #include <utility>
#include "content/public/test/web_test_support.h" #include "content/public/test/web_test_support.h"
#include "content/shell/browser/web_test/web_test_bluetooth_adapter_provider.h" #include "content/shell/browser/web_test/web_test_bluetooth_adapter_provider.h"
#include "content/shell/common/web_test/web_test_bluetooth_fake_adapter_setter.mojom.h"
#include "device/bluetooth/bluetooth_adapter_factory_wrapper.h" #include "device/bluetooth/bluetooth_adapter_factory_wrapper.h"
#include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
namespace content { namespace content {
...@@ -22,10 +25,10 @@ WebTestBluetoothFakeAdapterSetterImpl:: ...@@ -22,10 +25,10 @@ WebTestBluetoothFakeAdapterSetterImpl::
// static // static
void WebTestBluetoothFakeAdapterSetterImpl::Create( void WebTestBluetoothFakeAdapterSetterImpl::Create(
mojom::WebTestBluetoothFakeAdapterSetterRequest request) { mojo::PendingReceiver<mojom::WebTestBluetoothFakeAdapterSetter> receiver) {
mojo::MakeStrongBinding( mojo::MakeSelfOwnedReceiver(
std::make_unique<WebTestBluetoothFakeAdapterSetterImpl>(), std::make_unique<WebTestBluetoothFakeAdapterSetterImpl>(),
std::move(request)); std::move(receiver));
} }
void WebTestBluetoothFakeAdapterSetterImpl::Set(const std::string& adapter_name, void WebTestBluetoothFakeAdapterSetterImpl::Set(const std::string& adapter_name,
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "content/shell/common/web_test/web_test_bluetooth_fake_adapter_setter.mojom.h" #include "content/shell/common/web_test/web_test_bluetooth_fake_adapter_setter.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
namespace content { namespace content {
...@@ -16,7 +17,8 @@ class WebTestBluetoothFakeAdapterSetterImpl ...@@ -16,7 +17,8 @@ class WebTestBluetoothFakeAdapterSetterImpl
WebTestBluetoothFakeAdapterSetterImpl(); WebTestBluetoothFakeAdapterSetterImpl();
~WebTestBluetoothFakeAdapterSetterImpl() override; ~WebTestBluetoothFakeAdapterSetterImpl() override;
static void Create(mojom::WebTestBluetoothFakeAdapterSetterRequest request); static void Create(
mojo::PendingReceiver<mojom::WebTestBluetoothFakeAdapterSetter> receiver);
private: private:
void Set(const std::string& adapter_name, SetCallback callback) override; void Set(const std::string& adapter_name, SetCallback callback) override;
......
...@@ -766,7 +766,7 @@ mojom::WebTestBluetoothFakeAdapterSetter& ...@@ -766,7 +766,7 @@ mojom::WebTestBluetoothFakeAdapterSetter&
BlinkTestRunner::GetBluetoothFakeAdapterSetter() { BlinkTestRunner::GetBluetoothFakeAdapterSetter() {
if (!bluetooth_fake_adapter_setter_) { if (!bluetooth_fake_adapter_setter_) {
RenderThread::Get()->BindHostReceiver( RenderThread::Get()->BindHostReceiver(
mojo::MakeRequest(&bluetooth_fake_adapter_setter_)); bluetooth_fake_adapter_setter_.BindNewPipeAndPassReceiver());
} }
return *bluetooth_fake_adapter_setter_; return *bluetooth_fake_adapter_setter_;
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "content/shell/common/web_test/web_test_bluetooth_fake_adapter_setter.mojom.h" #include "content/shell/common/web_test/web_test_bluetooth_fake_adapter_setter.mojom.h"
#include "content/shell/test_runner/test_preferences.h" #include "content/shell/test_runner/test_preferences.h"
#include "content/shell/test_runner/web_test_delegate.h" #include "content/shell/test_runner/web_test_delegate.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "v8/include/v8.h" #include "v8/include/v8.h"
class SkBitmap; class SkBitmap;
...@@ -181,7 +182,8 @@ class BlinkTestRunner : public RenderViewObserver, ...@@ -181,7 +182,8 @@ class BlinkTestRunner : public RenderViewObserver,
scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(); scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner();
mojom::WebTestBluetoothFakeAdapterSetter& GetBluetoothFakeAdapterSetter(); mojom::WebTestBluetoothFakeAdapterSetter& GetBluetoothFakeAdapterSetter();
mojom::WebTestBluetoothFakeAdapterSetterPtr bluetooth_fake_adapter_setter_; mojo::Remote<mojom::WebTestBluetoothFakeAdapterSetter>
bluetooth_fake_adapter_setter_;
test_runner::TestPreferences prefs_; test_runner::TestPreferences prefs_;
......
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