summaryrefslogtreecommitdiffstats
path: root/device
diff options
context:
space:
mode:
authorjyasskin <jyasskin@chromium.org>2015-09-24 09:58:31 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-24 16:59:30 +0000
commit1e9f0c90c10d405dacfe7ab9b5ae4c1c05227a98 (patch)
treebcaf5d663c63d0d01c526417f2a636b9007f59dc /device
parent11f882b405f348be9a286164f14205f0184ff474 (diff)
downloadchromium_src-1e9f0c90c10d405dacfe7ab9b5ae4c1c05227a98.zip
chromium_src-1e9f0c90c10d405dacfe7ab9b5ae4c1c05227a98.tar.gz
chromium_src-1e9f0c90c10d405dacfe7ab9b5ae4c1c05227a98.tar.bz2
Handle RESCAN events from the Bluetooth chooser by starting or extending a discovery session.
I also added interfaces to support tests that this works, documented in https://github.com/WebBluetoothCG/web-bluetooth/pull/165. BUG=533185 TBR=mkwst@chromium.org Review URL: https://codereview.chromium.org/1353053002 Cr-Commit-Position: refs/heads/master@{#350586}
Diffstat (limited to 'device')
-rw-r--r--device/bluetooth/test/mock_bluetooth_adapter.cc11
-rw-r--r--device/bluetooth/test/mock_bluetooth_adapter.h7
2 files changed, 18 insertions, 0 deletions
diff --git a/device/bluetooth/test/mock_bluetooth_adapter.cc b/device/bluetooth/test/mock_bluetooth_adapter.cc
index 8054d69..26ae68b 100644
--- a/device/bluetooth/test/mock_bluetooth_adapter.cc
+++ b/device/bluetooth/test/mock_bluetooth_adapter.cc
@@ -8,10 +8,21 @@
namespace device {
+using testing::Invoke;
+using testing::_;
+
MockBluetoothAdapter::Observer::Observer() {}
MockBluetoothAdapter::Observer::~Observer() {}
MockBluetoothAdapter::MockBluetoothAdapter() {
+ ON_CALL(*this, AddObserver(_))
+ .WillByDefault(Invoke([this](BluetoothAdapter::Observer* observer) {
+ this->BluetoothAdapter::AddObserver(observer);
+ }));
+ ON_CALL(*this, RemoveObserver(_))
+ .WillByDefault(Invoke([this](BluetoothAdapter::Observer* observer) {
+ this->BluetoothAdapter::RemoveObserver(observer);
+ }));
}
MockBluetoothAdapter::~MockBluetoothAdapter() {}
diff --git a/device/bluetooth/test/mock_bluetooth_adapter.h b/device/bluetooth/test/mock_bluetooth_adapter.h
index 6d1ee73..775adee 100644
--- a/device/bluetooth/test/mock_bluetooth_adapter.h
+++ b/device/bluetooth/test/mock_bluetooth_adapter.h
@@ -109,6 +109,13 @@ class MockBluetoothAdapter : public BluetoothAdapter {
BluetoothAdapter::ConstDeviceList GetConstMockDevices();
BluetoothAdapter::DeviceList GetMockDevices();
+ // The observers are maintained by the default behavior of AddObserver() and
+ // RemoveObserver(). Test fakes can use this function to notify the observers
+ // about events.
+ base::ObserverList<device::BluetoothAdapter::Observer>& GetObservers() {
+ return observers_;
+ }
+
protected:
void AddDiscoverySession(
BluetoothDiscoveryFilter* discovery_filter,