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" |
| 11 #include "base/run_loop.h" |
11 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 12 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
12 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" | 13 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" |
13 #include "device/bluetooth/bluetooth_remote_gatt_service.h" | 14 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 | 16 |
16 namespace device { | 17 namespace device { |
17 | 18 |
18 TestBluetoothAdapterObserver::TestBluetoothAdapterObserver( | 19 TestBluetoothAdapterObserver::TestBluetoothAdapterObserver( |
19 scoped_refptr<BluetoothAdapter> adapter) | 20 scoped_refptr<BluetoothAdapter> adapter) |
20 : adapter_(adapter) { | 21 : adapter_(adapter) { |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 327 |
327 ASSERT_TRUE(descriptor->GetCharacteristic()); | 328 ASSERT_TRUE(descriptor->GetCharacteristic()); |
328 EXPECT_EQ( | 329 EXPECT_EQ( |
329 descriptor->GetCharacteristic()->GetDescriptor(last_gatt_descriptor_id_), | 330 descriptor->GetCharacteristic()->GetDescriptor(last_gatt_descriptor_id_), |
330 descriptor); | 331 descriptor); |
331 | 332 |
332 QuitMessageLoop(); | 333 QuitMessageLoop(); |
333 } | 334 } |
334 | 335 |
335 void TestBluetoothAdapterObserver::QuitMessageLoop() { | 336 void TestBluetoothAdapterObserver::QuitMessageLoop() { |
336 if (base::MessageLoop::current() && | 337 if (base::RunLoop::IsRunningOnCurrentThread()) |
337 base::MessageLoop::current()->is_running()) | |
338 base::MessageLoop::current()->QuitWhenIdle(); | 338 base::MessageLoop::current()->QuitWhenIdle(); |
339 } | 339 } |
340 | 340 |
341 } // namespace device | 341 } // namespace device |
OLD | NEW |