| OLD | NEW |
| 1 // Copyright 2016 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 "components/arc/bluetooth/arc_bluetooth_bridge.h" | 5 #include "components/arc/bluetooth/arc_bluetooth_bridge.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 AddTestDevice(); | 128 AddTestDevice(); |
| 129 EXPECT_EQ(1u, fake_bluetooth_instance_->le_device_found_data().size()); | 129 EXPECT_EQ(1u, fake_bluetooth_instance_->le_device_found_data().size()); |
| 130 | 130 |
| 131 const mojom::BluetoothAddressPtr& addr = | 131 const mojom::BluetoothAddressPtr& addr = |
| 132 fake_bluetooth_instance_->le_device_found_data().back()->addr(); | 132 fake_bluetooth_instance_->le_device_found_data().back()->addr(); |
| 133 const mojo::Array<mojom::BluetoothAdvertisingDataPtr>& adv_data = | 133 const mojo::Array<mojom::BluetoothAdvertisingDataPtr>& adv_data = |
| 134 fake_bluetooth_instance_->le_device_found_data().back()->adv_data(); | 134 fake_bluetooth_instance_->le_device_found_data().back()->adv_data(); |
| 135 | 135 |
| 136 EXPECT_EQ(std::string(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress), | 136 EXPECT_EQ(std::string(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress), |
| 137 addr->To<std::string>()); | 137 addr->To<std::string>()); |
| 138 EXPECT_EQ(1u, adv_data.size()); | 138 EXPECT_EQ(2u, adv_data.size()); |
| 139 | 139 |
| 140 EXPECT_TRUE(adv_data[0]->is_local_name()); | 140 EXPECT_TRUE(adv_data[0]->is_local_name()); |
| 141 EXPECT_EQ(std::string(bluez::FakeBluetoothDeviceClient::kLowEnergyName), | 141 EXPECT_EQ(std::string(bluez::FakeBluetoothDeviceClient::kLowEnergyName), |
| 142 adv_data[0]->get_local_name().To<std::string>()); | 142 adv_data[0]->get_local_name().To<std::string>()); |
| 143 |
| 144 EXPECT_TRUE(adv_data[1]->is_service_uuids()); |
| 145 EXPECT_EQ(1u, adv_data[1]->get_service_uuids().size()); |
| 146 EXPECT_EQ(device::BluetoothUUID( |
| 147 bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID), |
| 148 adv_data[1]->get_service_uuids()[0].To<device::BluetoothUUID>()); |
| 143 } | 149 } |
| 144 | 150 |
| 145 // Invoke GetGattDB and check correctness of the GattDB sent via arc bridge. | 151 // Invoke GetGattDB and check correctness of the GattDB sent via arc bridge. |
| 146 TEST_F(ArcBluetoothBridgeTest, GetGattDB) { | 152 TEST_F(ArcBluetoothBridgeTest, GetGattDB) { |
| 147 AddTestDevice(); | 153 AddTestDevice(); |
| 148 | 154 |
| 149 arc_bluetooth_bridge_->GetGattDB(mojom::BluetoothAddress::From( | 155 arc_bluetooth_bridge_->GetGattDB(mojom::BluetoothAddress::From( |
| 150 std::string(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress))); | 156 std::string(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress))); |
| 151 EXPECT_EQ(1u, fake_bluetooth_instance_->gatt_db_result().size()); | 157 EXPECT_EQ(1u, fake_bluetooth_instance_->gatt_db_result().size()); |
| 152 | 158 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 EXPECT_EQ(device::BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient:: | 202 EXPECT_EQ(device::BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient:: |
| 197 kHeartRateControlPointUUID), | 203 kHeartRateControlPointUUID), |
| 198 db[4]->uuid.To<device::BluetoothUUID>()); | 204 db[4]->uuid.To<device::BluetoothUUID>()); |
| 199 EXPECT_EQ(mojom::BluetoothGattDBAttributeType::BTGATT_DB_CHARACTERISTIC, | 205 EXPECT_EQ(mojom::BluetoothGattDBAttributeType::BTGATT_DB_CHARACTERISTIC, |
| 200 db[4]->type); | 206 db[4]->type); |
| 201 EXPECT_EQ(device::BluetoothGattCharacteristic::PROPERTY_WRITE, | 207 EXPECT_EQ(device::BluetoothGattCharacteristic::PROPERTY_WRITE, |
| 202 db[4]->properties); | 208 db[4]->properties); |
| 203 } | 209 } |
| 204 | 210 |
| 205 } // namespace arc | 211 } // namespace arc |
| OLD | NEW |