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_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // Simulates GattConnection disconnecting. | 106 // Simulates GattConnection disconnecting. |
107 virtual void SimulateGattDisconnection(BluetoothDevice* device) {} | 107 virtual void SimulateGattDisconnection(BluetoothDevice* device) {} |
108 | 108 |
109 // Simulates success of discovering services. |uuids| is used to create a | 109 // Simulates success of discovering services. |uuids| is used to create a |
110 // service for each UUID string. Multiple UUIDs with the same value produce | 110 // service for each UUID string. Multiple UUIDs with the same value produce |
111 // multiple service instances. | 111 // multiple service instances. |
112 virtual void SimulateGattServicesDiscovered( | 112 virtual void SimulateGattServicesDiscovered( |
113 BluetoothDevice* device, | 113 BluetoothDevice* device, |
114 const std::vector<std::string>& uuids) {} | 114 const std::vector<std::string>& uuids) {} |
115 | 115 |
| 116 // Simulates success of discovering included services of |service|. |uuids| is |
| 117 // used to create an included service for each UUID string. Multiple UUIDs |
| 118 // with the same value produce multiple service instances. |
| 119 virtual void SimulateIncludedGattServicesDiscovered( |
| 120 BluetoothGattService* service, |
| 121 const std::vector<std::string>& uuids) {} |
| 122 |
| 123 // Simulates remove of a |service|. |
| 124 virtual void SimulateGattServiceRemoved(BluetoothGattService* service) {} |
| 125 |
116 // Simulates failure to discover services. | 126 // Simulates failure to discover services. |
117 virtual void SimulateGattServicesDiscoveryError(BluetoothDevice* device) {} | 127 virtual void SimulateGattServicesDiscoveryError(BluetoothDevice* device) {} |
118 | 128 |
119 // Simulates a Characteristic on a service. | 129 // Simulates a Characteristic on a service. |
120 virtual void SimulateGattCharacteristic(BluetoothGattService* service, | 130 virtual void SimulateGattCharacteristic(BluetoothGattService* service, |
121 const std::string& uuid, | 131 const std::string& uuid, |
122 int properties) {} | 132 int properties) {} |
123 | 133 |
| 134 // Simulates remove of a |characteristic| from |service|. |
| 135 virtual void SimulateGattCharacteristicRemoved( |
| 136 BluetoothGattService* service, |
| 137 BluetoothGattCharacteristic* characteristic) {} |
| 138 |
124 // Remembers |characteristic|'s platform specific object to be used in a | 139 // Remembers |characteristic|'s platform specific object to be used in a |
125 // subsequent call to methods such as SimulateGattCharacteristicRead that | 140 // subsequent call to methods such as SimulateGattCharacteristicRead that |
126 // accept a nullptr value to select this remembered characteristic. This | 141 // accept a nullptr value to select this remembered characteristic. This |
127 // enables tests where the platform attempts to reference characteristic | 142 // enables tests where the platform attempts to reference characteristic |
128 // objects after the Chrome objects have been deleted, e.g. with DeleteDevice. | 143 // objects after the Chrome objects have been deleted, e.g. with DeleteDevice. |
129 virtual void RememberCharacteristicForSubsequentAction( | 144 virtual void RememberCharacteristicForSubsequentAction( |
130 BluetoothGattCharacteristic* characteristic) {} | 145 BluetoothGattCharacteristic* characteristic) {} |
131 | 146 |
132 // Simulates a Characteristic Set Notify success. | 147 // Simulates a Characteristic Set Notify success. |
133 virtual void SimulateGattNotifySessionStarted( | 148 virtual void SimulateGattNotifySessionStarted( |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 int actual_error_callback_calls_ = 0; | 267 int actual_error_callback_calls_ = 0; |
253 bool unexpected_success_callback_ = false; | 268 bool unexpected_success_callback_ = false; |
254 bool unexpected_error_callback_ = false; | 269 bool unexpected_error_callback_ = false; |
255 | 270 |
256 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; | 271 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; |
257 }; | 272 }; |
258 | 273 |
259 } // namespace device | 274 } // namespace device |
260 | 275 |
261 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 276 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
OLD | NEW |