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

Side by Side Diff: device/bluetooth/test/bluetooth_test_win.cc

Issue 1804093003: Add BluetoothGattCharacteristicTest::StartNotifySession_Reentrant unit test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 characteristic->GetService()->GetDevice()->GetAddress(), 374 characteristic->GetService()->GetDevice()->GetAddress(),
375 target_characteristic, CanonicalStringToBTH_LE_UUID(uuid)); 375 target_characteristic, CanonicalStringToBTH_LE_UUID(uuid));
376 ForceRefreshDevice(); 376 ForceRefreshDevice();
377 } 377 }
378 378
379 void BluetoothTestWin::SimulateGattNotifySessionStarted( 379 void BluetoothTestWin::SimulateGattNotifySessionStarted(
380 BluetoothRemoteGattCharacteristic* characteristic) { 380 BluetoothRemoteGattCharacteristic* characteristic) {
381 FinishPendingTasks(); 381 FinishPendingTasks();
382 } 382 }
383 383
384 void BluetoothTestWin::
385 SimulateGattCharacteristicSetNotifyWillFailAsynchronouslyOnce(
386 BluetoothRemoteGattCharacteristic* characteristic) {
387 win::GattCharacteristic* simulated_characteristic =
388 GetSimulatedCharacteristic(characteristic);
389 CHECK(simulated_characteristic);
390 fake_bt_le_wrapper_->SimulateGattCharacteristicSetNotifyError(
391 simulated_characteristic, E_BLUETOOTH_ATT_UNKNOWN_ERROR);
392 }
393
384 void BluetoothTestWin::SimulateGattCharacteristicChanged( 394 void BluetoothTestWin::SimulateGattCharacteristicChanged(
385 BluetoothRemoteGattCharacteristic* characteristic, 395 BluetoothRemoteGattCharacteristic* characteristic,
386 const std::vector<uint8_t>& value) { 396 const std::vector<uint8_t>& value) {
387 win::GattCharacteristic* target_simulated_characteristic = nullptr; 397 win::GattCharacteristic* target_simulated_characteristic = nullptr;
388 if (characteristic) { 398 if (characteristic) {
389 target_simulated_characteristic = 399 target_simulated_characteristic =
390 GetSimulatedCharacteristic(characteristic); 400 GetSimulatedCharacteristic(characteristic);
391 } 401 }
392 402
393 fake_bt_le_wrapper_->SimulateGattCharacteristicValue( 403 fake_bt_le_wrapper_->SimulateGattCharacteristicValue(
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 void BluetoothTestWin::ForceRefreshDevice() { 497 void BluetoothTestWin::ForceRefreshDevice() {
488 adapter_win_->force_update_device_for_test_ = true; 498 adapter_win_->force_update_device_for_test_ = true;
489 FinishPendingTasks(); 499 FinishPendingTasks();
490 } 500 }
491 501
492 void BluetoothTestWin::FinishPendingTasks() { 502 void BluetoothTestWin::FinishPendingTasks() {
493 bluetooth_task_runner_->RunPendingTasks(); 503 bluetooth_task_runner_->RunPendingTasks();
494 base::RunLoop().RunUntilIdle(); 504 base::RunLoop().RunUntilIdle();
495 } 505 }
496 } 506 }
OLDNEW
« device/bluetooth/test/bluetooth_test.cc ('K') | « device/bluetooth/test/bluetooth_test_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698