Index: device/bluetooth/bluetooth_low_energy_win.cc |
diff --git a/device/bluetooth/bluetooth_low_energy_win.cc b/device/bluetooth/bluetooth_low_energy_win.cc |
index 54af750526b42fa7387bb8fa271bd5aac77aab05..e0a843248f0aa4b1f2e23cf05ba367057232996b 100644 |
--- a/device/bluetooth/bluetooth_low_energy_win.cc |
+++ b/device/bluetooth/bluetooth_low_energy_win.cc |
@@ -652,7 +652,36 @@ bool IsBluetoothLowEnergySupported() { |
return base::win::GetVersion() >= base::win::VERSION_WIN8; |
} |
-bool EnumerateKnownBluetoothLowEnergyDevices( |
+bool ExtractBluetoothAddressFromDeviceInstanceIdForTesting( |
+ const std::string& instance_id, |
+ BLUETOOTH_ADDRESS* btha, |
+ std::string* error) { |
+ return ExtractBluetoothAddressFromDeviceInstanceId(instance_id, btha, error); |
+} |
+ |
+static BluetoothLowEnergyWrapper* instance_ = nullptr; |
+BluetoothLowEnergyWrapper* BluetoothLowEnergyWrapper::GetInstance() { |
+ if (instance_ == nullptr) { |
+ instance_ = new BluetoothLowEnergyWrapper(); |
+ } |
+ return instance_; |
+} |
+ |
+void BluetoothLowEnergyWrapper::DeleteInstance() { |
+ delete instance_; |
+ instance_ = nullptr; |
+} |
+ |
+void BluetoothLowEnergyWrapper::SetInstanceForTest( |
+ BluetoothLowEnergyWrapper* instance) { |
+ delete instance_; |
+ instance_ = instance; |
+} |
+ |
+BluetoothLowEnergyWrapper::BluetoothLowEnergyWrapper() {} |
+BluetoothLowEnergyWrapper::~BluetoothLowEnergyWrapper() {} |
+ |
+bool BluetoothLowEnergyWrapper::EnumerateKnownBluetoothLowEnergyDevices( |
ScopedVector<BluetoothLowEnergyDeviceInfo>* devices, |
std::string* error) { |
if (!IsBluetoothLowEnergySupported()) { |
@@ -664,9 +693,10 @@ bool EnumerateKnownBluetoothLowEnergyDevices( |
GUID_BLUETOOTHLE_DEVICE_INTERFACE, devices, error); |
} |
-bool EnumerateKnownBluetoothLowEnergyGattServiceDevices( |
- ScopedVector<BluetoothLowEnergyDeviceInfo>* devices, |
- std::string* error) { |
+bool BluetoothLowEnergyWrapper:: |
+ EnumerateKnownBluetoothLowEnergyGattServiceDevices( |
+ ScopedVector<BluetoothLowEnergyDeviceInfo>* devices, |
+ std::string* error) { |
if (!IsBluetoothLowEnergySupported()) { |
*error = kPlatformNotSupported; |
return false; |
@@ -676,7 +706,7 @@ bool EnumerateKnownBluetoothLowEnergyGattServiceDevices( |
GUID_BLUETOOTH_GATT_SERVICE_DEVICE_INTERFACE, devices, error); |
} |
-bool EnumerateKnownBluetoothLowEnergyServices( |
+bool BluetoothLowEnergyWrapper::EnumerateKnownBluetoothLowEnergyServices( |
const base::FilePath& device_path, |
ScopedVector<BluetoothLowEnergyServiceInfo>* services, |
std::string* error) { |
@@ -688,12 +718,5 @@ bool EnumerateKnownBluetoothLowEnergyServices( |
return CollectBluetoothLowEnergyDeviceServices(device_path, services, error); |
} |
-bool ExtractBluetoothAddressFromDeviceInstanceIdForTesting( |
- const std::string& instance_id, |
- BLUETOOTH_ADDRESS* btha, |
- std::string* error) { |
- return ExtractBluetoothAddressFromDeviceInstanceId(instance_id, btha, error); |
-} |
- |
} // namespace win |
} // namespace device |