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

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

Issue 1779083002: bluetooth: Test & make StartNotifySession reentrant. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-notify-followup-descriptors-
Patch Set: addressed ortuno comments Created 4 years, 9 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 BluetoothGattCharacteristic* characteristic) {} 130 BluetoothGattCharacteristic* characteristic) {}
131 131
132 // Remembers |characteristic|'s platform specific object to be used in a 132 // Remembers |characteristic|'s platform specific object to be used in a
133 // subsequent call to methods such as SimulateGattCharacteristicRead that 133 // subsequent call to methods such as SimulateGattCharacteristicRead that
134 // accept a nullptr value to select this remembered characteristic. This 134 // accept a nullptr value to select this remembered characteristic. This
135 // enables tests where the platform attempts to reference characteristic 135 // enables tests where the platform attempts to reference characteristic
136 // objects after the Chrome objects have been deleted, e.g. with DeleteDevice. 136 // objects after the Chrome objects have been deleted, e.g. with DeleteDevice.
137 virtual void RememberCharacteristicForSubsequentAction( 137 virtual void RememberCharacteristicForSubsequentAction(
138 BluetoothGattCharacteristic* characteristic) {} 138 BluetoothGattCharacteristic* characteristic) {}
139 139
140 // Remembers |characteristic|'s Client Characteristic Configuration (CCC)
141 // descriptor's platform specific object to be used in a subsequent call to
142 // methods such as SimulateGattNotifySessionStarted. This enables tests where
143 // the platform attempts to reference descriptor objects after the Chrome
144 // objects have been deleted, e.g. with DeleteDevice.
145 virtual void RememberCCCDescriptorForSubsequentAction(
146 BluetoothGattCharacteristic* characteristic) {}
147
140 // Simulates a Characteristic Set Notify success. 148 // Simulates a Characteristic Set Notify success.
149 // If |characteristic| is null, acts upon the characteristic & CCC
150 // descriptor provided to RememberCharacteristicForSubsequentAction &
151 // RememberCCCDescriptorForSubsequentAction.
141 virtual void SimulateGattNotifySessionStarted( 152 virtual void SimulateGattNotifySessionStarted(
142 BluetoothGattCharacteristic* characteristic) {} 153 BluetoothGattCharacteristic* characteristic) {}
143 154
155 // Simulates a Characteristic Set Notify error.
156 // If |characteristic| is null, acts upon the characteristic & CCC
157 // descriptor provided to RememberCharacteristicForSubsequentAction &
158 // RememberCCCDescriptorForSubsequentAction.
159 virtual void SimulateGattNotifySessionStartError(
160 BluetoothGattCharacteristic* characteristic,
161 BluetoothGattService::GattErrorCode error_code) {}
162
144 // Simulates a Characteristic Set Notify operation failing synchronously once 163 // Simulates a Characteristic Set Notify operation failing synchronously once
145 // for an unknown reason. 164 // for an unknown reason.
146 virtual void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( 165 virtual void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce(
147 BluetoothGattCharacteristic* characteristic) {} 166 BluetoothGattCharacteristic* characteristic) {}
148 167
149 // Simulates a Characteristic Changed operation with updated |value|. 168 // Simulates a Characteristic Changed operation with updated |value|.
150 virtual void SimulateGattCharacteristicChanged( 169 virtual void SimulateGattCharacteristicChanged(
151 BluetoothGattCharacteristic* characteristic, 170 BluetoothGattCharacteristic* characteristic,
152 const std::vector<uint8_t>& value) {} 171 const std::vector<uint8_t>& value) {}
153 172
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 int actual_error_callback_calls_ = 0; 315 int actual_error_callback_calls_ = 0;
297 bool unexpected_success_callback_ = false; 316 bool unexpected_success_callback_ = false;
298 bool unexpected_error_callback_ = false; 317 bool unexpected_error_callback_ = false;
299 318
300 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; 319 base::WeakPtrFactory<BluetoothTestBase> weak_factory_;
301 }; 320 };
302 321
303 } // namespace device 322 } // namespace device
304 323
305 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ 324 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc ('k') | device/bluetooth/test/bluetooth_test_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698