OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "dbus/object_path.h" | 14 #include "dbus/object_path.h" |
15 #include "device/bluetooth/bluetooth_adapter.h" | 15 #include "device/bluetooth/bluetooth_adapter.h" |
16 #include "device/bluetooth/bluetooth_adapter_factory.h" | 16 #include "device/bluetooth/bluetooth_adapter_factory.h" |
17 #include "device/bluetooth/bluetooth_device.h" | 17 #include "device/bluetooth/bluetooth_device.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 "device/bluetooth/bluetooth_uuid.h" | 23 #include "device/bluetooth/bluetooth_uuid.h" |
24 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 24 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
25 #include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h" | 25 #include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h" |
26 #include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h" | 26 #include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h" |
27 #include "device/bluetooth/dbus/fake_bluetooth_device_client.h" | 27 #include "device/bluetooth/dbus/fake_bluetooth_device_client.h" |
28 #include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h" | 28 #include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_client.h" |
29 #include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h" | 29 #include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_client.h" |
30 #include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h" | 30 #include "device/bluetooth/dbus/fake_bluetooth_gatt_service_client.h" |
31 #include "device/bluetooth/dbus/fake_bluetooth_input_client.h" | 31 #include "device/bluetooth/dbus/fake_bluetooth_input_client.h" |
32 #include "device/bluetooth/test/test_bluetooth_adapter_observer.h" | 32 #include "device/bluetooth/test/test_bluetooth_adapter_observer.h" |
33 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
34 | 34 |
35 using device::BluetoothAdapter; | 35 using device::BluetoothAdapter; |
36 using device::BluetoothDevice; | 36 using device::BluetoothDevice; |
37 using device::BluetoothGattCharacteristic; | 37 using device::BluetoothRemoteGattCharacteristic; |
38 using device::BluetoothGattConnection; | 38 using device::BluetoothGattConnection; |
39 using device::BluetoothGattDescriptor; | 39 using device::BluetoothRemoteGattDescriptor; |
40 using device::BluetoothGattService; | 40 using device::BluetoothRemoteGattService; |
41 using device::BluetoothGattNotifySession; | 41 using device::BluetoothGattNotifySession; |
42 using device::BluetoothUUID; | 42 using device::BluetoothUUID; |
43 using device::TestBluetoothAdapterObserver; | 43 using device::TestBluetoothAdapterObserver; |
44 | 44 |
45 namespace bluez { | 45 namespace bluez { |
46 | 46 |
47 namespace { | 47 namespace { |
48 | 48 |
49 const BluetoothUUID kHeartRateMeasurementUUID( | 49 const BluetoothUUID kHeartRateMeasurementUUID( |
50 bluez::FakeBluetoothGattCharacteristicClient::kHeartRateMeasurementUUID); | 50 bluez::FakeBluetoothGattCharacteristicClient::kHeartRateMeasurementUUID); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 gatt_conn_ = std::move(conn); | 149 gatt_conn_ = std::move(conn); |
150 } | 150 } |
151 | 151 |
152 void NotifySessionCallback( | 152 void NotifySessionCallback( |
153 std::unique_ptr<BluetoothGattNotifySession> session) { | 153 std::unique_ptr<BluetoothGattNotifySession> session) { |
154 ++success_callback_count_; | 154 ++success_callback_count_; |
155 update_sessions_.push_back(session.release()); | 155 update_sessions_.push_back(session.release()); |
156 QuitMessageLoop(); | 156 QuitMessageLoop(); |
157 } | 157 } |
158 | 158 |
159 void ServiceErrorCallback(BluetoothGattService::GattErrorCode err) { | 159 void ServiceErrorCallback(BluetoothRemoteGattService::GattErrorCode err) { |
160 ++error_callback_count_; | 160 ++error_callback_count_; |
161 last_service_error_ = err; | 161 last_service_error_ = err; |
162 } | 162 } |
163 | 163 |
164 void ErrorCallback() { ++error_callback_count_; } | 164 void ErrorCallback() { ++error_callback_count_; } |
165 | 165 |
166 void DBusErrorCallback(const std::string& error_name, | 166 void DBusErrorCallback(const std::string& error_name, |
167 const std::string& error_message) { | 167 const std::string& error_message) { |
168 ++error_callback_count_; | 168 ++error_callback_count_; |
169 } | 169 } |
(...skipping 17 matching lines...) Expand all Loading... |
187 fake_bluetooth_gatt_characteristic_client_; | 187 fake_bluetooth_gatt_characteristic_client_; |
188 bluez::FakeBluetoothGattDescriptorClient* | 188 bluez::FakeBluetoothGattDescriptorClient* |
189 fake_bluetooth_gatt_descriptor_client_; | 189 fake_bluetooth_gatt_descriptor_client_; |
190 std::unique_ptr<device::BluetoothGattConnection> gatt_conn_; | 190 std::unique_ptr<device::BluetoothGattConnection> gatt_conn_; |
191 ScopedVector<BluetoothGattNotifySession> update_sessions_; | 191 ScopedVector<BluetoothGattNotifySession> update_sessions_; |
192 scoped_refptr<BluetoothAdapter> adapter_; | 192 scoped_refptr<BluetoothAdapter> adapter_; |
193 | 193 |
194 int success_callback_count_; | 194 int success_callback_count_; |
195 int error_callback_count_; | 195 int error_callback_count_; |
196 std::vector<uint8_t> last_read_value_; | 196 std::vector<uint8_t> last_read_value_; |
197 BluetoothGattService::GattErrorCode last_service_error_; | 197 BluetoothRemoteGattService::GattErrorCode last_service_error_; |
198 }; | 198 }; |
199 | 199 |
200 TEST_F(BluetoothGattBlueZTest, GattConnection) { | 200 TEST_F(BluetoothGattBlueZTest, GattConnection) { |
201 fake_bluetooth_device_client_->CreateDevice( | 201 fake_bluetooth_device_client_->CreateDevice( |
202 dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), | 202 dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), |
203 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); | 203 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); |
204 BluetoothDevice* device = | 204 BluetoothDevice* device = |
205 adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); | 205 adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); |
206 ASSERT_TRUE(device); | 206 ASSERT_TRUE(device); |
207 ASSERT_FALSE(device->IsConnected()); | 207 ASSERT_FALSE(device->IsConnected()); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( | 290 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( |
291 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); | 291 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); |
292 EXPECT_EQ(1, observer.gatt_service_added_count()); | 292 EXPECT_EQ(1, observer.gatt_service_added_count()); |
293 EXPECT_EQ(0, observer.gatt_service_removed_count()); | 293 EXPECT_EQ(0, observer.gatt_service_removed_count()); |
294 EXPECT_FALSE(observer.last_gatt_service_id().empty()); | 294 EXPECT_FALSE(observer.last_gatt_service_id().empty()); |
295 EXPECT_EQ(1U, device->GetGattServices().size()); | 295 EXPECT_EQ(1U, device->GetGattServices().size()); |
296 EXPECT_EQ(BluetoothUUID( | 296 EXPECT_EQ(BluetoothUUID( |
297 bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID), | 297 bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID), |
298 observer.last_gatt_service_uuid()); | 298 observer.last_gatt_service_uuid()); |
299 | 299 |
300 BluetoothGattService* service = | 300 BluetoothRemoteGattService* service = |
301 device->GetGattService(observer.last_gatt_service_id()); | 301 device->GetGattService(observer.last_gatt_service_id()); |
302 EXPECT_FALSE(service->IsLocal()); | |
303 EXPECT_TRUE(service->IsPrimary()); | 302 EXPECT_TRUE(service->IsPrimary()); |
304 EXPECT_EQ(service, device->GetGattServices()[0]); | 303 EXPECT_EQ(service, device->GetGattServices()[0]); |
305 EXPECT_EQ(service, device->GetGattService(service->GetIdentifier())); | 304 EXPECT_EQ(service, device->GetGattService(service->GetIdentifier())); |
306 | 305 |
307 EXPECT_EQ(observer.last_gatt_service_uuid(), service->GetUUID()); | 306 EXPECT_EQ(observer.last_gatt_service_uuid(), service->GetUUID()); |
308 | 307 |
309 // Hide the service. | 308 // Hide the service. |
310 observer.last_gatt_service_uuid() = BluetoothUUID(); | 309 observer.last_gatt_service_uuid() = BluetoothUUID(); |
311 observer.last_gatt_service_id().clear(); | 310 observer.last_gatt_service_id().clear(); |
312 fake_bluetooth_gatt_service_client_->HideHeartRateService(); | 311 fake_bluetooth_gatt_service_client_->HideHeartRateService(); |
(...skipping 18 matching lines...) Expand all Loading... |
331 EXPECT_FALSE(observer.last_gatt_service_id().empty()); | 330 EXPECT_FALSE(observer.last_gatt_service_id().empty()); |
332 EXPECT_EQ(1U, device->GetGattServices().size()); | 331 EXPECT_EQ(1U, device->GetGattServices().size()); |
333 EXPECT_EQ(BluetoothUUID( | 332 EXPECT_EQ(BluetoothUUID( |
334 bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID), | 333 bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID), |
335 observer.last_gatt_service_uuid()); | 334 observer.last_gatt_service_uuid()); |
336 | 335 |
337 // The object |service| points to should have been deallocated. |device| | 336 // The object |service| points to should have been deallocated. |device| |
338 // should contain a brand new instance. | 337 // should contain a brand new instance. |
339 service = device->GetGattService(observer.last_gatt_service_id()); | 338 service = device->GetGattService(observer.last_gatt_service_id()); |
340 EXPECT_EQ(service, device->GetGattServices()[0]); | 339 EXPECT_EQ(service, device->GetGattServices()[0]); |
341 EXPECT_FALSE(service->IsLocal()); | |
342 EXPECT_TRUE(service->IsPrimary()); | 340 EXPECT_TRUE(service->IsPrimary()); |
343 | 341 |
344 EXPECT_EQ(observer.last_gatt_service_uuid(), service->GetUUID()); | 342 EXPECT_EQ(observer.last_gatt_service_uuid(), service->GetUUID()); |
345 | 343 |
346 // Remove the device. The observer should be notified of the removed service. | 344 // Remove the device. The observer should be notified of the removed service. |
347 // |device| becomes invalid after this. | 345 // |device| becomes invalid after this. |
348 observer.last_gatt_service_uuid() = BluetoothUUID(); | 346 observer.last_gatt_service_uuid() = BluetoothUUID(); |
349 observer.last_gatt_service_id().clear(); | 347 observer.last_gatt_service_id().clear(); |
350 fake_bluetooth_device_client_->RemoveDevice( | 348 fake_bluetooth_device_client_->RemoveDevice( |
351 dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), | 349 dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 ASSERT_TRUE(device); | 430 ASSERT_TRUE(device); |
433 | 431 |
434 TestBluetoothAdapterObserver observer(adapter_); | 432 TestBluetoothAdapterObserver observer(adapter_); |
435 | 433 |
436 // Expose the fake Heart Rate service. This will asynchronously expose | 434 // Expose the fake Heart Rate service. This will asynchronously expose |
437 // characteristics. | 435 // characteristics. |
438 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( | 436 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( |
439 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); | 437 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); |
440 ASSERT_EQ(1, observer.gatt_service_added_count()); | 438 ASSERT_EQ(1, observer.gatt_service_added_count()); |
441 | 439 |
442 BluetoothGattService* service = | 440 BluetoothRemoteGattService* service = |
443 device->GetGattService(observer.last_gatt_service_id()); | 441 device->GetGattService(observer.last_gatt_service_id()); |
444 | 442 |
445 EXPECT_EQ(0, observer.gatt_service_changed_count()); | 443 EXPECT_EQ(0, observer.gatt_service_changed_count()); |
446 EXPECT_EQ(0, observer.gatt_discovery_complete_count()); | 444 EXPECT_EQ(0, observer.gatt_discovery_complete_count()); |
447 EXPECT_EQ(0, observer.gatt_characteristic_added_count()); | 445 EXPECT_EQ(0, observer.gatt_characteristic_added_count()); |
448 EXPECT_EQ(0, observer.gatt_characteristic_removed_count()); | 446 EXPECT_EQ(0, observer.gatt_characteristic_removed_count()); |
449 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); | 447 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); |
450 EXPECT_TRUE(service->GetCharacteristics().empty()); | 448 EXPECT_TRUE(service->GetCharacteristics().empty()); |
451 | 449 |
452 // Run the message loop so that the characteristics appear. | 450 // Run the message loop so that the characteristics appear. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 ASSERT_TRUE(device); | 498 ASSERT_TRUE(device); |
501 | 499 |
502 TestBluetoothAdapterObserver observer(adapter_); | 500 TestBluetoothAdapterObserver observer(adapter_); |
503 | 501 |
504 // Expose the fake Heart Rate service. This will asynchronously expose | 502 // Expose the fake Heart Rate service. This will asynchronously expose |
505 // characteristics. | 503 // characteristics. |
506 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( | 504 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( |
507 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); | 505 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); |
508 ASSERT_EQ(1, observer.gatt_service_added_count()); | 506 ASSERT_EQ(1, observer.gatt_service_added_count()); |
509 | 507 |
510 BluetoothGattService* service = | 508 BluetoothRemoteGattService* service = |
511 device->GetGattService(observer.last_gatt_service_id()); | 509 device->GetGattService(observer.last_gatt_service_id()); |
512 | 510 |
513 EXPECT_EQ(0, observer.gatt_service_changed_count()); | 511 EXPECT_EQ(0, observer.gatt_service_changed_count()); |
514 EXPECT_EQ(0, observer.gatt_descriptor_added_count()); | 512 EXPECT_EQ(0, observer.gatt_descriptor_added_count()); |
515 EXPECT_EQ(0, observer.gatt_descriptor_removed_count()); | 513 EXPECT_EQ(0, observer.gatt_descriptor_removed_count()); |
516 EXPECT_EQ(0, observer.gatt_descriptor_value_changed_count()); | 514 EXPECT_EQ(0, observer.gatt_descriptor_value_changed_count()); |
517 | 515 |
518 EXPECT_TRUE(service->GetCharacteristics().empty()); | 516 EXPECT_TRUE(service->GetCharacteristics().empty()); |
519 | 517 |
520 // Run the message loop so that the characteristics appear. | 518 // Run the message loop so that the characteristics appear. |
521 base::MessageLoop::current()->Run(); | 519 base::MessageLoop::current()->Run(); |
522 EXPECT_EQ(0, observer.gatt_service_changed_count()); | 520 EXPECT_EQ(0, observer.gatt_service_changed_count()); |
523 | 521 |
524 // Only the Heart Rate Measurement characteristic has a descriptor. | 522 // Only the Heart Rate Measurement characteristic has a descriptor. |
525 EXPECT_EQ(1, observer.gatt_descriptor_added_count()); | 523 EXPECT_EQ(1, observer.gatt_descriptor_added_count()); |
526 EXPECT_EQ(0, observer.gatt_descriptor_removed_count()); | 524 EXPECT_EQ(0, observer.gatt_descriptor_removed_count()); |
527 EXPECT_EQ(0, observer.gatt_descriptor_value_changed_count()); | 525 EXPECT_EQ(0, observer.gatt_descriptor_value_changed_count()); |
528 | 526 |
529 BluetoothGattCharacteristic* characteristic = service->GetCharacteristic( | 527 BluetoothRemoteGattCharacteristic* characteristic = |
530 fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath() | 528 service->GetCharacteristic(fake_bluetooth_gatt_characteristic_client_ |
531 .value()); | 529 ->GetBodySensorLocationPath() |
| 530 .value()); |
532 ASSERT_TRUE(characteristic); | 531 ASSERT_TRUE(characteristic); |
533 EXPECT_TRUE(characteristic->GetDescriptors().empty()); | 532 EXPECT_TRUE(characteristic->GetDescriptors().empty()); |
534 | 533 |
535 characteristic = service->GetCharacteristic( | 534 characteristic = service->GetCharacteristic( |
536 fake_bluetooth_gatt_characteristic_client_->GetHeartRateControlPointPath() | 535 fake_bluetooth_gatt_characteristic_client_->GetHeartRateControlPointPath() |
537 .value()); | 536 .value()); |
538 ASSERT_TRUE(characteristic); | 537 ASSERT_TRUE(characteristic); |
539 EXPECT_TRUE(characteristic->GetDescriptors().empty()); | 538 EXPECT_TRUE(characteristic->GetDescriptors().empty()); |
540 | 539 |
541 characteristic = service->GetCharacteristic( | 540 characteristic = service->GetCharacteristic( |
542 fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath() | 541 fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath() |
543 .value()); | 542 .value()); |
544 ASSERT_TRUE(characteristic); | 543 ASSERT_TRUE(characteristic); |
545 EXPECT_EQ(1U, characteristic->GetDescriptors().size()); | 544 EXPECT_EQ(1U, characteristic->GetDescriptors().size()); |
546 | 545 |
547 BluetoothGattDescriptor* descriptor = characteristic->GetDescriptors()[0]; | 546 BluetoothRemoteGattDescriptor* descriptor = |
548 EXPECT_FALSE(descriptor->IsLocal()); | 547 characteristic->GetDescriptors()[0]; |
549 EXPECT_EQ(BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid(), | 548 EXPECT_EQ( |
550 descriptor->GetUUID()); | 549 BluetoothRemoteGattDescriptor::ClientCharacteristicConfigurationUuid(), |
| 550 descriptor->GetUUID()); |
551 EXPECT_EQ(descriptor->GetUUID(), observer.last_gatt_descriptor_uuid()); | 551 EXPECT_EQ(descriptor->GetUUID(), observer.last_gatt_descriptor_uuid()); |
552 EXPECT_EQ(descriptor->GetIdentifier(), observer.last_gatt_descriptor_id()); | 552 EXPECT_EQ(descriptor->GetIdentifier(), observer.last_gatt_descriptor_id()); |
553 | 553 |
554 // Hide the descriptor. | 554 // Hide the descriptor. |
555 fake_bluetooth_gatt_descriptor_client_->HideDescriptor( | 555 fake_bluetooth_gatt_descriptor_client_->HideDescriptor( |
556 dbus::ObjectPath(descriptor->GetIdentifier())); | 556 dbus::ObjectPath(descriptor->GetIdentifier())); |
557 EXPECT_TRUE(characteristic->GetDescriptors().empty()); | 557 EXPECT_TRUE(characteristic->GetDescriptors().empty()); |
558 EXPECT_EQ(0, observer.gatt_service_changed_count()); | 558 EXPECT_EQ(0, observer.gatt_service_changed_count()); |
559 EXPECT_EQ(1, observer.gatt_descriptor_added_count()); | 559 EXPECT_EQ(1, observer.gatt_descriptor_added_count()); |
560 EXPECT_EQ(1, observer.gatt_descriptor_removed_count()); | 560 EXPECT_EQ(1, observer.gatt_descriptor_removed_count()); |
561 EXPECT_EQ(0, observer.gatt_descriptor_value_changed_count()); | 561 EXPECT_EQ(0, observer.gatt_descriptor_value_changed_count()); |
562 | 562 |
563 // Expose the descriptor again. | 563 // Expose the descriptor again. |
564 observer.last_gatt_descriptor_id().clear(); | 564 observer.last_gatt_descriptor_id().clear(); |
565 observer.last_gatt_descriptor_uuid() = BluetoothUUID(); | 565 observer.last_gatt_descriptor_uuid() = BluetoothUUID(); |
566 fake_bluetooth_gatt_descriptor_client_->ExposeDescriptor( | 566 fake_bluetooth_gatt_descriptor_client_->ExposeDescriptor( |
567 dbus::ObjectPath(characteristic->GetIdentifier()), | 567 dbus::ObjectPath(characteristic->GetIdentifier()), |
568 bluez::FakeBluetoothGattDescriptorClient:: | 568 bluez::FakeBluetoothGattDescriptorClient:: |
569 kClientCharacteristicConfigurationUUID); | 569 kClientCharacteristicConfigurationUUID); |
570 EXPECT_EQ(0, observer.gatt_service_changed_count()); | 570 EXPECT_EQ(0, observer.gatt_service_changed_count()); |
571 EXPECT_EQ(1U, characteristic->GetDescriptors().size()); | 571 EXPECT_EQ(1U, characteristic->GetDescriptors().size()); |
572 EXPECT_EQ(2, observer.gatt_descriptor_added_count()); | 572 EXPECT_EQ(2, observer.gatt_descriptor_added_count()); |
573 EXPECT_EQ(1, observer.gatt_descriptor_removed_count()); | 573 EXPECT_EQ(1, observer.gatt_descriptor_removed_count()); |
574 EXPECT_EQ(0, observer.gatt_descriptor_value_changed_count()); | 574 EXPECT_EQ(0, observer.gatt_descriptor_value_changed_count()); |
575 | 575 |
576 descriptor = characteristic->GetDescriptors()[0]; | 576 descriptor = characteristic->GetDescriptors()[0]; |
577 EXPECT_FALSE(descriptor->IsLocal()); | 577 EXPECT_EQ( |
578 EXPECT_EQ(BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid(), | 578 BluetoothRemoteGattDescriptor::ClientCharacteristicConfigurationUuid(), |
579 descriptor->GetUUID()); | 579 descriptor->GetUUID()); |
580 EXPECT_EQ(descriptor->GetUUID(), observer.last_gatt_descriptor_uuid()); | 580 EXPECT_EQ(descriptor->GetUUID(), observer.last_gatt_descriptor_uuid()); |
581 EXPECT_EQ(descriptor->GetIdentifier(), observer.last_gatt_descriptor_id()); | 581 EXPECT_EQ(descriptor->GetIdentifier(), observer.last_gatt_descriptor_id()); |
582 } | 582 } |
583 | 583 |
584 TEST_F(BluetoothGattBlueZTest, AdapterAddedAfterGattService) { | 584 TEST_F(BluetoothGattBlueZTest, AdapterAddedAfterGattService) { |
585 // This unit test tests that all remote GATT objects are created for D-Bus | 585 // This unit test tests that all remote GATT objects are created for D-Bus |
586 // objects that were already exposed. | 586 // objects that were already exposed. |
587 adapter_ = NULL; | 587 adapter_ = NULL; |
588 ASSERT_FALSE(device::BluetoothAdapterFactory::HasSharedInstanceForTesting()); | 588 ASSERT_FALSE(device::BluetoothAdapterFactory::HasSharedInstanceForTesting()); |
589 | 589 |
590 // Create the fake D-Bus objects. | 590 // Create the fake D-Bus objects. |
591 fake_bluetooth_device_client_->CreateDevice( | 591 fake_bluetooth_device_client_->CreateDevice( |
592 dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), | 592 dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), |
593 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); | 593 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); |
594 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( | 594 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( |
595 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); | 595 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); |
596 while (!fake_bluetooth_gatt_characteristic_client_->IsHeartRateVisible()) | 596 while (!fake_bluetooth_gatt_characteristic_client_->IsHeartRateVisible()) |
597 base::RunLoop().RunUntilIdle(); | 597 base::RunLoop().RunUntilIdle(); |
598 ASSERT_TRUE(fake_bluetooth_gatt_service_client_->IsHeartRateVisible()); | 598 ASSERT_TRUE(fake_bluetooth_gatt_service_client_->IsHeartRateVisible()); |
599 ASSERT_TRUE(fake_bluetooth_gatt_characteristic_client_->IsHeartRateVisible()); | 599 ASSERT_TRUE(fake_bluetooth_gatt_characteristic_client_->IsHeartRateVisible()); |
600 | 600 |
601 // Create the adapter. This should create all the GATT objects. | 601 // Create the adapter. This should create all the GATT objects. |
602 GetAdapter(); | 602 GetAdapter(); |
603 BluetoothDevice* device = | 603 BluetoothDevice* device = |
604 adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); | 604 adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); |
605 ASSERT_TRUE(device); | 605 ASSERT_TRUE(device); |
606 EXPECT_EQ(1U, device->GetGattServices().size()); | 606 EXPECT_EQ(1U, device->GetGattServices().size()); |
607 | 607 |
608 BluetoothGattService* service = device->GetGattServices()[0]; | 608 BluetoothRemoteGattService* service = device->GetGattServices()[0]; |
609 ASSERT_TRUE(service); | 609 ASSERT_TRUE(service); |
610 EXPECT_FALSE(service->IsLocal()); | |
611 EXPECT_TRUE(service->IsPrimary()); | 610 EXPECT_TRUE(service->IsPrimary()); |
612 EXPECT_EQ(BluetoothUUID( | 611 EXPECT_EQ(BluetoothUUID( |
613 bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID), | 612 bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID), |
614 service->GetUUID()); | 613 service->GetUUID()); |
615 EXPECT_EQ(service, device->GetGattServices()[0]); | 614 EXPECT_EQ(service, device->GetGattServices()[0]); |
616 EXPECT_EQ(service, device->GetGattService(service->GetIdentifier())); | 615 EXPECT_EQ(service, device->GetGattService(service->GetIdentifier())); |
617 EXPECT_FALSE(service->IsLocal()); | |
618 EXPECT_EQ(3U, service->GetCharacteristics().size()); | 616 EXPECT_EQ(3U, service->GetCharacteristics().size()); |
619 | 617 |
620 BluetoothGattCharacteristic* characteristic = service->GetCharacteristic( | 618 BluetoothRemoteGattCharacteristic* characteristic = |
621 fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath() | 619 service->GetCharacteristic(fake_bluetooth_gatt_characteristic_client_ |
622 .value()); | 620 ->GetBodySensorLocationPath() |
| 621 .value()); |
623 ASSERT_TRUE(characteristic); | 622 ASSERT_TRUE(characteristic); |
624 EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient:: | 623 EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient:: |
625 kBodySensorLocationUUID), | 624 kBodySensorLocationUUID), |
626 characteristic->GetUUID()); | 625 characteristic->GetUUID()); |
627 EXPECT_FALSE(characteristic->IsLocal()); | |
628 EXPECT_TRUE(characteristic->GetDescriptors().empty()); | 626 EXPECT_TRUE(characteristic->GetDescriptors().empty()); |
629 | 627 |
630 characteristic = service->GetCharacteristic( | 628 characteristic = service->GetCharacteristic( |
631 fake_bluetooth_gatt_characteristic_client_->GetHeartRateControlPointPath() | 629 fake_bluetooth_gatt_characteristic_client_->GetHeartRateControlPointPath() |
632 .value()); | 630 .value()); |
633 ASSERT_TRUE(characteristic); | 631 ASSERT_TRUE(characteristic); |
634 EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient:: | 632 EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient:: |
635 kHeartRateControlPointUUID), | 633 kHeartRateControlPointUUID), |
636 characteristic->GetUUID()); | 634 characteristic->GetUUID()); |
637 EXPECT_FALSE(characteristic->IsLocal()); | |
638 EXPECT_TRUE(characteristic->GetDescriptors().empty()); | 635 EXPECT_TRUE(characteristic->GetDescriptors().empty()); |
639 | 636 |
640 characteristic = service->GetCharacteristic( | 637 characteristic = service->GetCharacteristic( |
641 fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath() | 638 fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath() |
642 .value()); | 639 .value()); |
643 ASSERT_TRUE(characteristic); | 640 ASSERT_TRUE(characteristic); |
644 EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient:: | 641 EXPECT_EQ(BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient:: |
645 kHeartRateMeasurementUUID), | 642 kHeartRateMeasurementUUID), |
646 characteristic->GetUUID()); | 643 characteristic->GetUUID()); |
647 EXPECT_FALSE(characteristic->IsLocal()); | |
648 EXPECT_EQ(1U, characteristic->GetDescriptors().size()); | 644 EXPECT_EQ(1U, characteristic->GetDescriptors().size()); |
649 | 645 |
650 BluetoothGattDescriptor* descriptor = characteristic->GetDescriptors()[0]; | 646 BluetoothRemoteGattDescriptor* descriptor = |
| 647 characteristic->GetDescriptors()[0]; |
651 ASSERT_TRUE(descriptor); | 648 ASSERT_TRUE(descriptor); |
652 EXPECT_EQ(BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid(), | 649 EXPECT_EQ( |
653 descriptor->GetUUID()); | 650 BluetoothRemoteGattDescriptor::ClientCharacteristicConfigurationUuid(), |
654 EXPECT_FALSE(descriptor->IsLocal()); | 651 descriptor->GetUUID()); |
655 } | 652 } |
656 | 653 |
657 TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) { | 654 TEST_F(BluetoothGattBlueZTest, GattCharacteristicValue) { |
658 fake_bluetooth_device_client_->CreateDevice( | 655 fake_bluetooth_device_client_->CreateDevice( |
659 dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), | 656 dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), |
660 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); | 657 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); |
661 BluetoothDevice* device = | 658 BluetoothDevice* device = |
662 adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); | 659 adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); |
663 ASSERT_TRUE(device); | 660 ASSERT_TRUE(device); |
664 | 661 |
665 TestBluetoothAdapterObserver observer(adapter_); | 662 TestBluetoothAdapterObserver observer(adapter_); |
666 | 663 |
667 // Expose the fake Heart Rate service. This will asynchronously expose | 664 // Expose the fake Heart Rate service. This will asynchronously expose |
668 // characteristics. | 665 // characteristics. |
669 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( | 666 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( |
670 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); | 667 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); |
671 ASSERT_EQ(1, observer.gatt_service_added_count()); | 668 ASSERT_EQ(1, observer.gatt_service_added_count()); |
672 | 669 |
673 BluetoothGattService* service = | 670 BluetoothRemoteGattService* service = |
674 device->GetGattService(observer.last_gatt_service_id()); | 671 device->GetGattService(observer.last_gatt_service_id()); |
675 | 672 |
676 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); | 673 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); |
677 | 674 |
678 // Run the message loop so that the characteristics appear. | 675 // Run the message loop so that the characteristics appear. |
679 base::MessageLoop::current()->Run(); | 676 base::MessageLoop::current()->Run(); |
680 | 677 |
681 // Issue write request to non-writable characteristics. | 678 // Issue write request to non-writable characteristics. |
682 observer.Reset(); | 679 observer.Reset(); |
683 | 680 |
684 std::vector<uint8_t> write_value; | 681 std::vector<uint8_t> write_value; |
685 write_value.push_back(0x01); | 682 write_value.push_back(0x01); |
686 BluetoothGattCharacteristic* characteristic = service->GetCharacteristic( | 683 BluetoothRemoteGattCharacteristic* characteristic = |
687 fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath() | 684 service->GetCharacteristic(fake_bluetooth_gatt_characteristic_client_ |
688 .value()); | 685 ->GetHeartRateMeasurementPath() |
| 686 .value()); |
689 ASSERT_TRUE(characteristic); | 687 ASSERT_TRUE(characteristic); |
690 EXPECT_FALSE(characteristic->IsNotifying()); | 688 EXPECT_FALSE(characteristic->IsNotifying()); |
691 EXPECT_EQ( | 689 EXPECT_EQ( |
692 fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath() | 690 fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath() |
693 .value(), | 691 .value(), |
694 characteristic->GetIdentifier()); | 692 characteristic->GetIdentifier()); |
695 EXPECT_EQ(kHeartRateMeasurementUUID, characteristic->GetUUID()); | 693 EXPECT_EQ(kHeartRateMeasurementUUID, characteristic->GetUUID()); |
696 characteristic->WriteRemoteCharacteristic( | 694 characteristic->WriteRemoteCharacteristic( |
697 write_value, base::Bind(&BluetoothGattBlueZTest::SuccessCallback, | 695 write_value, base::Bind(&BluetoothGattBlueZTest::SuccessCallback, |
698 base::Unretained(this)), | 696 base::Unretained(this)), |
699 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, | 697 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, |
700 base::Unretained(this))); | 698 base::Unretained(this))); |
701 EXPECT_TRUE(observer.last_gatt_characteristic_id().empty()); | 699 EXPECT_TRUE(observer.last_gatt_characteristic_id().empty()); |
702 EXPECT_FALSE(observer.last_gatt_characteristic_uuid().IsValid()); | 700 EXPECT_FALSE(observer.last_gatt_characteristic_uuid().IsValid()); |
703 EXPECT_EQ(0, success_callback_count_); | 701 EXPECT_EQ(0, success_callback_count_); |
704 EXPECT_EQ(1, error_callback_count_); | 702 EXPECT_EQ(1, error_callback_count_); |
705 EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_SUPPORTED, | 703 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_NOT_SUPPORTED, |
706 last_service_error_); | 704 last_service_error_); |
707 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); | 705 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); |
708 | 706 |
709 characteristic = service->GetCharacteristic( | 707 characteristic = service->GetCharacteristic( |
710 fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath() | 708 fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath() |
711 .value()); | 709 .value()); |
712 ASSERT_TRUE(characteristic); | 710 ASSERT_TRUE(characteristic); |
713 EXPECT_EQ( | 711 EXPECT_EQ( |
714 fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath() | 712 fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath() |
715 .value(), | 713 .value(), |
716 characteristic->GetIdentifier()); | 714 characteristic->GetIdentifier()); |
717 EXPECT_EQ(kBodySensorLocationUUID, characteristic->GetUUID()); | 715 EXPECT_EQ(kBodySensorLocationUUID, characteristic->GetUUID()); |
718 characteristic->WriteRemoteCharacteristic( | 716 characteristic->WriteRemoteCharacteristic( |
719 write_value, base::Bind(&BluetoothGattBlueZTest::SuccessCallback, | 717 write_value, base::Bind(&BluetoothGattBlueZTest::SuccessCallback, |
720 base::Unretained(this)), | 718 base::Unretained(this)), |
721 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, | 719 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, |
722 base::Unretained(this))); | 720 base::Unretained(this))); |
723 EXPECT_TRUE(observer.last_gatt_characteristic_id().empty()); | 721 EXPECT_TRUE(observer.last_gatt_characteristic_id().empty()); |
724 EXPECT_FALSE(observer.last_gatt_characteristic_uuid().IsValid()); | 722 EXPECT_FALSE(observer.last_gatt_characteristic_uuid().IsValid()); |
725 EXPECT_EQ(0, success_callback_count_); | 723 EXPECT_EQ(0, success_callback_count_); |
726 EXPECT_EQ(2, error_callback_count_); | 724 EXPECT_EQ(2, error_callback_count_); |
727 EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_PERMITTED, | 725 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_NOT_PERMITTED, |
728 last_service_error_); | 726 last_service_error_); |
729 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); | 727 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); |
730 | 728 |
731 // Issue write request to writable characteristic. The "Body Sensor Location" | 729 // Issue write request to writable characteristic. The "Body Sensor Location" |
732 // characteristic does not send notifications and WriteValue does not result | 730 // characteristic does not send notifications and WriteValue does not result |
733 // in a CharacteristicValueChanged event, thus no such event should be | 731 // in a CharacteristicValueChanged event, thus no such event should be |
734 // received. | 732 // received. |
735 characteristic = service->GetCharacteristic( | 733 characteristic = service->GetCharacteristic( |
736 fake_bluetooth_gatt_characteristic_client_->GetHeartRateControlPointPath() | 734 fake_bluetooth_gatt_characteristic_client_->GetHeartRateControlPointPath() |
737 .value()); | 735 .value()); |
(...skipping 20 matching lines...) Expand all Loading... |
758 std::vector<uint8_t> invalid_write_length; | 756 std::vector<uint8_t> invalid_write_length; |
759 invalid_write_length.push_back(0x01); | 757 invalid_write_length.push_back(0x01); |
760 invalid_write_length.push_back(0x00); | 758 invalid_write_length.push_back(0x00); |
761 characteristic->WriteRemoteCharacteristic( | 759 characteristic->WriteRemoteCharacteristic( |
762 invalid_write_length, base::Bind(&BluetoothGattBlueZTest::SuccessCallback, | 760 invalid_write_length, base::Bind(&BluetoothGattBlueZTest::SuccessCallback, |
763 base::Unretained(this)), | 761 base::Unretained(this)), |
764 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, | 762 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, |
765 base::Unretained(this))); | 763 base::Unretained(this))); |
766 EXPECT_EQ(1, success_callback_count_); | 764 EXPECT_EQ(1, success_callback_count_); |
767 EXPECT_EQ(3, error_callback_count_); | 765 EXPECT_EQ(3, error_callback_count_); |
768 EXPECT_EQ(BluetoothGattService::GATT_ERROR_INVALID_LENGTH, | 766 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_INVALID_LENGTH, |
769 last_service_error_); | 767 last_service_error_); |
770 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); | 768 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); |
771 | 769 |
772 std::vector<uint8_t> invalid_write_value; | 770 std::vector<uint8_t> invalid_write_value; |
773 invalid_write_value.push_back(0x02); | 771 invalid_write_value.push_back(0x02); |
774 characteristic->WriteRemoteCharacteristic( | 772 characteristic->WriteRemoteCharacteristic( |
775 invalid_write_value, base::Bind(&BluetoothGattBlueZTest::SuccessCallback, | 773 invalid_write_value, base::Bind(&BluetoothGattBlueZTest::SuccessCallback, |
776 base::Unretained(this)), | 774 base::Unretained(this)), |
777 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, | 775 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, |
778 base::Unretained(this))); | 776 base::Unretained(this))); |
779 EXPECT_EQ(1, success_callback_count_); | 777 EXPECT_EQ(1, success_callback_count_); |
780 EXPECT_EQ(4, error_callback_count_); | 778 EXPECT_EQ(4, error_callback_count_); |
781 EXPECT_EQ(BluetoothGattService::GATT_ERROR_FAILED, last_service_error_); | 779 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_FAILED, last_service_error_); |
782 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); | 780 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); |
783 | 781 |
784 // Issue a read request. A successful read results in a | 782 // Issue a read request. A successful read results in a |
785 // CharacteristicValueChanged notification. | 783 // CharacteristicValueChanged notification. |
786 characteristic = service->GetCharacteristic( | 784 characteristic = service->GetCharacteristic( |
787 fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath() | 785 fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath() |
788 .value()); | 786 .value()); |
789 ASSERT_TRUE(characteristic); | 787 ASSERT_TRUE(characteristic); |
790 EXPECT_EQ( | 788 EXPECT_EQ( |
791 fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath() | 789 fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath() |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 EXPECT_EQ(4, error_callback_count_); | 823 EXPECT_EQ(4, error_callback_count_); |
826 EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count()); | 824 EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count()); |
827 | 825 |
828 // Next read should error because IN_PROGRESS | 826 // Next read should error because IN_PROGRESS |
829 characteristic->ReadRemoteCharacteristic( | 827 characteristic->ReadRemoteCharacteristic( |
830 base::Bind(&BluetoothGattBlueZTest::ValueCallback, | 828 base::Bind(&BluetoothGattBlueZTest::ValueCallback, |
831 base::Unretained(this)), | 829 base::Unretained(this)), |
832 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, | 830 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, |
833 base::Unretained(this))); | 831 base::Unretained(this))); |
834 EXPECT_EQ(5, error_callback_count_); | 832 EXPECT_EQ(5, error_callback_count_); |
835 EXPECT_EQ(BluetoothGattService::GATT_ERROR_IN_PROGRESS, last_service_error_); | 833 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_IN_PROGRESS, |
| 834 last_service_error_); |
836 | 835 |
837 // But previous call finished. | 836 // But previous call finished. |
838 EXPECT_EQ(3, success_callback_count_); | 837 EXPECT_EQ(3, success_callback_count_); |
839 EXPECT_EQ(2, observer.gatt_characteristic_value_changed_count()); | 838 EXPECT_EQ(2, observer.gatt_characteristic_value_changed_count()); |
840 EXPECT_TRUE(ValuesEqual(characteristic->GetValue(), last_read_value_)); | 839 EXPECT_TRUE(ValuesEqual(characteristic->GetValue(), last_read_value_)); |
841 fake_bluetooth_gatt_characteristic_client_->SetExtraProcessing(0); | 840 fake_bluetooth_gatt_characteristic_client_->SetExtraProcessing(0); |
842 | 841 |
843 // Test unauthorized actions. | 842 // Test unauthorized actions. |
844 fake_bluetooth_gatt_characteristic_client_->SetAuthorized(false); | 843 fake_bluetooth_gatt_characteristic_client_->SetAuthorized(false); |
845 characteristic->ReadRemoteCharacteristic( | 844 characteristic->ReadRemoteCharacteristic( |
846 base::Bind(&BluetoothGattBlueZTest::ValueCallback, | 845 base::Bind(&BluetoothGattBlueZTest::ValueCallback, |
847 base::Unretained(this)), | 846 base::Unretained(this)), |
848 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, | 847 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, |
849 base::Unretained(this))); | 848 base::Unretained(this))); |
850 EXPECT_EQ(3, success_callback_count_); | 849 EXPECT_EQ(3, success_callback_count_); |
851 EXPECT_EQ(6, error_callback_count_); | 850 EXPECT_EQ(6, error_callback_count_); |
852 EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_AUTHORIZED, | 851 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_NOT_AUTHORIZED, |
853 last_service_error_); | 852 last_service_error_); |
854 EXPECT_EQ(2, observer.gatt_characteristic_value_changed_count()); | 853 EXPECT_EQ(2, observer.gatt_characteristic_value_changed_count()); |
855 fake_bluetooth_gatt_characteristic_client_->SetAuthorized(true); | 854 fake_bluetooth_gatt_characteristic_client_->SetAuthorized(true); |
856 | 855 |
857 // Test unauthenticated / needs login. | 856 // Test unauthenticated / needs login. |
858 fake_bluetooth_gatt_characteristic_client_->SetAuthenticated(false); | 857 fake_bluetooth_gatt_characteristic_client_->SetAuthenticated(false); |
859 characteristic->ReadRemoteCharacteristic( | 858 characteristic->ReadRemoteCharacteristic( |
860 base::Bind(&BluetoothGattBlueZTest::ValueCallback, | 859 base::Bind(&BluetoothGattBlueZTest::ValueCallback, |
861 base::Unretained(this)), | 860 base::Unretained(this)), |
862 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, | 861 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, |
863 base::Unretained(this))); | 862 base::Unretained(this))); |
864 EXPECT_EQ(3, success_callback_count_); | 863 EXPECT_EQ(3, success_callback_count_); |
865 EXPECT_EQ(7, error_callback_count_); | 864 EXPECT_EQ(7, error_callback_count_); |
866 EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_PAIRED, last_service_error_); | 865 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_NOT_PAIRED, |
| 866 last_service_error_); |
867 EXPECT_EQ(2, observer.gatt_characteristic_value_changed_count()); | 867 EXPECT_EQ(2, observer.gatt_characteristic_value_changed_count()); |
868 fake_bluetooth_gatt_characteristic_client_->SetAuthenticated(true); | 868 fake_bluetooth_gatt_characteristic_client_->SetAuthenticated(true); |
869 } | 869 } |
870 | 870 |
871 TEST_F(BluetoothGattBlueZTest, GattCharacteristicProperties) { | 871 TEST_F(BluetoothGattBlueZTest, GattCharacteristicProperties) { |
872 fake_bluetooth_device_client_->CreateDevice( | 872 fake_bluetooth_device_client_->CreateDevice( |
873 dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), | 873 dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), |
874 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); | 874 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); |
875 BluetoothDevice* device = | 875 BluetoothDevice* device = |
876 adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); | 876 adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); |
877 ASSERT_TRUE(device); | 877 ASSERT_TRUE(device); |
878 | 878 |
879 TestBluetoothAdapterObserver observer(adapter_); | 879 TestBluetoothAdapterObserver observer(adapter_); |
880 | 880 |
881 // Expose the fake Heart Rate service. This will asynchronously expose | 881 // Expose the fake Heart Rate service. This will asynchronously expose |
882 // characteristics. | 882 // characteristics. |
883 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( | 883 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( |
884 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); | 884 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); |
885 | 885 |
886 BluetoothGattService* service = | 886 BluetoothRemoteGattService* service = |
887 device->GetGattService(observer.last_gatt_service_id()); | 887 device->GetGattService(observer.last_gatt_service_id()); |
888 | 888 |
889 EXPECT_TRUE(service->GetCharacteristics().empty()); | 889 EXPECT_TRUE(service->GetCharacteristics().empty()); |
890 | 890 |
891 // Run the message loop so that the characteristics appear. | 891 // Run the message loop so that the characteristics appear. |
892 base::MessageLoop::current()->Run(); | 892 base::MessageLoop::current()->Run(); |
893 | 893 |
894 BluetoothGattCharacteristic* characteristic = service->GetCharacteristic( | 894 BluetoothRemoteGattCharacteristic* characteristic = |
895 fake_bluetooth_gatt_characteristic_client_->GetBodySensorLocationPath() | 895 service->GetCharacteristic(fake_bluetooth_gatt_characteristic_client_ |
896 .value()); | 896 ->GetBodySensorLocationPath() |
897 EXPECT_EQ(BluetoothGattCharacteristic::PROPERTY_READ, | 897 .value()); |
| 898 EXPECT_EQ(BluetoothRemoteGattCharacteristic::PROPERTY_READ, |
898 characteristic->GetProperties()); | 899 characteristic->GetProperties()); |
899 | 900 |
900 characteristic = service->GetCharacteristic( | 901 characteristic = service->GetCharacteristic( |
901 fake_bluetooth_gatt_characteristic_client_->GetHeartRateControlPointPath() | 902 fake_bluetooth_gatt_characteristic_client_->GetHeartRateControlPointPath() |
902 .value()); | 903 .value()); |
903 EXPECT_EQ(BluetoothGattCharacteristic::PROPERTY_WRITE, | 904 EXPECT_EQ(BluetoothRemoteGattCharacteristic::PROPERTY_WRITE, |
904 characteristic->GetProperties()); | 905 characteristic->GetProperties()); |
905 | 906 |
906 characteristic = service->GetCharacteristic( | 907 characteristic = service->GetCharacteristic( |
907 fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath() | 908 fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath() |
908 .value()); | 909 .value()); |
909 EXPECT_EQ(BluetoothGattCharacteristic::PROPERTY_NOTIFY, | 910 EXPECT_EQ(BluetoothRemoteGattCharacteristic::PROPERTY_NOTIFY, |
910 characteristic->GetProperties()); | 911 characteristic->GetProperties()); |
911 } | 912 } |
912 | 913 |
913 TEST_F(BluetoothGattBlueZTest, GattDescriptorValue) { | 914 TEST_F(BluetoothGattBlueZTest, GattDescriptorValue) { |
914 fake_bluetooth_device_client_->CreateDevice( | 915 fake_bluetooth_device_client_->CreateDevice( |
915 dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), | 916 dbus::ObjectPath(bluez::FakeBluetoothAdapterClient::kAdapterPath), |
916 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); | 917 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); |
917 BluetoothDevice* device = | 918 BluetoothDevice* device = |
918 adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); | 919 adapter_->GetDevice(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress); |
919 ASSERT_TRUE(device); | 920 ASSERT_TRUE(device); |
920 | 921 |
921 TestBluetoothAdapterObserver observer(adapter_); | 922 TestBluetoothAdapterObserver observer(adapter_); |
922 | 923 |
923 // Expose the fake Heart Rate service. This will asynchronously expose | 924 // Expose the fake Heart Rate service. This will asynchronously expose |
924 // characteristics. | 925 // characteristics. |
925 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( | 926 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( |
926 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); | 927 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); |
927 ASSERT_EQ(1, observer.gatt_service_added_count()); | 928 ASSERT_EQ(1, observer.gatt_service_added_count()); |
928 | 929 |
929 BluetoothGattService* service = | 930 BluetoothRemoteGattService* service = |
930 device->GetGattService(observer.last_gatt_service_id()); | 931 device->GetGattService(observer.last_gatt_service_id()); |
931 | 932 |
932 EXPECT_EQ(0, observer.gatt_service_changed_count()); | 933 EXPECT_EQ(0, observer.gatt_service_changed_count()); |
933 EXPECT_EQ(0, observer.gatt_discovery_complete_count()); | 934 EXPECT_EQ(0, observer.gatt_discovery_complete_count()); |
934 EXPECT_EQ(0, observer.gatt_descriptor_value_changed_count()); | 935 EXPECT_EQ(0, observer.gatt_descriptor_value_changed_count()); |
935 EXPECT_TRUE(service->GetCharacteristics().empty()); | 936 EXPECT_TRUE(service->GetCharacteristics().empty()); |
936 | 937 |
937 // Run the message loop so that the characteristics appear. | 938 // Run the message loop so that the characteristics appear. |
938 base::MessageLoop::current()->Run(); | 939 base::MessageLoop::current()->Run(); |
939 EXPECT_EQ(0, observer.gatt_service_changed_count()); | 940 EXPECT_EQ(0, observer.gatt_service_changed_count()); |
940 EXPECT_EQ(1, observer.gatt_discovery_complete_count()); | 941 EXPECT_EQ(1, observer.gatt_discovery_complete_count()); |
941 | 942 |
942 // Only the Heart Rate Measurement characteristic has a descriptor. | 943 // Only the Heart Rate Measurement characteristic has a descriptor. |
943 BluetoothGattCharacteristic* characteristic = service->GetCharacteristic( | 944 BluetoothRemoteGattCharacteristic* characteristic = |
944 fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath() | 945 service->GetCharacteristic(fake_bluetooth_gatt_characteristic_client_ |
945 .value()); | 946 ->GetHeartRateMeasurementPath() |
| 947 .value()); |
946 ASSERT_TRUE(characteristic); | 948 ASSERT_TRUE(characteristic); |
947 EXPECT_EQ(1U, characteristic->GetDescriptors().size()); | 949 EXPECT_EQ(1U, characteristic->GetDescriptors().size()); |
948 EXPECT_FALSE(characteristic->IsNotifying()); | 950 EXPECT_FALSE(characteristic->IsNotifying()); |
949 | 951 |
950 BluetoothGattDescriptor* descriptor = characteristic->GetDescriptors()[0]; | 952 BluetoothRemoteGattDescriptor* descriptor = |
951 EXPECT_FALSE(descriptor->IsLocal()); | 953 characteristic->GetDescriptors()[0]; |
952 EXPECT_EQ(BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid(), | 954 EXPECT_EQ( |
953 descriptor->GetUUID()); | 955 BluetoothRemoteGattDescriptor::ClientCharacteristicConfigurationUuid(), |
| 956 descriptor->GetUUID()); |
954 | 957 |
955 std::vector<uint8_t> desc_value = {0x00, 0x00}; | 958 std::vector<uint8_t> desc_value = {0x00, 0x00}; |
956 | 959 |
957 /* The cached value will be empty until the first read request */ | 960 /* The cached value will be empty until the first read request */ |
958 EXPECT_FALSE(ValuesEqual(desc_value, descriptor->GetValue())); | 961 EXPECT_FALSE(ValuesEqual(desc_value, descriptor->GetValue())); |
959 EXPECT_TRUE(descriptor->GetValue().empty()); | 962 EXPECT_TRUE(descriptor->GetValue().empty()); |
960 | 963 |
961 EXPECT_EQ(0, success_callback_count_); | 964 EXPECT_EQ(0, success_callback_count_); |
962 EXPECT_EQ(0, error_callback_count_); | 965 EXPECT_EQ(0, error_callback_count_); |
963 EXPECT_TRUE(last_read_value_.empty()); | 966 EXPECT_TRUE(last_read_value_.empty()); |
(...skipping 14 matching lines...) Expand all Loading... |
978 | 981 |
979 // Write value. Writes to this descriptor will fail. | 982 // Write value. Writes to this descriptor will fail. |
980 desc_value[0] = 0x03; | 983 desc_value[0] = 0x03; |
981 descriptor->WriteRemoteDescriptor( | 984 descriptor->WriteRemoteDescriptor( |
982 desc_value, base::Bind(&BluetoothGattBlueZTest::SuccessCallback, | 985 desc_value, base::Bind(&BluetoothGattBlueZTest::SuccessCallback, |
983 base::Unretained(this)), | 986 base::Unretained(this)), |
984 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, | 987 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, |
985 base::Unretained(this))); | 988 base::Unretained(this))); |
986 EXPECT_EQ(1, success_callback_count_); | 989 EXPECT_EQ(1, success_callback_count_); |
987 EXPECT_EQ(1, error_callback_count_); | 990 EXPECT_EQ(1, error_callback_count_); |
988 EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_PERMITTED, | 991 EXPECT_EQ(BluetoothRemoteGattService::GATT_ERROR_NOT_PERMITTED, |
989 last_service_error_); | 992 last_service_error_); |
990 EXPECT_TRUE(ValuesEqual(last_read_value_, descriptor->GetValue())); | 993 EXPECT_TRUE(ValuesEqual(last_read_value_, descriptor->GetValue())); |
991 EXPECT_FALSE(ValuesEqual(desc_value, descriptor->GetValue())); | 994 EXPECT_FALSE(ValuesEqual(desc_value, descriptor->GetValue())); |
992 EXPECT_EQ(0, observer.gatt_service_changed_count()); | 995 EXPECT_EQ(0, observer.gatt_service_changed_count()); |
993 EXPECT_EQ(1, observer.gatt_descriptor_value_changed_count()); | 996 EXPECT_EQ(1, observer.gatt_descriptor_value_changed_count()); |
994 | 997 |
995 // Read value. The value should remain unchanged. | 998 // Read value. The value should remain unchanged. |
996 descriptor->ReadRemoteDescriptor( | 999 descriptor->ReadRemoteDescriptor( |
997 base::Bind(&BluetoothGattBlueZTest::ValueCallback, | 1000 base::Bind(&BluetoothGattBlueZTest::ValueCallback, |
998 base::Unretained(this)), | 1001 base::Unretained(this)), |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 ASSERT_TRUE(device); | 1044 ASSERT_TRUE(device); |
1042 | 1045 |
1043 TestBluetoothAdapterObserver observer(adapter_); | 1046 TestBluetoothAdapterObserver observer(adapter_); |
1044 | 1047 |
1045 // Expose the fake Heart Rate service. This will asynchronously expose | 1048 // Expose the fake Heart Rate service. This will asynchronously expose |
1046 // characteristics. | 1049 // characteristics. |
1047 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( | 1050 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( |
1048 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); | 1051 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); |
1049 ASSERT_EQ(1, observer.gatt_service_added_count()); | 1052 ASSERT_EQ(1, observer.gatt_service_added_count()); |
1050 | 1053 |
1051 BluetoothGattService* service = | 1054 BluetoothRemoteGattService* service = |
1052 device->GetGattService(observer.last_gatt_service_id()); | 1055 device->GetGattService(observer.last_gatt_service_id()); |
1053 | 1056 |
1054 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); | 1057 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); |
1055 | 1058 |
1056 // Run the message loop so that the characteristics appear. | 1059 // Run the message loop so that the characteristics appear. |
1057 base::MessageLoop::current()->Run(); | 1060 base::MessageLoop::current()->Run(); |
1058 | 1061 |
1059 BluetoothGattCharacteristic* characteristic = service->GetCharacteristic( | 1062 BluetoothRemoteGattCharacteristic* characteristic = |
1060 fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath() | 1063 service->GetCharacteristic(fake_bluetooth_gatt_characteristic_client_ |
1061 .value()); | 1064 ->GetHeartRateMeasurementPath() |
| 1065 .value()); |
1062 ASSERT_TRUE(characteristic); | 1066 ASSERT_TRUE(characteristic); |
1063 EXPECT_FALSE(characteristic->IsNotifying()); | 1067 EXPECT_FALSE(characteristic->IsNotifying()); |
1064 EXPECT_TRUE(update_sessions_.empty()); | 1068 EXPECT_TRUE(update_sessions_.empty()); |
1065 | 1069 |
1066 // Request to start notifications. | 1070 // Request to start notifications. |
1067 characteristic->StartNotifySession( | 1071 characteristic->StartNotifySession( |
1068 base::Bind(&BluetoothGattBlueZTest::NotifySessionCallback, | 1072 base::Bind(&BluetoothGattBlueZTest::NotifySessionCallback, |
1069 base::Unretained(this)), | 1073 base::Unretained(this)), |
1070 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, | 1074 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, |
1071 base::Unretained(this))); | 1075 base::Unretained(this))); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 ASSERT_TRUE(device); | 1194 ASSERT_TRUE(device); |
1191 | 1195 |
1192 TestBluetoothAdapterObserver observer(adapter_); | 1196 TestBluetoothAdapterObserver observer(adapter_); |
1193 | 1197 |
1194 // Expose the fake Heart Rate service. This will asynchronously expose | 1198 // Expose the fake Heart Rate service. This will asynchronously expose |
1195 // characteristics. | 1199 // characteristics. |
1196 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( | 1200 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( |
1197 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); | 1201 dbus::ObjectPath(bluez::FakeBluetoothDeviceClient::kLowEnergyPath)); |
1198 ASSERT_EQ(1, observer.gatt_service_added_count()); | 1202 ASSERT_EQ(1, observer.gatt_service_added_count()); |
1199 | 1203 |
1200 BluetoothGattService* service = | 1204 BluetoothRemoteGattService* service = |
1201 device->GetGattService(observer.last_gatt_service_id()); | 1205 device->GetGattService(observer.last_gatt_service_id()); |
1202 | 1206 |
1203 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); | 1207 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count()); |
1204 | 1208 |
1205 // Run the message loop so that the characteristics appear. | 1209 // Run the message loop so that the characteristics appear. |
1206 base::MessageLoop::current()->Run(); | 1210 base::MessageLoop::current()->Run(); |
1207 | 1211 |
1208 BluetoothGattCharacteristic* characteristic = service->GetCharacteristic( | 1212 BluetoothRemoteGattCharacteristic* characteristic = |
1209 fake_bluetooth_gatt_characteristic_client_->GetHeartRateMeasurementPath() | 1213 service->GetCharacteristic(fake_bluetooth_gatt_characteristic_client_ |
1210 .value()); | 1214 ->GetHeartRateMeasurementPath() |
| 1215 .value()); |
1211 ASSERT_TRUE(characteristic); | 1216 ASSERT_TRUE(characteristic); |
1212 EXPECT_FALSE(characteristic->IsNotifying()); | 1217 EXPECT_FALSE(characteristic->IsNotifying()); |
1213 EXPECT_TRUE(update_sessions_.empty()); | 1218 EXPECT_TRUE(update_sessions_.empty()); |
1214 | 1219 |
1215 // Send several requests to start notifications. | 1220 // Send several requests to start notifications. |
1216 characteristic->StartNotifySession( | 1221 characteristic->StartNotifySession( |
1217 base::Bind(&BluetoothGattBlueZTest::NotifySessionCallback, | 1222 base::Bind(&BluetoothGattBlueZTest::NotifySessionCallback, |
1218 base::Unretained(this)), | 1223 base::Unretained(this)), |
1219 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, | 1224 base::Bind(&BluetoothGattBlueZTest::ServiceErrorCallback, |
1220 base::Unretained(this))); | 1225 base::Unretained(this))); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 | 1297 |
1293 EXPECT_EQ(1, success_callback_count_); | 1298 EXPECT_EQ(1, success_callback_count_); |
1294 EXPECT_EQ(0, error_callback_count_); | 1299 EXPECT_EQ(0, error_callback_count_); |
1295 EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count()); | 1300 EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count()); |
1296 EXPECT_TRUE(characteristic->IsNotifying()); | 1301 EXPECT_TRUE(characteristic->IsNotifying()); |
1297 EXPECT_EQ(1U, update_sessions_.size()); | 1302 EXPECT_EQ(1U, update_sessions_.size()); |
1298 EXPECT_TRUE(update_sessions_[0]->IsActive()); | 1303 EXPECT_TRUE(update_sessions_[0]->IsActive()); |
1299 } | 1304 } |
1300 | 1305 |
1301 } // namespace bluez | 1306 } // namespace bluez |
OLD | NEW |