OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 4 |
5 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_BLUEZ_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_BLUEZ_H_ |
6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_BLUEZ_H_ | 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_BLUEZ_H_ |
7 | 7 |
| 8 #include <cstdint> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/callback_forward.h" |
| 12 #include "device/bluetooth/bluetooth_device.h" |
| 13 #include "device/bluetooth/bluetooth_local_gatt_characteristic.h" |
| 14 #include "device/bluetooth/bluetooth_local_gatt_descriptor.h" |
| 15 #include "device/bluetooth/bluetooth_local_gatt_service.h" |
8 #include "device/bluetooth/test/bluetooth_test.h" | 16 #include "device/bluetooth/test/bluetooth_test.h" |
9 | 17 |
10 namespace bluez { | 18 namespace bluez { |
11 class FakeBluetoothDeviceClient; | 19 class FakeBluetoothDeviceClient; |
12 } | 20 } |
13 | 21 |
14 namespace device { | 22 namespace device { |
15 | 23 |
16 // BlueZ implementation of BluetoothTestBase. | 24 // BlueZ implementation of BluetoothTestBase. |
17 class BluetoothTestBlueZ : public BluetoothTestBase { | 25 class BluetoothTestBlueZ : public BluetoothTestBase { |
18 public: | 26 public: |
19 BluetoothTestBlueZ(); | 27 BluetoothTestBlueZ(); |
20 ~BluetoothTestBlueZ() override; | 28 ~BluetoothTestBlueZ() override; |
21 | 29 |
22 // Test overrides: | 30 // Test overrides: |
23 void SetUp() override; | 31 void SetUp() override; |
24 void TearDown() override; | 32 void TearDown() override; |
25 | 33 |
26 // BluetoothTestBase overrides: | 34 // BluetoothTestBase overrides: |
27 bool PlatformSupportsLowEnergy() override; | 35 bool PlatformSupportsLowEnergy() override; |
28 void InitWithFakeAdapter() override; | 36 void InitWithFakeAdapter() override; |
29 BluetoothDevice* DiscoverLowEnergyDevice(int device_ordinal) override; | 37 BluetoothDevice* DiscoverLowEnergyDevice(int device_ordinal) override; |
30 | 38 |
| 39 void SimulateLocalGattCharacteristicValueReadRequest( |
| 40 BluetoothLocalGattService* service, |
| 41 BluetoothLocalGattCharacteristic* characteristic, |
| 42 const BluetoothLocalGattService::Delegate::ValueCallback& value_callback, |
| 43 const base::Closure& error_callback) override; |
| 44 void SimulateLocalGattCharacteristicValueWriteRequest( |
| 45 BluetoothLocalGattService* service, |
| 46 BluetoothLocalGattCharacteristic* characteristic, |
| 47 const std::vector<uint8_t>& value_to_write, |
| 48 const base::Closure& success_callback, |
| 49 const base::Closure& error_callback) override; |
| 50 |
| 51 void SimulateLocalGattDescriptorValueReadRequest( |
| 52 BluetoothLocalGattService* service, |
| 53 BluetoothLocalGattDescriptor* descriptor, |
| 54 const BluetoothLocalGattService::Delegate::ValueCallback& value_callback, |
| 55 const base::Closure& error_callback) override; |
| 56 void SimulateLocalGattDescriptorValueWriteRequest( |
| 57 BluetoothLocalGattService* service, |
| 58 BluetoothLocalGattDescriptor* descriptor, |
| 59 const std::vector<uint8_t>& value_to_write, |
| 60 const base::Closure& success_callback, |
| 61 const base::Closure& error_callback) override; |
| 62 |
31 private: | 63 private: |
32 bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_; | 64 bluez::FakeBluetoothDeviceClient* fake_bluetooth_device_client_; |
33 }; | 65 }; |
34 | 66 |
35 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). | 67 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). |
36 using BluetoothTest = BluetoothTestBlueZ; | 68 using BluetoothTest = BluetoothTestBlueZ; |
37 | 69 |
38 } // namespace device | 70 } // namespace device |
39 | 71 |
40 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_BLUEZ_H_ | 72 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_BLUEZ_H_ |
OLD | NEW |