Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(901)

Unified Diff: device/bluetooth/bluetooth_adapter_factory.cc

Issue 2722473002: DO NOT SUBMIT. Stub implementation of FakeBluetooth mojo interface (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth_adapter_factory.h ('k') | device/bluetooth/bluetooth_adapter_factory_wrapper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « device/bluetooth/bluetooth_adapter_factory.h ('k') | device/bluetooth/bluetooth_adapter_factory_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698