| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 int confirm_passkey_count_; | 157 int confirm_passkey_count_; |
| 158 int authorize_pairing_count_; | 158 int authorize_pairing_count_; |
| 159 uint32_t last_passkey_; | 159 uint32_t last_passkey_; |
| 160 uint32_t last_entered_; | 160 uint32_t last_entered_; |
| 161 std::string last_pincode_; | 161 std::string last_pincode_; |
| 162 | 162 |
| 163 private: | 163 private: |
| 164 // Some tests use a message loop since background processing is simulated; | 164 // Some tests use a message loop since background processing is simulated; |
| 165 // break out of those loops. | 165 // break out of those loops. |
| 166 void QuitMessageLoop() { | 166 void QuitMessageLoop() { |
| 167 if (base::MessageLoop::current() && | 167 if (base::RunLoop::IsRunningOnCurrentThread()) |
| 168 base::MessageLoop::current()->is_running()) { | |
| 169 base::MessageLoop::current()->QuitWhenIdle(); | 168 base::MessageLoop::current()->QuitWhenIdle(); |
| 170 } | |
| 171 } | 169 } |
| 172 }; | 170 }; |
| 173 | 171 |
| 174 class BluetoothBlueZTest : public testing::Test { | 172 class BluetoothBlueZTest : public testing::Test { |
| 175 public: | 173 public: |
| 176 static const char kGapUuid[]; | 174 static const char kGapUuid[]; |
| 177 static const char kGattUuid[]; | 175 static const char kGattUuid[]; |
| 178 static const char kPnpUuid[]; | 176 static const char kPnpUuid[]; |
| 179 static const char kHeadsetUuid[]; | 177 static const char kHeadsetUuid[]; |
| 180 | 178 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 int error_callback_count_; | 353 int error_callback_count_; |
| 356 enum BluetoothDevice::ConnectErrorCode last_connect_error_; | 354 enum BluetoothDevice::ConnectErrorCode last_connect_error_; |
| 357 std::string last_client_error_; | 355 std::string last_client_error_; |
| 358 std::vector<std::unique_ptr<BluetoothDiscoverySession>> discovery_sessions_; | 356 std::vector<std::unique_ptr<BluetoothDiscoverySession>> discovery_sessions_; |
| 359 BluetoothAdapterProfileBlueZ* adapter_profile_; | 357 BluetoothAdapterProfileBlueZ* adapter_profile_; |
| 360 | 358 |
| 361 private: | 359 private: |
| 362 // Some tests use a message loop since background processing is simulated; | 360 // Some tests use a message loop since background processing is simulated; |
| 363 // break out of those loops. | 361 // break out of those loops. |
| 364 void QuitMessageLoop() { | 362 void QuitMessageLoop() { |
| 365 if (base::MessageLoop::current() && | 363 if (base::RunLoop::IsRunningOnCurrentThread()) |
| 366 base::MessageLoop::current()->is_running()) { | |
| 367 base::MessageLoop::current()->QuitWhenIdle(); | 364 base::MessageLoop::current()->QuitWhenIdle(); |
| 368 } | |
| 369 } | 365 } |
| 370 }; | 366 }; |
| 371 const char BluetoothBlueZTest::kGapUuid[] = | 367 const char BluetoothBlueZTest::kGapUuid[] = |
| 372 "00001800-0000-1000-8000-00805f9b34fb"; | 368 "00001800-0000-1000-8000-00805f9b34fb"; |
| 373 const char BluetoothBlueZTest::kGattUuid[] = | 369 const char BluetoothBlueZTest::kGattUuid[] = |
| 374 "00001801-0000-1000-8000-00805f9b34fb"; | 370 "00001801-0000-1000-8000-00805f9b34fb"; |
| 375 const char BluetoothBlueZTest::kPnpUuid[] = | 371 const char BluetoothBlueZTest::kPnpUuid[] = |
| 376 "00001200-0000-1000-8000-00805f9b34fb"; | 372 "00001200-0000-1000-8000-00805f9b34fb"; |
| 377 const char BluetoothBlueZTest::kHeadsetUuid[] = | 373 const char BluetoothBlueZTest::kHeadsetUuid[] = |
| 378 "00001112-0000-1000-8000-00805f9b34fb"; | 374 "00001112-0000-1000-8000-00805f9b34fb"; |
| (...skipping 4195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4574 | 4570 |
| 4575 // Check that we can update advertising data flags. | 4571 // Check that we can update advertising data flags. |
| 4576 properties->advertising_data_flags.ReplaceValue(std::vector<uint8_t>({0x23})); | 4572 properties->advertising_data_flags.ReplaceValue(std::vector<uint8_t>({0x23})); |
| 4577 EXPECT_EQ(2, observer.device_changed_count()); | 4573 EXPECT_EQ(2, observer.device_changed_count()); |
| 4578 EXPECT_EQ(device, observer.last_device()); | 4574 EXPECT_EQ(device, observer.last_device()); |
| 4579 EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value()); | 4575 EXPECT_TRUE(device->GetAdvertisingDataFlags().has_value()); |
| 4580 EXPECT_EQ(0x23u, device->GetAdvertisingDataFlags().value()); | 4576 EXPECT_EQ(0x23u, device->GetAdvertisingDataFlags().value()); |
| 4581 } | 4577 } |
| 4582 | 4578 |
| 4583 } // namespace bluez | 4579 } // namespace bluez |
| OLD | NEW |