Commit 105a98d1 authored by Christos Froussios's avatar Christos Froussios Committed by Commit Bot

Revert "bluetooth: Use DeviceUUID in FakePeripheral"

This reverts commit 20d09354.

Reason for revert: Suspected of breaking
* external/wpt/bluetooth/server/getPrimaryServices/blocklisted-services.https.html
* external/wpt/bluetooth/service/getCharacteristic/gen-blocklisted-characteristic.https.html
* external/wpt/bluetooth/service/getCharacteristics/blocklisted-characteristics.https.html
* external/wpt/bluetooth/service/getCharacteristics/gen-blocklisted-characteristic-with-uuid.https.html

Original change's description:
> bluetooth: Use DeviceUUID in FakePeripheral
> 
> This change refactors FakePeripheral to use the built-in DeviceUUIDs
> helper class in BluetoothDevice to handle the UUIDs for a device.
> 
> BUG=719826
> 
> Change-Id: I9c60f00912aca706f16f402031483711f6f3ae89
> Reviewed-on: https://chromium-review.googlesource.com/958337
> Commit-Queue: Ovidio Henriquez <odejesush@chromium.org>
> Reviewed-by: Giovanni Ortuño Urquidi <ortuno@chromium.org>
> Reviewed-by: Conley Owens <cco3@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#544235}

TBR=cco3@chromium.org,ortuno@chromium.org,odejesush@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 719826, 824704
Change-Id: I4543474f7412f954fe062c06d05a458cdf6d6447
Reviewed-on: https://chromium-review.googlesource.com/975123Reviewed-by: default avatarChristos Froussios <cfroussios@chromium.org>
Commit-Queue: Christos Froussios <cfroussios@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545043}
parent ce6595d4
......@@ -580,7 +580,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
// Helper class to easily update the sets of UUIDs and keep them in sync with
// the set of all the device's UUIDs.
class DEVICE_BLUETOOTH_EXPORT DeviceUUIDs {
class DeviceUUIDs {
public:
DeviceUUIDs();
~DeviceUUIDs();
......
......@@ -8,7 +8,6 @@
#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "device/bluetooth/bluetooth_uuid.h"
#include "device/bluetooth/test/fake_remote_gatt_service.h"
......@@ -36,20 +35,7 @@ void FakePeripheral::SetSystemConnected(bool connected) {
}
void FakePeripheral::SetServiceUUIDs(UUIDSet service_uuids) {
device::BluetoothDevice::GattServiceMap services_map;
bool inserted;
// Create a temporary map of services, because ReplaceServiceUUids expects a
// GattServiceMap even though it only uses the UUIDs.
int count = 0;
for (const auto& uuid : service_uuids) {
std::string id = base::IntToString(count++);
std::tie(std::ignore, inserted) =
services_map.emplace(id, std::make_unique<FakeRemoteGattService>(
id, uuid, true /* is_primary */, this));
DCHECK(inserted);
}
device_uuids_.ReplaceServiceUUIDs(services_map);
service_uuids_ = std::move(service_uuids);
}
void FakePeripheral::SetNextGATTConnectionResponse(uint16_t code) {
......@@ -80,7 +66,6 @@ void FakePeripheral::SimulateGATTDisconnection() {
// for more details.
system_connected_ = false;
gatt_connected_ = false;
device_uuids_.ClearServiceUUIDs();
SetGattServicesDiscoveryComplete(false);
DidDisconnectGatt();
}
......@@ -195,6 +180,10 @@ bool FakePeripheral::IsConnecting() const {
return false;
}
device::BluetoothDevice::UUIDSet FakePeripheral::GetUUIDs() const {
return service_uuids_;
}
bool FakePeripheral::ExpectingPinCode() const {
NOTREACHED();
return false;
......@@ -339,7 +328,6 @@ void FakePeripheral::DispatchDiscoveryResponse() {
pending_gatt_discovery_ = false;
if (code == mojom::kHCISuccess) {
device_uuids_.ReplaceServiceUUIDs(gatt_services_);
SetGattServicesDiscoveryComplete(true);
GetAdapter()->NotifyGattServicesDiscovered(this);
} else {
......
......@@ -81,6 +81,7 @@ class FakePeripheral : public device::BluetoothDevice {
bool IsGattConnected() const override;
bool IsConnectable() const override;
bool IsConnecting() const override;
UUIDSet GetUUIDs() const override;
bool ExpectingPinCode() const override;
bool ExpectingPasskey() const override;
bool ExpectingConfirmation() const override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment