• Giovanni Ortuño Urquidi's avatar
    bluetooth: Check the correct value was set when powering on/off · c9a6360c
    Giovanni Ortuño Urquidi authored
    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/1298818Reviewed-by: default avatarRyo Hashimoto <hashimoto@chromium.org>
    Reviewed-by: default avatarOvidio Henriquez <odejesush@chromium.org>
    Commit-Queue: Giovanni Ortuño Urquidi <ortuno@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#603697}
    c9a6360c
property.h 25.3 KB