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 "components/proximity_auth/ble/bluetooth_low_energy_characteristics_fin
der.h" | 5 #include "components/proximity_auth/ble/bluetooth_low_energy_characteristics_fin
der.h" |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "components/proximity_auth/ble/remote_attribute.h" | 11 #include "components/proximity_auth/ble/remote_attribute.h" |
11 #include "device/bluetooth/bluetooth_adapter_factory.h" | 12 #include "device/bluetooth/bluetooth_adapter_factory.h" |
12 #include "device/bluetooth/bluetooth_uuid.h" | 13 #include "device/bluetooth/bluetooth_uuid.h" |
13 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 14 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
14 #include "device/bluetooth/test/mock_bluetooth_device.h" | 15 #include "device/bluetooth/test/mock_bluetooth_device.h" |
15 #include "device/bluetooth/test/mock_bluetooth_gatt_characteristic.h" | 16 #include "device/bluetooth/test/mock_bluetooth_gatt_characteristic.h" |
16 #include "device/bluetooth/test/mock_bluetooth_gatt_service.h" | 17 #include "device/bluetooth/test/mock_bluetooth_gatt_service.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 | 20 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 EXPECT_CALL(*adapter_, RemoveObserver(_)); | 91 EXPECT_CALL(*adapter_, RemoveObserver(_)); |
91 } | 92 } |
92 | 93 |
93 MOCK_METHOD3(OnCharacteristicsFound, | 94 MOCK_METHOD3(OnCharacteristicsFound, |
94 void(const RemoteAttribute&, | 95 void(const RemoteAttribute&, |
95 const RemoteAttribute&, | 96 const RemoteAttribute&, |
96 const RemoteAttribute&)); | 97 const RemoteAttribute&)); |
97 MOCK_METHOD2(OnCharacteristicsFinderError, | 98 MOCK_METHOD2(OnCharacteristicsFinderError, |
98 void(const RemoteAttribute&, const RemoteAttribute&)); | 99 void(const RemoteAttribute&, const RemoteAttribute&)); |
99 | 100 |
100 scoped_ptr<device::MockBluetoothGattCharacteristic> | 101 std::unique_ptr<device::MockBluetoothGattCharacteristic> |
101 ExpectToFindCharacteristic(const device::BluetoothUUID& uuid, | 102 ExpectToFindCharacteristic(const device::BluetoothUUID& uuid, |
102 const std::string& id, | 103 const std::string& id, |
103 bool valid) { | 104 bool valid) { |
104 scoped_ptr<device::MockBluetoothGattCharacteristic> characteristic( | 105 std::unique_ptr<device::MockBluetoothGattCharacteristic> characteristic( |
105 new NiceMock<device::MockBluetoothGattCharacteristic>( | 106 new NiceMock<device::MockBluetoothGattCharacteristic>( |
106 service_.get(), id, uuid, true, kCharacteristicProperties, | 107 service_.get(), id, uuid, true, kCharacteristicProperties, |
107 device::BluetoothGattCharacteristic::PERMISSION_NONE)); | 108 device::BluetoothGattCharacteristic::PERMISSION_NONE)); |
108 | 109 |
109 ON_CALL(*characteristic.get(), GetUUID()).WillByDefault(Return(uuid)); | 110 ON_CALL(*characteristic.get(), GetUUID()).WillByDefault(Return(uuid)); |
110 if (valid) | 111 if (valid) |
111 ON_CALL(*characteristic.get(), GetIdentifier()).WillByDefault(Return(id)); | 112 ON_CALL(*characteristic.get(), GetIdentifier()).WillByDefault(Return(id)); |
112 ON_CALL(*characteristic.get(), GetService()) | 113 ON_CALL(*characteristic.get(), GetService()) |
113 .WillByDefault(Return(service_.get())); | 114 .WillByDefault(Return(service_.get())); |
114 return characteristic; | 115 return characteristic; |
115 } | 116 } |
116 | 117 |
117 scoped_refptr<device::MockBluetoothAdapter> adapter_; | 118 scoped_refptr<device::MockBluetoothAdapter> adapter_; |
118 BluetoothLowEnergyCharacteristicsFinder::SuccessCallback success_callback_; | 119 BluetoothLowEnergyCharacteristicsFinder::SuccessCallback success_callback_; |
119 BluetoothLowEnergyCharacteristicsFinder::ErrorCallback error_callback_; | 120 BluetoothLowEnergyCharacteristicsFinder::ErrorCallback error_callback_; |
120 scoped_ptr<device::MockBluetoothDevice> device_; | 121 std::unique_ptr<device::MockBluetoothDevice> device_; |
121 scoped_ptr<device::MockBluetoothGattService> service_; | 122 std::unique_ptr<device::MockBluetoothGattService> service_; |
122 RemoteAttribute remote_service_; | 123 RemoteAttribute remote_service_; |
123 RemoteAttribute to_peripheral_char_; | 124 RemoteAttribute to_peripheral_char_; |
124 RemoteAttribute from_peripheral_char_; | 125 RemoteAttribute from_peripheral_char_; |
125 }; | 126 }; |
126 | 127 |
127 TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, | 128 TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, |
128 ConstructAndDestroyDontCrash) { | 129 ConstructAndDestroyDontCrash) { |
129 BluetoothLowEnergyCharacteristicsFinder characteristic_finder( | 130 BluetoothLowEnergyCharacteristicsFinder characteristic_finder( |
130 adapter_, device_.get(), remote_service_, to_peripheral_char_, | 131 adapter_, device_.get(), remote_service_, to_peripheral_char_, |
131 from_peripheral_char_, success_callback_, error_callback_); | 132 from_peripheral_char_, success_callback_, error_callback_); |
132 } | 133 } |
133 | 134 |
134 TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, | 135 TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, |
135 FindRightCharacteristics) { | 136 FindRightCharacteristics) { |
136 BluetoothLowEnergyCharacteristicsFinder characteristic_finder( | 137 BluetoothLowEnergyCharacteristicsFinder characteristic_finder( |
137 adapter_, device_.get(), remote_service_, to_peripheral_char_, | 138 adapter_, device_.get(), remote_service_, to_peripheral_char_, |
138 from_peripheral_char_, success_callback_, error_callback_); | 139 from_peripheral_char_, success_callback_, error_callback_); |
139 // Upcasting |characteristic_finder| to access the virtual protected methods | 140 // Upcasting |characteristic_finder| to access the virtual protected methods |
140 // from Observer: GattCharacteristicAdded() and | 141 // from Observer: GattCharacteristicAdded() and |
141 // GattDiscoveryCompleteForService(). | 142 // GattDiscoveryCompleteForService(). |
142 device::BluetoothAdapter::Observer* observer = | 143 device::BluetoothAdapter::Observer* observer = |
143 static_cast<device::BluetoothAdapter::Observer*>(&characteristic_finder); | 144 static_cast<device::BluetoothAdapter::Observer*>(&characteristic_finder); |
144 | 145 |
145 RemoteAttribute found_to_char, found_from_char; | 146 RemoteAttribute found_to_char, found_from_char; |
146 EXPECT_CALL(*this, OnCharacteristicsFound(_, _, _)) | 147 EXPECT_CALL(*this, OnCharacteristicsFound(_, _, _)) |
147 .WillOnce( | 148 .WillOnce( |
148 DoAll(SaveArg<1>(&found_to_char), SaveArg<2>(&found_from_char))); | 149 DoAll(SaveArg<1>(&found_to_char), SaveArg<2>(&found_from_char))); |
149 EXPECT_CALL(*this, OnCharacteristicsFinderError(_, _)).Times(0); | 150 EXPECT_CALL(*this, OnCharacteristicsFinderError(_, _)).Times(0); |
150 | 151 |
151 scoped_ptr<device::MockBluetoothGattCharacteristic> from_char = | 152 std::unique_ptr<device::MockBluetoothGattCharacteristic> from_char = |
152 ExpectToFindCharacteristic(device::BluetoothUUID(kFromPeripheralCharUUID), | 153 ExpectToFindCharacteristic(device::BluetoothUUID(kFromPeripheralCharUUID), |
153 kFromPeripheralCharID, true); | 154 kFromPeripheralCharID, true); |
154 observer->GattCharacteristicAdded(adapter_.get(), from_char.get()); | 155 observer->GattCharacteristicAdded(adapter_.get(), from_char.get()); |
155 | 156 |
156 scoped_ptr<device::MockBluetoothGattCharacteristic> to_char = | 157 std::unique_ptr<device::MockBluetoothGattCharacteristic> to_char = |
157 ExpectToFindCharacteristic(device::BluetoothUUID(kToPeripheralCharUUID), | 158 ExpectToFindCharacteristic(device::BluetoothUUID(kToPeripheralCharUUID), |
158 kToPeripheralCharID, true); | 159 kToPeripheralCharID, true); |
159 observer->GattCharacteristicAdded(adapter_.get(), to_char.get()); | 160 observer->GattCharacteristicAdded(adapter_.get(), to_char.get()); |
160 | 161 |
161 EXPECT_EQ(kToPeripheralCharID, found_to_char.id); | 162 EXPECT_EQ(kToPeripheralCharID, found_to_char.id); |
162 EXPECT_EQ(kFromPeripheralCharID, found_from_char.id); | 163 EXPECT_EQ(kFromPeripheralCharID, found_from_char.id); |
163 | 164 |
164 EXPECT_CALL(*service_, GetUUID()) | 165 EXPECT_CALL(*service_, GetUUID()) |
165 .WillOnce(Return(device::BluetoothUUID(kServiceUUID))); | 166 .WillOnce(Return(device::BluetoothUUID(kServiceUUID))); |
166 observer->GattDiscoveryCompleteForService(adapter_.get(), service_.get()); | 167 observer->GattDiscoveryCompleteForService(adapter_.get(), service_.get()); |
167 } | 168 } |
168 | 169 |
169 TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, | 170 TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, |
170 DidntFindRightCharacteristics) { | 171 DidntFindRightCharacteristics) { |
171 BluetoothLowEnergyCharacteristicsFinder characteristic_finder( | 172 BluetoothLowEnergyCharacteristicsFinder characteristic_finder( |
172 adapter_, device_.get(), remote_service_, to_peripheral_char_, | 173 adapter_, device_.get(), remote_service_, to_peripheral_char_, |
173 from_peripheral_char_, success_callback_, error_callback_); | 174 from_peripheral_char_, success_callback_, error_callback_); |
174 device::BluetoothAdapter::Observer* observer = | 175 device::BluetoothAdapter::Observer* observer = |
175 static_cast<device::BluetoothAdapter::Observer*>(&characteristic_finder); | 176 static_cast<device::BluetoothAdapter::Observer*>(&characteristic_finder); |
176 | 177 |
177 EXPECT_CALL(*this, OnCharacteristicsFound(_, _, _)).Times(0); | 178 EXPECT_CALL(*this, OnCharacteristicsFound(_, _, _)).Times(0); |
178 EXPECT_CALL(*this, OnCharacteristicsFinderError(_, _)); | 179 EXPECT_CALL(*this, OnCharacteristicsFinderError(_, _)); |
179 | 180 |
180 scoped_ptr<device::MockBluetoothGattCharacteristic> other_char = | 181 std::unique_ptr<device::MockBluetoothGattCharacteristic> other_char = |
181 ExpectToFindCharacteristic(device::BluetoothUUID(kOtherCharUUID), | 182 ExpectToFindCharacteristic(device::BluetoothUUID(kOtherCharUUID), |
182 kOtherCharID, false); | 183 kOtherCharID, false); |
183 observer->GattCharacteristicAdded(adapter_.get(), other_char.get()); | 184 observer->GattCharacteristicAdded(adapter_.get(), other_char.get()); |
184 | 185 |
185 EXPECT_CALL(*service_, GetUUID()) | 186 EXPECT_CALL(*service_, GetUUID()) |
186 .WillOnce(Return(device::BluetoothUUID(kServiceUUID))); | 187 .WillOnce(Return(device::BluetoothUUID(kServiceUUID))); |
187 observer->GattDiscoveryCompleteForService(adapter_.get(), service_.get()); | 188 observer->GattDiscoveryCompleteForService(adapter_.get(), service_.get()); |
188 } | 189 } |
189 | 190 |
190 TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, | 191 TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, |
191 FindOnlyOneRightCharacteristic) { | 192 FindOnlyOneRightCharacteristic) { |
192 BluetoothLowEnergyCharacteristicsFinder characteristic_finder( | 193 BluetoothLowEnergyCharacteristicsFinder characteristic_finder( |
193 adapter_, device_.get(), remote_service_, to_peripheral_char_, | 194 adapter_, device_.get(), remote_service_, to_peripheral_char_, |
194 from_peripheral_char_, success_callback_, error_callback_); | 195 from_peripheral_char_, success_callback_, error_callback_); |
195 device::BluetoothAdapter::Observer* observer = | 196 device::BluetoothAdapter::Observer* observer = |
196 static_cast<device::BluetoothAdapter::Observer*>(&characteristic_finder); | 197 static_cast<device::BluetoothAdapter::Observer*>(&characteristic_finder); |
197 | 198 |
198 RemoteAttribute found_to_char, found_from_char; | 199 RemoteAttribute found_to_char, found_from_char; |
199 EXPECT_CALL(*this, OnCharacteristicsFound(_, _, _)).Times(0); | 200 EXPECT_CALL(*this, OnCharacteristicsFound(_, _, _)).Times(0); |
200 EXPECT_CALL(*this, OnCharacteristicsFinderError(_, _)) | 201 EXPECT_CALL(*this, OnCharacteristicsFinderError(_, _)) |
201 .WillOnce( | 202 .WillOnce( |
202 DoAll(SaveArg<0>(&found_to_char), SaveArg<1>(&found_from_char))); | 203 DoAll(SaveArg<0>(&found_to_char), SaveArg<1>(&found_from_char))); |
203 | 204 |
204 scoped_ptr<device::MockBluetoothGattCharacteristic> from_char = | 205 std::unique_ptr<device::MockBluetoothGattCharacteristic> from_char = |
205 ExpectToFindCharacteristic(device::BluetoothUUID(kFromPeripheralCharUUID), | 206 ExpectToFindCharacteristic(device::BluetoothUUID(kFromPeripheralCharUUID), |
206 kFromPeripheralCharID, true); | 207 kFromPeripheralCharID, true); |
207 observer->GattCharacteristicAdded(adapter_.get(), from_char.get()); | 208 observer->GattCharacteristicAdded(adapter_.get(), from_char.get()); |
208 | 209 |
209 EXPECT_CALL(*service_, GetUUID()) | 210 EXPECT_CALL(*service_, GetUUID()) |
210 .WillOnce(Return(device::BluetoothUUID(kServiceUUID))); | 211 .WillOnce(Return(device::BluetoothUUID(kServiceUUID))); |
211 observer->GattDiscoveryCompleteForService(adapter_.get(), service_.get()); | 212 observer->GattDiscoveryCompleteForService(adapter_.get(), service_.get()); |
212 EXPECT_EQ(kFromPeripheralCharID, found_from_char.id); | 213 EXPECT_EQ(kFromPeripheralCharID, found_from_char.id); |
213 } | 214 } |
214 | 215 |
215 TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, | 216 TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, |
216 FindWrongCharacteristic_FindRightCharacteristics) { | 217 FindWrongCharacteristic_FindRightCharacteristics) { |
217 BluetoothLowEnergyCharacteristicsFinder characteristic_finder( | 218 BluetoothLowEnergyCharacteristicsFinder characteristic_finder( |
218 adapter_, device_.get(), remote_service_, to_peripheral_char_, | 219 adapter_, device_.get(), remote_service_, to_peripheral_char_, |
219 from_peripheral_char_, success_callback_, error_callback_); | 220 from_peripheral_char_, success_callback_, error_callback_); |
220 device::BluetoothAdapter::Observer* observer = | 221 device::BluetoothAdapter::Observer* observer = |
221 static_cast<device::BluetoothAdapter::Observer*>(&characteristic_finder); | 222 static_cast<device::BluetoothAdapter::Observer*>(&characteristic_finder); |
222 | 223 |
223 RemoteAttribute found_to_char, found_from_char; | 224 RemoteAttribute found_to_char, found_from_char; |
224 EXPECT_CALL(*this, OnCharacteristicsFound(_, _, _)) | 225 EXPECT_CALL(*this, OnCharacteristicsFound(_, _, _)) |
225 .WillOnce( | 226 .WillOnce( |
226 DoAll(SaveArg<1>(&found_to_char), SaveArg<2>(&found_from_char))); | 227 DoAll(SaveArg<1>(&found_to_char), SaveArg<2>(&found_from_char))); |
227 EXPECT_CALL(*this, OnCharacteristicsFinderError(_, _)).Times(0); | 228 EXPECT_CALL(*this, OnCharacteristicsFinderError(_, _)).Times(0); |
228 | 229 |
229 scoped_ptr<device::MockBluetoothGattCharacteristic> other_char = | 230 std::unique_ptr<device::MockBluetoothGattCharacteristic> other_char = |
230 ExpectToFindCharacteristic(device::BluetoothUUID(kOtherCharUUID), | 231 ExpectToFindCharacteristic(device::BluetoothUUID(kOtherCharUUID), |
231 kOtherCharID, false); | 232 kOtherCharID, false); |
232 observer->GattCharacteristicAdded(adapter_.get(), other_char.get()); | 233 observer->GattCharacteristicAdded(adapter_.get(), other_char.get()); |
233 | 234 |
234 scoped_ptr<device::MockBluetoothGattCharacteristic> from_char = | 235 std::unique_ptr<device::MockBluetoothGattCharacteristic> from_char = |
235 ExpectToFindCharacteristic(device::BluetoothUUID(kFromPeripheralCharUUID), | 236 ExpectToFindCharacteristic(device::BluetoothUUID(kFromPeripheralCharUUID), |
236 kFromPeripheralCharID, true); | 237 kFromPeripheralCharID, true); |
237 observer->GattCharacteristicAdded(adapter_.get(), from_char.get()); | 238 observer->GattCharacteristicAdded(adapter_.get(), from_char.get()); |
238 | 239 |
239 scoped_ptr<device::MockBluetoothGattCharacteristic> to_char = | 240 std::unique_ptr<device::MockBluetoothGattCharacteristic> to_char = |
240 ExpectToFindCharacteristic(device::BluetoothUUID(kToPeripheralCharUUID), | 241 ExpectToFindCharacteristic(device::BluetoothUUID(kToPeripheralCharUUID), |
241 kToPeripheralCharID, true); | 242 kToPeripheralCharID, true); |
242 observer->GattCharacteristicAdded(adapter_.get(), to_char.get()); | 243 observer->GattCharacteristicAdded(adapter_.get(), to_char.get()); |
243 | 244 |
244 EXPECT_EQ(kToPeripheralCharID, found_to_char.id); | 245 EXPECT_EQ(kToPeripheralCharID, found_to_char.id); |
245 EXPECT_EQ(kFromPeripheralCharID, found_from_char.id); | 246 EXPECT_EQ(kFromPeripheralCharID, found_from_char.id); |
246 | 247 |
247 EXPECT_CALL(*service_, GetUUID()) | 248 EXPECT_CALL(*service_, GetUUID()) |
248 .WillOnce(Return(device::BluetoothUUID(kServiceUUID))); | 249 .WillOnce(Return(device::BluetoothUUID(kServiceUUID))); |
249 observer->GattDiscoveryCompleteForService(adapter_.get(), service_.get()); | 250 observer->GattDiscoveryCompleteForService(adapter_.get(), service_.get()); |
250 } | 251 } |
251 | 252 |
252 TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, | 253 TEST_F(ProximityAuthBluetoothLowEnergyCharacteristicFinderTest, |
253 RightCharacteristicsAlreadyPresent) { | 254 RightCharacteristicsAlreadyPresent) { |
254 RemoteAttribute found_to_char, found_from_char; | 255 RemoteAttribute found_to_char, found_from_char; |
255 EXPECT_CALL(*this, OnCharacteristicsFound(_, _, _)) | 256 EXPECT_CALL(*this, OnCharacteristicsFound(_, _, _)) |
256 .WillOnce( | 257 .WillOnce( |
257 DoAll(SaveArg<1>(&found_to_char), SaveArg<2>(&found_from_char))); | 258 DoAll(SaveArg<1>(&found_to_char), SaveArg<2>(&found_from_char))); |
258 EXPECT_CALL(*this, OnCharacteristicsFinderError(_, _)).Times(0); | 259 EXPECT_CALL(*this, OnCharacteristicsFinderError(_, _)).Times(0); |
259 | 260 |
260 scoped_ptr<device::MockBluetoothGattCharacteristic> from_char = | 261 std::unique_ptr<device::MockBluetoothGattCharacteristic> from_char = |
261 ExpectToFindCharacteristic(device::BluetoothUUID(kFromPeripheralCharUUID), | 262 ExpectToFindCharacteristic(device::BluetoothUUID(kFromPeripheralCharUUID), |
262 kFromPeripheralCharID, true); | 263 kFromPeripheralCharID, true); |
263 | 264 |
264 scoped_ptr<device::MockBluetoothGattCharacteristic> to_char = | 265 std::unique_ptr<device::MockBluetoothGattCharacteristic> to_char = |
265 ExpectToFindCharacteristic(device::BluetoothUUID(kToPeripheralCharUUID), | 266 ExpectToFindCharacteristic(device::BluetoothUUID(kToPeripheralCharUUID), |
266 kToPeripheralCharID, true); | 267 kToPeripheralCharID, true); |
267 | 268 |
268 std::vector<device::BluetoothGattService*> services; | 269 std::vector<device::BluetoothGattService*> services; |
269 services.push_back(service_.get()); | 270 services.push_back(service_.get()); |
270 ON_CALL(*device_, GetGattServices()).WillByDefault(Return(services)); | 271 ON_CALL(*device_, GetGattServices()).WillByDefault(Return(services)); |
271 | 272 |
272 std::vector<device::BluetoothGattCharacteristic*> characteristics; | 273 std::vector<device::BluetoothGattCharacteristic*> characteristics; |
273 characteristics.push_back(from_char.get()); | 274 characteristics.push_back(from_char.get()); |
274 characteristics.push_back(to_char.get()); | 275 characteristics.push_back(to_char.get()); |
275 ON_CALL(*service_, GetCharacteristics()) | 276 ON_CALL(*service_, GetCharacteristics()) |
276 .WillByDefault(Return(characteristics)); | 277 .WillByDefault(Return(characteristics)); |
277 | 278 |
278 BluetoothLowEnergyCharacteristicsFinder characteristic_finder( | 279 BluetoothLowEnergyCharacteristicsFinder characteristic_finder( |
279 adapter_, device_.get(), remote_service_, to_peripheral_char_, | 280 adapter_, device_.get(), remote_service_, to_peripheral_char_, |
280 from_peripheral_char_, success_callback_, error_callback_); | 281 from_peripheral_char_, success_callback_, error_callback_); |
281 device::BluetoothAdapter::Observer* observer = | 282 device::BluetoothAdapter::Observer* observer = |
282 static_cast<device::BluetoothAdapter::Observer*>(&characteristic_finder); | 283 static_cast<device::BluetoothAdapter::Observer*>(&characteristic_finder); |
283 | 284 |
284 EXPECT_EQ(kToPeripheralCharID, found_to_char.id); | 285 EXPECT_EQ(kToPeripheralCharID, found_to_char.id); |
285 EXPECT_EQ(kFromPeripheralCharID, found_from_char.id); | 286 EXPECT_EQ(kFromPeripheralCharID, found_from_char.id); |
286 | 287 |
287 EXPECT_CALL(*service_, GetUUID()) | 288 EXPECT_CALL(*service_, GetUUID()) |
288 .WillOnce(Return(device::BluetoothUUID(kServiceUUID))); | 289 .WillOnce(Return(device::BluetoothUUID(kServiceUUID))); |
289 observer->GattDiscoveryCompleteForService(adapter_.get(), service_.get()); | 290 observer->GattDiscoveryCompleteForService(adapter_.get(), service_.get()); |
290 } | 291 } |
291 | 292 |
292 } // namespace proximity_auth | 293 } // namespace proximity_auth |
OLD | NEW |