| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.h" | 5 #include "device/bluetooth/test/bluetooth_test.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 const std::string BluetoothTestBase::kTestUUIDLinkLoss = "1803"; | 31 const std::string BluetoothTestBase::kTestUUIDLinkLoss = "1803"; |
| 32 const std::string BluetoothTestBase::kTestUUIDHeartRate = "180d"; | 32 const std::string BluetoothTestBase::kTestUUIDHeartRate = "180d"; |
| 33 | 33 |
| 34 BluetoothTestBase::BluetoothTestBase() : weak_factory_(this) {} | 34 BluetoothTestBase::BluetoothTestBase() : weak_factory_(this) {} |
| 35 | 35 |
| 36 BluetoothTestBase::~BluetoothTestBase() { | 36 BluetoothTestBase::~BluetoothTestBase() { |
| 37 } | 37 } |
| 38 | 38 |
| 39 void BluetoothTestBase::StartLowEnergyDiscoverySession() { | 39 void BluetoothTestBase::StartLowEnergyDiscoverySession() { |
| 40 adapter_->StartDiscoverySessionWithFilter( | 40 adapter_->StartDiscoverySessionWithFilter( |
| 41 base::WrapUnique(new BluetoothDiscoveryFilter(BLUETOOTH_TRANSPORT_LE)), | 41 base::MakeUnique<BluetoothDiscoveryFilter>(BLUETOOTH_TRANSPORT_LE), |
| 42 GetDiscoverySessionCallback(Call::EXPECTED), | 42 GetDiscoverySessionCallback(Call::EXPECTED), |
| 43 GetErrorCallback(Call::NOT_EXPECTED)); | 43 GetErrorCallback(Call::NOT_EXPECTED)); |
| 44 base::RunLoop().RunUntilIdle(); | 44 base::RunLoop().RunUntilIdle(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void BluetoothTestBase::StartLowEnergyDiscoverySessionExpectedToFail() { | 47 void BluetoothTestBase::StartLowEnergyDiscoverySessionExpectedToFail() { |
| 48 adapter_->StartDiscoverySessionWithFilter( | 48 adapter_->StartDiscoverySessionWithFilter( |
| 49 base::WrapUnique(new BluetoothDiscoveryFilter(BLUETOOTH_TRANSPORT_LE)), | 49 base::MakeUnique<BluetoothDiscoveryFilter>(BLUETOOTH_TRANSPORT_LE), |
| 50 GetDiscoverySessionCallback(Call::NOT_EXPECTED), | 50 GetDiscoverySessionCallback(Call::NOT_EXPECTED), |
| 51 GetErrorCallback(Call::EXPECTED)); | 51 GetErrorCallback(Call::EXPECTED)); |
| 52 base::RunLoop().RunUntilIdle(); | 52 base::RunLoop().RunUntilIdle(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void BluetoothTestBase::TearDown() { | 55 void BluetoothTestBase::TearDown() { |
| 56 EXPECT_EQ(expected_success_callback_calls_, actual_success_callback_calls_); | 56 EXPECT_EQ(expected_success_callback_calls_, actual_success_callback_calls_); |
| 57 EXPECT_EQ(expected_error_callback_calls_, actual_error_callback_calls_); | 57 EXPECT_EQ(expected_error_callback_calls_, actual_error_callback_calls_); |
| 58 EXPECT_FALSE(unexpected_success_callback_); | 58 EXPECT_FALSE(unexpected_success_callback_); |
| 59 EXPECT_FALSE(unexpected_error_callback_); | 59 EXPECT_FALSE(unexpected_error_callback_); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 gatt_write_characteristic_attempts_ = 0; | 374 gatt_write_characteristic_attempts_ = 0; |
| 375 gatt_read_descriptor_attempts_ = 0; | 375 gatt_read_descriptor_attempts_ = 0; |
| 376 gatt_write_descriptor_attempts_ = 0; | 376 gatt_write_descriptor_attempts_ = 0; |
| 377 } | 377 } |
| 378 | 378 |
| 379 void BluetoothTestBase::RemoveTimedOutDevices() { | 379 void BluetoothTestBase::RemoveTimedOutDevices() { |
| 380 adapter_->RemoveTimedOutDevices(); | 380 adapter_->RemoveTimedOutDevices(); |
| 381 } | 381 } |
| 382 | 382 |
| 383 } // namespace device | 383 } // namespace device |
| OLD | NEW |