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 "device/bluetooth/bluetooth_adapter.h" | 5 #include "device/bluetooth/bluetooth_adapter.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> |
12 | 13 |
13 #include "base/bind.h" | 14 #include "base/bind.h" |
14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
15 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
16 #include "build/build_config.h" | 17 #include "build/build_config.h" |
17 #include "device/bluetooth/bluetooth_common.h" | 18 #include "device/bluetooth/bluetooth_common.h" |
18 #include "device/bluetooth/bluetooth_device.h" | 19 #include "device/bluetooth/bluetooth_device.h" |
19 #include "device/bluetooth/bluetooth_discovery_session.h" | 20 #include "device/bluetooth/bluetooth_discovery_session.h" |
20 #include "device/bluetooth/bluetooth_gatt_service.h" | 21 #include "device/bluetooth/bluetooth_gatt_service.h" |
21 #include "device/bluetooth/bluetooth_local_gatt_characteristic.h" | 22 #include "device/bluetooth/bluetooth_local_gatt_characteristic.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 const AdvertisementErrorCallback& error_callback) override {} | 108 const AdvertisementErrorCallback& error_callback) override {} |
108 #endif | 109 #endif |
109 | 110 |
110 BluetoothLocalGattService* GetGattService( | 111 BluetoothLocalGattService* GetGattService( |
111 const std::string& identifier) const override { | 112 const std::string& identifier) const override { |
112 return nullptr; | 113 return nullptr; |
113 } | 114 } |
114 | 115 |
115 void TestErrorCallback() {} | 116 void TestErrorCallback() {} |
116 | 117 |
117 ScopedVector<BluetoothDiscoverySession> discovery_sessions_; | 118 std::vector<std::unique_ptr<BluetoothDiscoverySession>> discovery_sessions_; |
118 | 119 |
119 void TestOnStartDiscoverySession( | 120 void TestOnStartDiscoverySession( |
120 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session) { | 121 std::unique_ptr<device::BluetoothDiscoverySession> discovery_session) { |
121 discovery_sessions_.push_back(std::move(discovery_session)); | 122 discovery_sessions_.push_back(std::move(discovery_session)); |
122 } | 123 } |
123 | 124 |
124 void CleanupSessions() { discovery_sessions_.clear(); } | 125 void CleanupSessions() { discovery_sessions_.clear(); } |
125 | 126 |
126 void InjectFilteredSession( | 127 void InjectFilteredSession( |
127 std::unique_ptr<device::BluetoothDiscoveryFilter> discovery_filter) { | 128 std::unique_ptr<device::BluetoothDiscoveryFilter> discovery_filter) { |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 } | 1045 } |
1045 EXPECT_EQ(BluetoothDevice::UUIDSet({heart_service_uuid}), | 1046 EXPECT_EQ(BluetoothDevice::UUIDSet({heart_service_uuid}), |
1046 RetrieveConnectedPeripheralServiceUUIDs()); | 1047 RetrieveConnectedPeripheralServiceUUIDs()); |
1047 | 1048 |
1048 EXPECT_EQ(0, observer.device_added_count()); | 1049 EXPECT_EQ(0, observer.device_added_count()); |
1049 EXPECT_EQ(1u, adapter_->GetDevices().size()); | 1050 EXPECT_EQ(1u, adapter_->GetDevices().size()); |
1050 } | 1051 } |
1051 #endif // defined(OS_MACOSX) | 1052 #endif // defined(OS_MACOSX) |
1052 | 1053 |
1053 } // namespace device | 1054 } // namespace device |
OLD | NEW |