OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 #ifndef DEVICE_BLUETOOTH_TEST_FAKE_CENTRAL_H_ | 4 #ifndef DEVICE_BLUETOOTH_TEST_FAKE_CENTRAL_H_ |
5 #define DEVICE_BLUETOOTH_TEST_FAKE_CENTRAL_H_ | 5 #define DEVICE_BLUETOOTH_TEST_FAKE_CENTRAL_H_ |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "device/bluetooth/bluetooth_adapter.h" | 11 #include "device/bluetooth/bluetooth_adapter.h" |
12 #include "device/bluetooth/public/interfaces/test/fake_bluetooth.mojom.h" | 12 #include "device/bluetooth/public/interfaces/test/fake_bluetooth.mojom.h" |
13 #include "mojo/public/cpp/bindings/binding.h" | 13 #include "mojo/public/cpp/bindings/binding.h" |
14 | 14 |
15 namespace bluetooth { | 15 namespace bluetooth { |
16 | 16 |
17 // Implementation of FakeCentral in | 17 // Implementation of FakeCentral in |
18 // src/device/bluetooth/public/interfaces/test/fake_bluetooth.mojom. | 18 // src/device/bluetooth/public/interfaces/test/fake_bluetooth.mojom. |
19 // Implemented on top of the C++ device/bluetooth API, mainly | 19 // Implemented on top of the C++ device/bluetooth API, mainly |
20 // device/bluetooth/bluetooth_adapter.h. | 20 // device/bluetooth/bluetooth_adapter.h. |
21 class FakeCentral : NON_EXPORTED_BASE(public mojom::FakeCentral), | 21 class FakeCentral : NON_EXPORTED_BASE(public mojom::FakeCentral), |
22 public device::BluetoothAdapter { | 22 public device::BluetoothAdapter { |
23 public: | 23 public: |
24 FakeCentral(mojom::CentralState state, mojom::FakeCentralRequest request); | 24 FakeCentral(mojom::CentralState state, mojom::FakeCentralRequest request); |
25 | 25 |
| 26 // FakeCentral overrides: |
| 27 void SimulatePreconnectedPeripheral( |
| 28 const std::string& address, |
| 29 const std::string& name, |
| 30 SimulatePreconnectedPeripheralCallback callback) override; |
| 31 |
26 // BluetoothAdapter overrides: | 32 // BluetoothAdapter overrides: |
27 std::string GetAddress() const override; | 33 std::string GetAddress() const override; |
28 std::string GetName() const override; | 34 std::string GetName() const override; |
29 void SetName(const std::string& name, | 35 void SetName(const std::string& name, |
30 const base::Closure& callback, | 36 const base::Closure& callback, |
31 const ErrorCallback& error_callback) override; | 37 const ErrorCallback& error_callback) override; |
32 bool IsInitialized() const override; | 38 bool IsInitialized() const override; |
33 bool IsPresent() const override; | 39 bool IsPresent() const override; |
34 bool IsPowered() const override; | 40 bool IsPowered() const override; |
35 void SetPowered(bool powered, | 41 void SetPowered(bool powered, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 private: | 88 private: |
83 ~FakeCentral() override; | 89 ~FakeCentral() override; |
84 | 90 |
85 mojom::CentralState state_; | 91 mojom::CentralState state_; |
86 mojo::Binding<mojom::FakeCentral> binding_; | 92 mojo::Binding<mojom::FakeCentral> binding_; |
87 }; | 93 }; |
88 | 94 |
89 } // namespace bluetooth | 95 } // namespace bluetooth |
90 | 96 |
91 #endif // DEVICE_BLUETOOTH_TEST_FAKE_CENTRAL_H_ | 97 #endif // DEVICE_BLUETOOTH_TEST_FAKE_CENTRAL_H_ |
OLD | NEW |