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

Side by Side Diff: device/bluetooth/dbus/fake_bluetooth_device_client.cc

Issue 2908673002: device/blueooth: Add BlueZ unit test for BluetoothDevice::SetConnectionInterval. (Closed)
Patch Set: Created 3 years, 7 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 "device/bluetooth/dbus/fake_bluetooth_device_client.h" 5 #include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 594
595 callback.Run(connection_rssi_, transmit_power_, max_transmit_power_); 595 callback.Run(connection_rssi_, transmit_power_, max_transmit_power_);
596 } 596 }
597 597
598 void FakeBluetoothDeviceClient::SetLEConnectionParameters( 598 void FakeBluetoothDeviceClient::SetLEConnectionParameters(
599 const dbus::ObjectPath& object_path, 599 const dbus::ObjectPath& object_path,
600 const ConnectionParameters& conn_params, 600 const ConnectionParameters& conn_params,
601 const base::Closure& callback, 601 const base::Closure& callback,
602 const ErrorCallback& error_callback) { 602 const ErrorCallback& error_callback) {
603 Properties* properties = GetProperties(object_path); 603 Properties* properties = GetProperties(object_path);
604 if (!properties->connected.value()) { 604 if (properties->type.value() == kTypeBredr) {
ortuno 2017/05/26 16:54:36 I'm not that familiar with type as is not in upstr
Tim Song 2017/05/26 19:56:18 This property is exposed by the org.bluez.Device1
ortuno 2017/05/26 19:59:50 It's optional though so it could still be invalid.
Miao 2017/05/31 20:14:06 Device Type is a CHROMIUM specific patch that upst
Tim Song 2017/06/01 18:06:03 Done. I added the validity check.
605 error_callback.Run(bluetooth_device::kErrorNotConnected, "Not Connected"); 605 error_callback.Run(bluetooth_device::kErrorFailed,
606 "BR/EDR devices not supported");
ortuno 2017/05/26 16:54:36 Should the call still work for non-connected devic
Tim Song 2017/05/26 19:56:18 Yes. One of the principle use cases is to set the
Miao 2017/05/31 20:14:06 The connection parameters can be set BEFORE or DUR
Tim Song 2017/06/01 18:06:02 Acknowledged.
606 return; 607 return;
607 } 608 }
608 609
609 callback.Run(); 610 callback.Run();
610 } 611 }
611 612
612 void FakeBluetoothDeviceClient::GetServiceRecords( 613 void FakeBluetoothDeviceClient::GetServiceRecords(
613 const dbus::ObjectPath& object_path, 614 const dbus::ObjectPath& object_path,
614 const ServiceRecordsCallback& callback, 615 const ServiceRecordsCallback& callback,
615 const ErrorCallback& error_callback) { 616 const ErrorCallback& error_callback) {
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 properties->service_data.set_valid(true); 1860 properties->service_data.set_valid(true);
1860 } 1861 }
1861 1862
1862 properties_map_.insert(std::make_pair(device_path, std::move(properties))); 1863 properties_map_.insert(std::make_pair(device_path, std::move(properties)));
1863 device_list_.push_back(device_path); 1864 device_list_.push_back(device_path);
1864 for (auto& observer : observers_) 1865 for (auto& observer : observers_)
1865 observer.DeviceAdded(device_path); 1866 observer.DeviceAdded(device_path);
1866 } 1867 }
1867 1868
1868 } // namespace bluez 1869 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698