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

Unified Diff: device/bluetooth/test/fake_central.cc

Issue 2874873003: bluetooth: Implement simulateGATTConnectionResponse() (Closed)
Patch Set: fix Created 3 years, 6 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/test/fake_central.h ('k') | device/bluetooth/test/fake_peripheral.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/test/fake_central.cc
diff --git a/device/bluetooth/test/fake_central.cc b/device/bluetooth/test/fake_central.cc
index 8bc994fffc81a9d12eeb2afab8b46d8fb2581fbe..2b11378a0632d77dce5e3fe74afe4bbb88cd684a 100644
--- a/device/bluetooth/test/fake_central.cc
+++ b/device/bluetooth/test/fake_central.cc
@@ -37,13 +37,29 @@ void FakeCentral::SimulatePreconnectedPeripheral(
FakePeripheral* fake_peripheral =
static_cast<FakePeripheral*>(device_iter->second.get());
fake_peripheral->SetName(name);
- fake_peripheral->SetGattConnected(true);
+ fake_peripheral->SetSystemConnected(true);
fake_peripheral->SetServiceUUIDs(device::BluetoothDevice::UUIDSet(
known_service_uuids.begin(), known_service_uuids.end()));
std::move(callback).Run();
}
+void FakeCentral::SetNextGATTConnectionResponse(
+ const std::string& address,
+ uint16_t code,
+ SetNextGATTConnectionResponseCallback callback) {
+ auto device_iter = devices_.find(address);
+ if (device_iter == devices_.end()) {
+ std::move(callback).Run(false);
+ return;
+ }
+
+ FakePeripheral* fake_peripheral =
+ static_cast<FakePeripheral*>(device_iter->second.get());
+ fake_peripheral->SetNextGATTConnectionResponse(code);
+ std::move(callback).Run(true);
+}
+
std::string FakeCentral::GetAddress() const {
NOTREACHED();
return std::string();
« no previous file with comments | « device/bluetooth/test/fake_central.h ('k') | device/bluetooth/test/fake_peripheral.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698