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 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 device->GetGattService(observer.last_gatt_service_id_); | 1038 device->GetGattService(observer.last_gatt_service_id_); |
1039 | 1039 |
1040 EXPECT_TRUE(service->GetCharacteristics().empty()); | 1040 EXPECT_TRUE(service->GetCharacteristics().empty()); |
1041 | 1041 |
1042 // Run the message loop so that the characteristics appear. | 1042 // Run the message loop so that the characteristics appear. |
1043 base::MessageLoop::current()->Run(); | 1043 base::MessageLoop::current()->Run(); |
1044 | 1044 |
1045 BluetoothGattCharacteristic *characteristic = service->GetCharacteristic( | 1045 BluetoothGattCharacteristic *characteristic = service->GetCharacteristic( |
1046 fake_bluetooth_gatt_characteristic_client_-> | 1046 fake_bluetooth_gatt_characteristic_client_-> |
1047 GetBodySensorLocationPath().value()); | 1047 GetBodySensorLocationPath().value()); |
1048 EXPECT_EQ(BluetoothGattCharacteristic::kPropertyRead, | 1048 EXPECT_EQ(BluetoothGattCharacteristic::PROPERTY_READ, |
1049 characteristic->GetProperties()); | 1049 characteristic->GetProperties()); |
1050 | 1050 |
1051 characteristic = service->GetCharacteristic( | 1051 characteristic = service->GetCharacteristic( |
1052 fake_bluetooth_gatt_characteristic_client_-> | 1052 fake_bluetooth_gatt_characteristic_client_-> |
1053 GetHeartRateControlPointPath().value()); | 1053 GetHeartRateControlPointPath().value()); |
1054 EXPECT_EQ(BluetoothGattCharacteristic::kPropertyWrite, | 1054 EXPECT_EQ(BluetoothGattCharacteristic::PROPERTY_WRITE, |
1055 characteristic->GetProperties()); | 1055 characteristic->GetProperties()); |
1056 | 1056 |
1057 characteristic = service->GetCharacteristic( | 1057 characteristic = service->GetCharacteristic( |
1058 fake_bluetooth_gatt_characteristic_client_-> | 1058 fake_bluetooth_gatt_characteristic_client_-> |
1059 GetHeartRateMeasurementPath().value()); | 1059 GetHeartRateMeasurementPath().value()); |
1060 EXPECT_EQ(BluetoothGattCharacteristic::kPropertyNotify, | 1060 EXPECT_EQ(BluetoothGattCharacteristic::PROPERTY_NOTIFY, |
1061 characteristic->GetProperties()); | 1061 characteristic->GetProperties()); |
1062 } | 1062 } |
1063 | 1063 |
1064 TEST_F(BluetoothGattChromeOSTest, GattDescriptorValue) { | 1064 TEST_F(BluetoothGattChromeOSTest, GattDescriptorValue) { |
1065 fake_bluetooth_device_client_->CreateDevice( | 1065 fake_bluetooth_device_client_->CreateDevice( |
1066 dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), | 1066 dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath), |
1067 dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); | 1067 dbus::ObjectPath(FakeBluetoothDeviceClient::kLowEnergyPath)); |
1068 BluetoothDevice* device = adapter_->GetDevice( | 1068 BluetoothDevice* device = adapter_->GetDevice( |
1069 FakeBluetoothDeviceClient::kLowEnergyAddress); | 1069 FakeBluetoothDeviceClient::kLowEnergyAddress); |
1070 ASSERT_TRUE(device); | 1070 ASSERT_TRUE(device); |
(...skipping 348 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 |