| 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 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
| 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // Simulates success of discovering services. |uuids| is used to create a | 87 // Simulates success of discovering services. |uuids| is used to create a |
| 88 // service for each UUID string. Multiple UUIDs with the same value produce | 88 // service for each UUID string. Multiple UUIDs with the same value produce |
| 89 // multiple service instances. | 89 // multiple service instances. |
| 90 virtual void SimulateGattServicesDiscovered( | 90 virtual void SimulateGattServicesDiscovered( |
| 91 BluetoothDevice* device, | 91 BluetoothDevice* device, |
| 92 const std::vector<std::string>& uuids) {} | 92 const std::vector<std::string>& uuids) {} |
| 93 | 93 |
| 94 // Simulates failure to discover services. | 94 // Simulates failure to discover services. |
| 95 virtual void SimulateGattServicesDiscoveryError(BluetoothDevice* device) {} | 95 virtual void SimulateGattServicesDiscoveryError(BluetoothDevice* device) {} |
| 96 | 96 |
| 97 // Simulates a Characteristic on a service. |
| 97 virtual void SimulateGattCharacteristic(BluetoothGattService* service, | 98 virtual void SimulateGattCharacteristic(BluetoothGattService* service, |
| 98 const std::string& uuid){}; | 99 const std::string& uuid, |
| 100 int properties) {} |
| 99 | 101 |
| 100 // Remove the device from the adapter and delete it. | 102 // Remove the device from the adapter and delete it. |
| 101 virtual void DeleteDevice(BluetoothDevice* device); | 103 virtual void DeleteDevice(BluetoothDevice* device); |
| 102 | 104 |
| 103 // Callbacks that increment |callback_count_|, |error_callback_count_|: | 105 // Callbacks that increment |callback_count_|, |error_callback_count_|: |
| 104 void Callback(); | 106 void Callback(); |
| 105 void DiscoverySessionCallback(scoped_ptr<BluetoothDiscoverySession>); | 107 void DiscoverySessionCallback(scoped_ptr<BluetoothDiscoverySession>); |
| 106 void GattConnectionCallback(scoped_ptr<BluetoothGattConnection>); | 108 void GattConnectionCallback(scoped_ptr<BluetoothGattConnection>); |
| 107 void ErrorCallback(); | 109 void ErrorCallback(); |
| 108 void ConnectErrorCallback(enum BluetoothDevice::ConnectErrorCode); | 110 void ConnectErrorCallback(enum BluetoothDevice::ConnectErrorCode); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 130 int error_callback_count_ = 0; | 132 int error_callback_count_ = 0; |
| 131 int gatt_connection_attempts_ = 0; | 133 int gatt_connection_attempts_ = 0; |
| 132 int gatt_disconnection_attempts_ = 0; | 134 int gatt_disconnection_attempts_ = 0; |
| 133 int gatt_discovery_attempts_ = 0; | 135 int gatt_discovery_attempts_ = 0; |
| 134 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; | 136 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; |
| 135 }; | 137 }; |
| 136 | 138 |
| 137 } // namespace device | 139 } // namespace device |
| 138 | 140 |
| 139 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 141 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
| OLD | NEW |