Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc

Issue 1144333007: Adding unit tests for BLE connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing compilation on OS X and Windows 2 Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_connection_finder.h " 5 #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h "
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 CloseGattConnection(gatt_connection.Pass()); 216 CloseGattConnection(gatt_connection.Pass());
217 return; 217 return;
218 } 218 }
219 219
220 VLOG(1) << "Connection created"; 220 VLOG(1) << "Connection created";
221 connected_ = true; 221 connected_ = true;
222 pending_connections_.clear(); 222 pending_connections_.clear();
223 223
224 connection_ = CreateConnection(gatt_connection.Pass()); 224 connection_ = CreateConnection(gatt_connection.Pass());
225 connection_->AddObserver(this); 225 connection_->AddObserver(this);
226 connection_->Connect();
226 227
227 StopDiscoverySession(); 228 StopDiscoverySession();
228 } 229 }
229 230
230 void BluetoothLowEnergyConnectionFinder::CreateGattConnection( 231 void BluetoothLowEnergyConnectionFinder::CreateGattConnection(
231 device::BluetoothDevice* remote_device) { 232 device::BluetoothDevice* remote_device) {
232 VLOG(1) << "SmartLock service found (" 233 VLOG(1) << "SmartLock service found ("
233 << remote_service_uuid_.canonical_value() << ")\n" 234 << remote_service_uuid_.canonical_value() << ")\n"
234 << "device = " << remote_device->GetAddress() 235 << "device = " << remote_device->GetAddress()
235 << ", name = " << remote_device->GetName(); 236 << ", name = " << remote_device->GetName();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 DCHECK_EQ(connection, connection_.get()); 273 DCHECK_EQ(connection, connection_.get());
273 274
274 if (!connection_callback_.is_null() && connection_->IsConnected()) { 275 if (!connection_callback_.is_null() && connection_->IsConnected()) {
275 connection_->RemoveObserver(this); 276 connection_->RemoveObserver(this);
276 connection_callback_.Run(connection_.Pass()); 277 connection_callback_.Run(connection_.Pass());
277 connection_callback_.Reset(); 278 connection_callback_.Reset();
278 } 279 }
279 } 280 }
280 281
281 } // namespace proximity_auth 282 } // namespace proximity_auth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698