New issue
Advanced search Search tips

Issue 713922 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 3
Type: Bug

Blocking:
issue 580406



Sign in to add a comment

bluetooth: Tests should define all GATT attributes before dispatching a Services Discovered event

Project Member Reported by ortuno@chromium.org, Apr 20 2017

Issue description

In tests, GATT Attributes are added incrementally:

device_ = SimulateLowEnergyDevice(3);
device_->CreateGattConnection(GetGattConnectionCallback(Call::EXPECTED),
                                  GetConnectErrorCallback(Call::NOT_EXPECTED));
SimulateGattConnection(device_);
base::RunLoop().RunUntilIdle();

SimulateGattServicesDiscovered(device_, std::vector<std::string>({kTestUUIDGenericAccess}));
service_ = device_->GetGattServices()[0];

SimulateGattCharacteristic(service_, kTestUUIDDeviceName, 0);
characteristic_ = service_->GetCharacteristics()[0];

SimulateGattDescriptor(characteristic_,
                       kTestUUIDCharacteristicUserDescription);
descriptor1_ = characteristic_->GetDescriptors()[0];

But that's not how discovery actually works in the platform APIs. In the platform APIs discovery is done all at once i.e. once the "Services Discovered" signal arrives all attributes are present.

This pattern is forcing us to perform extra operations that don't actually occur in real devices[1][2]. This causes an increase in the complexity of our testing framework and also makes our tests less accurate.

Tests should define all GATT Attributes upfront and call SimulateGattServicesDiscovered once all desired GATT Attributes are in place. A test would look like this:

SimulateGattService(...);
SimulateGattCharacteristic(...);
SimulateGattDescriptor(...);

SimulateGattDiscoveryComplete();

[1] https://cs.chromium.org/chromium/src/device/bluetooth/test/bluetooth_test_win.cc?type=cs&q=SimulateGattCharacteristic&sq=package:chromium&l=274
[2] https://cs.chromium.org/chromium/src/device/bluetooth/test/bluetooth_test_mac.mm?type=cs&q=SimulateGattCharacteristic&sq=package:chromium&l=335
 

Comment 1 by jlebel@chromium.org, Apr 21 2017

Status: ExternalDependency (was: Available)
Great idea, I really think it would be way better.

Comment 2 by scheib@chromium.org, Apr 21 2017

Status: Available (was: ExternalDependency)
Cc: -scheib@chromium.org
Project Member

Comment 4 by sheriffbot@chromium.org, Jan 10

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Available (was: Untriaged)

Sign in to add a comment