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

Unified Diff: device/bluetooth/bluetooth_adapter_factory.h

Issue 2815793003: bluetooth: Introduce SetLowEnergyAvailableForTesting (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | device/bluetooth/bluetooth_adapter_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_adapter_factory.h
diff --git a/device/bluetooth/bluetooth_adapter_factory.h b/device/bluetooth/bluetooth_adapter_factory.h
index ab800db0b63e3366f7c99b0a00a25d2bec2c5072..43cf6865fc1ea840793ab8e34384ec4e44fc02d2 100644
--- a/device/bluetooth/bluetooth_adapter_factory.h
+++ b/device/bluetooth/bluetooth_adapter_factory.h
@@ -6,6 +6,7 @@
#define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_H_
#include "base/callback.h"
+#include "base/lazy_instance.h"
#include "base/memory/ref_counted.h"
#include "build/build_config.h"
#include "device/bluetooth/bluetooth_adapter.h"
@@ -20,13 +21,17 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterFactory {
typedef base::Callback<void(scoped_refptr<BluetoothAdapter> adapter)>
AdapterCallback;
+ ~BluetoothAdapterFactory();
+
+ static BluetoothAdapterFactory& Get();
+
// Returns true if the Bluetooth adapter is available for the current
// platform.
static bool IsBluetoothAdapterAvailable();
// Returns true if Bluetooth Low Energy is available for the current
// platform.
- static bool IsLowEnergyAvailable();
+ bool IsLowEnergyAvailable();
// Returns the shared instance of the default adapter, creating and
// initializing it if necessary. |callback| is called with the adapter
@@ -48,6 +53,17 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterFactory {
// Returns true iff the implementation has a (non-NULL) shared instance of the
// adapter. Exposed for testing.
static bool HasSharedInstanceForTesting();
+
+ // Sets the return value for IsLowEnergyAvailable() to |available|.
+ void SetLowEnergyAvailableForTesting(bool available);
+
+ private:
+ // Friend LazyInstance to permit access to private constructor.
+ friend base::LazyInstanceTraitsBase<BluetoothAdapterFactory>;
+
+ BluetoothAdapterFactory();
+
+ base::Optional<bool> le_available_for_testing_;
};
} // namespace device
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_adapter_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698