| 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 "components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.
h" | 5 #include "components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.
h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/test/test_simple_task_runner.h" | 16 #include "base/test/test_simple_task_runner.h" |
| 17 #include "components/cryptauth/bluetooth_throttler.h" | 17 #include "components/cryptauth/bluetooth_throttler.h" |
| 18 #include "components/cryptauth/connection_finder.h" | 18 #include "components/cryptauth/connection_finder.h" |
| 19 #include "components/cryptauth/connection_observer.h" | 19 #include "components/cryptauth/connection_observer.h" |
| 20 #include "components/cryptauth/cryptauth_test_util.h" | 20 #include "components/cryptauth/cryptauth_test_util.h" |
| 21 #include "components/cryptauth/remote_device.h" | 21 #include "components/cryptauth/remote_device.h" |
| 22 #include "components/cryptauth/wire_message.h" | 22 #include "components/cryptauth/wire_message.h" |
| 23 #include "components/proximity_auth/logging/logging.h" |
| 23 #include "device/bluetooth/bluetooth_adapter_factory.h" | 24 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 24 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 25 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
| 25 #include "device/bluetooth/test/mock_bluetooth_device.h" | 26 #include "device/bluetooth/test/mock_bluetooth_device.h" |
| 26 #include "device/bluetooth/test/mock_bluetooth_discovery_session.h" | 27 #include "device/bluetooth/test/mock_bluetooth_discovery_session.h" |
| 27 #include "device/bluetooth/test/mock_bluetooth_gatt_characteristic.h" | 28 #include "device/bluetooth/test/mock_bluetooth_gatt_characteristic.h" |
| 28 #include "device/bluetooth/test/mock_bluetooth_gatt_connection.h" | 29 #include "device/bluetooth/test/mock_bluetooth_gatt_connection.h" |
| 29 #include "device/bluetooth/test/mock_bluetooth_gatt_notify_session.h" | 30 #include "device/bluetooth/test/mock_bluetooth_gatt_notify_session.h" |
| 30 #include "testing/gmock/include/gmock/gmock.h" | 31 #include "testing/gmock/include/gmock/gmock.h" |
| 31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 32 | 33 |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 characteristics_finder_error_callback_; | 632 characteristics_finder_error_callback_; |
| 632 | 633 |
| 633 device::BluetoothRemoteGattCharacteristic::NotifySessionCallback | 634 device::BluetoothRemoteGattCharacteristic::NotifySessionCallback |
| 634 notify_session_success_callback_; | 635 notify_session_success_callback_; |
| 635 device::BluetoothRemoteGattCharacteristic::ErrorCallback | 636 device::BluetoothRemoteGattCharacteristic::ErrorCallback |
| 636 notify_session_error_callback_; | 637 notify_session_error_callback_; |
| 637 | 638 |
| 638 base::Closure write_remote_characteristic_success_callback_; | 639 base::Closure write_remote_characteristic_success_callback_; |
| 639 device::BluetoothRemoteGattCharacteristic::ErrorCallback | 640 device::BluetoothRemoteGattCharacteristic::ErrorCallback |
| 640 write_remote_characteristic_error_callback_; | 641 write_remote_characteristic_error_callback_; |
| 642 |
| 643 proximity_auth::ScopedDisableLoggingForTesting disable_logging_; |
| 641 }; | 644 }; |
| 642 | 645 |
| 643 TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, | 646 TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, |
| 644 CreateAndDestroyWithoutConnectCallDoesntCrash) { | 647 CreateAndDestroyWithoutConnectCallDoesntCrash) { |
| 645 BluetoothLowEnergyWeaveClientConnection connection( | 648 BluetoothLowEnergyWeaveClientConnection connection( |
| 646 remote_device_, kTestRemoteDeviceBluetoothAddress, adapter_, | 649 remote_device_, kTestRemoteDeviceBluetoothAddress, adapter_, |
| 647 service_uuid_, bluetooth_throttler_.get()); | 650 service_uuid_, bluetooth_throttler_.get()); |
| 648 } | 651 } |
| 649 | 652 |
| 650 TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, | 653 TEST_F(CryptAuthBluetoothLowEnergyWeaveClientConnectionTest, |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 adapter_, kTestRemoteDeviceBluetoothAddress)); | 1096 adapter_, kTestRemoteDeviceBluetoothAddress)); |
| 1094 | 1097 |
| 1095 CharacteristicsFound(connection.get()); | 1098 CharacteristicsFound(connection.get()); |
| 1096 NotifySessionStarted(connection.get()); | 1099 NotifySessionStarted(connection.get()); |
| 1097 ConnectionResponseReceived(connection.get(), kDefaultMaxPacketSize); | 1100 ConnectionResponseReceived(connection.get(), kDefaultMaxPacketSize); |
| 1098 } | 1101 } |
| 1099 | 1102 |
| 1100 } // namespace weave | 1103 } // namespace weave |
| 1101 | 1104 |
| 1102 } // namespace cryptauth | 1105 } // namespace cryptauth |
| OLD | NEW |