| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 #include <utility> |
| 7 | 8 |
| 8 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 9 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 11 #include "dbus/object_path.h" | 12 #include "dbus/object_path.h" |
| 12 #include "device/bluetooth/bluetooth_adapter.h" | 13 #include "device/bluetooth/bluetooth_adapter.h" |
| 13 #include "device/bluetooth/bluetooth_adapter_factory.h" | 14 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 14 #include "device/bluetooth/bluetooth_device.h" | 15 #include "device/bluetooth/bluetooth_device.h" |
| 15 #include "device/bluetooth/bluetooth_gatt_characteristic.h" | 16 #include "device/bluetooth/bluetooth_gatt_characteristic.h" |
| 16 #include "device/bluetooth/bluetooth_gatt_connection.h" | 17 #include "device/bluetooth/bluetooth_gatt_connection.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 132 |
| 132 void SuccessCallback() { ++success_callback_count_; } | 133 void SuccessCallback() { ++success_callback_count_; } |
| 133 | 134 |
| 134 void ValueCallback(const std::vector<uint8_t>& value) { | 135 void ValueCallback(const std::vector<uint8_t>& value) { |
| 135 ++success_callback_count_; | 136 ++success_callback_count_; |
| 136 last_read_value_ = value; | 137 last_read_value_ = value; |
| 137 } | 138 } |
| 138 | 139 |
| 139 void GattConnectionCallback(scoped_ptr<BluetoothGattConnection> conn) { | 140 void GattConnectionCallback(scoped_ptr<BluetoothGattConnection> conn) { |
| 140 ++success_callback_count_; | 141 ++success_callback_count_; |
| 141 gatt_conn_ = conn.Pass(); | 142 gatt_conn_ = std::move(conn); |
| 142 } | 143 } |
| 143 | 144 |
| 144 void NotifySessionCallback(scoped_ptr<BluetoothGattNotifySession> session) { | 145 void NotifySessionCallback(scoped_ptr<BluetoothGattNotifySession> session) { |
| 145 ++success_callback_count_; | 146 ++success_callback_count_; |
| 146 update_sessions_.push_back(session.release()); | 147 update_sessions_.push_back(session.release()); |
| 147 QuitMessageLoop(); | 148 QuitMessageLoop(); |
| 148 } | 149 } |
| 149 | 150 |
| 150 void ServiceErrorCallback(BluetoothGattService::GattErrorCode err) { | 151 void ServiceErrorCallback(BluetoothGattService::GattErrorCode err) { |
| 151 ++error_callback_count_; | 152 ++error_callback_count_; |
| (...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 | 1252 |
| 1252 EXPECT_EQ(1, success_callback_count_); | 1253 EXPECT_EQ(1, success_callback_count_); |
| 1253 EXPECT_EQ(0, error_callback_count_); | 1254 EXPECT_EQ(0, error_callback_count_); |
| 1254 EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count()); | 1255 EXPECT_EQ(1, observer.gatt_characteristic_value_changed_count()); |
| 1255 EXPECT_TRUE(characteristic->IsNotifying()); | 1256 EXPECT_TRUE(characteristic->IsNotifying()); |
| 1256 EXPECT_EQ(1U, update_sessions_.size()); | 1257 EXPECT_EQ(1U, update_sessions_.size()); |
| 1257 EXPECT_TRUE(update_sessions_[0]->IsActive()); | 1258 EXPECT_TRUE(update_sessions_[0]->IsActive()); |
| 1258 } | 1259 } |
| 1259 | 1260 |
| 1260 } // namespace bluez | 1261 } // namespace bluez |
| OLD | NEW |