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) { |