Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: device/bluetooth/test/bluetooth_test.h

Issue 1577623002: bluetooth: android: Implement Descriptor Write as needed for notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-descriptors-
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // Simulates a Characteristic Write operation failing synchronously once for 169 // Simulates a Characteristic Write operation failing synchronously once for
170 // an unknown reason. 170 // an unknown reason.
171 virtual void SimulateGattCharacteristicWriteWillFailSynchronouslyOnce( 171 virtual void SimulateGattCharacteristicWriteWillFailSynchronouslyOnce(
172 BluetoothGattCharacteristic* characteristic) {} 172 BluetoothGattCharacteristic* characteristic) {}
173 173
174 // Simulates a Descriptor on a service. 174 // Simulates a Descriptor on a service.
175 virtual void SimulateGattDescriptor( 175 virtual void SimulateGattDescriptor(
176 BluetoothGattCharacteristic* characteristic, 176 BluetoothGattCharacteristic* characteristic,
177 const std::string& uuid) {} 177 const std::string& uuid) {}
178 178
179 // Simulates a Descriptor Write operation failing synchronously once for
180 // an unknown reason.
181 virtual void SimulateGattDescriptorWriteWillFailSynchronouslyOnce(
182 BluetoothGattDescriptor* descriptor) {}
183
179 // Removes the device from the adapter and deletes it. 184 // Removes the device from the adapter and deletes it.
180 virtual void DeleteDevice(BluetoothDevice* device); 185 virtual void DeleteDevice(BluetoothDevice* device);
181 186
182 // Callbacks that increment |callback_count_|, |error_callback_count_|: 187 // Callbacks that increment |callback_count_|, |error_callback_count_|:
183 void Callback(Call expected); 188 void Callback(Call expected);
184 void DiscoverySessionCallback(Call expected, 189 void DiscoverySessionCallback(Call expected,
185 scoped_ptr<BluetoothDiscoverySession>); 190 scoped_ptr<BluetoothDiscoverySession>);
186 void GattConnectionCallback(Call expected, 191 void GattConnectionCallback(Call expected,
187 scoped_ptr<BluetoothGattConnection>); 192 scoped_ptr<BluetoothGattConnection>);
188 void NotifyCallback(Call expected, scoped_ptr<BluetoothGattNotifySession>); 193 void NotifyCallback(Call expected, scoped_ptr<BluetoothGattNotifySession>);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 BluetoothGattService::GattErrorCode last_gatt_error_code_; 230 BluetoothGattService::GattErrorCode last_gatt_error_code_;
226 231
227 int callback_count_ = 0; 232 int callback_count_ = 0;
228 int error_callback_count_ = 0; 233 int error_callback_count_ = 0;
229 int gatt_connection_attempts_ = 0; 234 int gatt_connection_attempts_ = 0;
230 int gatt_disconnection_attempts_ = 0; 235 int gatt_disconnection_attempts_ = 0;
231 int gatt_discovery_attempts_ = 0; 236 int gatt_discovery_attempts_ = 0;
232 int gatt_notify_characteristic_attempts_ = 0; 237 int gatt_notify_characteristic_attempts_ = 0;
233 int gatt_read_characteristic_attempts_ = 0; 238 int gatt_read_characteristic_attempts_ = 0;
234 int gatt_write_characteristic_attempts_ = 0; 239 int gatt_write_characteristic_attempts_ = 0;
240 int gatt_write_descriptor_attempts_ = 0;
235 241
236 // The following values are used to make sure the correct callbacks 242 // The following values are used to make sure the correct callbacks
237 // have been called. They are not reset when calling ResetEventCounts(). 243 // have been called. They are not reset when calling ResetEventCounts().
238 int expected_success_callback_calls_ = 0; 244 int expected_success_callback_calls_ = 0;
239 int expected_error_callback_calls_ = 0; 245 int expected_error_callback_calls_ = 0;
240 int actual_success_callback_calls_ = 0; 246 int actual_success_callback_calls_ = 0;
241 int actual_error_callback_calls_ = 0; 247 int actual_error_callback_calls_ = 0;
242 bool unexpected_success_callback_ = false; 248 bool unexpected_success_callback_ = false;
243 bool unexpected_error_callback_ = false; 249 bool unexpected_error_callback_ = false;
244 250
245 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; 251 base::WeakPtrFactory<BluetoothTestBase> weak_factory_;
246 }; 252 };
247 253
248 } // namespace device 254 } // namespace device
249 255
250 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ 256 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698