Summary: bluetooth: Add a new Bluetooth System interface that performs all the necessary OS operations (was: bluetooth: Add a new Bluetooth System interface that perform all the necessary OS operations)
The following revision refers to this bug:
https://chromium.googlesource.com/chromium/src.git/+/c9a6360ca61b4ec20f12ba91a633df1b2d014ebe
commit c9a6360ca61b4ec20f12ba91a633df1b2d014ebe
Author: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Date: Tue Oct 30 00:09:26 2018
bluetooth: Check the correct value was set when powering on/off
Part of a bigger refactor to change how tests work. Currently tests
perform the following steps:
1. Set the next response to a BlueZ method call
2. Call a method that will call the BlueZ method
3. Check that the BlueZ method was called the right number of times
4. Apply the values that were passed to the BlueZ method
With this approach, we have no control over when BlueZ replies and
we don't know what values were passed to BlueZ until after we apply
them.
This CL address the second problem by exposing a GetSetValueForTesting
method in dbus::Property and adding a GetLastSetPoweredValue() method
to tests that use GetSetValueForTesting to test that the BlueZ method
was called with the right value. Now that we don't need to apply the
`set_value` to know what it was, we can remove
SimulateSetPoweredCompleted.
A follow up CL will address the first problem. In the end tests should
perform the following steps:
1. Call a method that will call a BlueZ method
2. Check that the BlueZ method was called the right number of times
3. Check that the BlueZ method was called with the right value
4. Simulate the BlueZ method replying
An added benefit of this approach is that we can simulate other
operations, like the adapter getting removed, between steps 1.
and 4., something that happens often in real devices.
Bug: 870192
Change-Id: I0c2cfc90a84d6d79b158804264c0e93664310a08
Reviewed-on: https://chromium-review.googlesource.com/c/1298818
Reviewed-by: Ryo Hashimoto <hashimoto@chromium.org>
Reviewed-by: Ovidio Henriquez <odejesush@chromium.org>
Commit-Queue: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603697}
[modify] https://crrev.com/c9a6360ca61b4ec20f12ba91a633df1b2d014ebe/dbus/property.h
[modify] https://crrev.com/c9a6360ca61b4ec20f12ba91a633df1b2d014ebe/services/device/bluetooth/bluetooth_system_unittest.cc
Comment 1 by ortuno@chromium.org
, Aug 2