Commit 1fe98e60 authored by Reilly Grant's avatar Reilly Grant Committed by Commit Bot

[fido] Fix FIDO BLE tests which use BluetoothTest

These tests use BluetoothTest to create a platform-specific fake
adapter. Since FidoBleDiscovery uses BluetoothAdapterFactory to get the
BluetoothAdapter SetAdapterForTesting() must be called to register this
fake adapter with the factory so that the tests use the right one.

Bug: 1071677
Change-Id: I3cc53f39bbd492a0901e334cea0308c65fde4b8d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2153938Reviewed-by: default avatarMartin Kreichgauer <martinkr@google.com>
Commit-Queue: Martin Kreichgauer <martinkr@google.com>
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Auto-Submit: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759886}
parent 69894666
...@@ -186,6 +186,7 @@ TEST_F(BluetoothTest, FidoBleDiscoveryFindsKnownDevice) { ...@@ -186,6 +186,7 @@ TEST_F(BluetoothTest, FidoBleDiscoveryFindsKnownDevice) {
return; return;
} }
InitWithFakeAdapter(); InitWithFakeAdapter();
BluetoothAdapterFactory::SetAdapterForTesting(adapter_);
SimulateLowEnergyDevice(4); // This device should be ignored. SimulateLowEnergyDevice(4); // This device should be ignored.
SimulateLowEnergyDevice(7); SimulateLowEnergyDevice(7);
...@@ -215,6 +216,7 @@ TEST_F(BluetoothTest, FidoBleDiscoveryFindsNewDevice) { ...@@ -215,6 +216,7 @@ TEST_F(BluetoothTest, FidoBleDiscoveryFindsNewDevice) {
return; return;
} }
InitWithFakeAdapter(); InitWithFakeAdapter();
BluetoothAdapterFactory::SetAdapterForTesting(adapter_);
FidoBleDiscovery discovery; FidoBleDiscovery discovery;
MockFidoDiscoveryObserver observer; MockFidoDiscoveryObserver observer;
...@@ -258,6 +260,7 @@ TEST_F(BluetoothTest, FidoBleDiscoveryFindsUpdatedDevice) { ...@@ -258,6 +260,7 @@ TEST_F(BluetoothTest, FidoBleDiscoveryFindsUpdatedDevice) {
return; return;
} }
InitWithFakeAdapter(); InitWithFakeAdapter();
BluetoothAdapterFactory::SetAdapterForTesting(adapter_);
SimulateLowEnergyDevice(3); SimulateLowEnergyDevice(3);
...@@ -306,6 +309,7 @@ TEST_F(BluetoothTest, FidoBleDiscoveryRejectsCableDevice) { ...@@ -306,6 +309,7 @@ TEST_F(BluetoothTest, FidoBleDiscoveryRejectsCableDevice) {
return; return;
} }
InitWithFakeAdapter(); InitWithFakeAdapter();
BluetoothAdapterFactory::SetAdapterForTesting(adapter_);
FidoBleDiscovery discovery; FidoBleDiscovery discovery;
MockFidoDiscoveryObserver observer; MockFidoDiscoveryObserver observer;
......
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