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/memory/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "chromeos/dbus/dbus_thread_manager.h" | 8 #include "chromeos/dbus/dbus_thread_manager.h" |
9 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" | 9 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" |
10 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" | 10 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 ASSERT_EQ(1, observer.gatt_service_added_count_); | 820 ASSERT_EQ(1, observer.gatt_service_added_count_); |
821 | 821 |
822 BluetoothGattService* service = | 822 BluetoothGattService* service = |
823 device->GetGattService(observer.last_gatt_service_id_); | 823 device->GetGattService(observer.last_gatt_service_id_); |
824 | 824 |
825 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count_); | 825 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count_); |
826 | 826 |
827 // Run the message loop so that the characteristics appear. | 827 // Run the message loop so that the characteristics appear. |
828 base::MessageLoop::current()->Run(); | 828 base::MessageLoop::current()->Run(); |
829 | 829 |
830 // Issue write request to non-writeable characteristics. | 830 // Issue write request to non-writable characteristics. |
831 observer.last_gatt_characteristic_id_.clear(); | 831 observer.last_gatt_characteristic_id_.clear(); |
832 observer.last_gatt_characteristic_uuid_ = BluetoothUUID(); | 832 observer.last_gatt_characteristic_uuid_ = BluetoothUUID(); |
833 | 833 |
834 std::vector<uint8> write_value; | 834 std::vector<uint8> write_value; |
835 write_value.push_back(0x01); | 835 write_value.push_back(0x01); |
836 BluetoothGattCharacteristic* characteristic = | 836 BluetoothGattCharacteristic* characteristic = |
837 service->GetCharacteristic(fake_bluetooth_gatt_characteristic_client_-> | 837 service->GetCharacteristic(fake_bluetooth_gatt_characteristic_client_-> |
838 GetHeartRateMeasurementPath().value()); | 838 GetHeartRateMeasurementPath().value()); |
839 ASSERT_TRUE(characteristic); | 839 ASSERT_TRUE(characteristic); |
840 EXPECT_FALSE(characteristic->IsNotifying()); | 840 EXPECT_FALSE(characteristic->IsNotifying()); |
(...skipping 30 matching lines...) Expand all Loading... |
871 base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback, | 871 base::Bind(&BluetoothGattChromeOSTest::ServiceErrorCallback, |
872 base::Unretained(this))); | 872 base::Unretained(this))); |
873 EXPECT_TRUE(observer.last_gatt_characteristic_id_.empty()); | 873 EXPECT_TRUE(observer.last_gatt_characteristic_id_.empty()); |
874 EXPECT_FALSE(observer.last_gatt_characteristic_uuid_.IsValid()); | 874 EXPECT_FALSE(observer.last_gatt_characteristic_uuid_.IsValid()); |
875 EXPECT_EQ(0, success_callback_count_); | 875 EXPECT_EQ(0, success_callback_count_); |
876 EXPECT_EQ(2, error_callback_count_); | 876 EXPECT_EQ(2, error_callback_count_); |
877 EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_PERMITTED, | 877 EXPECT_EQ(BluetoothGattService::GATT_ERROR_NOT_PERMITTED, |
878 last_service_error_); | 878 last_service_error_); |
879 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count_); | 879 EXPECT_EQ(0, observer.gatt_characteristic_value_changed_count_); |
880 | 880 |
881 // Issue write request to writeable characteristic. The "Body Sensor Location" | 881 // Issue write request to writable characteristic. The "Body Sensor Location" |
882 // characteristic does not send notifications and WriteValue does not result | 882 // characteristic does not send notifications and WriteValue does not result |
883 // in a CharacteristicValueChanged event, thus no such event should be | 883 // in a CharacteristicValueChanged event, thus no such event should be |
884 // received. | 884 // received. |
885 characteristic = service->GetCharacteristic( | 885 characteristic = service->GetCharacteristic( |
886 fake_bluetooth_gatt_characteristic_client_-> | 886 fake_bluetooth_gatt_characteristic_client_-> |
887 GetHeartRateControlPointPath().value()); | 887 GetHeartRateControlPointPath().value()); |
888 ASSERT_TRUE(characteristic); | 888 ASSERT_TRUE(characteristic); |
889 EXPECT_EQ(fake_bluetooth_gatt_characteristic_client_-> | 889 EXPECT_EQ(fake_bluetooth_gatt_characteristic_client_-> |
890 GetHeartRateControlPointPath().value(), | 890 GetHeartRateControlPointPath().value(), |
891 characteristic->GetIdentifier()); | 891 characteristic->GetIdentifier()); |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 | 1419 |
1420 EXPECT_EQ(1, success_callback_count_); | 1420 EXPECT_EQ(1, success_callback_count_); |
1421 EXPECT_EQ(0, error_callback_count_); | 1421 EXPECT_EQ(0, error_callback_count_); |
1422 EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count_); | 1422 EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count_); |
1423 EXPECT_TRUE(characteristic->IsNotifying()); | 1423 EXPECT_TRUE(characteristic->IsNotifying()); |
1424 EXPECT_EQ(1U, update_sessions_.size()); | 1424 EXPECT_EQ(1U, update_sessions_.size()); |
1425 EXPECT_TRUE(update_sessions_[0]->IsActive()); | 1425 EXPECT_TRUE(update_sessions_[0]->IsActive()); |
1426 } | 1426 } |
1427 | 1427 |
1428 } // namespace chromeos | 1428 } // namespace chromeos |
OLD | NEW |