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

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: address comments Created 4 years, 7 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
« no previous file with comments | « device/bluetooth/test/bluetooth_test_win.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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::SimulateGattNotifySessionStartError(
385 BluetoothRemoteGattCharacteristic* characteristic,
386 BluetoothRemoteGattService::GattErrorCode error_code) {
387 win::GattCharacteristic* simulated_characteristic =
388 GetSimulatedCharacteristic(characteristic);
389 CHECK(simulated_characteristic);
ortuno 2016/04/28 16:21:25 DCHECK is enough. CHECK is normally used if failin
gogerald1 2016/05/02 15:37:50 Done.
390 CHECK(error_code == BluetoothRemoteGattService::GATT_ERROR_UNKNOWN);
391 fake_bt_le_wrapper_->SimulateGattCharacteristicSetNotifyError(
392 simulated_characteristic, E_BLUETOOTH_ATT_UNKNOWN_ERROR);
393 }
394
384 void BluetoothTestWin::SimulateGattCharacteristicChanged( 395 void BluetoothTestWin::SimulateGattCharacteristicChanged(
385 BluetoothRemoteGattCharacteristic* characteristic, 396 BluetoothRemoteGattCharacteristic* characteristic,
386 const std::vector<uint8_t>& value) { 397 const std::vector<uint8_t>& value) {
387 win::GattCharacteristic* target_simulated_characteristic = nullptr; 398 win::GattCharacteristic* target_simulated_characteristic = nullptr;
388 if (characteristic) { 399 if (characteristic) {
389 target_simulated_characteristic = 400 target_simulated_characteristic =
390 GetSimulatedCharacteristic(characteristic); 401 GetSimulatedCharacteristic(characteristic);
391 } 402 }
392 403
393 fake_bt_le_wrapper_->SimulateGattCharacteristicValue( 404 fake_bt_le_wrapper_->SimulateGattCharacteristicValue(
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 void BluetoothTestWin::ForceRefreshDevice() { 498 void BluetoothTestWin::ForceRefreshDevice() {
488 adapter_win_->force_update_device_for_test_ = true; 499 adapter_win_->force_update_device_for_test_ = true;
489 FinishPendingTasks(); 500 FinishPendingTasks();
490 } 501 }
491 502
492 void BluetoothTestWin::FinishPendingTasks() { 503 void BluetoothTestWin::FinishPendingTasks() {
493 bluetooth_task_runner_->RunPendingTasks(); 504 bluetooth_task_runner_->RunPendingTasks();
494 base::RunLoop().RunUntilIdle(); 505 base::RunLoop().RunUntilIdle();
495 } 506 }
496 } 507 }
OLDNEW
« no previous file with comments | « 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