| 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> |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 tx_characteristic_uuid_(device::BluetoothUUID(kTXCharacteristicUUID)), | 362 tx_characteristic_uuid_(device::BluetoothUUID(kTXCharacteristicUUID)), |
| 363 rx_characteristic_uuid_(device::BluetoothUUID(kRXCharacteristicUUID)), | 363 rx_characteristic_uuid_(device::BluetoothUUID(kRXCharacteristicUUID)), |
| 364 notify_session_alias_(NULL), | 364 notify_session_alias_(NULL), |
| 365 bluetooth_throttler_(new NiceMock<MockBluetoothThrottler>), | 365 bluetooth_throttler_(new NiceMock<MockBluetoothThrottler>), |
| 366 task_runner_(new base::TestSimpleTaskRunner), | 366 task_runner_(new base::TestSimpleTaskRunner), |
| 367 generator_factory_( | 367 generator_factory_( |
| 368 new MockBluetoothLowEnergyWeavePacketGeneratorFactory()), | 368 new MockBluetoothLowEnergyWeavePacketGeneratorFactory()), |
| 369 receiver_factory_( | 369 receiver_factory_( |
| 370 new MockBluetoothLowEnergyWeavePacketReceiverFactory()) { | 370 new MockBluetoothLowEnergyWeavePacketReceiverFactory()) { |
| 371 BluetoothLowEnergyWeavePacketGenerator::Factory::SetInstanceForTesting( | 371 BluetoothLowEnergyWeavePacketGenerator::Factory::SetInstanceForTesting( |
| 372 generator_factory_); | 372 generator_factory_.get()); |
| 373 BluetoothLowEnergyWeavePacketReceiver::Factory::SetInstanceForTesting( | 373 BluetoothLowEnergyWeavePacketReceiver::Factory::SetInstanceForTesting( |
| 374 receiver_factory_); | 374 receiver_factory_.get()); |
| 375 } | 375 } |
| 376 | 376 |
| 377 ~CryptAuthBluetoothLowEnergyWeaveClientConnectionTest() override { | 377 ~CryptAuthBluetoothLowEnergyWeaveClientConnectionTest() override { |
| 378 BluetoothLowEnergyWeavePacketGenerator::Factory::SetInstanceForTesting( | 378 BluetoothLowEnergyWeavePacketGenerator::Factory::SetInstanceForTesting( |
| 379 nullptr); | 379 nullptr); |
| 380 BluetoothLowEnergyWeavePacketReceiver::Factory::SetInstanceForTesting( | 380 BluetoothLowEnergyWeavePacketReceiver::Factory::SetInstanceForTesting( |
| 381 nullptr); | 381 nullptr); |
| 382 } | 382 } |
| 383 | 383 |
| 384 void SetUp() override { | 384 void SetUp() override { |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 std::unique_ptr<device::MockBluetoothDevice> mock_bluetooth_device_; | 607 std::unique_ptr<device::MockBluetoothDevice> mock_bluetooth_device_; |
| 608 std::unique_ptr<device::MockBluetoothGattService> service_; | 608 std::unique_ptr<device::MockBluetoothGattService> service_; |
| 609 std::unique_ptr<device::MockBluetoothGattCharacteristic> tx_characteristic_; | 609 std::unique_ptr<device::MockBluetoothGattCharacteristic> tx_characteristic_; |
| 610 std::unique_ptr<device::MockBluetoothGattCharacteristic> rx_characteristic_; | 610 std::unique_ptr<device::MockBluetoothGattCharacteristic> rx_characteristic_; |
| 611 std::vector<uint8_t> last_value_written_on_tx_characteristic_; | 611 std::vector<uint8_t> last_value_written_on_tx_characteristic_; |
| 612 device::MockBluetoothGattNotifySession* notify_session_alias_; | 612 device::MockBluetoothGattNotifySession* notify_session_alias_; |
| 613 std::unique_ptr<MockBluetoothThrottler> bluetooth_throttler_; | 613 std::unique_ptr<MockBluetoothThrottler> bluetooth_throttler_; |
| 614 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; | 614 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; |
| 615 base::MessageLoop message_loop_; | 615 base::MessageLoop message_loop_; |
| 616 bool last_wire_message_success_; | 616 bool last_wire_message_success_; |
| 617 std::shared_ptr<MockBluetoothLowEnergyWeavePacketGeneratorFactory> | 617 std::unique_ptr<MockBluetoothLowEnergyWeavePacketGeneratorFactory> |
| 618 generator_factory_; | 618 generator_factory_; |
| 619 std::shared_ptr<MockBluetoothLowEnergyWeavePacketReceiverFactory> | 619 std::unique_ptr<MockBluetoothLowEnergyWeavePacketReceiverFactory> |
| 620 receiver_factory_; | 620 receiver_factory_; |
| 621 MockConnectionObserver connection_observer_; | 621 MockConnectionObserver connection_observer_; |
| 622 | 622 |
| 623 // Callbacks | 623 // Callbacks |
| 624 device::BluetoothDevice::GattConnectionCallback | 624 device::BluetoothDevice::GattConnectionCallback |
| 625 create_gatt_connection_success_callback_; | 625 create_gatt_connection_success_callback_; |
| 626 device::BluetoothDevice::ConnectErrorCallback | 626 device::BluetoothDevice::ConnectErrorCallback |
| 627 create_gatt_connection_error_callback_; | 627 create_gatt_connection_error_callback_; |
| 628 | 628 |
| 629 BluetoothLowEnergyCharacteristicsFinder::SuccessCallback | 629 BluetoothLowEnergyCharacteristicsFinder::SuccessCallback |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 adapter_, kTestRemoteDeviceBluetoothAddress)); | 1096 adapter_, kTestRemoteDeviceBluetoothAddress)); |
| 1097 | 1097 |
| 1098 CharacteristicsFound(connection.get()); | 1098 CharacteristicsFound(connection.get()); |
| 1099 NotifySessionStarted(connection.get()); | 1099 NotifySessionStarted(connection.get()); |
| 1100 ConnectionResponseReceived(connection.get(), kDefaultMaxPacketSize); | 1100 ConnectionResponseReceived(connection.get(), kDefaultMaxPacketSize); |
| 1101 } | 1101 } |
| 1102 | 1102 |
| 1103 } // namespace weave | 1103 } // namespace weave |
| 1104 | 1104 |
| 1105 } // namespace cryptauth | 1105 } // namespace cryptauth |
| OLD | NEW |