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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Simulates success of implementation details of CreateGattConnection. | 77 // Simulates success of implementation details of CreateGattConnection. |
78 virtual void SimulateGattConnection(BluetoothDevice* device) {} | 78 virtual void SimulateGattConnection(BluetoothDevice* device) {} |
79 | 79 |
80 // Simulates failure of CreateGattConnection with the given error code. | 80 // Simulates failure of CreateGattConnection with the given error code. |
81 virtual void SimulateGattConnectionError(BluetoothDevice* device, | 81 virtual void SimulateGattConnectionError(BluetoothDevice* device, |
82 BluetoothDevice::ConnectErrorCode) {} | 82 BluetoothDevice::ConnectErrorCode) {} |
83 | 83 |
84 // Simulates GattConnection disconnecting. | 84 // Simulates GattConnection disconnecting. |
85 virtual void SimulateGattDisconnection(BluetoothDevice* device) {} | 85 virtual void SimulateGattDisconnection(BluetoothDevice* device) {} |
86 | 86 |
87 // Simulates success of discovering services. Two services are created. | 87 // Simulates success of discovering services. |uuids| is used to create a |
88 // TODO(scheib): Add more control over how many services are created and | 88 // service for each UUID string. Multiple UUIDs with the same value produce |
89 // their properties. http://crbug.com/541400 | 89 // multiple service instances. |
90 virtual void SimulateGattServicesDiscovered(BluetoothDevice* device) {} | 90 virtual void SimulateGattServicesDiscovered(BluetoothDevice* device, |
| 91 std::vector<std::string> uuids) {} |
91 | 92 |
92 // Simulates failure to discover services. | 93 // Simulates failure to discover services. |
93 virtual void SimulateGattServicesDiscoveryError(BluetoothDevice* device) {} | 94 virtual void SimulateGattServicesDiscoveryError(BluetoothDevice* device) {} |
94 | 95 |
95 // Remove the device from the adapter and delete it. | 96 // Remove the device from the adapter and delete it. |
96 virtual void DeleteDevice(BluetoothDevice* device); | 97 virtual void DeleteDevice(BluetoothDevice* device); |
97 | 98 |
98 // Callbacks that increment |callback_count_|, |error_callback_count_|: | 99 // Callbacks that increment |callback_count_|, |error_callback_count_|: |
99 void Callback(); | 100 void Callback(); |
100 void DiscoverySessionCallback(scoped_ptr<BluetoothDiscoverySession>); | 101 void DiscoverySessionCallback(scoped_ptr<BluetoothDiscoverySession>); |
(...skipping 24 matching lines...) Expand all Loading... |
125 int error_callback_count_ = 0; | 126 int error_callback_count_ = 0; |
126 int gatt_connection_attempts_ = 0; | 127 int gatt_connection_attempts_ = 0; |
127 int gatt_disconnection_attempts_ = 0; | 128 int gatt_disconnection_attempts_ = 0; |
128 int gatt_discovery_attempts_ = 0; | 129 int gatt_discovery_attempts_ = 0; |
129 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; | 130 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; |
130 }; | 131 }; |
131 | 132 |
132 } // namespace device | 133 } // namespace device |
133 | 134 |
134 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 135 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
OLD | NEW |