| 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/test_bluetooth_adapter_observer.h" | 5 #include "device/bluetooth/test/test_bluetooth_adapter_observer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 gatt_characteristic_removed_count_ = 0; | 53 gatt_characteristic_removed_count_ = 0; |
| 54 gatt_characteristic_value_changed_count_ = 0; | 54 gatt_characteristic_value_changed_count_ = 0; |
| 55 gatt_descriptor_added_count_ = 0; | 55 gatt_descriptor_added_count_ = 0; |
| 56 gatt_descriptor_removed_count_ = 0; | 56 gatt_descriptor_removed_count_ = 0; |
| 57 gatt_descriptor_value_changed_count_ = 0; | 57 gatt_descriptor_value_changed_count_ = 0; |
| 58 last_gatt_service_id_.clear(); | 58 last_gatt_service_id_.clear(); |
| 59 last_gatt_service_uuid_ = BluetoothUUID(); | 59 last_gatt_service_uuid_ = BluetoothUUID(); |
| 60 last_gatt_characteristic_id_.clear(); | 60 last_gatt_characteristic_id_.clear(); |
| 61 last_gatt_characteristic_uuid_ = BluetoothUUID(); | 61 last_gatt_characteristic_uuid_ = BluetoothUUID(); |
| 62 last_changed_characteristic_value_.clear(); | 62 last_changed_characteristic_value_.clear(); |
| 63 previous_characteristic_value_changed_values_.clear(); |
| 63 last_gatt_descriptor_id_.clear(); | 64 last_gatt_descriptor_id_.clear(); |
| 64 last_gatt_descriptor_uuid_ = BluetoothUUID(); | 65 last_gatt_descriptor_uuid_ = BluetoothUUID(); |
| 65 last_changed_descriptor_value_.clear(); | 66 last_changed_descriptor_value_.clear(); |
| 66 } | 67 } |
| 67 | 68 |
| 68 void TestBluetoothAdapterObserver::AdapterPresentChanged( | 69 void TestBluetoothAdapterObserver::AdapterPresentChanged( |
| 69 BluetoothAdapter* adapter, | 70 BluetoothAdapter* adapter, |
| 70 bool present) { | 71 bool present) { |
| 71 EXPECT_EQ(adapter_.get(), adapter); | 72 EXPECT_EQ(adapter_.get(), adapter); |
| 72 | 73 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 void TestBluetoothAdapterObserver::GattCharacteristicValueChanged( | 296 void TestBluetoothAdapterObserver::GattCharacteristicValueChanged( |
| 296 BluetoothAdapter* adapter, | 297 BluetoothAdapter* adapter, |
| 297 BluetoothRemoteGattCharacteristic* characteristic, | 298 BluetoothRemoteGattCharacteristic* characteristic, |
| 298 const std::vector<uint8_t>& value) { | 299 const std::vector<uint8_t>& value) { |
| 299 ASSERT_EQ(adapter_.get(), adapter); | 300 ASSERT_EQ(adapter_.get(), adapter); |
| 300 | 301 |
| 301 ++gatt_characteristic_value_changed_count_; | 302 ++gatt_characteristic_value_changed_count_; |
| 302 last_gatt_characteristic_id_ = characteristic->GetIdentifier(); | 303 last_gatt_characteristic_id_ = characteristic->GetIdentifier(); |
| 303 last_gatt_characteristic_uuid_ = characteristic->GetUUID(); | 304 last_gatt_characteristic_uuid_ = characteristic->GetUUID(); |
| 304 last_changed_characteristic_value_ = value; | 305 last_changed_characteristic_value_ = value; |
| 306 previous_characteristic_value_changed_values_.push_back(value); |
| 305 | 307 |
| 306 ASSERT_TRUE(characteristic->GetService()); | 308 ASSERT_TRUE(characteristic->GetService()); |
| 307 EXPECT_EQ(characteristic->GetService()->GetCharacteristic( | 309 EXPECT_EQ(characteristic->GetService()->GetCharacteristic( |
| 308 last_gatt_characteristic_id_), | 310 last_gatt_characteristic_id_), |
| 309 characteristic); | 311 characteristic); |
| 310 | 312 |
| 311 QuitMessageLoop(); | 313 QuitMessageLoop(); |
| 312 } | 314 } |
| 313 | 315 |
| 314 void TestBluetoothAdapterObserver::GattDescriptorValueChanged( | 316 void TestBluetoothAdapterObserver::GattDescriptorValueChanged( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 330 QuitMessageLoop(); | 332 QuitMessageLoop(); |
| 331 } | 333 } |
| 332 | 334 |
| 333 void TestBluetoothAdapterObserver::QuitMessageLoop() { | 335 void TestBluetoothAdapterObserver::QuitMessageLoop() { |
| 334 if (base::MessageLoop::current() && | 336 if (base::MessageLoop::current() && |
| 335 base::MessageLoop::current()->is_running()) | 337 base::MessageLoop::current()->is_running()) |
| 336 base::MessageLoop::current()->QuitWhenIdle(); | 338 base::MessageLoop::current()->QuitWhenIdle(); |
| 337 } | 339 } |
| 338 | 340 |
| 339 } // namespace device | 341 } // namespace device |
| OLD | NEW |