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

Unified Diff: device/bluetooth/test/bluetooth_test_mac.mm

Issue 2242833002: Bluetooth: mac: add connected BLE devices at startup Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Device: bluetooth: use untyped containers Created 4 years, 3 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/test/bluetooth_test_mac.mm
diff --git a/device/bluetooth/test/bluetooth_test_mac.mm b/device/bluetooth/test/bluetooth_test_mac.mm
index d7e6f4b63ad6020d8ebfeed19d13e4afb3bd52ee..bdb3eef5606dfde6d5abfa202e32429c22b3c7cb 100644
--- a/device/bluetooth/test/bluetooth_test_mac.mm
+++ b/device/bluetooth/test/bluetooth_test_mac.mm
@@ -144,6 +144,29 @@ explicit ScopedMockCentralManager(MockCentralManager* mock_central_manager) {
}
}
+void BluetoothTestMac::InitWithFakeAdapterWithConnectedLowEnergyDevice() {
+ MockCentralManager* mock_central_manager = [[MockCentralManager alloc] init];
+
+ scoped_nsobject<MockCBPeripheral> mock_peripheral([[MockCBPeripheral alloc]
+ initWithUTF8StringIdentifier:kTestPeripheralUUID1.c_str()
+ name:@(kTestDeviceName.c_str())]);
+
+ mock_central_manager.connected_peripherals = @[ mock_peripheral.get() ];
+
+ mock_central_manager_.reset(
+ new ScopedMockCentralManager(mock_central_manager));
+
+ mock_central_manager_->get().bluetoothTestMac = this;
+ [mock_central_manager_->get() setState:CBCentralManagerStatePoweredOn];
+
+ adapter_mac_ =
+ BluetoothAdapterMac::CreateAdapterForTest(
+ kTestAdapterName, kTestAdapterAddress, message_loop_.task_runner(),
+ (id)mock_central_manager_->get())
+ .get();
+ adapter_ = adapter_mac_;
+}
+
BluetoothDevice* BluetoothTestMac::SimulateLowEnergyDevice(int device_ordinal) {
TestBluetoothAdapterObserver observer(adapter_);
CBCentralManager* central_manager = adapter_mac_->low_energy_central_manager_;
« no previous file with comments | « device/bluetooth/test/bluetooth_test_mac.h ('k') | device/bluetooth/test/mock_bluetooth_central_manager_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698