OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "device/bluetooth/test/bluetooth_test_win.h" | 5 #include "device/bluetooth/test/bluetooth_test_win.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "device/bluetooth/bluetooth_adapter_win.h" | 9 #include "device/bluetooth/bluetooth_adapter_win.h" |
10 #include "device/bluetooth/bluetooth_low_energy_win.h" | 10 #include "device/bluetooth/bluetooth_low_energy_win.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 ui_task_runner_->RunPendingTasks(); | 121 ui_task_runner_->RunPendingTasks(); |
122 | 122 |
123 std::vector<BluetoothDevice*> devices = adapter_win_->GetDevices(); | 123 std::vector<BluetoothDevice*> devices = adapter_win_->GetDevices(); |
124 for (auto device : devices) { | 124 for (auto device : devices) { |
125 if (device->GetAddress() == device_address) | 125 if (device->GetAddress() == device_address) |
126 return device; | 126 return device; |
127 } | 127 } |
128 | 128 |
129 return nullptr; | 129 return nullptr; |
130 } | 130 } |
| 131 |
| 132 void BluetoothTestWin::SimulateGattConnection(BluetoothDevice* device) { |
| 133 bluetooth_task_runner_->RunPendingTasks(); |
| 134 ui_task_runner_->RunPendingTasks(); |
| 135 |
| 136 // Clear records caused by CreateGattConnection since we do not support it on |
| 137 // Windows. |
| 138 gatt_discovery_attempts_++; |
| 139 expected_success_callback_calls_--; |
| 140 unexpected_error_callback_ = false; |
131 } | 141 } |
| 142 |
| 143 void BluetoothTestWin::SimulateGattServicesDiscovered( |
| 144 BluetoothDevice* device, |
| 145 const std::vector<std::string>& uuids) { |
| 146 win::BLEDevice* simulated_device = |
| 147 fake_bt_le_wrapper_->GetSimulatedBLEDevice(device->GetAddress()); |
| 148 CHECK(simulated_device); |
| 149 |
| 150 for (auto uuid : uuids) { |
| 151 fake_bt_le_wrapper_->SimulateBLEGattService(simulated_device, uuid); |
| 152 } |
| 153 |
| 154 bluetooth_task_runner_->RunPendingTasks(); |
| 155 ui_task_runner_->RunPendingTasks(); |
| 156 } |
| 157 } |
OLD | NEW |