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/location.h" | 8 #include "base/location.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 if (!service_uuid_2.empty()) { | 164 if (!service_uuid_2.empty()) { |
165 fake_bt_le_wrapper_->SimulateGattService( | 165 fake_bt_le_wrapper_->SimulateGattService( |
166 simulated_device, nullptr, | 166 simulated_device, nullptr, |
167 CanonicalStringToBTH_LE_UUID(service_uuid_2)); | 167 CanonicalStringToBTH_LE_UUID(service_uuid_2)); |
168 } | 168 } |
169 } | 169 } |
170 FinishPendingTasks(); | 170 FinishPendingTasks(); |
171 | 171 |
172 std::vector<BluetoothDevice*> devices = adapter_win_->GetDevices(); | 172 std::vector<BluetoothDevice*> devices = adapter_win_->GetDevices(); |
173 for (auto device : devices) { | 173 for (auto* device : devices) { |
174 if (device->GetAddress() == device_address) | 174 if (device->GetAddress() == device_address) |
175 return device; | 175 return device; |
176 } | 176 } |
177 | 177 |
178 return nullptr; | 178 return nullptr; |
179 } | 179 } |
180 | 180 |
181 void BluetoothTestWin::SimulateGattConnection(BluetoothDevice* device) { | 181 void BluetoothTestWin::SimulateGattConnection(BluetoothDevice* device) { |
182 FinishPendingTasks(); | 182 FinishPendingTasks(); |
183 | 183 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 void BluetoothTestWin::ForceRefreshDevice() { | 498 void BluetoothTestWin::ForceRefreshDevice() { |
499 adapter_win_->force_update_device_for_test_ = true; | 499 adapter_win_->force_update_device_for_test_ = true; |
500 FinishPendingTasks(); | 500 FinishPendingTasks(); |
501 } | 501 } |
502 | 502 |
503 void BluetoothTestWin::FinishPendingTasks() { | 503 void BluetoothTestWin::FinishPendingTasks() { |
504 bluetooth_task_runner_->RunPendingTasks(); | 504 bluetooth_task_runner_->RunPendingTasks(); |
505 base::RunLoop().RunUntilIdle(); | 505 base::RunLoop().RunUntilIdle(); |
506 } | 506 } |
507 } | 507 } |
OLD | NEW |