| 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 <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "device/bluetooth/bluetooth_adapter.h" | 15 #include "device/bluetooth/bluetooth_adapter.h" |
| 16 #include "device/bluetooth/bluetooth_device.h" | 16 #include "device/bluetooth/bluetooth_device.h" |
| 17 #include "device/bluetooth/bluetooth_discovery_session.h" | 17 #include "device/bluetooth/bluetooth_discovery_session.h" |
| 18 #include "device/bluetooth/bluetooth_gatt_characteristic.h" | |
| 19 #include "device/bluetooth/bluetooth_gatt_connection.h" | 18 #include "device/bluetooth/bluetooth_gatt_connection.h" |
| 20 #include "device/bluetooth/bluetooth_gatt_descriptor.h" | |
| 21 #include "device/bluetooth/bluetooth_gatt_notify_session.h" | 19 #include "device/bluetooth/bluetooth_gatt_notify_session.h" |
| 22 #include "device/bluetooth/bluetooth_gatt_service.h" | 20 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
| 21 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" |
| 22 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 24 | 24 |
| 25 namespace device { | 25 namespace device { |
| 26 | 26 |
| 27 class BluetoothAdapter; | 27 class BluetoothAdapter; |
| 28 class BluetoothDevice; | 28 class BluetoothDevice; |
| 29 | 29 |
| 30 // A test fixture for Bluetooth that abstracts platform specifics for creating | 30 // A test fixture for Bluetooth that abstracts platform specifics for creating |
| 31 // and controlling fake low level objects. | 31 // and controlling fake low level objects. |
| 32 // | 32 // |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 virtual void SimulateGattDisconnection(BluetoothDevice* device) {} | 111 virtual void SimulateGattDisconnection(BluetoothDevice* device) {} |
| 112 | 112 |
| 113 // Simulates success of discovering services. |uuids| is used to create a | 113 // Simulates success of discovering services. |uuids| is used to create a |
| 114 // service for each UUID string. Multiple UUIDs with the same value produce | 114 // service for each UUID string. Multiple UUIDs with the same value produce |
| 115 // multiple service instances. | 115 // multiple service instances. |
| 116 virtual void SimulateGattServicesDiscovered( | 116 virtual void SimulateGattServicesDiscovered( |
| 117 BluetoothDevice* device, | 117 BluetoothDevice* device, |
| 118 const std::vector<std::string>& uuids) {} | 118 const std::vector<std::string>& uuids) {} |
| 119 | 119 |
| 120 // Simulates remove of a |service|. | 120 // Simulates remove of a |service|. |
| 121 virtual void SimulateGattServiceRemoved(BluetoothGattService* service) {} | 121 virtual void SimulateGattServiceRemoved(BluetoothRemoteGattService* service) { |
| 122 } |
| 122 | 123 |
| 123 // Simulates failure to discover services. | 124 // Simulates failure to discover services. |
| 124 virtual void SimulateGattServicesDiscoveryError(BluetoothDevice* device) {} | 125 virtual void SimulateGattServicesDiscoveryError(BluetoothDevice* device) {} |
| 125 | 126 |
| 126 // Simulates a Characteristic on a service. | 127 // Simulates a Characteristic on a service. |
| 127 virtual void SimulateGattCharacteristic(BluetoothGattService* service, | 128 virtual void SimulateGattCharacteristic(BluetoothRemoteGattService* service, |
| 128 const std::string& uuid, | 129 const std::string& uuid, |
| 129 int properties) {} | 130 int properties) {} |
| 130 | 131 |
| 131 // Simulates remove of a |characteristic| from |service|. | 132 // Simulates remove of a |characteristic| from |service|. |
| 132 virtual void SimulateGattCharacteristicRemoved( | 133 virtual void SimulateGattCharacteristicRemoved( |
| 133 BluetoothGattService* service, | 134 BluetoothRemoteGattService* service, |
| 134 BluetoothGattCharacteristic* characteristic) {} | 135 BluetoothRemoteGattCharacteristic* characteristic) {} |
| 135 | 136 |
| 136 // Remembers |characteristic|'s platform specific object to be used in a | 137 // Remembers |characteristic|'s platform specific object to be used in a |
| 137 // subsequent call to methods such as SimulateGattCharacteristicRead that | 138 // subsequent call to methods such as SimulateGattCharacteristicRead that |
| 138 // accept a nullptr value to select this remembered characteristic. This | 139 // accept a nullptr value to select this remembered characteristic. This |
| 139 // enables tests where the platform attempts to reference characteristic | 140 // enables tests where the platform attempts to reference characteristic |
| 140 // objects after the Chrome objects have been deleted, e.g. with DeleteDevice. | 141 // objects after the Chrome objects have been deleted, e.g. with DeleteDevice. |
| 141 virtual void RememberCharacteristicForSubsequentAction( | 142 virtual void RememberCharacteristicForSubsequentAction( |
| 142 BluetoothGattCharacteristic* characteristic) {} | 143 BluetoothRemoteGattCharacteristic* characteristic) {} |
| 143 | 144 |
| 144 // Remembers |characteristic|'s Client Characteristic Configuration (CCC) | 145 // Remembers |characteristic|'s Client Characteristic Configuration (CCC) |
| 145 // descriptor's platform specific object to be used in a subsequent call to | 146 // descriptor's platform specific object to be used in a subsequent call to |
| 146 // methods such as SimulateGattNotifySessionStarted. This enables tests where | 147 // methods such as SimulateGattNotifySessionStarted. This enables tests where |
| 147 // the platform attempts to reference descriptor objects after the Chrome | 148 // the platform attempts to reference descriptor objects after the Chrome |
| 148 // objects have been deleted, e.g. with DeleteDevice. | 149 // objects have been deleted, e.g. with DeleteDevice. |
| 149 virtual void RememberCCCDescriptorForSubsequentAction( | 150 virtual void RememberCCCDescriptorForSubsequentAction( |
| 150 BluetoothGattCharacteristic* characteristic) {} | 151 BluetoothRemoteGattCharacteristic* characteristic) {} |
| 151 | 152 |
| 152 // Simulates a Characteristic Set Notify success. | 153 // Simulates a Characteristic Set Notify success. |
| 153 // If |characteristic| is null, acts upon the characteristic & CCC | 154 // If |characteristic| is null, acts upon the characteristic & CCC |
| 154 // descriptor provided to RememberCharacteristicForSubsequentAction & | 155 // descriptor provided to RememberCharacteristicForSubsequentAction & |
| 155 // RememberCCCDescriptorForSubsequentAction. | 156 // RememberCCCDescriptorForSubsequentAction. |
| 156 virtual void SimulateGattNotifySessionStarted( | 157 virtual void SimulateGattNotifySessionStarted( |
| 157 BluetoothGattCharacteristic* characteristic) {} | 158 BluetoothRemoteGattCharacteristic* characteristic) {} |
| 158 | 159 |
| 159 // Simulates a Characteristic Set Notify error. | 160 // Simulates a Characteristic Set Notify error. |
| 160 // If |characteristic| is null, acts upon the characteristic & CCC | 161 // If |characteristic| is null, acts upon the characteristic & CCC |
| 161 // descriptor provided to RememberCharacteristicForSubsequentAction & | 162 // descriptor provided to RememberCharacteristicForSubsequentAction & |
| 162 // RememberCCCDescriptorForSubsequentAction. | 163 // RememberCCCDescriptorForSubsequentAction. |
| 163 virtual void SimulateGattNotifySessionStartError( | 164 virtual void SimulateGattNotifySessionStartError( |
| 164 BluetoothGattCharacteristic* characteristic, | 165 BluetoothRemoteGattCharacteristic* characteristic, |
| 165 BluetoothGattService::GattErrorCode error_code) {} | 166 BluetoothRemoteGattService::GattErrorCode error_code) {} |
| 166 | 167 |
| 167 // Simulates a Characteristic Set Notify operation failing synchronously once | 168 // Simulates a Characteristic Set Notify operation failing synchronously once |
| 168 // for an unknown reason. | 169 // for an unknown reason. |
| 169 virtual void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( | 170 virtual void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( |
| 170 BluetoothGattCharacteristic* characteristic) {} | 171 BluetoothRemoteGattCharacteristic* characteristic) {} |
| 171 | 172 |
| 172 // Simulates a Characteristic Changed operation with updated |value|. | 173 // Simulates a Characteristic Changed operation with updated |value|. |
| 173 virtual void SimulateGattCharacteristicChanged( | 174 virtual void SimulateGattCharacteristicChanged( |
| 174 BluetoothGattCharacteristic* characteristic, | 175 BluetoothRemoteGattCharacteristic* characteristic, |
| 175 const std::vector<uint8_t>& value) {} | 176 const std::vector<uint8_t>& value) {} |
| 176 | 177 |
| 177 // Simulates a Characteristic Read operation succeeding, returning |value|. | 178 // Simulates a Characteristic Read operation succeeding, returning |value|. |
| 178 // If |characteristic| is null, acts upon the characteristic provided to | 179 // If |characteristic| is null, acts upon the characteristic provided to |
| 179 // RememberCharacteristicForSubsequentAction. | 180 // RememberCharacteristicForSubsequentAction. |
| 180 virtual void SimulateGattCharacteristicRead( | 181 virtual void SimulateGattCharacteristicRead( |
| 181 BluetoothGattCharacteristic* characteristic, | 182 BluetoothRemoteGattCharacteristic* characteristic, |
| 182 const std::vector<uint8_t>& value) {} | 183 const std::vector<uint8_t>& value) {} |
| 183 | 184 |
| 184 // Simulates a Characteristic Read operation failing with a GattErrorCode. | 185 // Simulates a Characteristic Read operation failing with a GattErrorCode. |
| 185 virtual void SimulateGattCharacteristicReadError( | 186 virtual void SimulateGattCharacteristicReadError( |
| 186 BluetoothGattCharacteristic* characteristic, | 187 BluetoothRemoteGattCharacteristic* characteristic, |
| 187 BluetoothGattService::GattErrorCode) {} | 188 BluetoothRemoteGattService::GattErrorCode) {} |
| 188 | 189 |
| 189 // Simulates a Characteristic Read operation failing synchronously once for an | 190 // Simulates a Characteristic Read operation failing synchronously once for an |
| 190 // unknown reason. | 191 // unknown reason. |
| 191 virtual void SimulateGattCharacteristicReadWillFailSynchronouslyOnce( | 192 virtual void SimulateGattCharacteristicReadWillFailSynchronouslyOnce( |
| 192 BluetoothGattCharacteristic* characteristic) {} | 193 BluetoothRemoteGattCharacteristic* characteristic) {} |
| 193 | 194 |
| 194 // Simulates a Characteristic Write operation succeeding, returning |value|. | 195 // Simulates a Characteristic Write operation succeeding, returning |value|. |
| 195 // If |characteristic| is null, acts upon the characteristic provided to | 196 // If |characteristic| is null, acts upon the characteristic provided to |
| 196 // RememberCharacteristicForSubsequentAction. | 197 // RememberCharacteristicForSubsequentAction. |
| 197 virtual void SimulateGattCharacteristicWrite( | 198 virtual void SimulateGattCharacteristicWrite( |
| 198 BluetoothGattCharacteristic* characteristic) {} | 199 BluetoothRemoteGattCharacteristic* characteristic) {} |
| 199 | 200 |
| 200 // Simulates a Characteristic Write operation failing with a GattErrorCode. | 201 // Simulates a Characteristic Write operation failing with a GattErrorCode. |
| 201 virtual void SimulateGattCharacteristicWriteError( | 202 virtual void SimulateGattCharacteristicWriteError( |
| 202 BluetoothGattCharacteristic* characteristic, | 203 BluetoothRemoteGattCharacteristic* characteristic, |
| 203 BluetoothGattService::GattErrorCode) {} | 204 BluetoothRemoteGattService::GattErrorCode) {} |
| 204 | 205 |
| 205 // Simulates a Characteristic Write operation failing synchronously once for | 206 // Simulates a Characteristic Write operation failing synchronously once for |
| 206 // an unknown reason. | 207 // an unknown reason. |
| 207 virtual void SimulateGattCharacteristicWriteWillFailSynchronouslyOnce( | 208 virtual void SimulateGattCharacteristicWriteWillFailSynchronouslyOnce( |
| 208 BluetoothGattCharacteristic* characteristic) {} | 209 BluetoothRemoteGattCharacteristic* characteristic) {} |
| 209 | 210 |
| 210 // Simulates a Descriptor on a service. | 211 // Simulates a Descriptor on a service. |
| 211 virtual void SimulateGattDescriptor( | 212 virtual void SimulateGattDescriptor( |
| 212 BluetoothGattCharacteristic* characteristic, | 213 BluetoothRemoteGattCharacteristic* characteristic, |
| 213 const std::string& uuid) {} | 214 const std::string& uuid) {} |
| 214 | 215 |
| 215 // Remembers |descriptor|'s platform specific object to be used in a | 216 // Remembers |descriptor|'s platform specific object to be used in a |
| 216 // subsequent call to methods such as SimulateGattDescriptorRead that | 217 // subsequent call to methods such as SimulateGattDescriptorRead that |
| 217 // accept a nullptr value to select this remembered descriptor. This | 218 // accept a nullptr value to select this remembered descriptor. This |
| 218 // enables tests where the platform attempts to reference descriptor | 219 // enables tests where the platform attempts to reference descriptor |
| 219 // objects after the Chrome objects have been deleted, e.g. with DeleteDevice. | 220 // objects after the Chrome objects have been deleted, e.g. with DeleteDevice. |
| 220 virtual void RememberDescriptorForSubsequentAction( | 221 virtual void RememberDescriptorForSubsequentAction( |
| 221 BluetoothGattDescriptor* descriptor) {} | 222 BluetoothRemoteGattDescriptor* descriptor) {} |
| 222 | 223 |
| 223 // Simulates a Descriptor Read operation succeeding, returning |value|. | 224 // Simulates a Descriptor Read operation succeeding, returning |value|. |
| 224 // If |descriptor| is null, acts upon the descriptor provided to | 225 // If |descriptor| is null, acts upon the descriptor provided to |
| 225 // RememberDescriptorForSubsequentAction. | 226 // RememberDescriptorForSubsequentAction. |
| 226 virtual void SimulateGattDescriptorRead(BluetoothGattDescriptor* descriptor, | 227 virtual void SimulateGattDescriptorRead( |
| 227 const std::vector<uint8_t>& value) {} | 228 BluetoothRemoteGattDescriptor* descriptor, |
| 229 const std::vector<uint8_t>& value) {} |
| 228 | 230 |
| 229 // Simulates a Descriptor Read operation failing with a GattErrorCode. | 231 // Simulates a Descriptor Read operation failing with a GattErrorCode. |
| 230 virtual void SimulateGattDescriptorReadError( | 232 virtual void SimulateGattDescriptorReadError( |
| 231 BluetoothGattDescriptor* descriptor, | 233 BluetoothRemoteGattDescriptor* descriptor, |
| 232 BluetoothGattService::GattErrorCode) {} | 234 BluetoothRemoteGattService::GattErrorCode) {} |
| 233 | 235 |
| 234 // Simulates a Descriptor Read operation failing synchronously once for an | 236 // Simulates a Descriptor Read operation failing synchronously once for an |
| 235 // unknown reason. | 237 // unknown reason. |
| 236 virtual void SimulateGattDescriptorReadWillFailSynchronouslyOnce( | 238 virtual void SimulateGattDescriptorReadWillFailSynchronouslyOnce( |
| 237 BluetoothGattDescriptor* descriptor) {} | 239 BluetoothRemoteGattDescriptor* descriptor) {} |
| 238 | 240 |
| 239 // Simulates a Descriptor Write operation succeeding, returning |value|. | 241 // Simulates a Descriptor Write operation succeeding, returning |value|. |
| 240 // If |descriptor| is null, acts upon the descriptor provided to | 242 // If |descriptor| is null, acts upon the descriptor provided to |
| 241 // RememberDescriptorForSubsequentAction. | 243 // RememberDescriptorForSubsequentAction. |
| 242 virtual void SimulateGattDescriptorWrite( | 244 virtual void SimulateGattDescriptorWrite( |
| 243 BluetoothGattDescriptor* descriptor) {} | 245 BluetoothRemoteGattDescriptor* descriptor) {} |
| 244 | 246 |
| 245 // Simulates a Descriptor Write operation failing with a GattErrorCode. | 247 // Simulates a Descriptor Write operation failing with a GattErrorCode. |
| 246 virtual void SimulateGattDescriptorWriteError( | 248 virtual void SimulateGattDescriptorWriteError( |
| 247 BluetoothGattDescriptor* descriptor, | 249 BluetoothRemoteGattDescriptor* descriptor, |
| 248 BluetoothGattService::GattErrorCode) {} | 250 BluetoothRemoteGattService::GattErrorCode) {} |
| 249 | 251 |
| 250 // Simulates a Descriptor Write operation failing synchronously once for | 252 // Simulates a Descriptor Write operation failing synchronously once for |
| 251 // an unknown reason. | 253 // an unknown reason. |
| 252 virtual void SimulateGattDescriptorWriteWillFailSynchronouslyOnce( | 254 virtual void SimulateGattDescriptorWriteWillFailSynchronouslyOnce( |
| 253 BluetoothGattDescriptor* descriptor) {} | 255 BluetoothRemoteGattDescriptor* descriptor) {} |
| 254 | 256 |
| 255 // Removes the device from the adapter and deletes it. | 257 // Removes the device from the adapter and deletes it. |
| 256 virtual void DeleteDevice(BluetoothDevice* device); | 258 virtual void DeleteDevice(BluetoothDevice* device); |
| 257 | 259 |
| 258 // Callbacks that increment |callback_count_|, |error_callback_count_|: | 260 // Callbacks that increment |callback_count_|, |error_callback_count_|: |
| 259 void Callback(Call expected); | 261 void Callback(Call expected); |
| 260 void DiscoverySessionCallback(Call expected, | 262 void DiscoverySessionCallback(Call expected, |
| 261 std::unique_ptr<BluetoothDiscoverySession>); | 263 std::unique_ptr<BluetoothDiscoverySession>); |
| 262 void GattConnectionCallback(Call expected, | 264 void GattConnectionCallback(Call expected, |
| 263 std::unique_ptr<BluetoothGattConnection>); | 265 std::unique_ptr<BluetoothGattConnection>); |
| 264 void NotifyCallback(Call expected, | 266 void NotifyCallback(Call expected, |
| 265 std::unique_ptr<BluetoothGattNotifySession>); | 267 std::unique_ptr<BluetoothGattNotifySession>); |
| 266 void ReadValueCallback(Call expected, const std::vector<uint8_t>& value); | 268 void ReadValueCallback(Call expected, const std::vector<uint8_t>& value); |
| 267 void ErrorCallback(Call expected); | 269 void ErrorCallback(Call expected); |
| 268 void ConnectErrorCallback(Call expected, | 270 void ConnectErrorCallback(Call expected, |
| 269 enum BluetoothDevice::ConnectErrorCode); | 271 enum BluetoothDevice::ConnectErrorCode); |
| 270 void GattErrorCallback(Call expected, BluetoothGattService::GattErrorCode); | 272 void GattErrorCallback(Call expected, |
| 273 BluetoothRemoteGattService::GattErrorCode); |
| 271 | 274 |
| 272 // Accessors to get callbacks bound to this fixture: | 275 // Accessors to get callbacks bound to this fixture: |
| 273 base::Closure GetCallback(Call expected); | 276 base::Closure GetCallback(Call expected); |
| 274 BluetoothAdapter::DiscoverySessionCallback GetDiscoverySessionCallback( | 277 BluetoothAdapter::DiscoverySessionCallback GetDiscoverySessionCallback( |
| 275 Call expected); | 278 Call expected); |
| 276 BluetoothDevice::GattConnectionCallback GetGattConnectionCallback( | 279 BluetoothDevice::GattConnectionCallback GetGattConnectionCallback( |
| 277 Call expected); | 280 Call expected); |
| 278 BluetoothGattCharacteristic::NotifySessionCallback GetNotifyCallback( | 281 BluetoothRemoteGattCharacteristic::NotifySessionCallback GetNotifyCallback( |
| 279 Call expected); | 282 Call expected); |
| 280 BluetoothGattCharacteristic::ValueCallback GetReadValueCallback( | 283 BluetoothRemoteGattCharacteristic::ValueCallback GetReadValueCallback( |
| 281 Call expected); | 284 Call expected); |
| 282 BluetoothAdapter::ErrorCallback GetErrorCallback(Call expected); | 285 BluetoothAdapter::ErrorCallback GetErrorCallback(Call expected); |
| 283 BluetoothDevice::ConnectErrorCallback GetConnectErrorCallback(Call expected); | 286 BluetoothDevice::ConnectErrorCallback GetConnectErrorCallback(Call expected); |
| 284 base::Callback<void(BluetoothGattService::GattErrorCode)> | 287 base::Callback<void(BluetoothRemoteGattService::GattErrorCode)> |
| 285 GetGattErrorCallback(Call expected); | 288 GetGattErrorCallback(Call expected); |
| 286 | 289 |
| 287 // Reset all event count members to 0. | 290 // Reset all event count members to 0. |
| 288 void ResetEventCounts(); | 291 void ResetEventCounts(); |
| 289 | 292 |
| 290 // A Message loop is required by some implementations that will PostTasks and | 293 // A Message loop is required by some implementations that will PostTasks and |
| 291 // by base::RunLoop().RunUntilIdle() use in this fixture. | 294 // by base::RunLoop().RunUntilIdle() use in this fixture. |
| 292 base::MessageLoop message_loop_; | 295 base::MessageLoop message_loop_; |
| 293 | 296 |
| 294 scoped_refptr<BluetoothAdapter> adapter_; | 297 scoped_refptr<BluetoothAdapter> adapter_; |
| 295 ScopedVector<BluetoothDiscoverySession> discovery_sessions_; | 298 ScopedVector<BluetoothDiscoverySession> discovery_sessions_; |
| 296 ScopedVector<BluetoothGattConnection> gatt_connections_; | 299 ScopedVector<BluetoothGattConnection> gatt_connections_; |
| 297 enum BluetoothDevice::ConnectErrorCode last_connect_error_code_ = | 300 enum BluetoothDevice::ConnectErrorCode last_connect_error_code_ = |
| 298 BluetoothDevice::ERROR_UNKNOWN; | 301 BluetoothDevice::ERROR_UNKNOWN; |
| 299 ScopedVector<BluetoothGattNotifySession> notify_sessions_; | 302 ScopedVector<BluetoothGattNotifySession> notify_sessions_; |
| 300 std::vector<uint8_t> last_read_value_; | 303 std::vector<uint8_t> last_read_value_; |
| 301 std::vector<uint8_t> last_write_value_; | 304 std::vector<uint8_t> last_write_value_; |
| 302 BluetoothGattService::GattErrorCode last_gatt_error_code_; | 305 BluetoothRemoteGattService::GattErrorCode last_gatt_error_code_; |
| 303 | 306 |
| 304 int callback_count_ = 0; | 307 int callback_count_ = 0; |
| 305 int error_callback_count_ = 0; | 308 int error_callback_count_ = 0; |
| 306 int gatt_connection_attempts_ = 0; | 309 int gatt_connection_attempts_ = 0; |
| 307 int gatt_disconnection_attempts_ = 0; | 310 int gatt_disconnection_attempts_ = 0; |
| 308 int gatt_discovery_attempts_ = 0; | 311 int gatt_discovery_attempts_ = 0; |
| 309 int gatt_notify_characteristic_attempts_ = 0; | 312 int gatt_notify_characteristic_attempts_ = 0; |
| 310 int gatt_read_characteristic_attempts_ = 0; | 313 int gatt_read_characteristic_attempts_ = 0; |
| 311 int gatt_write_characteristic_attempts_ = 0; | 314 int gatt_write_characteristic_attempts_ = 0; |
| 312 int gatt_read_descriptor_attempts_ = 0; | 315 int gatt_read_descriptor_attempts_ = 0; |
| 313 int gatt_write_descriptor_attempts_ = 0; | 316 int gatt_write_descriptor_attempts_ = 0; |
| 314 | 317 |
| 315 // The following values are used to make sure the correct callbacks | 318 // The following values are used to make sure the correct callbacks |
| 316 // have been called. They are not reset when calling ResetEventCounts(). | 319 // have been called. They are not reset when calling ResetEventCounts(). |
| 317 int expected_success_callback_calls_ = 0; | 320 int expected_success_callback_calls_ = 0; |
| 318 int expected_error_callback_calls_ = 0; | 321 int expected_error_callback_calls_ = 0; |
| 319 int actual_success_callback_calls_ = 0; | 322 int actual_success_callback_calls_ = 0; |
| 320 int actual_error_callback_calls_ = 0; | 323 int actual_error_callback_calls_ = 0; |
| 321 bool unexpected_success_callback_ = false; | 324 bool unexpected_success_callback_ = false; |
| 322 bool unexpected_error_callback_ = false; | 325 bool unexpected_error_callback_ = false; |
| 323 | 326 |
| 324 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; | 327 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; |
| 325 }; | 328 }; |
| 326 | 329 |
| 327 } // namespace device | 330 } // namespace device |
| 328 | 331 |
| 329 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 332 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
| OLD | NEW |