Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Unified Diff: device/bluetooth/test/fake_le_central_observer_manager.h

Issue 2853433002: bluetooth: Implement simulateCentral (Closed)
Patch Set: even moar cleanup Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/test/fake_le_central_observer_manager.h
diff --git a/device/bluetooth/test/fake_le_central_observer_manager.h b/device/bluetooth/test/fake_le_central_observer_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..eb932996be23d07493aaa849fc19c6019c8b7f69
--- /dev/null
+++ b/device/bluetooth/test/fake_le_central_observer_manager.h
@@ -0,0 +1,91 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+#ifndef DEVICE_BLUETOOTH_TEST_FAKE_LE_CENTRAL_OBSERVER_MANAGER_H_
+#define DEVICE_BLUETOOTH_TEST_FAKE_LE_CENTRAL_OBSERVER_MANAGER_H_
+
+#include "base/compiler_specific.h"
+#include "device/bluetooth/bluetooth_adapter.h"
+#include "device/bluetooth/public/interfaces/test/fake_bluetooth.mojom.h"
+#include "mojo/public/cpp/bindings/binding.h"
+
+namespace bluetooth {
+
+// Implementation of FakeLECentralObserverManager in
+// src/device/bluetooth/public/interfaces/test/fake_bluetooth.mojom.
+// Implemented on top of the C++ device/bluetooth API, mainly
+// device/bluetooth/bluetooth_adapter.h.
+class FakeLECentralObserverManager
+ : NON_EXPORTED_BASE(public mojom::FakeLECentralObserverManager),
+ public device::BluetoothAdapter {
+ public:
+ FakeLECentralObserverManager(
+ mojom::LECentralObserverManagerState state,
+ mojom::FakeLECentralObserverManagerRequest request);
+
+ // BluetoothAdapter overrides:
+ std::string GetAddress() const override;
+ std::string GetName() const override;
+ void SetName(const std::string& name,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback) override;
+ bool IsInitialized() const override;
+ bool IsPresent() const override;
+ bool IsPowered() const override;
+ void SetPowered(bool powered,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback) override;
+ bool IsDiscoverable() const override;
+ void SetDiscoverable(bool discoverable,
+ const base::Closure& callback,
+ const ErrorCallback& error_callback) override;
+ bool IsDiscovering() const override;
+ UUIDList GetUUIDs() const override;
+ void CreateRfcommService(
+ const device::BluetoothUUID& uuid,
+ const ServiceOptions& options,
+ const CreateServiceCallback& callback,
+ const CreateServiceErrorCallback& error_callback) override;
+ void CreateL2capService(
+ const device::BluetoothUUID& uuid,
+ const ServiceOptions& options,
+ const CreateServiceCallback& callback,
+ const CreateServiceErrorCallback& error_callback) override;
+ void RegisterAdvertisement(
+ std::unique_ptr<device::BluetoothAdvertisement::Data> advertisement_data,
+ const CreateAdvertisementCallback& callback,
+ const AdvertisementErrorCallback& error_callback) override;
+#if defined(OS_CHROMEOS) || defined(OS_LINUX)
+ void SetAdvertisingInterval(
+ const base::TimeDelta& min,
+ const base::TimeDelta& max,
+ const base::Closure& callback,
+ const AdvertisementErrorCallback& error_callback) override;
+#endif
+ device::BluetoothLocalGattService* GetGattService(
+ const std::string& identifier) const override;
+ void AddDiscoverySession(
+ device::BluetoothDiscoveryFilter* discovery_filter,
+ const base::Closure& callback,
+ const DiscoverySessionErrorCallback& error_callback) override;
+ void RemoveDiscoverySession(
+ device::BluetoothDiscoveryFilter* discovery_filter,
+ const base::Closure& callback,
+ const DiscoverySessionErrorCallback& error_callback) override;
+ void SetDiscoveryFilter(
+ std::unique_ptr<device::BluetoothDiscoveryFilter> discovery_filter,
+ const base::Closure& callback,
+ const DiscoverySessionErrorCallback& error_callback) override;
+ void RemovePairingDelegateInternal(
+ device::BluetoothDevice::PairingDelegate* pairing_delegate) override;
+
+ private:
+ ~FakeLECentralObserverManager() override;
+
+ mojom::LECentralObserverManagerState state_;
+ mojo::Binding<mojom::FakeLECentralObserverManager> binding_;
+};
+
+} // namespace bluetooth
+
+#endif // DEVICE_BLUETOOTH_TEST_FAKE_LE_CENTRAL_OBSERVER_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698