| 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_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ |
| 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ | 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/test/test_simple_task_runner.h" | 10 #include "base/test/test_simple_task_runner.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 BluetoothRemoteGattCharacteristic* characteristic, | 59 BluetoothRemoteGattCharacteristic* characteristic, |
| 60 const std::vector<uint8_t>& value) override; | 60 const std::vector<uint8_t>& value) override; |
| 61 void SimulateGattCharacteristicReadError( | 61 void SimulateGattCharacteristicReadError( |
| 62 BluetoothRemoteGattCharacteristic* characteristic, | 62 BluetoothRemoteGattCharacteristic* characteristic, |
| 63 BluetoothRemoteGattService::GattErrorCode) override; | 63 BluetoothRemoteGattService::GattErrorCode) override; |
| 64 void SimulateGattCharacteristicWrite( | 64 void SimulateGattCharacteristicWrite( |
| 65 BluetoothRemoteGattCharacteristic* characteristic) override; | 65 BluetoothRemoteGattCharacteristic* characteristic) override; |
| 66 void SimulateGattCharacteristicWriteError( | 66 void SimulateGattCharacteristicWriteError( |
| 67 BluetoothRemoteGattCharacteristic* characteristic, | 67 BluetoothRemoteGattCharacteristic* characteristic, |
| 68 BluetoothRemoteGattService::GattErrorCode error_code) override; | 68 BluetoothRemoteGattService::GattErrorCode error_code) override; |
| 69 void SimulateGattDescriptor(BluetoothRemoteGattCharacteristic* characteristic, |
| 70 const std::string& uuid) override; |
| 69 void SimulateGattNotifySessionStarted( | 71 void SimulateGattNotifySessionStarted( |
| 70 BluetoothRemoteGattCharacteristic* characteristic) override; | 72 BluetoothRemoteGattCharacteristic* characteristic) override; |
| 71 void SimulateGattNotifySessionStartError( | 73 void SimulateGattNotifySessionStartError( |
| 72 BluetoothRemoteGattCharacteristic* characteristic, | 74 BluetoothRemoteGattCharacteristic* characteristic, |
| 73 BluetoothRemoteGattService::GattErrorCode error_code) override; | 75 BluetoothRemoteGattService::GattErrorCode error_code) override; |
| 74 void SimulateGattCharacteristicChanged( | 76 void SimulateGattCharacteristicChanged( |
| 75 BluetoothRemoteGattCharacteristic* characteristic, | 77 BluetoothRemoteGattCharacteristic* characteristic, |
| 76 const std::vector<uint8_t>& value) override; | 78 const std::vector<uint8_t>& value) override; |
| 77 void SimulateGattCharacteristicRemoved( | 79 void SimulateGattCharacteristicRemoved( |
| 78 BluetoothRemoteGattService* service, | 80 BluetoothRemoteGattService* service, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 92 BluetoothDevice::UUIDSet RetrieveConnectedPeripheralServiceUUIDs(); | 94 BluetoothDevice::UUIDSet RetrieveConnectedPeripheralServiceUUIDs(); |
| 93 // Reset RetrieveConnectedPeripheralServiceUUIDs set. | 95 // Reset RetrieveConnectedPeripheralServiceUUIDs set. |
| 94 void ResetRetrieveConnectedPeripheralServiceUUIDs(); | 96 void ResetRetrieveConnectedPeripheralServiceUUIDs(); |
| 95 | 97 |
| 96 protected: | 98 protected: |
| 97 class ScopedMockCentralManager; | 99 class ScopedMockCentralManager; |
| 98 | 100 |
| 99 // Returns MockCBPeripheral from BluetoothRemoteGattService. | 101 // Returns MockCBPeripheral from BluetoothRemoteGattService. |
| 100 MockCBPeripheral* GetMockCBPeripheral( | 102 MockCBPeripheral* GetMockCBPeripheral( |
| 101 BluetoothRemoteGattService* service) const; | 103 BluetoothRemoteGattService* service) const; |
| 102 // Returns MockCBPeripheral from BluetoothRemoteGattService. | 104 // Returns MockCBPeripheral from BluetoothRemoteGattCharacteristic. |
| 105 MockCBPeripheral* GetMockCBPeripheral( |
| 106 BluetoothRemoteGattCharacteristic* characteristic) const; |
| 107 // Returns MockCBCharacteristic from BluetoothRemoteGattCharacteristic. |
| 103 MockCBCharacteristic* GetCBMockCharacteristic( | 108 MockCBCharacteristic* GetCBMockCharacteristic( |
| 104 BluetoothRemoteGattCharacteristic* characteristic) const; | 109 BluetoothRemoteGattCharacteristic* characteristic) const; |
| 105 | 110 |
| 106 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes. | 111 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes. |
| 107 std::string FindCBUUIDForHashTarget(); | 112 std::string FindCBUUIDForHashTarget(); |
| 108 | 113 |
| 109 BluetoothAdapterMac* adapter_mac_ = nullptr; | 114 BluetoothAdapterMac* adapter_mac_ = nullptr; |
| 110 std::unique_ptr<ScopedMockCentralManager> mock_central_manager_; | 115 std::unique_ptr<ScopedMockCentralManager> mock_central_manager_; |
| 111 }; | 116 }; |
| 112 | 117 |
| 113 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). | 118 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). |
| 114 typedef BluetoothTestMac BluetoothTest; | 119 typedef BluetoothTestMac BluetoothTest; |
| 115 | 120 |
| 116 } // namespace device | 121 } // namespace device |
| 117 | 122 |
| 118 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ | 123 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ |
| OLD | NEW |