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