Chromium Code Reviews| 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" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "device/bluetooth/bluetooth_adapter.h" | 13 #include "device/bluetooth/bluetooth_adapter.h" |
| 14 #include "device/bluetooth/bluetooth_common.h" | 14 #include "device/bluetooth/bluetooth_common.h" |
| 15 | 15 |
| 16 namespace device { | 16 namespace device { |
| 17 | 17 |
| 18 const std::string BluetoothTestBase::kTestAdapterName = "FakeBluetoothAdapter"; | 18 const std::string BluetoothTestBase::kTestAdapterName = "FakeBluetoothAdapter"; |
| 19 const std::string BluetoothTestBase::kTestAdapterAddress = "A1:B2:C3:D4:E5:F6"; | 19 const std::string BluetoothTestBase::kTestAdapterAddress = "A1:B2:C3:D4:E5:F6"; |
| 20 | 20 |
| 21 const std::string BluetoothTestBase::kTestDeviceName = "FakeBluetoothDevice"; | 21 const std::string BluetoothTestBase::kTestDeviceName = "FakeBluetoothDevice"; |
| 22 const std::string BluetoothTestBase::kTestDeviceNameEmpty = ""; | 22 const std::string BluetoothTestBase::kTestDeviceNameEmpty = ""; |
| 23 | 23 |
| 24 const std::string BluetoothTestBase::kTestDeviceAddress1 = "01:00:00:90:1E:BE"; | 24 const std::string BluetoothTestBase::kTestDeviceAddress1 = "01:00:00:90:1E:BE"; |
| 25 const std::string BluetoothTestBase::kTestDeviceAddress2 = "02:00:00:8B:74:63"; | 25 const std::string BluetoothTestBase::kTestDeviceAddress2 = "02:00:00:8B:74:63"; |
| 26 const std::string BluetoothTestBase::kTestDeviceAddress3 = "03:00:00:17:C0:57"; | 26 const std::string BluetoothTestBase::kTestDeviceAddress3 = "03:00:00:17:C0:57"; |
| 27 | 27 |
| 28 const std::string BluetoothTestBase::kTestUUIDGenericAccess = | 28 const std::string BluetoothTestBase::kTestUUIDGenericAccess = |
|
ortuno
2017/04/06 00:56:20
nit: Add the following on top of the relevant UUID
juncai
2017/04/07 18:50:19
Done.
| |
| 29 "00001800-0000-1000-8000-00805f9b34fb"; | 29 "00001800-0000-1000-8000-00805f9b34fb"; |
| 30 const std::string BluetoothTestBase::kTestUUIDGenericAttribute = | 30 const std::string BluetoothTestBase::kTestUUIDGenericAttribute = |
| 31 "00001801-0000-1000-8000-00805f9b34fb"; | 31 "00001801-0000-1000-8000-00805f9b34fb"; |
| 32 const std::string BluetoothTestBase::kTestUUIDImmediateAlert = | 32 const std::string BluetoothTestBase::kTestUUIDImmediateAlert = |
| 33 "00001802-0000-1000-8000-00805f9b34fb"; | 33 "00001802-0000-1000-8000-00805f9b34fb"; |
| 34 const std::string BluetoothTestBase::kTestUUIDLinkLoss = | 34 const std::string BluetoothTestBase::kTestUUIDLinkLoss = |
| 35 "00001803-0000-1000-8000-00805f9b34fb"; | 35 "00001803-0000-1000-8000-00805f9b34fb"; |
| 36 const std::string BluetoothTestBase::kTestUUIDHeartRate = | 36 const std::string BluetoothTestBase::kTestUUIDHeartRate = |
| 37 "0000180d-0000-1000-8000-00805f9b34fb"; | 37 "0000180d-0000-1000-8000-00805f9b34fb"; |
| 38 const std::string BluetoothTestBase::kTestUUIDDeviceName = | |
| 39 "00002a00-0000-1000-8000-00805f9b34fb"; | |
| 40 const std::string BluetoothTestBase::kTestUUIDAppearance = | |
| 41 "00002a01-0000-1000-8000-00805f9b34fb"; | |
| 42 const std::string BluetoothTestBase::kTestUUIDReconnectionAddress = | |
| 43 "00002a03-0000-1000-8000-00805f9b34fb"; | |
| 44 const std::string BluetoothTestBase::kTestUUIDHeartRateMeasurement = | |
| 45 "00002a37-0000-1000-8000-00805f9b34fb"; | |
| 46 const std::string BluetoothTestBase::kTestUUIDCharacteristicUserDescription = | |
| 47 "00002901-0000-1000-8000-00805f9b34fb"; | |
| 48 const std::string | |
| 49 BluetoothTestBase::kTestUUIDClientCharacteristicConfiguration = | |
| 50 "00002902-0000-1000-8000-00805f9b34fb"; | |
| 51 const std::string | |
| 52 BluetoothTestBase::kTestUUIDServerCharacteristicConfiguration = | |
| 53 "00002903-0000-1000-8000-00805f9b34fb"; | |
| 54 const std::string BluetoothTestBase::kTestUUIDCharacteristicPresentationFormat = | |
| 55 "00002904-0000-1000-8000-00805f9b34fb"; | |
| 38 | 56 |
| 39 BluetoothTestBase::BluetoothTestBase() : weak_factory_(this) {} | 57 BluetoothTestBase::BluetoothTestBase() : weak_factory_(this) {} |
| 40 | 58 |
| 41 BluetoothTestBase::~BluetoothTestBase() { | 59 BluetoothTestBase::~BluetoothTestBase() { |
| 42 } | 60 } |
| 43 | 61 |
| 44 void BluetoothTestBase::StartLowEnergyDiscoverySession() { | 62 void BluetoothTestBase::StartLowEnergyDiscoverySession() { |
| 45 adapter_->StartDiscoverySessionWithFilter( | 63 adapter_->StartDiscoverySessionWithFilter( |
| 46 base::MakeUnique<BluetoothDiscoveryFilter>(BLUETOOTH_TRANSPORT_LE), | 64 base::MakeUnique<BluetoothDiscoveryFilter>(BLUETOOTH_TRANSPORT_LE), |
| 47 GetDiscoverySessionCallback(Call::EXPECTED), | 65 GetDiscoverySessionCallback(Call::EXPECTED), |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 403 gatt_write_characteristic_attempts_ = 0; | 421 gatt_write_characteristic_attempts_ = 0; |
| 404 gatt_read_descriptor_attempts_ = 0; | 422 gatt_read_descriptor_attempts_ = 0; |
| 405 gatt_write_descriptor_attempts_ = 0; | 423 gatt_write_descriptor_attempts_ = 0; |
| 406 } | 424 } |
| 407 | 425 |
| 408 void BluetoothTestBase::RemoveTimedOutDevices() { | 426 void BluetoothTestBase::RemoveTimedOutDevices() { |
| 409 adapter_->RemoveTimedOutDevices(); | 427 adapter_->RemoveTimedOutDevices(); |
| 410 } | 428 } |
| 411 | 429 |
| 412 } // namespace device | 430 } // namespace device |
| OLD | NEW |