| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" | 7 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" |
| 8 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" | 8 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" |
| 9 #include "chromeos/dbus/fake_bluetooth_device_client.h" | 9 #include "chromeos/dbus/fake_bluetooth_device_client.h" |
| 10 #include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h" | 10 #include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 class TestGattServiceObserver : public BluetoothGattService::Observer { | 126 class TestGattServiceObserver : public BluetoothGattService::Observer { |
| 127 public: | 127 public: |
| 128 TestGattServiceObserver(scoped_refptr<BluetoothAdapter> adapter, | 128 TestGattServiceObserver(scoped_refptr<BluetoothAdapter> adapter, |
| 129 BluetoothDevice* device, | 129 BluetoothDevice* device, |
| 130 BluetoothGattService* service) | 130 BluetoothGattService* service) |
| 131 : gatt_service_changed_count_(0), | 131 : gatt_service_changed_count_(0), |
| 132 gatt_characteristic_added_count_(0), | 132 gatt_characteristic_added_count_(0), |
| 133 gatt_characteristic_removed_count_(0), | 133 gatt_characteristic_removed_count_(0), |
| 134 gatt_characteristic_value_changed_count_(0), | 134 gatt_characteristic_value_changed_count_(0), |
| 135 gatt_descriptor_added_count_(0), |
| 136 gatt_descriptor_removed_count_(0), |
| 137 gatt_descriptor_value_changed_count_(0), |
| 135 device_address_(device->GetAddress()), | 138 device_address_(device->GetAddress()), |
| 136 gatt_service_id_(service->GetIdentifier()), | 139 gatt_service_id_(service->GetIdentifier()), |
| 137 adapter_(adapter) { | 140 adapter_(adapter) { |
| 138 service->AddObserver(this); | 141 service->AddObserver(this); |
| 139 } | 142 } |
| 140 | 143 |
| 141 virtual ~TestGattServiceObserver() { | 144 virtual ~TestGattServiceObserver() { |
| 142 // See if either the device or the service even exist. | 145 // See if either the device or the service even exist. |
| 143 BluetoothDevice* device = adapter_->GetDevice(device_address_); | 146 BluetoothDevice* device = adapter_->GetDevice(device_address_); |
| 144 if (!device) | 147 if (!device) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 196 |
| 194 virtual void GattCharacteristicValueChanged( | 197 virtual void GattCharacteristicValueChanged( |
| 195 BluetoothGattService* service, | 198 BluetoothGattService* service, |
| 196 BluetoothGattCharacteristic* characteristic, | 199 BluetoothGattCharacteristic* characteristic, |
| 197 const std::vector<uint8>& value) OVERRIDE { | 200 const std::vector<uint8>& value) OVERRIDE { |
| 198 ASSERT_EQ(gatt_service_id_, service->GetIdentifier()); | 201 ASSERT_EQ(gatt_service_id_, service->GetIdentifier()); |
| 199 | 202 |
| 200 ++gatt_characteristic_value_changed_count_; | 203 ++gatt_characteristic_value_changed_count_; |
| 201 last_gatt_characteristic_id_ = characteristic->GetIdentifier(); | 204 last_gatt_characteristic_id_ = characteristic->GetIdentifier(); |
| 202 last_gatt_characteristic_uuid_ = characteristic->GetUUID(); | 205 last_gatt_characteristic_uuid_ = characteristic->GetUUID(); |
| 203 last_changed_characteristic_value_ = characteristic->GetValue(); | 206 last_changed_characteristic_value_ = value; |
| 204 | 207 |
| 205 EXPECT_EQ(service->GetCharacteristic(last_gatt_characteristic_id_), | 208 EXPECT_EQ(service->GetCharacteristic(last_gatt_characteristic_id_), |
| 206 characteristic); | 209 characteristic); |
| 210 EXPECT_EQ(service, characteristic->GetService()); |
| 207 | 211 |
| 208 QuitMessageLoop(); | 212 QuitMessageLoop(); |
| 209 } | 213 } |
| 214 |
| 215 virtual void GattDescriptorAdded( |
| 216 BluetoothGattCharacteristic* characteristic, |
| 217 BluetoothGattDescriptor* descriptor) OVERRIDE { |
| 218 ASSERT_EQ(gatt_service_id_, characteristic->GetService()->GetIdentifier()); |
| 219 |
| 220 ++gatt_descriptor_added_count_; |
| 221 last_gatt_descriptor_id_ = descriptor->GetIdentifier(); |
| 222 last_gatt_descriptor_uuid_ = descriptor->GetUUID(); |
| 223 |
| 224 EXPECT_EQ(characteristic->GetDescriptor(last_gatt_descriptor_id_), |
| 225 descriptor); |
| 226 EXPECT_EQ(characteristic, descriptor->GetCharacteristic()); |
| 227 |
| 228 QuitMessageLoop(); |
| 229 } |
| 230 |
| 231 virtual void GattDescriptorRemoved( |
| 232 BluetoothGattCharacteristic* characteristic, |
| 233 BluetoothGattDescriptor* descriptor) OVERRIDE { |
| 234 ASSERT_EQ(gatt_service_id_, characteristic->GetService()->GetIdentifier()); |
| 235 |
| 236 ++gatt_descriptor_removed_count_; |
| 237 last_gatt_descriptor_id_ = descriptor->GetIdentifier(); |
| 238 last_gatt_descriptor_uuid_ = descriptor->GetUUID(); |
| 239 |
| 240 // The characteristic should return NULL for this descriptor.. |
| 241 EXPECT_FALSE(characteristic->GetDescriptor(last_gatt_descriptor_id_)); |
| 242 EXPECT_EQ(characteristic, descriptor->GetCharacteristic()); |
| 243 |
| 244 QuitMessageLoop(); |
| 245 } |
| 246 |
| 247 virtual void GattDescriptorValueChanged( |
| 248 BluetoothGattCharacteristic* characteristic, |
| 249 BluetoothGattDescriptor* descriptor, |
| 250 const std::vector<uint8>& value) OVERRIDE { |
| 251 ASSERT_EQ(gatt_service_id_, characteristic->GetService()->GetIdentifier()); |
| 252 |
| 253 ++gatt_descriptor_value_changed_count_; |
| 254 last_gatt_descriptor_id_ = descriptor->GetIdentifier(); |
| 255 last_gatt_descriptor_uuid_ = descriptor->GetUUID(); |
| 256 last_changed_descriptor_value_ = value; |
| 257 |
| 258 EXPECT_EQ(characteristic->GetDescriptor(last_gatt_descriptor_id_), |
| 259 descriptor); |
| 260 EXPECT_EQ(characteristic, descriptor->GetCharacteristic()); |
| 261 |
| 262 QuitMessageLoop(); |
| 263 } |
| 210 | 264 |
| 211 int gatt_service_changed_count_; | 265 int gatt_service_changed_count_; |
| 212 int gatt_characteristic_added_count_; | 266 int gatt_characteristic_added_count_; |
| 213 int gatt_characteristic_removed_count_; | 267 int gatt_characteristic_removed_count_; |
| 214 int gatt_characteristic_value_changed_count_; | 268 int gatt_characteristic_value_changed_count_; |
| 269 int gatt_descriptor_added_count_; |
| 270 int gatt_descriptor_removed_count_; |
| 271 int gatt_descriptor_value_changed_count_; |
| 215 std::string last_gatt_characteristic_id_; | 272 std::string last_gatt_characteristic_id_; |
| 216 BluetoothUUID last_gatt_characteristic_uuid_; | 273 BluetoothUUID last_gatt_characteristic_uuid_; |
| 217 std::vector<uint8> last_changed_characteristic_value_; | 274 std::vector<uint8> last_changed_characteristic_value_; |
| 275 std::string last_gatt_descriptor_id_; |
| 276 BluetoothUUID last_gatt_descriptor_uuid_; |
| 277 std::vector<uint8> last_changed_descriptor_value_; |
| 218 | 278 |
| 219 private: | 279 private: |
| 220 // Some tests use a message loop since background processing is simulated; | 280 // Some tests use a message loop since background processing is simulated; |
| 221 // break out of those loops. | 281 // break out of those loops. |
| 222 void QuitMessageLoop() { | 282 void QuitMessageLoop() { |
| 223 if (base::MessageLoop::current() && | 283 if (base::MessageLoop::current() && |
| 224 base::MessageLoop::current()->is_running()) | 284 base::MessageLoop::current()->is_running()) |
| 225 base::MessageLoop::current()->Quit(); | 285 base::MessageLoop::current()->Quit(); |
| 226 } | 286 } |
| 227 | 287 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // characteristics. | 554 // characteristics. |
| 495 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( | 555 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( |
| 496 dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); | 556 dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); |
| 497 ASSERT_EQ(1, observer.gatt_service_added_count_); | 557 ASSERT_EQ(1, observer.gatt_service_added_count_); |
| 498 | 558 |
| 499 BluetoothGattService* service = | 559 BluetoothGattService* service = |
| 500 device->GetGattService(observer.last_gatt_service_id_); | 560 device->GetGattService(observer.last_gatt_service_id_); |
| 501 | 561 |
| 502 TestGattServiceObserver service_observer(adapter_, device, service); | 562 TestGattServiceObserver service_observer(adapter_, device, service); |
| 503 EXPECT_EQ(0, service_observer.gatt_service_changed_count_); | 563 EXPECT_EQ(0, service_observer.gatt_service_changed_count_); |
| 564 EXPECT_EQ(0, service_observer.gatt_descriptor_added_count_); |
| 565 EXPECT_EQ(0, service_observer.gatt_descriptor_removed_count_); |
| 566 EXPECT_EQ(0, service_observer.gatt_descriptor_value_changed_count_); |
| 567 |
| 504 EXPECT_TRUE(service->GetCharacteristics().empty()); | 568 EXPECT_TRUE(service->GetCharacteristics().empty()); |
| 505 | 569 |
| 506 // Run the message loop so that the characteristics appear. | 570 // Run the message loop so that the characteristics appear. |
| 507 base::MessageLoop::current()->Run(); | 571 base::MessageLoop::current()->Run(); |
| 508 EXPECT_EQ(4, service_observer.gatt_service_changed_count_); | 572 EXPECT_EQ(4, service_observer.gatt_service_changed_count_); |
| 509 | 573 |
| 510 // Only the Heart Rate Measurement characteristic has a descriptor. | 574 // Only the Heart Rate Measurement characteristic has a descriptor. |
| 575 EXPECT_EQ(1, service_observer.gatt_descriptor_added_count_); |
| 576 EXPECT_EQ(0, service_observer.gatt_descriptor_removed_count_); |
| 577 EXPECT_EQ(0, service_observer.gatt_descriptor_value_changed_count_); |
| 578 |
| 511 BluetoothGattCharacteristic* characteristic = service->GetCharacteristic( | 579 BluetoothGattCharacteristic* characteristic = service->GetCharacteristic( |
| 512 fake_bluetooth_gatt_characteristic_client_-> | 580 fake_bluetooth_gatt_characteristic_client_-> |
| 513 GetBodySensorLocationPath().value()); | 581 GetBodySensorLocationPath().value()); |
| 514 ASSERT_TRUE(characteristic); | 582 ASSERT_TRUE(characteristic); |
| 515 EXPECT_TRUE(characteristic->GetDescriptors().empty()); | 583 EXPECT_TRUE(characteristic->GetDescriptors().empty()); |
| 516 | 584 |
| 517 characteristic = service->GetCharacteristic( | 585 characteristic = service->GetCharacteristic( |
| 518 fake_bluetooth_gatt_characteristic_client_-> | 586 fake_bluetooth_gatt_characteristic_client_-> |
| 519 GetHeartRateControlPointPath().value()); | 587 GetHeartRateControlPointPath().value()); |
| 520 ASSERT_TRUE(characteristic); | 588 ASSERT_TRUE(characteristic); |
| 521 EXPECT_TRUE(characteristic->GetDescriptors().empty()); | 589 EXPECT_TRUE(characteristic->GetDescriptors().empty()); |
| 522 | 590 |
| 523 characteristic = service->GetCharacteristic( | 591 characteristic = service->GetCharacteristic( |
| 524 fake_bluetooth_gatt_characteristic_client_-> | 592 fake_bluetooth_gatt_characteristic_client_-> |
| 525 GetHeartRateMeasurementPath().value()); | 593 GetHeartRateMeasurementPath().value()); |
| 526 ASSERT_TRUE(characteristic); | 594 ASSERT_TRUE(characteristic); |
| 527 EXPECT_EQ(1U, characteristic->GetDescriptors().size()); | 595 EXPECT_EQ(1U, characteristic->GetDescriptors().size()); |
| 528 | 596 |
| 529 BluetoothGattDescriptor* descriptor = characteristic->GetDescriptors()[0]; | 597 BluetoothGattDescriptor* descriptor = characteristic->GetDescriptors()[0]; |
| 530 EXPECT_FALSE(descriptor->IsLocal()); | 598 EXPECT_FALSE(descriptor->IsLocal()); |
| 531 EXPECT_EQ(BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid(), | 599 EXPECT_EQ(BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid(), |
| 532 descriptor->GetUUID()); | 600 descriptor->GetUUID()); |
| 601 EXPECT_EQ(descriptor->GetUUID(), |
| 602 service_observer.last_gatt_descriptor_uuid_); |
| 603 EXPECT_EQ(descriptor->GetIdentifier(), |
| 604 service_observer.last_gatt_descriptor_id_); |
| 533 | 605 |
| 534 // Hide the descriptor. | 606 // Hide the descriptor. |
| 535 fake_bluetooth_gatt_descriptor_client_->HideDescriptor( | 607 fake_bluetooth_gatt_descriptor_client_->HideDescriptor( |
| 536 dbus::ObjectPath(descriptor->GetIdentifier())); | 608 dbus::ObjectPath(descriptor->GetIdentifier())); |
| 537 EXPECT_TRUE(characteristic->GetDescriptors().empty()); | 609 EXPECT_TRUE(characteristic->GetDescriptors().empty()); |
| 538 EXPECT_EQ(5, service_observer.gatt_service_changed_count_); | 610 EXPECT_EQ(5, service_observer.gatt_service_changed_count_); |
| 611 EXPECT_EQ(1, service_observer.gatt_descriptor_added_count_); |
| 612 EXPECT_EQ(1, service_observer.gatt_descriptor_removed_count_); |
| 613 EXPECT_EQ(0, service_observer.gatt_descriptor_value_changed_count_); |
| 539 | 614 |
| 540 // Expose the descriptor again. | 615 // Expose the descriptor again. |
| 616 service_observer.last_gatt_descriptor_id_.clear(); |
| 617 service_observer.last_gatt_descriptor_uuid_ = BluetoothUUID(); |
| 541 fake_bluetooth_gatt_descriptor_client_->ExposeDescriptor( | 618 fake_bluetooth_gatt_descriptor_client_->ExposeDescriptor( |
| 542 dbus::ObjectPath(characteristic->GetIdentifier()), | 619 dbus::ObjectPath(characteristic->GetIdentifier()), |
| 543 FakeBluetoothGattDescriptorClient:: | 620 FakeBluetoothGattDescriptorClient:: |
| 544 kClientCharacteristicConfigurationUUID); | 621 kClientCharacteristicConfigurationUUID); |
| 545 EXPECT_EQ(6, service_observer.gatt_service_changed_count_); | 622 EXPECT_EQ(6, service_observer.gatt_service_changed_count_); |
| 546 EXPECT_EQ(1U, characteristic->GetDescriptors().size()); | 623 EXPECT_EQ(1U, characteristic->GetDescriptors().size()); |
| 624 EXPECT_EQ(2, service_observer.gatt_descriptor_added_count_); |
| 625 EXPECT_EQ(1, service_observer.gatt_descriptor_removed_count_); |
| 626 EXPECT_EQ(0, service_observer.gatt_descriptor_value_changed_count_); |
| 547 | 627 |
| 548 descriptor = characteristic->GetDescriptors()[0]; | 628 descriptor = characteristic->GetDescriptors()[0]; |
| 549 EXPECT_FALSE(descriptor->IsLocal()); | 629 EXPECT_FALSE(descriptor->IsLocal()); |
| 550 EXPECT_EQ(BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid(), | 630 EXPECT_EQ(BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid(), |
| 551 descriptor->GetUUID()); | 631 descriptor->GetUUID()); |
| 632 EXPECT_EQ(descriptor->GetUUID(), service_observer.last_gatt_descriptor_uuid_); |
| 633 EXPECT_EQ(descriptor->GetIdentifier(), |
| 634 service_observer.last_gatt_descriptor_id_); |
| 552 } | 635 } |
| 553 | 636 |
| 554 TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) { | 637 TEST_F(BluetoothGattChromeOSTest, AdapterAddedAfterGattService) { |
| 555 // This unit test tests that all remote GATT objects are created for D-Bus | 638 // This unit test tests that all remote GATT objects are created for D-Bus |
| 556 // objects that were already exposed. | 639 // objects that were already exposed. |
| 557 adapter_ = NULL; | 640 adapter_ = NULL; |
| 558 EXPECT_FALSE(device::BluetoothAdapterFactory::HasSharedInstanceForTesting()); | 641 EXPECT_FALSE(device::BluetoothAdapterFactory::HasSharedInstanceForTesting()); |
| 559 | 642 |
| 560 // Create the fake D-Bus objects. | 643 // Create the fake D-Bus objects. |
| 561 fake_bluetooth_device_client_->CreateDevice( | 644 fake_bluetooth_device_client_->CreateDevice( |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 // characteristics. | 874 // characteristics. |
| 792 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( | 875 fake_bluetooth_gatt_service_client_->ExposeHeartRateService( |
| 793 dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); | 876 dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); |
| 794 ASSERT_EQ(1, observer.gatt_service_added_count_); | 877 ASSERT_EQ(1, observer.gatt_service_added_count_); |
| 795 | 878 |
| 796 BluetoothGattService* service = | 879 BluetoothGattService* service = |
| 797 device->GetGattService(observer.last_gatt_service_id_); | 880 device->GetGattService(observer.last_gatt_service_id_); |
| 798 | 881 |
| 799 TestGattServiceObserver service_observer(adapter_, device, service); | 882 TestGattServiceObserver service_observer(adapter_, device, service); |
| 800 EXPECT_EQ(0, service_observer.gatt_service_changed_count_); | 883 EXPECT_EQ(0, service_observer.gatt_service_changed_count_); |
| 884 EXPECT_EQ(0, service_observer.gatt_descriptor_value_changed_count_); |
| 801 EXPECT_TRUE(service->GetCharacteristics().empty()); | 885 EXPECT_TRUE(service->GetCharacteristics().empty()); |
| 802 | 886 |
| 803 // Run the message loop so that the characteristics appear. | 887 // Run the message loop so that the characteristics appear. |
| 804 base::MessageLoop::current()->Run(); | 888 base::MessageLoop::current()->Run(); |
| 805 EXPECT_EQ(4, service_observer.gatt_service_changed_count_); | 889 EXPECT_EQ(4, service_observer.gatt_service_changed_count_); |
| 806 | 890 |
| 807 // Only the Heart Rate Measurement characteristic has a descriptor. | 891 // Only the Heart Rate Measurement characteristic has a descriptor. |
| 808 BluetoothGattCharacteristic* characteristic = service->GetCharacteristic( | 892 BluetoothGattCharacteristic* characteristic = service->GetCharacteristic( |
| 809 fake_bluetooth_gatt_characteristic_client_-> | 893 fake_bluetooth_gatt_characteristic_client_-> |
| 810 GetHeartRateMeasurementPath().value()); | 894 GetHeartRateMeasurementPath().value()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 827 | 911 |
| 828 // Read value. | 912 // Read value. |
| 829 descriptor->ReadRemoteDescriptor( | 913 descriptor->ReadRemoteDescriptor( |
| 830 base::Bind(&BluetoothGattChromeOSTest::ValueCallback, | 914 base::Bind(&BluetoothGattChromeOSTest::ValueCallback, |
| 831 base::Unretained(this)), | 915 base::Unretained(this)), |
| 832 base::Bind(&BluetoothGattChromeOSTest::ErrorCallback, | 916 base::Bind(&BluetoothGattChromeOSTest::ErrorCallback, |
| 833 base::Unretained(this))); | 917 base::Unretained(this))); |
| 834 EXPECT_EQ(1, success_callback_count_); | 918 EXPECT_EQ(1, success_callback_count_); |
| 835 EXPECT_EQ(0, error_callback_count_); | 919 EXPECT_EQ(0, error_callback_count_); |
| 836 EXPECT_TRUE(ValuesEqual(last_read_value_, descriptor->GetValue())); | 920 EXPECT_TRUE(ValuesEqual(last_read_value_, descriptor->GetValue())); |
| 921 EXPECT_EQ(4, service_observer.gatt_service_changed_count_); |
| 922 EXPECT_EQ(0, service_observer.gatt_descriptor_value_changed_count_); |
| 837 | 923 |
| 838 // Write value. | 924 // Write value. |
| 839 desc_value[0] = 0x03; | 925 desc_value[0] = 0x03; |
| 840 descriptor->WriteRemoteDescriptor( | 926 descriptor->WriteRemoteDescriptor( |
| 841 desc_value, | 927 desc_value, |
| 842 base::Bind(&BluetoothGattChromeOSTest::SuccessCallback, | 928 base::Bind(&BluetoothGattChromeOSTest::SuccessCallback, |
| 843 base::Unretained(this)), | 929 base::Unretained(this)), |
| 844 base::Bind(&BluetoothGattChromeOSTest::ErrorCallback, | 930 base::Bind(&BluetoothGattChromeOSTest::ErrorCallback, |
| 845 base::Unretained(this))); | 931 base::Unretained(this))); |
| 846 EXPECT_EQ(2, success_callback_count_); | 932 EXPECT_EQ(2, success_callback_count_); |
| 847 EXPECT_EQ(0, error_callback_count_); | 933 EXPECT_EQ(0, error_callback_count_); |
| 848 EXPECT_FALSE(ValuesEqual(last_read_value_, descriptor->GetValue())); | 934 EXPECT_FALSE(ValuesEqual(last_read_value_, descriptor->GetValue())); |
| 849 EXPECT_TRUE(ValuesEqual(desc_value, descriptor->GetValue())); | 935 EXPECT_TRUE(ValuesEqual(desc_value, descriptor->GetValue())); |
| 936 EXPECT_EQ(4, service_observer.gatt_service_changed_count_); |
| 937 EXPECT_EQ(1, service_observer.gatt_descriptor_value_changed_count_); |
| 850 | 938 |
| 851 // Read new value. | 939 // Read new value. |
| 852 descriptor->ReadRemoteDescriptor( | 940 descriptor->ReadRemoteDescriptor( |
| 853 base::Bind(&BluetoothGattChromeOSTest::ValueCallback, | 941 base::Bind(&BluetoothGattChromeOSTest::ValueCallback, |
| 854 base::Unretained(this)), | 942 base::Unretained(this)), |
| 855 base::Bind(&BluetoothGattChromeOSTest::ErrorCallback, | 943 base::Bind(&BluetoothGattChromeOSTest::ErrorCallback, |
| 856 base::Unretained(this))); | 944 base::Unretained(this))); |
| 857 EXPECT_EQ(3, success_callback_count_); | 945 EXPECT_EQ(3, success_callback_count_); |
| 858 EXPECT_EQ(0, error_callback_count_); | 946 EXPECT_EQ(0, error_callback_count_); |
| 859 EXPECT_TRUE(ValuesEqual(last_read_value_, descriptor->GetValue())); | 947 EXPECT_TRUE(ValuesEqual(last_read_value_, descriptor->GetValue())); |
| 860 EXPECT_TRUE(ValuesEqual(desc_value, descriptor->GetValue())); | 948 EXPECT_TRUE(ValuesEqual(desc_value, descriptor->GetValue())); |
| 949 EXPECT_EQ(4, service_observer.gatt_service_changed_count_); |
| 950 EXPECT_EQ(1, service_observer.gatt_descriptor_value_changed_count_); |
| 861 } | 951 } |
| 862 | 952 |
| 863 } // namespace chromeos | 953 } // namespace chromeos |
| OLD | NEW |