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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 BluetoothRemoteGattCharacteristic* characteristic) override; | 87 BluetoothRemoteGattCharacteristic* characteristic) override; |
88 void ExpectedChangeNotifyValueAttempts(int attempts) override; | 88 void ExpectedChangeNotifyValueAttempts(int attempts) override; |
89 void ExpectedNotifyValue(NotifyValueState expected_value_state) override; | 89 void ExpectedNotifyValue(NotifyValueState expected_value_state) override; |
90 | 90 |
91 // Callback for the bluetooth central manager mock. | 91 // Callback for the bluetooth central manager mock. |
92 void OnFakeBluetoothDeviceConnectGattCalled(); | 92 void OnFakeBluetoothDeviceConnectGattCalled(); |
93 void OnFakeBluetoothGattDisconnect(); | 93 void OnFakeBluetoothGattDisconnect(); |
94 | 94 |
95 // Callback for the bluetooth peripheral mock. | 95 // Callback for the bluetooth peripheral mock. |
96 void OnFakeBluetoothServiceDiscovery(); | 96 void OnFakeBluetoothServiceDiscovery(); |
| 97 void OnFakeBluetoothCharacteristicDiscovery(); |
97 void OnFakeBluetoothCharacteristicReadValue(); | 98 void OnFakeBluetoothCharacteristicReadValue(); |
98 void OnFakeBluetoothCharacteristicWriteValue(std::vector<uint8_t> value); | 99 void OnFakeBluetoothCharacteristicWriteValue(std::vector<uint8_t> value); |
99 void OnFakeBluetoothGattSetCharacteristicNotification(bool notify_value); | 100 void OnFakeBluetoothGattSetCharacteristicNotification(bool notify_value); |
100 | 101 |
101 // Returns the service UUIDs used to retrieve connected peripherals. | 102 // Returns the service UUIDs used to retrieve connected peripherals. |
102 BluetoothDevice::UUIDSet RetrieveConnectedPeripheralServiceUUIDs(); | 103 BluetoothDevice::UUIDSet RetrieveConnectedPeripheralServiceUUIDs(); |
103 // Reset RetrieveConnectedPeripheralServiceUUIDs set. | 104 // Reset RetrieveConnectedPeripheralServiceUUIDs set. |
104 void ResetRetrieveConnectedPeripheralServiceUUIDs(); | 105 void ResetRetrieveConnectedPeripheralServiceUUIDs(); |
105 | 106 |
106 protected: | 107 protected: |
(...skipping 10 matching lines...) Expand all Loading... |
117 BluetoothRemoteGattCharacteristic* characteristic) const; | 118 BluetoothRemoteGattCharacteristic* characteristic) const; |
118 | 119 |
119 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes. | 120 // Utility function for finding CBUUIDs with relatively nice SHA256 hashes. |
120 std::string FindCBUUIDForHashTarget(); | 121 std::string FindCBUUIDForHashTarget(); |
121 | 122 |
122 BluetoothAdapterMac* adapter_mac_ = nullptr; | 123 BluetoothAdapterMac* adapter_mac_ = nullptr; |
123 std::unique_ptr<ScopedMockCentralManager> mock_central_manager_; | 124 std::unique_ptr<ScopedMockCentralManager> mock_central_manager_; |
124 | 125 |
125 // Value set by -[CBPeripheral setNotifyValue:forCharacteristic:] call. | 126 // Value set by -[CBPeripheral setNotifyValue:forCharacteristic:] call. |
126 bool last_notify_value_ = false; | 127 bool last_notify_value_ = false; |
| 128 int gatt_characteristic_discovery_attempts_ = 0; |
127 }; | 129 }; |
128 | 130 |
129 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). | 131 // Defines common test fixture name. Use TEST_F(BluetoothTest, YourTestName). |
130 typedef BluetoothTestMac BluetoothTest; | 132 typedef BluetoothTestMac BluetoothTest; |
131 | 133 |
132 } // namespace device | 134 } // namespace device |
133 | 135 |
134 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ | 136 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_MAC_H_ |
OLD | NEW |