| 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 characteristic->GetService()->GetDevice()->GetAddress(), | 362 characteristic->GetService()->GetDevice()->GetAddress(), |
| 363 target_characteristic, CanonicalStringToBTH_LE_UUID(uuid)); | 363 target_characteristic, CanonicalStringToBTH_LE_UUID(uuid)); |
| 364 ForceRefreshDevice(); | 364 ForceRefreshDevice(); |
| 365 } | 365 } |
| 366 | 366 |
| 367 void BluetoothTestWin::SimulateGattNotifySessionStarted( | 367 void BluetoothTestWin::SimulateGattNotifySessionStarted( |
| 368 BluetoothGattCharacteristic* characteristic) { | 368 BluetoothGattCharacteristic* characteristic) { |
| 369 FinishPendingTasks(); | 369 FinishPendingTasks(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void BluetoothTestWin:: |
| 373 SimulateGattCharacteristicSetNotifyWillFailAsynchronouslyOnce( |
| 374 BluetoothGattCharacteristic* characteristic) { |
| 375 win::GattCharacteristic* simulated_characteristic = |
| 376 GetSimulatedCharacteristic(characteristic); |
| 377 CHECK(simulated_characteristic); |
| 378 fake_bt_le_wrapper_->SimulateGattCharacteristicSetNotifyError( |
| 379 simulated_characteristic, E_BLUETOOTH_ATT_UNKNOWN_ERROR); |
| 380 } |
| 381 |
| 372 void BluetoothTestWin::SimulateGattCharacteristicChanged( | 382 void BluetoothTestWin::SimulateGattCharacteristicChanged( |
| 373 BluetoothGattCharacteristic* characteristic, | 383 BluetoothGattCharacteristic* characteristic, |
| 374 const std::vector<uint8_t>& value) { | 384 const std::vector<uint8_t>& value) { |
| 375 BluetoothGattCharacteristic* target_characteristic = characteristic; | 385 BluetoothGattCharacteristic* target_characteristic = characteristic; |
| 376 if (target_characteristic == nullptr) | 386 if (target_characteristic == nullptr) |
| 377 target_characteristic = remembered_characteristic_; | 387 target_characteristic = remembered_characteristic_; |
| 378 CHECK(target_characteristic); | 388 CHECK(target_characteristic); |
| 379 | 389 |
| 380 win::GattCharacteristic* simulated_characteristic = | 390 win::GattCharacteristic* simulated_characteristic = |
| 381 GetSimulatedCharacteristic(target_characteristic); | 391 GetSimulatedCharacteristic(target_characteristic); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 void BluetoothTestWin::ForceRefreshDevice() { | 481 void BluetoothTestWin::ForceRefreshDevice() { |
| 472 adapter_win_->force_update_device_for_test_ = true; | 482 adapter_win_->force_update_device_for_test_ = true; |
| 473 FinishPendingTasks(); | 483 FinishPendingTasks(); |
| 474 } | 484 } |
| 475 | 485 |
| 476 void BluetoothTestWin::FinishPendingTasks() { | 486 void BluetoothTestWin::FinishPendingTasks() { |
| 477 bluetooth_task_runner_->RunPendingTasks(); | 487 bluetooth_task_runner_->RunPendingTasks(); |
| 478 base::RunLoop().RunUntilIdle(); | 488 base::RunLoop().RunUntilIdle(); |
| 479 } | 489 } |
| 480 } | 490 } |
| OLD | NEW |