Commit 32a2d739 authored by Giovanni Ortuño Urquidi's avatar Giovanni Ortuño Urquidi Committed by Commit Bot

bluetooth: Call AdapterPropertyChanged before AdapterAdded

On real devices, AdapterPropertyChanged is called for each property in
the adapter before AdapterAdded is called. During this, the adapter
should be included when returning GetAdapter and all its properties should
be accessible (though they will be empty).

Changes TestBluetoothAdapterClient to match this behavior but instead of
calling AdapterPropertyChanged for all properties, we call it for the two
that are used in tests "Powered" and "Discovering".

Bug: 870192
Change-Id: I501cfb8ad2665aee27314188e5a7f667e2209ebf
Reviewed-on: https://chromium-review.googlesource.com/c/1358101Reviewed-by: default avatarOvidio Henriquez <odejesush@chromium.org>
Commit-Queue: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613285}
parent 90845ab7
......@@ -73,7 +73,11 @@ void BluetoothSystem::AdapterRemoved(const dbus::ObjectPath& object_path) {
void BluetoothSystem::AdapterPropertyChanged(
const dbus::ObjectPath& object_path,
const std::string& property_name) {
DCHECK(active_adapter_);
// AdapterPropertyChanged is called for each property in the adapter before
// AdapterAdded is called. Immediately return in this case.
if (!active_adapter_)
return;
if (active_adapter_.value() != object_path)
return;
......
......@@ -142,6 +142,9 @@ class DEVICE_BLUETOOTH_EXPORT TestBluetoothAdapterClient
object_path));
adapter_object_paths_to_next_responses_[object_path];
GetProperties(object_path)->powered.ReplaceValue(false);
GetProperties(object_path)->discovering.ReplaceValue(false);
for (auto& observer : observers_)
observer.AdapterAdded(object_path);
}
......
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