| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_WIN_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_WIN_H_ |
| 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_WIN_H_ | 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_WIN_H_ |
| 7 | 7 |
| 8 #include "device/bluetooth/test/bluetooth_test.h" | 8 #include "device/bluetooth/test/bluetooth_test.h" |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 void InitWithDefaultAdapter() override; | 30 void InitWithDefaultAdapter() override; |
| 31 void InitWithoutDefaultAdapter() override; | 31 void InitWithoutDefaultAdapter() override; |
| 32 void InitWithFakeAdapter() override; | 32 void InitWithFakeAdapter() override; |
| 33 bool DenyPermission() override; | 33 bool DenyPermission() override; |
| 34 void StartLowEnergyDiscoverySession() override; | 34 void StartLowEnergyDiscoverySession() override; |
| 35 BluetoothDevice* DiscoverLowEnergyDevice(int device_ordinal) override; | 35 BluetoothDevice* DiscoverLowEnergyDevice(int device_ordinal) override; |
| 36 void SimulateGattConnection(BluetoothDevice* device) override; | 36 void SimulateGattConnection(BluetoothDevice* device) override; |
| 37 void SimulateGattServicesDiscovered( | 37 void SimulateGattServicesDiscovered( |
| 38 BluetoothDevice* device, | 38 BluetoothDevice* device, |
| 39 const std::vector<std::string>& uuids) override; | 39 const std::vector<std::string>& uuids) override; |
| 40 void SimulateGattServiceRemoved(BluetoothGattService* service) override; | 40 void SimulateGattServiceRemoved(BluetoothRemoteGattService* service) override; |
| 41 void SimulateGattCharacteristic(BluetoothGattService* service, | 41 void SimulateGattCharacteristic(BluetoothRemoteGattService* service, |
| 42 const std::string& uuid, | 42 const std::string& uuid, |
| 43 int properties) override; | 43 int properties) override; |
| 44 void SimulateGattCharacteristicRemoved( | 44 void SimulateGattCharacteristicRemoved( |
| 45 BluetoothGattService* service, | 45 BluetoothRemoteGattService* service, |
| 46 BluetoothGattCharacteristic* characteristic) override; | 46 BluetoothRemoteGattCharacteristic* characteristic) override; |
| 47 void RememberCharacteristicForSubsequentAction( | 47 void RememberCharacteristicForSubsequentAction( |
| 48 BluetoothGattCharacteristic* characteristic) override; | 48 BluetoothRemoteGattCharacteristic* characteristic) override; |
| 49 void SimulateGattCharacteristicRead( | 49 void SimulateGattCharacteristicRead( |
| 50 BluetoothGattCharacteristic* characteristic, | 50 BluetoothRemoteGattCharacteristic* characteristic, |
| 51 const std::vector<uint8_t>& value) override; | 51 const std::vector<uint8_t>& value) override; |
| 52 void SimulateGattCharacteristicReadError( | 52 void SimulateGattCharacteristicReadError( |
| 53 BluetoothGattCharacteristic* characteristic, | 53 BluetoothRemoteGattCharacteristic* characteristic, |
| 54 BluetoothGattService::GattErrorCode error_code) override; | 54 BluetoothRemoteGattService::GattErrorCode error_code) override; |
| 55 void SimulateGattCharacteristicWrite( | 55 void SimulateGattCharacteristicWrite( |
| 56 BluetoothGattCharacteristic* characteristic) override; | 56 BluetoothRemoteGattCharacteristic* characteristic) override; |
| 57 void SimulateGattCharacteristicWriteError( | 57 void SimulateGattCharacteristicWriteError( |
| 58 BluetoothGattCharacteristic* characteristic, | 58 BluetoothRemoteGattCharacteristic* characteristic, |
| 59 BluetoothGattService::GattErrorCode error_code) override; | 59 BluetoothRemoteGattService::GattErrorCode error_code) override; |
| 60 void DeleteDevice(BluetoothDevice* device) override; | 60 void DeleteDevice(BluetoothDevice* device) override; |
| 61 void SimulateGattDescriptor(BluetoothGattCharacteristic* characteristic, | 61 void SimulateGattDescriptor(BluetoothRemoteGattCharacteristic* characteristic, |
| 62 const std::string& uuid) override; | 62 const std::string& uuid) override; |
| 63 void SimulateGattNotifySessionStarted( | 63 void SimulateGattNotifySessionStarted( |
| 64 BluetoothGattCharacteristic* characteristic) override; | 64 BluetoothRemoteGattCharacteristic* characteristic) override; |
| 65 void SimulateGattCharacteristicChanged( | 65 void SimulateGattCharacteristicChanged( |
| 66 BluetoothGattCharacteristic* characteristic, | 66 BluetoothRemoteGattCharacteristic* characteristic, |
| 67 const std::vector<uint8_t>& value) override; | 67 const std::vector<uint8_t>& value) override; |
| 68 | 68 |
| 69 // win::BluetoothLowEnergyWrapperFake::Observer overrides. | 69 // win::BluetoothLowEnergyWrapperFake::Observer overrides. |
| 70 void OnReadGattCharacteristicValue() override; | 70 void OnReadGattCharacteristicValue() override; |
| 71 void OnWriteGattCharacteristicValue( | 71 void OnWriteGattCharacteristicValue( |
| 72 const PBTH_LE_GATT_CHARACTERISTIC_VALUE value) override; | 72 const PBTH_LE_GATT_CHARACTERISTIC_VALUE value) override; |
| 73 void OnStartCharacteristicNotification() override; | 73 void OnStartCharacteristicNotification() override; |
| 74 void OnWriteGattDescriptorValue(const std::vector<uint8_t>& value) override; | 74 void OnWriteGattDescriptorValue(const std::vector<uint8_t>& value) override; |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 scoped_refptr<base::TestSimpleTaskRunner> ui_task_runner_; | 77 scoped_refptr<base::TestSimpleTaskRunner> ui_task_runner_; |
| 78 scoped_refptr<base::TestSimpleTaskRunner> bluetooth_task_runner_; | 78 scoped_refptr<base::TestSimpleTaskRunner> bluetooth_task_runner_; |
| 79 BluetoothAdapterWin* adapter_win_; | 79 BluetoothAdapterWin* adapter_win_; |
| 80 | 80 |
| 81 win::BluetoothClassicWrapperFake* fake_bt_classic_wrapper_; | 81 win::BluetoothClassicWrapperFake* fake_bt_classic_wrapper_; |
| 82 win::BluetoothLowEnergyWrapperFake* fake_bt_le_wrapper_; | 82 win::BluetoothLowEnergyWrapperFake* fake_bt_le_wrapper_; |
| 83 | 83 |
| 84 void AdapterInitCallback(); | 84 void AdapterInitCallback(); |
| 85 win::GattService* GetSimulatedService(win::BLEDevice* device, | 85 win::GattService* GetSimulatedService(win::BLEDevice* device, |
| 86 BluetoothGattService* service); | 86 BluetoothRemoteGattService* service); |
| 87 win::GattCharacteristic* GetSimulatedCharacteristic( | 87 win::GattCharacteristic* GetSimulatedCharacteristic( |
| 88 BluetoothGattCharacteristic* characteristic); | 88 BluetoothRemoteGattCharacteristic* characteristic); |
| 89 | 89 |
| 90 // Run pending Bluetooth tasks until the first callback that the test fixture | 90 // Run pending Bluetooth tasks until the first callback that the test fixture |
| 91 // tracks is called. | 91 // tracks is called. |
| 92 void RunPendingTasksUntilCallback(); | 92 void RunPendingTasksUntilCallback(); |
| 93 void ForceRefreshDevice(); | 93 void ForceRefreshDevice(); |
| 94 void FinishPendingTasks(); | 94 void FinishPendingTasks(); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). | 97 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). |
| 98 typedef BluetoothTestWin BluetoothTest; | 98 typedef BluetoothTestWin BluetoothTest; |
| 99 | 99 |
| 100 } // namespace device | 100 } // namespace device |
| 101 | 101 |
| 102 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_WIN_H_ | 102 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_WIN_H_ |
| OLD | NEW |