Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: device/bluetooth/test/bluetooth_test.h

Issue 1394973003: bluetooth: android: Create BluetoothRemoteGattServiceAndroid objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt-renames-
Patch Set: Address ortuno Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.
88 // TODO(scheib): Add more control over how many services are created and
89 // their properties. http://crbug.com/541400
90 virtual void SimulateGattServicesDiscovered(BluetoothDevice* device) {}
91
92 // Simulates failure to discover services.
93 virtual void SimulateGattServicesDiscoveryError(BluetoothDevice* device) {}
94
87 // Remove the device from the adapter and delete it. 95 // Remove the device from the adapter and delete it.
88 virtual void DeleteDevice(BluetoothDevice* device); 96 virtual void DeleteDevice(BluetoothDevice* device);
89 97
90 // Callbacks that increment |callback_count_|, |error_callback_count_|: 98 // Callbacks that increment |callback_count_|, |error_callback_count_|:
91 void Callback(); 99 void Callback();
92 void DiscoverySessionCallback(scoped_ptr<BluetoothDiscoverySession>); 100 void DiscoverySessionCallback(scoped_ptr<BluetoothDiscoverySession>);
93 void GattConnectionCallback(scoped_ptr<BluetoothGattConnection>); 101 void GattConnectionCallback(scoped_ptr<BluetoothGattConnection>);
94 void ErrorCallback(); 102 void ErrorCallback();
95 void ConnectErrorCallback(enum BluetoothDevice::ConnectErrorCode); 103 void ConnectErrorCallback(enum BluetoothDevice::ConnectErrorCode);
96 104
(...skipping 13 matching lines...) Expand all
110 118
111 scoped_refptr<BluetoothAdapter> adapter_; 119 scoped_refptr<BluetoothAdapter> adapter_;
112 ScopedVector<BluetoothDiscoverySession> discovery_sessions_; 120 ScopedVector<BluetoothDiscoverySession> discovery_sessions_;
113 ScopedVector<BluetoothGattConnection> gatt_connections_; 121 ScopedVector<BluetoothGattConnection> gatt_connections_;
114 enum BluetoothDevice::ConnectErrorCode last_connect_error_code_ = 122 enum BluetoothDevice::ConnectErrorCode last_connect_error_code_ =
115 BluetoothDevice::ERROR_UNKNOWN; 123 BluetoothDevice::ERROR_UNKNOWN;
116 int callback_count_ = 0; 124 int callback_count_ = 0;
117 int error_callback_count_ = 0; 125 int error_callback_count_ = 0;
118 int gatt_connection_attempts_ = 0; 126 int gatt_connection_attempts_ = 0;
119 int gatt_disconnection_attempts_ = 0; 127 int gatt_disconnection_attempts_ = 0;
128 int gatt_discovery_attempts_ = 0;
120 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; 129 base::WeakPtrFactory<BluetoothTestBase> weak_factory_;
121 }; 130 };
122 131
123 } // namespace device 132 } // namespace device
124 133
125 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ 134 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698