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

Side by Side Diff: chromeos/dbus/fake_bluetooth_device_client.cc

Issue 1258783009: Add functionality to Bluetooth settings UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chromeos/dbus/fake_bluetooth_device_client.h" 5 #include "chromeos/dbus/fake_bluetooth_device_client.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <sys/socket.h> 8 #include <sys/socket.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 27 matching lines...) Expand all
38 // Default interval between simulated events. 38 // Default interval between simulated events.
39 const int kSimulationIntervalMs = 750; 39 const int kSimulationIntervalMs = 750;
40 40
41 // Minimum and maximum bounds for randomly generated RSSI values. 41 // Minimum and maximum bounds for randomly generated RSSI values.
42 const int kMinRSSI = -90; 42 const int kMinRSSI = -90;
43 const int kMaxRSSI = -30; 43 const int kMaxRSSI = -30;
44 44
45 // The default value of connection info properties from GetConnInfo(). 45 // The default value of connection info properties from GetConnInfo().
46 const int kUnkownPower = 127; 46 const int kUnkownPower = 127;
47 47
48 const char kPairingMethodNone[] = "None";
49 const char kPairingMethodPinCode[] = "PIN Code";
50 const char kPairingMethodPassKey[] = "PassKey";
51 const char kTestPinCode[] = "123456";
52
53 const int kSimulatedPairTimeMultiplierFour = 4;
54 const int kSimulatedPairTimeMultiplierFortyFive = 45;
55 const int kSimulatedPairTimeMultiplierSeven = 7;
56 const int kSimulatedPairTimeMultiplierThirty = 30;
57 const int kSimulatedPairTimeMultiplierThree = 3;
stevenjb 2015/07/31 16:49:33 Instead of using undescriptive names like Four, we
58 const int kTestPassKey = 123456;
48 59
49 void SimulatedProfileSocket(int fd) { 60 void SimulatedProfileSocket(int fd) {
50 // Simulate a server-side socket of a profile; read data from the socket, 61 // Simulate a server-side socket of a profile; read data from the socket,
51 // write it back, and then close. 62 // write it back, and then close.
52 char buf[1024]; 63 char buf[1024];
53 ssize_t len; 64 ssize_t len;
54 ssize_t count; 65 ssize_t count;
55 66
56 len = read(fd, buf, sizeof buf); 67 len = read(fd, buf, sizeof buf);
57 if (len < 0) { 68 if (len < 0) {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 dbus::PropertySet::SetCallback callback) { 230 dbus::PropertySet::SetCallback callback) {
220 VLOG(1) << "Set " << property->name(); 231 VLOG(1) << "Set " << property->name();
221 if (property->name() == trusted.name()) { 232 if (property->name() == trusted.name()) {
222 callback.Run(true); 233 callback.Run(true);
223 property->ReplaceValueWithSetValue(); 234 property->ReplaceValueWithSetValue();
224 } else { 235 } else {
225 callback.Run(false); 236 callback.Run(false);
226 } 237 }
227 } 238 }
228 239
240 FakeBluetoothDeviceClient::IncomingDeviceProperties::IncomingDeviceProperties()
241 : device_class(0), is_trusted(true) {}
242
243 FakeBluetoothDeviceClient::IncomingDeviceProperties::
244 ~IncomingDeviceProperties() {}
245
229 FakeBluetoothDeviceClient::FakeBluetoothDeviceClient() 246 FakeBluetoothDeviceClient::FakeBluetoothDeviceClient()
230 : simulation_interval_ms_(kSimulationIntervalMs), 247 : simulation_interval_ms_(kSimulationIntervalMs),
231 discovery_simulation_step_(0), 248 discovery_simulation_step_(0),
232 incoming_pairing_simulation_step_(0), 249 incoming_pairing_simulation_step_(0),
233 pairing_cancelled_(false), 250 pairing_cancelled_(false),
234 connection_rssi_(kUnkownPower), 251 connection_rssi_(kUnkownPower),
235 transmit_power_(kUnkownPower), 252 transmit_power_(kUnkownPower),
236 max_transmit_power_(kUnkownPower) { 253 max_transmit_power_(kUnkownPower) {
237 Properties* properties = new Properties(base::Bind( 254 scoped_ptr<Properties> properties(new Properties(
238 &FakeBluetoothDeviceClient::OnPropertyChanged, 255 base::Bind(&FakeBluetoothDeviceClient::OnPropertyChanged,
239 base::Unretained(this), 256 base::Unretained(this), dbus::ObjectPath(kPairedDevicePath))));
240 dbus::ObjectPath(kPairedDevicePath)));
241 properties->address.ReplaceValue(kPairedDeviceAddress); 257 properties->address.ReplaceValue(kPairedDeviceAddress);
242 properties->bluetooth_class.ReplaceValue(kPairedDeviceClass); 258 properties->bluetooth_class.ReplaceValue(kPairedDeviceClass);
243 properties->name.ReplaceValue("Fake Device (Name)"); 259 properties->name.ReplaceValue("Fake Device (Name)");
244 properties->alias.ReplaceValue(kPairedDeviceName); 260 properties->alias.ReplaceValue(kPairedDeviceName);
245 properties->paired.ReplaceValue(true); 261 properties->paired.ReplaceValue(true);
246 properties->trusted.ReplaceValue(true); 262 properties->trusted.ReplaceValue(true);
247 properties->adapter.ReplaceValue( 263 properties->adapter.ReplaceValue(
248 dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath)); 264 dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
249 265
250 std::vector<std::string> uuids; 266 std::vector<std::string> uuids;
251 uuids.push_back("00001800-0000-1000-8000-00805f9b34fb"); 267 uuids.push_back("00001800-0000-1000-8000-00805f9b34fb");
252 uuids.push_back("00001801-0000-1000-8000-00805f9b34fb"); 268 uuids.push_back("00001801-0000-1000-8000-00805f9b34fb");
253 properties->uuids.ReplaceValue(uuids); 269 properties->uuids.ReplaceValue(uuids);
254 270
255 properties->modalias.ReplaceValue("usb:v05ACp030Dd0306"); 271 properties->modalias.ReplaceValue("usb:v05ACp030Dd0306");
256 272
257 properties_map_[dbus::ObjectPath(kPairedDevicePath)] = properties; 273 properties_map_.insert(dbus::ObjectPath(kPairedDevicePath),
274 properties.Pass());
258 device_list_.push_back(dbus::ObjectPath(kPairedDevicePath)); 275 device_list_.push_back(dbus::ObjectPath(kPairedDevicePath));
259 276
260 properties = new Properties(base::Bind( 277 properties.reset(new Properties(base::Bind(
261 &FakeBluetoothDeviceClient::OnPropertyChanged, base::Unretained(this), 278 &FakeBluetoothDeviceClient::OnPropertyChanged, base::Unretained(this),
262 dbus::ObjectPath(kPairedUnconnectableDevicePath))); 279 dbus::ObjectPath(kPairedUnconnectableDevicePath))));
263 properties->address.ReplaceValue(kPairedUnconnectableDeviceAddress); 280 properties->address.ReplaceValue(kPairedUnconnectableDeviceAddress);
264 properties->bluetooth_class.ReplaceValue(kPairedUnconnectableDeviceClass); 281 properties->bluetooth_class.ReplaceValue(kPairedUnconnectableDeviceClass);
265 properties->name.ReplaceValue("Fake Device 2 (Unconnectable)"); 282 properties->name.ReplaceValue("Fake Device 2 (Unconnectable)");
266 properties->alias.ReplaceValue(kPairedUnconnectableDeviceName); 283 properties->alias.ReplaceValue(kPairedUnconnectableDeviceName);
267 properties->paired.ReplaceValue(true); 284 properties->paired.ReplaceValue(true);
268 properties->trusted.ReplaceValue(true); 285 properties->trusted.ReplaceValue(true);
269 properties->adapter.ReplaceValue( 286 properties->adapter.ReplaceValue(
270 dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath)); 287 dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath));
271 288
272 properties->uuids.ReplaceValue(uuids); 289 properties->uuids.ReplaceValue(uuids);
273 290
274 properties->modalias.ReplaceValue("usb:v05ACp030Dd0306"); 291 properties->modalias.ReplaceValue("usb:v05ACp030Dd0306");
275 292
276 properties_map_[dbus::ObjectPath(kPairedUnconnectableDevicePath)] = 293 properties_map_.insert(dbus::ObjectPath(kPairedUnconnectableDevicePath),
277 properties; 294 properties.Pass());
278 device_list_.push_back(dbus::ObjectPath(kPairedUnconnectableDevicePath)); 295 device_list_.push_back(dbus::ObjectPath(kPairedUnconnectableDevicePath));
279 } 296 }
280 297
281 FakeBluetoothDeviceClient::~FakeBluetoothDeviceClient() { 298 FakeBluetoothDeviceClient::~FakeBluetoothDeviceClient() {
282 // Clean up Properties structures
283 STLDeleteValues(&properties_map_);
284 } 299 }
285 300
286 void FakeBluetoothDeviceClient::Init(dbus::Bus* bus) { 301 void FakeBluetoothDeviceClient::Init(dbus::Bus* bus) {
287 } 302 }
288 303
289 void FakeBluetoothDeviceClient::AddObserver(Observer* observer) { 304 void FakeBluetoothDeviceClient::AddObserver(Observer* observer) {
290 observers_.AddObserver(observer); 305 observers_.AddObserver(observer);
291 } 306 }
292 307
293 void FakeBluetoothDeviceClient::RemoveObserver(Observer* observer) { 308 void FakeBluetoothDeviceClient::RemoveObserver(Observer* observer) {
294 observers_.RemoveObserver(observer); 309 observers_.RemoveObserver(observer);
295 } 310 }
296 311
297 std::vector<dbus::ObjectPath> FakeBluetoothDeviceClient::GetDevicesForAdapter( 312 std::vector<dbus::ObjectPath> FakeBluetoothDeviceClient::GetDevicesForAdapter(
298 const dbus::ObjectPath& adapter_path) { 313 const dbus::ObjectPath& adapter_path) {
299 if (adapter_path == 314 if (adapter_path ==
300 dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath)) 315 dbus::ObjectPath(FakeBluetoothAdapterClient::kAdapterPath))
301 return device_list_; 316 return device_list_;
302 else 317 else
303 return std::vector<dbus::ObjectPath>(); 318 return std::vector<dbus::ObjectPath>();
304 } 319 }
305 320
306 FakeBluetoothDeviceClient::Properties* 321 FakeBluetoothDeviceClient::Properties*
307 FakeBluetoothDeviceClient::GetProperties(const dbus::ObjectPath& object_path) { 322 FakeBluetoothDeviceClient::GetProperties(const dbus::ObjectPath& object_path) {
308 PropertiesMap::iterator iter = properties_map_.find(object_path); 323 PropertiesMap::const_iterator iter = properties_map_.find(object_path);
309 if (iter != properties_map_.end()) 324 if (iter != properties_map_.end())
310 return iter->second; 325 return iter->second;
311 return NULL; 326 return NULL;
312 } 327 }
313 328
329 FakeBluetoothDeviceClient::SimulatedPairingOptions*
330 FakeBluetoothDeviceClient::GetPairingOptions(
331 const dbus::ObjectPath& object_path) {
332 PairingOptionsMap::const_iterator iter =
333 pairing_options_map_.find(object_path);
334 if (iter != pairing_options_map_.end())
335 return iter->second;
336 return iter != pairing_options_map_.end() ? iter->second : nullptr;
337 }
338
314 void FakeBluetoothDeviceClient::Connect( 339 void FakeBluetoothDeviceClient::Connect(
315 const dbus::ObjectPath& object_path, 340 const dbus::ObjectPath& object_path,
316 const base::Closure& callback, 341 const base::Closure& callback,
317 const ErrorCallback& error_callback) { 342 const ErrorCallback& error_callback) {
318 VLOG(1) << "Connect: " << object_path.value(); 343 VLOG(1) << "Connect: " << object_path.value();
319 Properties* properties = GetProperties(object_path); 344 Properties* properties = GetProperties(object_path);
320 345
321 if (properties->connected.value() == true) { 346 if (properties->connected.value() == true) {
322 // Already connected. 347 // Already connected.
323 callback.Run(); 348 callback.Run();
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 void FakeBluetoothDeviceClient::BeginIncomingPairingSimulation( 560 void FakeBluetoothDeviceClient::BeginIncomingPairingSimulation(
536 const dbus::ObjectPath& adapter_path) { 561 const dbus::ObjectPath& adapter_path) {
537 VLOG(1) << "starting incoming pairing simulation"; 562 VLOG(1) << "starting incoming pairing simulation";
538 563
539 incoming_pairing_simulation_step_ = 1; 564 incoming_pairing_simulation_step_ = 1;
540 565
541 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 566 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
542 FROM_HERE, 567 FROM_HERE,
543 base::Bind(&FakeBluetoothDeviceClient::IncomingPairingSimulationTimer, 568 base::Bind(&FakeBluetoothDeviceClient::IncomingPairingSimulationTimer,
544 base::Unretained(this)), 569 base::Unretained(this)),
545 base::TimeDelta::FromMilliseconds(30 * simulation_interval_ms_)); 570 base::TimeDelta::FromMilliseconds(kSimulatedPairTimeMultiplierThirty *
571 simulation_interval_ms_));
546 } 572 }
547 573
548 void FakeBluetoothDeviceClient::EndIncomingPairingSimulation( 574 void FakeBluetoothDeviceClient::EndIncomingPairingSimulation(
549 const dbus::ObjectPath& adapter_path) { 575 const dbus::ObjectPath& adapter_path) {
550 VLOG(1) << "stopping incoming pairing simulation"; 576 VLOG(1) << "stopping incoming pairing simulation";
551 incoming_pairing_simulation_step_ = 0; 577 incoming_pairing_simulation_step_ = 0;
552 } 578 }
553 579
554 void FakeBluetoothDeviceClient::SetSimulationIntervalMs(int interval_ms) { 580 void FakeBluetoothDeviceClient::SetSimulationIntervalMs(int interval_ms) {
555 simulation_interval_ms_ = interval_ms; 581 simulation_interval_ms_ = interval_ms;
556 } 582 }
557 583
558 void FakeBluetoothDeviceClient::CreateDevice( 584 void FakeBluetoothDeviceClient::CreateDevice(
559 const dbus::ObjectPath& adapter_path, 585 const dbus::ObjectPath& adapter_path,
560 const dbus::ObjectPath& device_path) { 586 const dbus::ObjectPath& device_path) {
561 if (std::find(device_list_.begin(), 587 if (std::find(device_list_.begin(),
562 device_list_.end(), device_path) != device_list_.end()) 588 device_list_.end(), device_path) != device_list_.end())
563 return; 589 return;
564 590
565 Properties* properties = new Properties(base::Bind( 591 scoped_ptr<Properties> properties(
566 &FakeBluetoothDeviceClient::OnPropertyChanged, 592 new Properties(base::Bind(&FakeBluetoothDeviceClient::OnPropertyChanged,
567 base::Unretained(this), 593 base::Unretained(this), device_path)));
568 device_path));
569 properties->adapter.ReplaceValue(adapter_path); 594 properties->adapter.ReplaceValue(adapter_path);
570 595
571 if (device_path == dbus::ObjectPath(kLegacyAutopairPath)) { 596 if (device_path == dbus::ObjectPath(kLegacyAutopairPath)) {
572 properties->address.ReplaceValue(kLegacyAutopairAddress); 597 properties->address.ReplaceValue(kLegacyAutopairAddress);
573 properties->bluetooth_class.ReplaceValue(kLegacyAutopairClass); 598 properties->bluetooth_class.ReplaceValue(kLegacyAutopairClass);
574 properties->name.ReplaceValue("LegacyAutopair"); 599 properties->name.ReplaceValue("LegacyAutopair");
575 properties->alias.ReplaceValue(kLegacyAutopairName); 600 properties->alias.ReplaceValue(kLegacyAutopairName);
576 601
577 std::vector<std::string> uuids; 602 std::vector<std::string> uuids;
578 uuids.push_back("00001124-0000-1000-8000-00805f9b34fb"); 603 uuids.push_back("00001124-0000-1000-8000-00805f9b34fb");
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 683
659 std::vector<std::string> uuids; 684 std::vector<std::string> uuids;
660 uuids.push_back(FakeBluetoothGattServiceClient::kHeartRateServiceUUID); 685 uuids.push_back(FakeBluetoothGattServiceClient::kHeartRateServiceUUID);
661 properties->uuids.ReplaceValue(uuids); 686 properties->uuids.ReplaceValue(uuids);
662 687
663 } else { 688 } else {
664 NOTREACHED(); 689 NOTREACHED();
665 690
666 } 691 }
667 692
668 properties_map_[device_path] = properties; 693 properties_map_.insert(device_path, properties.Pass());
669 device_list_.push_back(device_path); 694 device_list_.push_back(device_path);
670 FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_, 695 FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_,
671 DeviceAdded(device_path)); 696 DeviceAdded(device_path));
672 } 697 }
698
699 void FakeBluetoothDeviceClient::CreateDeviceWithProperties(
700 const dbus::ObjectPath& adapter_path,
701 const IncomingDeviceProperties& props) {
702 dbus::ObjectPath device_path(props.device_path);
703 if (std::find(device_list_.begin(), device_list_.end(), device_path) !=
704 device_list_.end())
705 return;
706
707 scoped_ptr<Properties> properties(
708 new Properties(base::Bind(&FakeBluetoothDeviceClient::OnPropertyChanged,
709 base::Unretained(this), device_path)));
710 properties->adapter.ReplaceValue(adapter_path);
711 properties->name.ReplaceValue(props.device_name);
712 properties->alias.ReplaceValue(props.device_alias);
713 properties->address.ReplaceValue(props.device_address);
714 properties->bluetooth_class.ReplaceValue(props.device_class);
715 properties->trusted.ReplaceValue(props.is_trusted);
716
717 if (props.is_trusted)
718 properties->paired.ReplaceValue(true);
719
720 scoped_ptr<SimulatedPairingOptions> options(new SimulatedPairingOptions);
721 options->pairing_method = props.pairing_method;
722 options->pairing_auth_token = props.pairing_auth_token;
723
724 properties_map_.insert(device_path, properties.Pass());
725 device_list_.push_back(device_path);
726 pairing_options_map_.insert(device_path, options.Pass());
727 FOR_EACH_OBSERVER(BluetoothDeviceClient::Observer, observers_,
728 DeviceAdded(device_path));
729 }
673 730
674 void FakeBluetoothDeviceClient::RemoveDevice( 731 void FakeBluetoothDeviceClient::RemoveDevice(
675 const dbus::ObjectPath& adapter_path, 732 const dbus::ObjectPath& adapter_path,
676 const dbus::ObjectPath& device_path) { 733 const dbus::ObjectPath& device_path) {
677 std::vector<dbus::ObjectPath>::iterator listiter = 734 std::vector<dbus::ObjectPath>::iterator listiter =
678 std::find(device_list_.begin(), device_list_.end(), device_path); 735 std::find(device_list_.begin(), device_list_.end(), device_path);
679 if (listiter == device_list_.end()) 736 if (listiter == device_list_.end())
680 return; 737 return;
681 738
682 PropertiesMap::iterator iter = properties_map_.find(device_path); 739 PropertiesMap::const_iterator iter = properties_map_.find(device_path);
683 Properties* properties = iter->second; 740 Properties* properties = iter->second;
684 741
685 VLOG(1) << "removing device: " << properties->alias.value(); 742 VLOG(1) << "removing device: " << properties->alias.value();
686 device_list_.erase(listiter); 743 device_list_.erase(listiter);
687 744
688 // Remove the Input interface if it exists. This should be called before the 745 // Remove the Input interface if it exists. This should be called before the
689 // BluetoothDeviceClient::Observer::DeviceRemoved because it deletes the 746 // BluetoothDeviceClient::Observer::DeviceRemoved because it deletes the
690 // BluetoothDeviceChromeOS object, including the device_path referenced here. 747 // BluetoothDeviceChromeOS object, including the device_path referenced here.
691 FakeBluetoothInputClient* fake_bluetooth_input_client = 748 FakeBluetoothInputClient* fake_bluetooth_input_client =
692 static_cast<FakeBluetoothInputClient*>( 749 static_cast<FakeBluetoothInputClient*>(
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 break; 894 break;
838 default: 895 default:
839 return; 896 return;
840 } 897 }
841 898
842 ++incoming_pairing_simulation_step_; 899 ++incoming_pairing_simulation_step_;
843 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 900 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
844 FROM_HERE, 901 FROM_HERE,
845 base::Bind(&FakeBluetoothDeviceClient::IncomingPairingSimulationTimer, 902 base::Bind(&FakeBluetoothDeviceClient::IncomingPairingSimulationTimer,
846 base::Unretained(this)), 903 base::Unretained(this)),
847 base::TimeDelta::FromMilliseconds(45 * simulation_interval_ms_)); 904 base::TimeDelta::FromMilliseconds(kSimulatedPairTimeMultiplierFortyFive *
905 simulation_interval_ms_));
848 } 906 }
849 907
850 void FakeBluetoothDeviceClient::SimulatePairing( 908 void FakeBluetoothDeviceClient::SimulatePairing(
851 const dbus::ObjectPath& object_path, 909 const dbus::ObjectPath& object_path,
852 bool incoming_request, 910 bool incoming_request,
853 const base::Closure& callback, 911 const base::Closure& callback,
854 const ErrorCallback& error_callback) { 912 const ErrorCallback& error_callback) {
855 pairing_cancelled_ = false; 913 pairing_cancelled_ = false;
856 914
857 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client = 915 FakeBluetoothAgentManagerClient* fake_bluetooth_agent_manager_client =
858 static_cast<FakeBluetoothAgentManagerClient*>( 916 static_cast<FakeBluetoothAgentManagerClient*>(
859 DBusThreadManager::Get()->GetBluetoothAgentManagerClient()); 917 DBusThreadManager::Get()->GetBluetoothAgentManagerClient());
860 FakeBluetoothAgentServiceProvider* agent_service_provider = 918 FakeBluetoothAgentServiceProvider* agent_service_provider =
861 fake_bluetooth_agent_manager_client->GetAgentServiceProvider(); 919 fake_bluetooth_agent_manager_client->GetAgentServiceProvider();
862 CHECK(agent_service_provider != NULL); 920 CHECK(agent_service_provider != NULL);
863 921
864 if (object_path == dbus::ObjectPath(kLegacyAutopairPath) || 922 // Grab the device's pairing properties.
865 object_path == dbus::ObjectPath(kConnectUnpairablePath) || 923 PairingOptionsMap::const_iterator iter =
866 object_path == dbus::ObjectPath(kUnconnectableDevicePath) || 924 pairing_options_map_.find(object_path);
867 object_path == dbus::ObjectPath(kLowEnergyPath)) {
868 // No need to call anything on the pairing delegate, just wait 3 times
869 // the interval before acting as if the other end accepted it.
870 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
871 FROM_HERE,
872 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing,
873 base::Unretained(this), object_path, callback,
874 error_callback),
875 base::TimeDelta::FromMilliseconds(3 * simulation_interval_ms_));
876 925
877 } else if (object_path == dbus::ObjectPath(kDisplayPinCodePath)) { 926 // If the device with path |object_path| has simulated pairing properties
878 // Display a Pincode, and wait 7 times the interval before acting as 927 // defined, then pair it based on its |pairing_method|.
879 // if the other end accepted it. 928 if (iter != pairing_options_map_.end()) {
880 agent_service_provider->DisplayPinCode(object_path, "123456"); 929 if (iter->second->pairing_method == kPairingMethodNone ||
930 iter->second->pairing_method == "") {
stevenjb 2015/07/31 16:49:33 nit: iter->second->pairing_method.empty()
931 // Simply pair and connect the device.
932 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
933 FROM_HERE,
934 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing,
935 base::Unretained(this), object_path, callback,
936 error_callback),
937 base::TimeDelta::FromMilliseconds(kSimulatedPairTimeMultiplierThree *
938 simulation_interval_ms_));
939 } else if (iter->second->pairing_method == kPairingMethodPinCode) {
940 // Display a Pincode, and wait 7 times the interval before acting as
stevenjb 2015/07/31 16:49:33 nit: We should remove any hard coded values from t
941 // if the other end accepted it.
942 agent_service_provider->DisplayPinCode(object_path,
943 iter->second->pairing_auth_token);
881 944
882 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 945 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
883 FROM_HERE, 946 FROM_HERE,
884 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing, 947 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing,
885 base::Unretained(this), object_path, callback, 948 base::Unretained(this), object_path, callback,
886 error_callback), 949 error_callback),
887 base::TimeDelta::FromMilliseconds(7 * simulation_interval_ms_)); 950 base::TimeDelta::FromMilliseconds(kSimulatedPairTimeMultiplierSeven *
951 simulation_interval_ms_));
952 } else if (iter->second->pairing_method == kPairingMethodPassKey) {
953 // Display a passkey, and each interval act as if another key was entered
954 // for it.
955 agent_service_provider->DisplayPasskey(
956 object_path, std::stoi(iter->second->pairing_auth_token), 0);
888 957
889 } else if (object_path == dbus::ObjectPath(kVanishingDevicePath)) { 958 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
890 // The vanishing device simulates being too far away, and thus times out. 959 FROM_HERE, base::Bind(&FakeBluetoothDeviceClient::SimulateKeypress,
891 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 960 base::Unretained(this), 1, object_path,
892 FROM_HERE, 961 callback, error_callback),
893 base::Bind(&FakeBluetoothDeviceClient::TimeoutSimulatedPairing, 962 base::TimeDelta::FromMilliseconds(simulation_interval_ms_));
894 base::Unretained(this), object_path, error_callback), 963 }
895 base::TimeDelta::FromMilliseconds(4 * simulation_interval_ms_)); 964 } else {
896 965 if (object_path == dbus::ObjectPath(kLegacyAutopairPath) ||
897 } else if (object_path == dbus::ObjectPath(kDisplayPasskeyPath)) { 966 object_path == dbus::ObjectPath(kConnectUnpairablePath) ||
898 // Display a passkey, and each interval act as if another key was entered 967 object_path == dbus::ObjectPath(kUnconnectableDevicePath) ||
899 // for it. 968 object_path == dbus::ObjectPath(kLowEnergyPath)) {
900 agent_service_provider->DisplayPasskey(object_path, 123456, 0);
901
902 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
903 FROM_HERE, base::Bind(&FakeBluetoothDeviceClient::SimulateKeypress,
904 base::Unretained(this), 1, object_path, callback,
905 error_callback),
906 base::TimeDelta::FromMilliseconds(simulation_interval_ms_));
907
908 } else if (object_path == dbus::ObjectPath(kRequestPinCodePath)) {
909 // Request a Pincode.
910 agent_service_provider->RequestPinCode(
911 object_path,
912 base::Bind(&FakeBluetoothDeviceClient::PinCodeCallback,
913 base::Unretained(this),
914 object_path,
915 callback,
916 error_callback));
917
918 } else if (object_path == dbus::ObjectPath(kConfirmPasskeyPath)) {
919 // Request confirmation of a Passkey.
920 agent_service_provider->RequestConfirmation(
921 object_path, 123456,
922 base::Bind(&FakeBluetoothDeviceClient::ConfirmationCallback,
923 base::Unretained(this),
924 object_path,
925 callback,
926 error_callback));
927
928 } else if (object_path == dbus::ObjectPath(kRequestPasskeyPath)) {
929 // Request a Passkey from the user.
930 agent_service_provider->RequestPasskey(
931 object_path,
932 base::Bind(&FakeBluetoothDeviceClient::PasskeyCallback,
933 base::Unretained(this),
934 object_path,
935 callback,
936 error_callback));
937
938 } else if (object_path == dbus::ObjectPath(kUnpairableDevicePath)) {
939 // Fails the pairing with an org.bluez.Error.Failed error.
940 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
941 FROM_HERE,
942 base::Bind(&FakeBluetoothDeviceClient::FailSimulatedPairing,
943 base::Unretained(this), object_path, error_callback),
944 base::TimeDelta::FromMilliseconds(simulation_interval_ms_));
945
946 } else if (object_path == dbus::ObjectPath(kJustWorksPath)) {
947 if (incoming_request) {
948 agent_service_provider->RequestAuthorization(
949 object_path,
950 base::Bind(&FakeBluetoothDeviceClient::ConfirmationCallback,
951 base::Unretained(this),
952 object_path,
953 callback,
954 error_callback));
955
956 } else {
957 // No need to call anything on the pairing delegate, just wait 3 times 969 // No need to call anything on the pairing delegate, just wait 3 times
958 // the interval before acting as if the other end accepted it. 970 // the interval before acting as if the other end accepted it.
959 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 971 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
960 FROM_HERE, 972 FROM_HERE,
961 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing, 973 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing,
962 base::Unretained(this), object_path, callback, 974 base::Unretained(this), object_path, callback,
963 error_callback), 975 error_callback),
964 base::TimeDelta::FromMilliseconds(3 * simulation_interval_ms_)); 976 base::TimeDelta::FromMilliseconds(kSimulatedPairTimeMultiplierThree *
977 simulation_interval_ms_));
978
979 } else if (object_path == dbus::ObjectPath(kDisplayPinCodePath)) {
980 // Display a Pincode, and wait 7 times the interval before acting as
981 // if the other end accepted it.
982 agent_service_provider->DisplayPinCode(object_path, kTestPinCode);
983
984 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
985 FROM_HERE,
986 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing,
987 base::Unretained(this), object_path, callback,
988 error_callback),
989 base::TimeDelta::FromMilliseconds(kSimulatedPairTimeMultiplierSeven *
990 simulation_interval_ms_));
991
992 } else if (object_path == dbus::ObjectPath(kVanishingDevicePath)) {
993 // The vanishing device simulates being too far away, and thus times out.
994 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
995 FROM_HERE,
996 base::Bind(&FakeBluetoothDeviceClient::TimeoutSimulatedPairing,
997 base::Unretained(this), object_path, error_callback),
998 base::TimeDelta::FromMilliseconds(kSimulatedPairTimeMultiplierFour *
999 simulation_interval_ms_));
1000
1001 } else if (object_path == dbus::ObjectPath(kDisplayPasskeyPath)) {
1002 // Display a passkey, and each interval act as if another key was entered
1003 // for it.
1004 agent_service_provider->DisplayPasskey(object_path, kTestPassKey, 0);
1005
1006 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1007 FROM_HERE, base::Bind(&FakeBluetoothDeviceClient::SimulateKeypress,
1008 base::Unretained(this), 1, object_path,
1009 callback, error_callback),
1010 base::TimeDelta::FromMilliseconds(simulation_interval_ms_));
1011
1012 } else if (object_path == dbus::ObjectPath(kRequestPinCodePath)) {
1013 // Request a Pincode.
1014 agent_service_provider->RequestPinCode(
1015 object_path, base::Bind(&FakeBluetoothDeviceClient::PinCodeCallback,
1016 base::Unretained(this), object_path, callback,
1017 error_callback));
1018
1019 } else if (object_path == dbus::ObjectPath(kConfirmPasskeyPath)) {
1020 // Request confirmation of a Passkey.
1021 agent_service_provider->RequestConfirmation(
1022 object_path, kTestPassKey,
1023 base::Bind(&FakeBluetoothDeviceClient::ConfirmationCallback,
1024 base::Unretained(this), object_path, callback,
1025 error_callback));
1026
1027 } else if (object_path == dbus::ObjectPath(kRequestPasskeyPath)) {
1028 // Request a Passkey from the user.
1029 agent_service_provider->RequestPasskey(
1030 object_path, base::Bind(&FakeBluetoothDeviceClient::PasskeyCallback,
1031 base::Unretained(this), object_path, callback,
1032 error_callback));
1033
1034 } else if (object_path == dbus::ObjectPath(kUnpairableDevicePath)) {
1035 // Fails the pairing with an org.bluez.Error.Failed error.
1036 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1037 FROM_HERE,
1038 base::Bind(&FakeBluetoothDeviceClient::FailSimulatedPairing,
1039 base::Unretained(this), object_path, error_callback),
1040 base::TimeDelta::FromMilliseconds(simulation_interval_ms_));
1041
1042 } else if (object_path == dbus::ObjectPath(kJustWorksPath)) {
1043 if (incoming_request) {
1044 agent_service_provider->RequestAuthorization(
1045 object_path,
1046 base::Bind(&FakeBluetoothDeviceClient::ConfirmationCallback,
1047 base::Unretained(this), object_path, callback,
1048 error_callback));
1049
1050 } else {
1051 // No need to call anything on the pairing delegate, just wait 3 times
1052 // the interval before acting as if the other end accepted it.
1053 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1054 FROM_HERE,
1055 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing,
1056 base::Unretained(this), object_path, callback,
1057 error_callback),
1058 base::TimeDelta::FromMilliseconds(
1059 kSimulatedPairTimeMultiplierThree * simulation_interval_ms_));
1060 }
1061
1062 } else {
1063 error_callback.Run(kNoResponseError, "No pairing fake");
965 } 1064 }
966
967 } else {
968 error_callback.Run(kNoResponseError, "No pairing fake");
969 } 1065 }
970 } 1066 }
971 1067
972 void FakeBluetoothDeviceClient::CompleteSimulatedPairing( 1068 void FakeBluetoothDeviceClient::CompleteSimulatedPairing(
973 const dbus::ObjectPath& object_path, 1069 const dbus::ObjectPath& object_path,
974 const base::Closure& callback, 1070 const base::Closure& callback,
975 const ErrorCallback& error_callback) { 1071 const ErrorCallback& error_callback) {
976 VLOG(1) << "CompleteSimulatedPairing: " << object_path.value(); 1072 VLOG(1) << "CompleteSimulatedPairing: " << object_path.value();
977 if (pairing_cancelled_) { 1073 if (pairing_cancelled_) {
978 pairing_cancelled_ = false; 1074 pairing_cancelled_ = false;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 static_cast<FakeBluetoothInputClient*>( 1129 static_cast<FakeBluetoothInputClient*>(
1034 DBusThreadManager::Get()->GetBluetoothInputClient()); 1130 DBusThreadManager::Get()->GetBluetoothInputClient());
1035 1131
1036 if ((properties->bluetooth_class.value() & 0x001f03) == 0x000500) 1132 if ((properties->bluetooth_class.value() & 0x001f03) == 0x000500)
1037 fake_bluetooth_input_client->AddInputDevice(object_path); 1133 fake_bluetooth_input_client->AddInputDevice(object_path);
1038 } 1134 }
1039 1135
1040 void FakeBluetoothDeviceClient::UpdateDeviceRSSI( 1136 void FakeBluetoothDeviceClient::UpdateDeviceRSSI(
1041 const dbus::ObjectPath& object_path, 1137 const dbus::ObjectPath& object_path,
1042 int16 rssi) { 1138 int16 rssi) {
1043 PropertiesMap::iterator iter = properties_map_.find(object_path); 1139 PropertiesMap::const_iterator iter = properties_map_.find(object_path);
1044 if (iter == properties_map_.end()) { 1140 if (iter == properties_map_.end()) {
1045 VLOG(2) << "Fake device does not exist: " << object_path.value(); 1141 VLOG(2) << "Fake device does not exist: " << object_path.value();
1046 return; 1142 return;
1047 } 1143 }
1048 Properties* properties = iter->second; 1144 Properties* properties = iter->second;
1049 DCHECK(properties); 1145 DCHECK(properties);
1050 properties->rssi.ReplaceValue(rssi); 1146 properties->rssi.ReplaceValue(rssi);
1051 } 1147 }
1052 1148
1053 void FakeBluetoothDeviceClient::UpdateConnectionInfo( 1149 void FakeBluetoothDeviceClient::UpdateConnectionInfo(
(...skipping 12 matching lines...) Expand all
1066 BluetoothAgentServiceProvider::Delegate::Status status, 1162 BluetoothAgentServiceProvider::Delegate::Status status,
1067 const std::string& pincode) { 1163 const std::string& pincode) {
1068 VLOG(1) << "PinCodeCallback: " << object_path.value(); 1164 VLOG(1) << "PinCodeCallback: " << object_path.value();
1069 1165
1070 if (status == BluetoothAgentServiceProvider::Delegate::SUCCESS) { 1166 if (status == BluetoothAgentServiceProvider::Delegate::SUCCESS) {
1071 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1167 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1072 FROM_HERE, 1168 FROM_HERE,
1073 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing, 1169 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing,
1074 base::Unretained(this), object_path, callback, 1170 base::Unretained(this), object_path, callback,
1075 error_callback), 1171 error_callback),
1076 base::TimeDelta::FromMilliseconds(3 * simulation_interval_ms_)); 1172 base::TimeDelta::FromMilliseconds(kSimulatedPairTimeMultiplierThree *
1173 simulation_interval_ms_));
1077 1174
1078 } else if (status == BluetoothAgentServiceProvider::Delegate::CANCELLED) { 1175 } else if (status == BluetoothAgentServiceProvider::Delegate::CANCELLED) {
1079 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1176 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1080 FROM_HERE, 1177 FROM_HERE,
1081 base::Bind(&FakeBluetoothDeviceClient::CancelSimulatedPairing, 1178 base::Bind(&FakeBluetoothDeviceClient::CancelSimulatedPairing,
1082 base::Unretained(this), object_path, error_callback), 1179 base::Unretained(this), object_path, error_callback),
1083 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); 1180 base::TimeDelta::FromMilliseconds(simulation_interval_ms_));
1084 1181
1085 } else if (status == BluetoothAgentServiceProvider::Delegate::REJECTED) { 1182 } else if (status == BluetoothAgentServiceProvider::Delegate::REJECTED) {
1086 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1183 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
(...skipping 11 matching lines...) Expand all
1098 BluetoothAgentServiceProvider::Delegate::Status status, 1195 BluetoothAgentServiceProvider::Delegate::Status status,
1099 uint32 passkey) { 1196 uint32 passkey) {
1100 VLOG(1) << "PasskeyCallback: " << object_path.value(); 1197 VLOG(1) << "PasskeyCallback: " << object_path.value();
1101 1198
1102 if (status == BluetoothAgentServiceProvider::Delegate::SUCCESS) { 1199 if (status == BluetoothAgentServiceProvider::Delegate::SUCCESS) {
1103 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1200 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1104 FROM_HERE, 1201 FROM_HERE,
1105 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing, 1202 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing,
1106 base::Unretained(this), object_path, callback, 1203 base::Unretained(this), object_path, callback,
1107 error_callback), 1204 error_callback),
1108 base::TimeDelta::FromMilliseconds(3 * simulation_interval_ms_)); 1205 base::TimeDelta::FromMilliseconds(kSimulatedPairTimeMultiplierThree *
1206 simulation_interval_ms_));
1109 1207
1110 } else if (status == BluetoothAgentServiceProvider::Delegate::CANCELLED) { 1208 } else if (status == BluetoothAgentServiceProvider::Delegate::CANCELLED) {
1111 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1209 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1112 FROM_HERE, 1210 FROM_HERE,
1113 base::Bind(&FakeBluetoothDeviceClient::CancelSimulatedPairing, 1211 base::Bind(&FakeBluetoothDeviceClient::CancelSimulatedPairing,
1114 base::Unretained(this), object_path, error_callback), 1212 base::Unretained(this), object_path, error_callback),
1115 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); 1213 base::TimeDelta::FromMilliseconds(simulation_interval_ms_));
1116 1214
1117 } else if (status == BluetoothAgentServiceProvider::Delegate::REJECTED) { 1215 } else if (status == BluetoothAgentServiceProvider::Delegate::REJECTED) {
1118 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1216 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
(...skipping 10 matching lines...) Expand all
1129 const ErrorCallback& error_callback, 1227 const ErrorCallback& error_callback,
1130 BluetoothAgentServiceProvider::Delegate::Status status) { 1228 BluetoothAgentServiceProvider::Delegate::Status status) {
1131 VLOG(1) << "ConfirmationCallback: " << object_path.value(); 1229 VLOG(1) << "ConfirmationCallback: " << object_path.value();
1132 1230
1133 if (status == BluetoothAgentServiceProvider::Delegate::SUCCESS) { 1231 if (status == BluetoothAgentServiceProvider::Delegate::SUCCESS) {
1134 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1232 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1135 FROM_HERE, 1233 FROM_HERE,
1136 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing, 1234 base::Bind(&FakeBluetoothDeviceClient::CompleteSimulatedPairing,
1137 base::Unretained(this), object_path, callback, 1235 base::Unretained(this), object_path, callback,
1138 error_callback), 1236 error_callback),
1139 base::TimeDelta::FromMilliseconds(3 * simulation_interval_ms_)); 1237 base::TimeDelta::FromMilliseconds(kSimulatedPairTimeMultiplierThree *
1238 simulation_interval_ms_));
1140 1239
1141 } else if (status == BluetoothAgentServiceProvider::Delegate::CANCELLED) { 1240 } else if (status == BluetoothAgentServiceProvider::Delegate::CANCELLED) {
1142 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1241 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1143 FROM_HERE, 1242 FROM_HERE,
1144 base::Bind(&FakeBluetoothDeviceClient::CancelSimulatedPairing, 1243 base::Bind(&FakeBluetoothDeviceClient::CancelSimulatedPairing,
1145 base::Unretained(this), object_path, error_callback), 1244 base::Unretained(this), object_path, error_callback),
1146 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); 1245 base::TimeDelta::FromMilliseconds(simulation_interval_ms_));
1147 1246
1148 } else if (status == BluetoothAgentServiceProvider::Delegate::REJECTED) { 1247 } else if (status == BluetoothAgentServiceProvider::Delegate::REJECTED) {
1149 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1248 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
(...skipping 15 matching lines...) Expand all
1165 static_cast<FakeBluetoothAgentManagerClient*>( 1264 static_cast<FakeBluetoothAgentManagerClient*>(
1166 DBusThreadManager::Get()->GetBluetoothAgentManagerClient()); 1265 DBusThreadManager::Get()->GetBluetoothAgentManagerClient());
1167 FakeBluetoothAgentServiceProvider* agent_service_provider = 1266 FakeBluetoothAgentServiceProvider* agent_service_provider =
1168 fake_bluetooth_agent_manager_client->GetAgentServiceProvider(); 1267 fake_bluetooth_agent_manager_client->GetAgentServiceProvider();
1169 1268
1170 // The agent service provider object could have been destroyed after the 1269 // The agent service provider object could have been destroyed after the
1171 // pairing is canceled. 1270 // pairing is canceled.
1172 if (!agent_service_provider) 1271 if (!agent_service_provider)
1173 return; 1272 return;
1174 1273
1175 agent_service_provider->DisplayPasskey(object_path, 123456, entered); 1274 agent_service_provider->DisplayPasskey(object_path, kTestPassKey, entered);
1176 1275
1177 if (entered < 7) { 1276 if (entered < 7) {
1178 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1277 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1179 FROM_HERE, base::Bind(&FakeBluetoothDeviceClient::SimulateKeypress, 1278 FROM_HERE, base::Bind(&FakeBluetoothDeviceClient::SimulateKeypress,
1180 base::Unretained(this), entered + 1, object_path, 1279 base::Unretained(this), entered + 1, object_path,
1181 callback, error_callback), 1280 callback, error_callback),
1182 base::TimeDelta::FromMilliseconds(simulation_interval_ms_)); 1281 base::TimeDelta::FromMilliseconds(simulation_interval_ms_));
1183 1282
1184 } else { 1283 } else {
1185 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1284 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 // TODO(keybuk): tear down this side of the connection 1319 // TODO(keybuk): tear down this side of the connection
1221 callback.Run(); 1320 callback.Run();
1222 } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) { 1321 } else if (status == BluetoothProfileServiceProvider::Delegate::CANCELLED) {
1223 error_callback.Run(bluetooth_device::kErrorFailed, "Canceled"); 1322 error_callback.Run(bluetooth_device::kErrorFailed, "Canceled");
1224 } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) { 1323 } else if (status == BluetoothProfileServiceProvider::Delegate::REJECTED) {
1225 error_callback.Run(bluetooth_device::kErrorFailed, "Rejected"); 1324 error_callback.Run(bluetooth_device::kErrorFailed, "Rejected");
1226 } 1325 }
1227 } 1326 }
1228 1327
1229 } // namespace chromeos 1328 } // namespace chromeos
OLDNEW
« chromeos/dbus/fake_bluetooth_device_client.h ('K') | « chromeos/dbus/fake_bluetooth_device_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698