| 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 10 matching lines...) Expand all Loading... |
| 21 const std::string BluetoothTestBase::kTestDeviceNameEmpty = ""; | 21 const std::string BluetoothTestBase::kTestDeviceNameEmpty = ""; |
| 22 | 22 |
| 23 const std::string BluetoothTestBase::kTestDeviceAddress1 = "01:00:00:90:1E:BE"; | 23 const std::string BluetoothTestBase::kTestDeviceAddress1 = "01:00:00:90:1E:BE"; |
| 24 const std::string BluetoothTestBase::kTestDeviceAddress2 = "02:00:00:8B:74:63"; | 24 const std::string BluetoothTestBase::kTestDeviceAddress2 = "02:00:00:8B:74:63"; |
| 25 | 25 |
| 26 const std::string BluetoothTestBase::kTestUUIDGenericAccess = "1800"; | 26 const std::string BluetoothTestBase::kTestUUIDGenericAccess = "1800"; |
| 27 const std::string BluetoothTestBase::kTestUUIDGenericAttribute = "1801"; | 27 const std::string BluetoothTestBase::kTestUUIDGenericAttribute = "1801"; |
| 28 const std::string BluetoothTestBase::kTestUUIDImmediateAlert = "1802"; | 28 const std::string BluetoothTestBase::kTestUUIDImmediateAlert = "1802"; |
| 29 const std::string BluetoothTestBase::kTestUUIDLinkLoss = "1803"; | 29 const std::string BluetoothTestBase::kTestUUIDLinkLoss = "1803"; |
| 30 | 30 |
| 31 BluetoothTestBase::NotificationType::NotificationType() : indicate(false) {} |
| 32 |
| 33 BluetoothTestBase::NotificationType::NotificationType( |
| 34 std::string device_path, |
| 35 std::vector<uint8_t> value, |
| 36 bool indicate) |
| 37 : device_path(device_path), value(value), indicate(indicate) {} |
| 38 |
| 39 BluetoothTestBase::NotificationType::NotificationType( |
| 40 const NotificationType& obj) { |
| 41 this->device_path = obj.device_path; |
| 42 this->value = obj.value; |
| 43 this->indicate = obj.indicate; |
| 44 } |
| 45 |
| 46 BluetoothTestBase::NotificationType::~NotificationType() {} |
| 47 |
| 31 BluetoothTestBase::BluetoothTestBase() : weak_factory_(this) {} | 48 BluetoothTestBase::BluetoothTestBase() : weak_factory_(this) {} |
| 32 | 49 |
| 33 BluetoothTestBase::~BluetoothTestBase() { | 50 BluetoothTestBase::~BluetoothTestBase() { |
| 34 } | 51 } |
| 35 | 52 |
| 36 void BluetoothTestBase::StartLowEnergyDiscoverySession() { | 53 void BluetoothTestBase::StartLowEnergyDiscoverySession() { |
| 37 adapter_->StartDiscoverySessionWithFilter( | 54 adapter_->StartDiscoverySessionWithFilter( |
| 38 base::WrapUnique(new BluetoothDiscoveryFilter( | 55 base::WrapUnique(new BluetoothDiscoveryFilter( |
| 39 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE)), | 56 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE)), |
| 40 GetDiscoverySessionCallback(Call::EXPECTED), | 57 GetDiscoverySessionCallback(Call::EXPECTED), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 68 return nullptr; | 85 return nullptr; |
| 69 } | 86 } |
| 70 | 87 |
| 71 bool BluetoothTestBase::SimulateLocalGattCharacteristicNotificationsRequest( | 88 bool BluetoothTestBase::SimulateLocalGattCharacteristicNotificationsRequest( |
| 72 BluetoothLocalGattCharacteristic* characteristic, | 89 BluetoothLocalGattCharacteristic* characteristic, |
| 73 bool start) { | 90 bool start) { |
| 74 NOTIMPLEMENTED(); | 91 NOTIMPLEMENTED(); |
| 75 return false; | 92 return false; |
| 76 } | 93 } |
| 77 | 94 |
| 78 std::vector<uint8_t> BluetoothTestBase::LastNotifactionValueForCharacteristic( | 95 BluetoothTestBase::NotificationType |
| 96 BluetoothTestBase::LastNotifactionValueForCharacteristic( |
| 79 BluetoothLocalGattCharacteristic* characteristic) { | 97 BluetoothLocalGattCharacteristic* characteristic) { |
| 80 NOTIMPLEMENTED(); | 98 NOTIMPLEMENTED(); |
| 81 return std::vector<uint8_t>(); | 99 return NotificationType(); |
| 82 } | 100 } |
| 83 | 101 |
| 84 std::vector<BluetoothLocalGattService*> | 102 std::vector<BluetoothLocalGattService*> |
| 85 BluetoothTestBase::RegisteredGattServices() { | 103 BluetoothTestBase::RegisteredGattServices() { |
| 86 NOTIMPLEMENTED(); | 104 NOTIMPLEMENTED(); |
| 87 return std::vector<BluetoothLocalGattService*>(); | 105 return std::vector<BluetoothLocalGattService*>(); |
| 88 } | 106 } |
| 89 | 107 |
| 90 void BluetoothTestBase::DeleteDevice(BluetoothDevice* device) { | 108 void BluetoothTestBase::DeleteDevice(BluetoothDevice* device) { |
| 91 adapter_->DeleteDeviceForTesting(device->GetAddress()); | 109 adapter_->DeleteDeviceForTesting(device->GetAddress()); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 gatt_disconnection_attempts_ = 0; | 333 gatt_disconnection_attempts_ = 0; |
| 316 gatt_discovery_attempts_ = 0; | 334 gatt_discovery_attempts_ = 0; |
| 317 gatt_notify_characteristic_attempts_ = 0; | 335 gatt_notify_characteristic_attempts_ = 0; |
| 318 gatt_read_characteristic_attempts_ = 0; | 336 gatt_read_characteristic_attempts_ = 0; |
| 319 gatt_write_characteristic_attempts_ = 0; | 337 gatt_write_characteristic_attempts_ = 0; |
| 320 gatt_read_descriptor_attempts_ = 0; | 338 gatt_read_descriptor_attempts_ = 0; |
| 321 gatt_write_descriptor_attempts_ = 0; | 339 gatt_write_descriptor_attempts_ = 0; |
| 322 } | 340 } |
| 323 | 341 |
| 324 } // namespace device | 342 } // namespace device |
| OLD | NEW |