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

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

Issue 1973703002: Implement //device/bt changes for notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notifications_dbus
Patch Set: Created 4 years, 7 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 <memory> 10 #include <memory>
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 // Simulates write a value to a locally hosted GATT descriptor by a 248 // Simulates write a value to a locally hosted GATT descriptor by a
249 // remote central device. 249 // remote central device.
250 virtual void SimulateLocalGattDescriptorValueWriteRequest( 250 virtual void SimulateLocalGattDescriptorValueWriteRequest(
251 BluetoothLocalGattService* service, 251 BluetoothLocalGattService* service,
252 BluetoothLocalGattDescriptor* descriptor, 252 BluetoothLocalGattDescriptor* descriptor,
253 const std::vector<uint8_t>& value_to_write, 253 const std::vector<uint8_t>& value_to_write,
254 const base::Closure& success_callback, 254 const base::Closure& success_callback,
255 const base::Closure& error_callback) {} 255 const base::Closure& error_callback) {}
256 256
257 // Simulates starting or stopping a notification session for a locally
258 // hosted GATT characteristic by a remote device. Returns false if we were
259 // not able to start or stop notifications.
260 virtual bool SimulateLocalGattCharacteristicNotificationsRequest(
261 BluetoothLocalGattService* service,
262 BluetoothLocalGattCharacteristic* characteristic,
263 bool start);
264
265 // Simulates sending a value updated notification to a remote device. Returns
scheib 2016/05/12 16:53:19 I think tests should call characteristic_->NotifyV
rkc 2016/05/12 20:12:49 The BlueZ implementation does check the result. I'
scheib 2016/05/12 20:38:27 I'm not feeling good about this approach. The meth
rkc 2016/05/12 21:19:18 Actually we don't really need to simulate a notifi
266 // false if the send was unsuccessful.
267 virtual bool SimulateLocalGattCharacteristicSendValueUpdate(
268 BluetoothLocalGattService* service,
269 BluetoothLocalGattCharacteristic* characteristic,
270 const std::vector<uint8_t>& new_value);
271
257 // Remembers |descriptor|'s platform specific object to be used in a 272 // Remembers |descriptor|'s platform specific object to be used in a
258 // subsequent call to methods such as SimulateGattDescriptorRead that 273 // subsequent call to methods such as SimulateGattDescriptorRead that
259 // accept a nullptr value to select this remembered descriptor. This 274 // accept a nullptr value to select this remembered descriptor. This
260 // enables tests where the platform attempts to reference descriptor 275 // enables tests where the platform attempts to reference descriptor
261 // objects after the Chrome objects have been deleted, e.g. with DeleteDevice. 276 // objects after the Chrome objects have been deleted, e.g. with DeleteDevice.
262 virtual void RememberDescriptorForSubsequentAction( 277 virtual void RememberDescriptorForSubsequentAction(
263 BluetoothRemoteGattDescriptor* descriptor) {} 278 BluetoothRemoteGattDescriptor* descriptor) {}
264 279
265 // Simulates a Descriptor Read operation succeeding, returning |value|. 280 // Simulates a Descriptor Read operation succeeding, returning |value|.
266 // If |descriptor| is null, acts upon the descriptor provided to 281 // If |descriptor| is null, acts upon the descriptor provided to
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 int actual_error_callback_calls_ = 0; 400 int actual_error_callback_calls_ = 0;
386 bool unexpected_success_callback_ = false; 401 bool unexpected_success_callback_ = false;
387 bool unexpected_error_callback_ = false; 402 bool unexpected_error_callback_ = false;
388 403
389 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; 404 base::WeakPtrFactory<BluetoothTestBase> weak_factory_;
390 }; 405 };
391 406
392 } // namespace device 407 } // namespace device
393 408
394 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ 409 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698