Commit 3b34bf69 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Migrate MockGeolocation|IpGeoLocationProvider to the new Mojo types

This CL converts mojo::Binding to mojo::Receiver in test_utils.cc/h.

Bug: 955171
Change-Id: Ia7682397aad47316b9bf8e375c6c3e9633c0ee5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1781908Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarJia Meng <jiameng@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#693017}
parent 2fccf478
......@@ -6,7 +6,7 @@
namespace language {
MockGeoLocation::MockGeoLocation() : binding_(this) {}
MockGeoLocation::MockGeoLocation() {}
MockGeoLocation::~MockGeoLocation() {}
void MockGeoLocation::SetHighAccuracy(bool high_accuracy) {}
......@@ -17,8 +17,8 @@ void MockGeoLocation::QueryNextPosition(QueryNextPositionCallback callback) {
}
void MockGeoLocation::BindGeoLocation(
device::mojom::GeolocationRequest request) {
binding_.Bind(std::move(request));
mojo::PendingReceiver<device::mojom::Geolocation> receiver) {
receiver_.Bind(std::move(receiver));
}
void MockGeoLocation::MoveToLocation(float latitude, float longitude) {
......@@ -28,13 +28,14 @@ void MockGeoLocation::MoveToLocation(float latitude, float longitude) {
MockIpGeoLocationProvider::MockIpGeoLocationProvider(
MockGeoLocation* mock_geo_location)
: mock_geo_location_(mock_geo_location), binding_(this) {}
: mock_geo_location_(mock_geo_location) {}
MockIpGeoLocationProvider::~MockIpGeoLocationProvider() {}
void MockIpGeoLocationProvider::Bind(mojo::ScopedMessagePipeHandle handle) {
binding_.Bind(device::mojom::PublicIpAddressGeolocationProviderRequest(
std::move(handle)));
receiver_.Bind(
mojo::PendingReceiver<device::mojom::PublicIpAddressGeolocationProvider>(
std::move(handle)));
}
void MockIpGeoLocationProvider::CreateGeolocation(
......
......@@ -5,7 +5,8 @@
#ifndef COMPONENTS_LANGUAGE_CONTENT_BROWSER_TEST_UTILS_H_
#define COMPONENTS_LANGUAGE_CONTENT_BROWSER_TEST_UTILS_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/public/mojom/constants.mojom.h"
#include "services/device/public/mojom/geolocation.mojom.h"
#include "services/device/public/mojom/geoposition.mojom.h"
......@@ -26,7 +27,8 @@ class MockGeoLocation : public device::mojom::Geolocation {
void SetHighAccuracy(bool high_accuracy) override;
void QueryNextPosition(QueryNextPositionCallback callback) override;
void BindGeoLocation(device::mojom::GeolocationRequest request);
void BindGeoLocation(
mojo::PendingReceiver<device::mojom::Geolocation> receiver);
void MoveToLocation(float latitude, float longitude);
int query_next_position_called_times() const {
......@@ -36,7 +38,7 @@ class MockGeoLocation : public device::mojom::Geolocation {
private:
int query_next_position_called_times_ = 0;
device::mojom::Geoposition position_;
mojo::Binding<device::mojom::Geolocation> binding_;
mojo::Receiver<device::mojom::Geolocation> receiver_{this};
};
// Mock impl of mojom::PublicIpAddressGeolocationProvider that binds Geolocation
......@@ -55,7 +57,8 @@ class MockIpGeoLocationProvider
private:
MockGeoLocation* mock_geo_location_;
mojo::Binding<device::mojom::PublicIpAddressGeolocationProvider> binding_;
mojo::Receiver<device::mojom::PublicIpAddressGeolocationProvider> receiver_{
this};
};
} // namespace language
......
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