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

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

Issue 2853433002: bluetooth: Implement simulateCentral (Closed)
Patch Set: Address dcheng's comments Created 3 years, 7 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
« no previous file with comments | « device/bluetooth/test/fake_bluetooth.cc ('k') | device/bluetooth/test/fake_central.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/test/fake_central.h
diff --git a/device/bluetooth/test/fake_central.h b/device/bluetooth/test/fake_central.h
new file mode 100644
index 0000000000000000000000000000000000000000..c4e2be4ca331ba76b5839b2836d5a919cf50593e
--- /dev/null
+++ b/device/bluetooth/test/fake_central.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_CENTRAL_H_
+#define DEVICE_BLUETOOTH_TEST_FAKE_CENTRAL_H_
+
+#include <memory>
+#include <string>
+
+#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 FakeCentral 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 FakeCentral : NON_EXPORTED_BASE(public mojom::FakeCentral),
+ public device::BluetoothAdapter {
+ public:
+ FakeCentral(mojom::CentralState state, mojom::FakeCentralRequest 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:
+ ~FakeCentral() override;
+
+ mojom::CentralState state_;
+ mojo::Binding<mojom::FakeCentral> binding_;
+};
+
+} // namespace bluetooth
+
+#endif // DEVICE_BLUETOOTH_TEST_FAKE_CENTRAL_H_
« no previous file with comments | « device/bluetooth/test/fake_bluetooth.cc ('k') | device/bluetooth/test/fake_central.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698