Index: device/bluetooth/bluetooth_adapter_factory.cc |
diff --git a/device/bluetooth/bluetooth_adapter_factory.cc b/device/bluetooth/bluetooth_adapter_factory.cc |
index e542638aef15f4f66bb0fbf3d5d49c79d908354c..e31754408cc8e3e21908ce9bfc2f4b6317968f43 100644 |
--- a/device/bluetooth/bluetooth_adapter_factory.cc |
+++ b/device/bluetooth/bluetooth_adapter_factory.cc |
@@ -54,6 +54,10 @@ void RunAdapterCallbacks() { |
} // namespace |
// static |
+bool BluetoothAdapterFactory::availability_set_ = false; |
+bool BluetoothAdapterFactory::low_energy_available_ = false; |
+ |
+// static |
bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() { |
// SetAdapterForTesting() may be used to provide a test or mock adapter |
// instance even on platforms that would otherwise not support it. |
@@ -71,6 +75,10 @@ bool BluetoothAdapterFactory::IsBluetoothAdapterAvailable() { |
bool BluetoothAdapterFactory::IsLowEnergyAvailable() { |
DCHECK(IsBluetoothAdapterAvailable()); |
+ if (availability_set_) { |
+ return low_energy_available_; |
+ } |
+ |
// SetAdapterForTesting() may be used to provide a test or mock adapter |
// instance even on platforms that would otherwise not support it. |
if (default_adapter.Get()) |
@@ -121,6 +129,12 @@ void BluetoothAdapterFactory::Shutdown() { |
#endif |
// static |
+void BluetoothAdapterFactory::SetAvailability(bool available) { |
+ availability_set_ = true; |
+ low_energy_available_ = available; |
+} |
+ |
+// static |
void BluetoothAdapterFactory::SetAdapterForTesting( |
scoped_refptr<BluetoothAdapter> adapter) { |
default_adapter.Get() = adapter->GetWeakPtrForTesting(); |