Commit 9d7700b6 authored by Kyle Lund's avatar Kyle Lund Committed by Commit Bot

[Bluetooth] Mock Async RemoteDevice methods

This CL adds mocks for the asyncronous methods in RemoteDevice that were
not yet mocked.

Bug: None
Test: Run cast_bluetooth_unittests.
Change-Id: Ic5257e9797d47aa61274811d3a623d6d0fe942a9
Reviewed-on: https://chromium-review.googlesource.com/1111205Reviewed-by: default avatarBailey Forrest <bcf@chromium.org>
Reviewed-by: default avatarStephen Lanham <slan@chromium.org>
Commit-Queue: Kyle Lund <kylelund@google.com>
Cr-Commit-Position: refs/heads/master@{#569653}
parent 3e45a732
...@@ -29,25 +29,52 @@ class MockRemoteDevice : public RemoteDevice { ...@@ -29,25 +29,52 @@ class MockRemoteDevice : public RemoteDevice {
} }
MOCK_METHOD0(DisconnectSync, bool()); MOCK_METHOD0(DisconnectSync, bool());
void ReadRemoteRssi(RssiCallback cb) override {}
void RequestMtu(int mtu, StatusCallback cb) override {} MOCK_METHOD1(ReadRemoteRssi, void(RssiCallback cb));
MOCK_METHOD1(RequestMtu, bool(int mtu));
void RequestMtu(int mtu, StatusCallback cb) override {
std::move(cb).Run(RequestMtu(mtu));
}
MOCK_METHOD4(
ConnectionParameterUpdate,
bool(int min_interval, int max_interval, int latency, int timeout));
void ConnectionParameterUpdate(int min_interval, void ConnectionParameterUpdate(int min_interval,
int max_interval, int max_interval,
int latency, int latency,
int timeout, int timeout,
StatusCallback cb) override {} StatusCallback cb) override {
std::move(cb).Run(ConnectionParameterUpdate(min_interval, max_interval,
latency, timeout));
}
MOCK_METHOD0(IsConnected, bool()); MOCK_METHOD0(IsConnected, bool());
MOCK_METHOD0(GetMtu, int()); MOCK_METHOD0(GetMtu, int());
MOCK_METHOD0(GetServices, std::vector<scoped_refptr<RemoteService>>());
void GetServices( void GetServices(
base::OnceCallback<void(std::vector<scoped_refptr<RemoteService>>)> cb) base::OnceCallback<void(std::vector<scoped_refptr<RemoteService>>)> cb)
override {} override {
std::move(cb).Run(GetServices());
}
MOCK_METHOD0(GetServicesSync, std::vector<scoped_refptr<RemoteService>>()); MOCK_METHOD0(GetServicesSync, std::vector<scoped_refptr<RemoteService>>());
MOCK_METHOD1(
GetServiceByUuid,
scoped_refptr<RemoteService>(const bluetooth_v2_shlib::Uuid& uuid));
void GetServiceByUuid( void GetServiceByUuid(
const bluetooth_v2_shlib::Uuid& uuid, const bluetooth_v2_shlib::Uuid& uuid,
base::OnceCallback<void(scoped_refptr<RemoteService>)> cb) override {} base::OnceCallback<void(scoped_refptr<RemoteService>)> cb) override {
std::move(cb).Run(GetServiceByUuid(uuid));
}
MOCK_METHOD1( MOCK_METHOD1(
GetServiceByUuidSync, GetServiceByUuidSync,
scoped_refptr<RemoteService>(const bluetooth_v2_shlib::Uuid& uuid)); scoped_refptr<RemoteService>(const bluetooth_v2_shlib::Uuid& uuid));
const bluetooth_v2_shlib::Addr& addr() const override { return addr_; } const bluetooth_v2_shlib::Addr& addr() const override { return addr_; }
const bluetooth_v2_shlib::Addr addr_; const bluetooth_v2_shlib::Addr addr_;
......
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