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

Unified Diff: device/bluetooth/bluetooth_classic_win_fake.cc

Issue 1676073002: Implement BluetoothLowEnergyWrapperFake for Bluetooth test fixture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
Index: device/bluetooth/bluetooth_classic_win_fake.cc
diff --git a/device/bluetooth/bluetooth_classic_win_fake.cc b/device/bluetooth/bluetooth_classic_win_fake.cc
index 2b8bec05eb589081a0f37dde47fd65c66c799abb..20ccf751342ea67ee974e7bc1181804f19c54591 100644
--- a/device/bluetooth/bluetooth_classic_win_fake.cc
+++ b/device/bluetooth/bluetooth_classic_win_fake.cc
@@ -9,7 +9,8 @@
namespace device {
namespace win {
-BluetoothClassicWrapperFake::BluetoothClassicWrapperFake() {}
+BluetoothClassicWrapperFake::BluetoothClassicWrapperFake()
+ : last_error_(ERROR_SUCCESS) {}
BluetoothClassicWrapperFake::~BluetoothClassicWrapperFake() {}
HBLUETOOTH_RADIO_FIND BluetoothClassicWrapperFake::FindFirstRadio(
@@ -17,8 +18,10 @@ HBLUETOOTH_RADIO_FIND BluetoothClassicWrapperFake::FindFirstRadio(
HANDLE* out_handle) {
if (simulated_radios_.get() != nullptr) {
*out_handle = (PVOID)simulated_radios_.get();
+ last_error_ = ERROR_SUCCESS;
return *out_handle;
}
+ last_error_ = ERROR_NO_MORE_ITEMS;
return NULL;
}
@@ -27,8 +30,11 @@ DWORD BluetoothClassicWrapperFake::GetRadioInfo(
PBLUETOOTH_RADIO_INFO out_radio_info) {
if (simulated_radios_.get() != nullptr) {
*out_radio_info = simulated_radios_->radio_info;
+ last_error_ = ERROR_SUCCESS;
+ return last_error_;
}
- return ERROR_SUCCESS;
+ last_error_ = ERROR_INVALID_HANDLE;
+ return last_error_;
}
BOOL BluetoothClassicWrapperFake::FindRadioClose(HBLUETOOTH_RADIO_FIND handle) {
@@ -37,14 +43,17 @@ BOOL BluetoothClassicWrapperFake::FindRadioClose(HBLUETOOTH_RADIO_FIND handle) {
BOOL BluetoothClassicWrapperFake::IsConnectable(HANDLE handle) {
if (simulated_radios_.get() != nullptr) {
+ last_error_ = ERROR_SUCCESS;
return simulated_radios_->is_connectable;
}
- return TRUE;
+ last_error_ = ERROR_INVALID_HANDLE;
+ return false;
}
HBLUETOOTH_DEVICE_FIND BluetoothClassicWrapperFake::FindFirstDevice(
const BLUETOOTH_DEVICE_SEARCH_PARAMS* params,
BLUETOOTH_DEVICE_INFO* out_device_info) {
+ last_error_ = ERROR_NO_MORE_ITEMS;
return NULL;
}
@@ -57,7 +66,6 @@ BOOL BluetoothClassicWrapperFake::FindNextDevice(
BOOL BluetoothClassicWrapperFake::FindDeviceClose(
HBLUETOOTH_DEVICE_FIND handle) {
- NOTIMPLEMENTED();
return TRUE;
}
@@ -71,6 +79,10 @@ BOOL BluetoothClassicWrapperFake::EnableIncomingConnections(HANDLE handle,
return TRUE;
}
+DWORD BluetoothClassicWrapperFake::LastError() {
+ return last_error_;
+}
+
BluetoothRadio* BluetoothClassicWrapperFake::SimulateARadio(
base::string16 name,
BLUETOOTH_ADDRESS address) {

Powered by Google App Engine
This is Rietveld 408576698