Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(676)

Side by Side Diff: components/arc/bluetooth/arc_bluetooth_bridge_unittest.cc

Issue 2376873002: arc: bluetooth: Use uuid 128 bit for service uuid (Closed)
Patch Set: fix comment Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/arc/bluetooth/arc_bluetooth_bridge.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 fake_bluetooth_instance_->le_device_found_data().back()->adv_data(); 135 fake_bluetooth_instance_->le_device_found_data().back()->adv_data();
136 136
137 EXPECT_EQ(std::string(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress), 137 EXPECT_EQ(std::string(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress),
138 addr->To<std::string>()); 138 addr->To<std::string>());
139 EXPECT_EQ(2u, adv_data.size()); 139 EXPECT_EQ(2u, adv_data.size());
140 140
141 EXPECT_TRUE(adv_data[0]->is_local_name()); 141 EXPECT_TRUE(adv_data[0]->is_local_name());
142 EXPECT_EQ(std::string(bluez::FakeBluetoothDeviceClient::kLowEnergyName), 142 EXPECT_EQ(std::string(bluez::FakeBluetoothDeviceClient::kLowEnergyName),
143 adv_data[0]->get_local_name().To<std::string>()); 143 adv_data[0]->get_local_name().To<std::string>());
144 144
145 EXPECT_TRUE(adv_data[1]->is_service_uuids_16()); 145 EXPECT_TRUE(adv_data[1]->is_service_uuids());
146 EXPECT_EQ(1u, adv_data[1]->get_service_uuids_16().size()); 146 EXPECT_EQ(1u, adv_data[1]->get_service_uuids().size());
147
148 std::string uuid16_str =
149 base::StringPrintf("%04x", adv_data[1]->get_service_uuids_16()[0]);
150 EXPECT_EQ(bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID, 147 EXPECT_EQ(bluez::FakeBluetoothGattServiceClient::kHeartRateServiceUUID,
151 device::BluetoothUUID(uuid16_str).canonical_value()); 148 adv_data[1]->get_service_uuids()[0].canonical_value());
152 } 149 }
153 150
154 // 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.
155 TEST_F(ArcBluetoothBridgeTest, GetGattDB) { 152 TEST_F(ArcBluetoothBridgeTest, GetGattDB) {
156 AddTestDevice(); 153 AddTestDevice();
157 154
158 arc_bluetooth_bridge_->GetGattDB(mojom::BluetoothAddress::From( 155 arc_bluetooth_bridge_->GetGattDB(mojom::BluetoothAddress::From(
159 std::string(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress))); 156 std::string(bluez::FakeBluetoothDeviceClient::kLowEnergyAddress)));
160 EXPECT_EQ(1u, fake_bluetooth_instance_->gatt_db_result().size()); 157 EXPECT_EQ(1u, fake_bluetooth_instance_->gatt_db_result().size());
161 158
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 EXPECT_EQ(device::BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient:: 202 EXPECT_EQ(device::BluetoothUUID(bluez::FakeBluetoothGattCharacteristicClient::
206 kHeartRateControlPointUUID), 203 kHeartRateControlPointUUID),
207 db[4]->uuid); 204 db[4]->uuid);
208 EXPECT_EQ(mojom::BluetoothGattDBAttributeType::BTGATT_DB_CHARACTERISTIC, 205 EXPECT_EQ(mojom::BluetoothGattDBAttributeType::BTGATT_DB_CHARACTERISTIC,
209 db[4]->type); 206 db[4]->type);
210 EXPECT_EQ(device::BluetoothGattCharacteristic::PROPERTY_WRITE, 207 EXPECT_EQ(device::BluetoothGattCharacteristic::PROPERTY_WRITE,
211 db[4]->properties); 208 db[4]->properties);
212 } 209 }
213 210
214 } // namespace arc 211 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/bluetooth/arc_bluetooth_bridge.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698