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

Side by Side Diff: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc

Issue 2637343002: Implement WebBluetooth descriptor.readValue() (Closed)
Patch Set: #2 Created 3 years, 11 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 "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provid er.h" 5 #include "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provid er.h"
6 6
7 #include <utility> 7 #include <utility>
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 const char kHeartRateMeasurementUUID[] = "2a37"; 90 const char kHeartRateMeasurementUUID[] = "2a37";
91 const char kSerialNumberStringUUID[] = "2a25"; 91 const char kSerialNumberStringUUID[] = "2a25";
92 const char kPeripheralPrivacyFlagUUID[] = "2a02"; 92 const char kPeripheralPrivacyFlagUUID[] = "2a02";
93 // Descriptors: 93 // Descriptors:
94 const char kUserDescriptionUUID[] = "2901"; 94 const char kUserDescriptionUUID[] = "2901";
95 // Client Config is in our blocklist. It must not be writable 95 // Client Config is in our blocklist. It must not be writable
96 const char kClientConfigUUID[] = "2902"; 96 const char kClientConfigUUID[] = "2902";
97 // Blocklisted descriptor 97 // Blocklisted descriptor
98 const char kBlocklistedDescriptorUUID[] = 98 const char kBlocklistedDescriptorUUID[] =
99 "bad2ddcf-60db-45cd-bef9-fd72b153cf7c"; 99 "bad2ddcf-60db-45cd-bef9-fd72b153cf7c";
100 const char kCharacteristicUserDescription[] =
101 "gatt.characteristic_user_description";
100 102
101 // Invokes Run() on the k-th argument of the function with no arguments. 103 // Invokes Run() on the k-th argument of the function with no arguments.
102 ACTION_TEMPLATE(RunCallback, 104 ACTION_TEMPLATE(RunCallback,
103 HAS_1_TEMPLATE_PARAMS(int, k), 105 HAS_1_TEMPLATE_PARAMS(int, k),
104 AND_0_VALUE_PARAMS()) { 106 AND_0_VALUE_PARAMS()) {
105 return ::testing::get<k>(args).Run(); 107 return ::testing::get<k>(args).Run();
106 } 108 }
107 109
108 // Invokes Run() on the k-th argument of the function with 1 argument. 110 // Invokes Run() on the k-th argument of the function with 1 argument.
109 ACTION_TEMPLATE(RunCallback, 111 ACTION_TEMPLATE(RunCallback,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 observer.GattServicesDiscovered(adapter, device); 155 observer.GattServicesDiscovered(adapter, device);
154 } 156 }
155 157
156 // Notifies the adapter's observers that a device has changed. 158 // Notifies the adapter's observers that a device has changed.
157 void NotifyDeviceChanged(MockBluetoothAdapter* adapter, 159 void NotifyDeviceChanged(MockBluetoothAdapter* adapter,
158 MockBluetoothDevice* device) { 160 MockBluetoothDevice* device) {
159 for (auto& observer : adapter->GetObservers()) 161 for (auto& observer : adapter->GetObservers())
160 observer.DeviceChanged(adapter, device); 162 observer.DeviceChanged(adapter, device);
161 } 163 }
162 164
163 void PerformReadValue( 165 void PerformCharacteristicReadValue(
164 MockBluetoothAdapter* adapter, 166 MockBluetoothAdapter* adapter,
165 MockBluetoothGattCharacteristic* characteristic, 167 MockBluetoothGattCharacteristic* characteristic,
166 const BluetoothRemoteGattCharacteristic::ValueCallback& callback, 168 const BluetoothRemoteGattCharacteristic::ValueCallback& callback,
167 const std::vector<uint8_t>& value) { 169 const std::vector<uint8_t>& value) {
168 for (auto& observer : adapter->GetObservers()) { 170 for (auto& observer : adapter->GetObservers()) {
169 observer.GattCharacteristicValueChanged(adapter, characteristic, value); 171 observer.GattCharacteristicValueChanged(adapter, characteristic, value);
170 } 172 }
171 callback.Run(value); 173 callback.Run(value);
172 } 174 }
173 175
176 void PerformDescriptorReadValue(
177 MockBluetoothAdapter* adapter,
178 MockBluetoothGattDescriptor* descriptor,
179 const BluetoothRemoteGattDescriptor::ValueCallback& callback,
180 const std::vector<uint8_t>& value) {
181 for (auto& observer : adapter->GetObservers()) {
182 observer.GattDescriptorValueChanged(adapter, descriptor, value);
183 }
184 callback.Run(value);
185 }
186
174 } // namespace 187 } // namespace
175 188
176 namespace content { 189 namespace content {
177 190
178 // static 191 // static
179 scoped_refptr<BluetoothAdapter> 192 scoped_refptr<BluetoothAdapter>
180 LayoutTestBluetoothAdapterProvider::GetBluetoothAdapter( 193 LayoutTestBluetoothAdapterProvider::GetBluetoothAdapter(
181 const std::string& fake_adapter_name) { 194 const std::string& fake_adapter_name) {
182 if (fake_adapter_name == "BaseAdapter") 195 if (fake_adapter_name == "BaseAdapter")
183 return GetBaseAdapter(); 196 return GetBaseAdapter();
(...skipping 25 matching lines...) Expand all
209 return GetNoNameDeviceAdapter(); 222 return GetNoNameDeviceAdapter();
210 if (fake_adapter_name == "EmptyNameHeartRateAdapter") 223 if (fake_adapter_name == "EmptyNameHeartRateAdapter")
211 return GetEmptyNameHeartRateAdapter(); 224 return GetEmptyNameHeartRateAdapter();
212 if (fake_adapter_name == "NoNameHeartRateAdapter") 225 if (fake_adapter_name == "NoNameHeartRateAdapter")
213 return GetNoNameHeartRateAdapter(); 226 return GetNoNameHeartRateAdapter();
214 if (fake_adapter_name == "TwoHeartRateServicesAdapter") 227 if (fake_adapter_name == "TwoHeartRateServicesAdapter")
215 return GetTwoHeartRateServicesAdapter(); 228 return GetTwoHeartRateServicesAdapter();
216 if (fake_adapter_name == "DisconnectingHeartRateAdapter") 229 if (fake_adapter_name == "DisconnectingHeartRateAdapter")
217 return GetDisconnectingHeartRateAdapter(); 230 return GetDisconnectingHeartRateAdapter();
218 if (fake_adapter_name == "DisconnectingHealthThermometerAdapter") 231 if (fake_adapter_name == "DisconnectingHealthThermometerAdapter")
219 return GetDisconnectingHealthThermometer(); 232 return GetDisconnectingHealthThermometer(true);
233 if (fake_adapter_name ==
234 "MissingDescriptorsDisconnectingHealthThermometerAdapter")
235 return GetDisconnectingHealthThermometer(false);
220 if (fake_adapter_name == "DisconnectingDuringServiceRetrievalAdapter") 236 if (fake_adapter_name == "DisconnectingDuringServiceRetrievalAdapter")
221 return GetServicesDiscoveredAfterReconnectionAdapter(true /* disconnect */); 237 return GetServicesDiscoveredAfterReconnectionAdapter(true /* disconnect */);
222 if (fake_adapter_name == "ServicesDiscoveredAfterReconnectionAdapter") 238 if (fake_adapter_name == "ServicesDiscoveredAfterReconnectionAdapter")
223 return GetServicesDiscoveredAfterReconnectionAdapter( 239 return GetServicesDiscoveredAfterReconnectionAdapter(
224 false /* disconnect */); 240 false /* disconnect */);
225 if (fake_adapter_name == "DisconnectingDuringSuccessGATTOperationAdapter") { 241 if (fake_adapter_name == "DisconnectingDuringSuccessGATTOperationAdapter") {
226 return GetGATTOperationFinishesAfterReconnectionAdapter( 242 return GetGATTOperationFinishesAfterReconnectionAdapter(
227 true /* disconnect */, true /* succeeds */); 243 true /* disconnect */, true /* succeeds */);
228 } 244 }
229 if (fake_adapter_name == "DisconnectingDuringFailureGATTOperationAdapter") { 245 if (fake_adapter_name == "DisconnectingDuringFailureGATTOperationAdapter") {
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 // See: http://crbug.com/529975 688 // See: http://crbug.com/529975
673 689
674 device->AddMockService(GetGenericAccessService(device.get())); 690 device->AddMockService(GetGenericAccessService(device.get()));
675 device->AddMockService(GetHeartRateService(adapter.get(), device.get())); 691 device->AddMockService(GetHeartRateService(adapter.get(), device.get()));
676 adapter->AddMockDevice(std::move(device)); 692 adapter->AddMockDevice(std::move(device));
677 return adapter; 693 return adapter;
678 } 694 }
679 695
680 // static 696 // static
681 scoped_refptr<NiceMockBluetoothAdapter> 697 scoped_refptr<NiceMockBluetoothAdapter>
682 LayoutTestBluetoothAdapterProvider::GetDisconnectingHealthThermometer() { 698 LayoutTestBluetoothAdapterProvider::GetDisconnectingHealthThermometer(
699 bool addDescriptors) {
683 scoped_refptr<NiceMockBluetoothAdapter> adapter(GetEmptyAdapter()); 700 scoped_refptr<NiceMockBluetoothAdapter> adapter(GetEmptyAdapter());
684 NiceMockBluetoothAdapter* adapter_ptr = adapter.get(); 701 NiceMockBluetoothAdapter* adapter_ptr = adapter.get();
685 702
686 auto device(GetConnectableDevice( 703 auto device(GetConnectableDevice(
687 adapter_ptr, "Disconnecting Health Thermometer", 704 adapter_ptr, "Disconnecting Health Thermometer",
688 std::vector<BluetoothUUID>({BluetoothUUID(kGenericAccessServiceUUID), 705 std::vector<BluetoothUUID>({BluetoothUUID(kGenericAccessServiceUUID),
689 BluetoothUUID(kHealthThermometerUUID)}))); 706 BluetoothUUID(kHealthThermometerUUID)})));
690 707
691 device->AddMockService(GetGenericAccessService(device.get())); 708 device->AddMockService(GetGenericAccessService(device.get()));
692 device->AddMockService(GetDisconnectingService(adapter.get(), device.get())); 709 device->AddMockService(GetDisconnectingService(adapter.get(), device.get()));
(...skipping 24 matching lines...) Expand all
717 734
718 ON_CALL(*measurement_interval, WriteRemoteCharacteristic(_, _, _)) 735 ON_CALL(*measurement_interval, WriteRemoteCharacteristic(_, _, _))
719 .WillByDefault(RunCallback<1 /* success_callback */>()); 736 .WillByDefault(RunCallback<1 /* success_callback */>());
720 737
721 ON_CALL(*measurement_interval, StartNotifySession(_, _)) 738 ON_CALL(*measurement_interval, StartNotifySession(_, _))
722 .WillByDefault( 739 .WillByDefault(
723 RunCallbackWithResult<0 /* success_callback */>([measurement_ptr]() { 740 RunCallbackWithResult<0 /* success_callback */>([measurement_ptr]() {
724 return GetBaseGATTNotifySession(measurement_ptr->GetWeakPtr()); 741 return GetBaseGATTNotifySession(measurement_ptr->GetWeakPtr());
725 })); 742 }));
726 743
727 auto user_description = base::MakeUnique<NiceMockBluetoothGattDescriptor>( 744 if (addDescriptors == true) {
ortuno 2017/01/22 22:04:04 nit: no need for == true.
dougt 2017/01/23 21:40:35 Done.
728 measurement_interval.get(), "gatt.characteristic_user_description", 745 std::string descriptorName = kCharacteristicUserDescription;
ortuno 2017/01/22 22:04:04 nit: const std::string.
dougt 2017/01/23 21:40:35 Done.
729 BluetoothUUID(kUserDescriptionUUID), false, 746 auto user_description = base::MakeUnique<NiceMockBluetoothGattDescriptor>(
730 device::BluetoothRemoteGattCharacteristic::PROPERTY_READ); 747 measurement_interval.get(), descriptorName,
748 BluetoothUUID(kUserDescriptionUUID), false,
ortuno 2017/01/22 22:04:04 nit: false /* is_local */
dougt 2017/01/23 21:40:35 Done.
749 device::BluetoothRemoteGattCharacteristic::PROPERTY_READ);
731 750
732 auto client_config = base::MakeUnique<NiceMockBluetoothGattDescriptor>( 751 ON_CALL(*user_description, ReadRemoteDescriptor(_, _))
733 measurement_interval.get(), "gatt.client_characteristic_configuration", 752 .WillByDefault(Invoke([descriptorName](
734 BluetoothUUID(kClientConfigUUID), false, 753 const BluetoothRemoteGattDescriptor::ValueCallback& callback,
735 device::BluetoothRemoteGattCharacteristic::PROPERTY_READ | 754 const BluetoothRemoteGattDescriptor::ErrorCallback&) {
736 device::BluetoothRemoteGattCharacteristic::PROPERTY_WRITE); 755 std::vector<uint8_t> value(descriptorName.begin(),
ortuno 2017/01/22 22:04:04 optional: I think you would end up with less code
dougt 2017/01/23 21:40:35 Acknowledged.
756 descriptorName.end());
757 callback.Run(value);
758 }));
737 759
738 // Add it here with full permission as the blocklist should prevent us from 760 auto client_config = base::MakeUnique<NiceMockBluetoothGattDescriptor>(
739 // accessing this descriptor 761 measurement_interval.get(), "gatt.client_characteristic_configuration",
740 auto blocklisted_descriptor = 762 BluetoothUUID(kClientConfigUUID), false,
ortuno 2017/01/22 22:04:04 nit: false /* is_local */
dougt 2017/01/23 21:40:35 Done.
741 base::MakeUnique<NiceMockBluetoothGattDescriptor>( 763 device::BluetoothRemoteGattCharacteristic::PROPERTY_READ |
742 measurement_interval.get(), "bad2ddcf-60db-45cd-bef9-fd72b153cf7c", 764 device::BluetoothRemoteGattCharacteristic::PROPERTY_WRITE);
743 BluetoothUUID(kBlocklistedDescriptorUUID), false,
744 device::BluetoothRemoteGattCharacteristic::PROPERTY_READ |
745 device::BluetoothRemoteGattCharacteristic::PROPERTY_WRITE);
746 765
747 measurement_interval->AddMockDescriptor(std::move(user_description)); 766 // Add it here with full permission as the blocklist should prevent us from
748 measurement_interval->AddMockDescriptor(std::move(client_config)); 767 // accessing this descriptor
749 measurement_interval->AddMockDescriptor(std::move(blocklisted_descriptor)); 768 auto blocklisted_descriptor =
769 base::MakeUnique<NiceMockBluetoothGattDescriptor>(
770 measurement_interval.get(), "bad2ddcf-60db-45cd-bef9-fd72b153cf7c",
771 BluetoothUUID(kBlocklistedDescriptorUUID), false,
772 device::BluetoothRemoteGattCharacteristic::PROPERTY_READ |
773 device::BluetoothRemoteGattCharacteristic::PROPERTY_WRITE);
750 774
ortuno 2017/01/22 22:04:04 optional: What do you think about adding a ON_CALL
dougt 2017/01/23 21:40:35 I'll add a separate descriptor for blocklist testi
775 measurement_interval->AddMockDescriptor(std::move(user_description));
776 measurement_interval->AddMockDescriptor(std::move(client_config));
777 measurement_interval->AddMockDescriptor(std::move(blocklisted_descriptor));
778 }
751 health_thermometer->AddMockCharacteristic(std::move(measurement_interval)); 779 health_thermometer->AddMockCharacteristic(std::move(measurement_interval));
752 device->AddMockService(std::move(health_thermometer)); 780 device->AddMockService(std::move(health_thermometer));
753 781
754 adapter->AddMockDevice(std::move(device)); 782 adapter->AddMockDevice(std::move(device));
755 783
756 return adapter; 784 return adapter;
757 } 785 }
758 786
759 // static 787 // static
760 scoped_refptr<NiceMockBluetoothAdapter> 788 scoped_refptr<NiceMockBluetoothAdapter>
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 measurement_interval.get(); 1008 measurement_interval.get();
981 1009
982 ON_CALL(*measurement_interval, ReadRemoteCharacteristic(_, _)) 1010 ON_CALL(*measurement_interval, ReadRemoteCharacteristic(_, _))
983 .WillByDefault(Invoke([adapter_ptr, device_ptr, measurement_ptr, 1011 .WillByDefault(Invoke([adapter_ptr, device_ptr, measurement_ptr,
984 disconnect, succeeds]( 1012 disconnect, succeeds](
985 const BluetoothRemoteGattCharacteristic::ValueCallback& callback, 1013 const BluetoothRemoteGattCharacteristic::ValueCallback& callback,
986 const BluetoothRemoteGattCharacteristic::ErrorCallback& 1014 const BluetoothRemoteGattCharacteristic::ErrorCallback&
987 error_callback) { 1015 error_callback) {
988 base::Closure pending; 1016 base::Closure pending;
989 if (succeeds) { 1017 if (succeeds) {
990 pending = 1018 pending = base::Bind(&PerformCharacteristicReadValue,
991 base::Bind(&PerformReadValue, base::RetainedRef(adapter_ptr), 1019 base::RetainedRef(adapter_ptr), measurement_ptr,
992 measurement_ptr, callback, std::vector<uint8_t>({1})); 1020 callback, std::vector<uint8_t>({1}));
993 } else { 1021 } else {
994 pending = base::Bind(error_callback, 1022 pending = base::Bind(error_callback,
995 BluetoothRemoteGattService::GATT_ERROR_FAILED); 1023 BluetoothRemoteGattService::GATT_ERROR_FAILED);
996 } 1024 }
997 device_ptr->PushPendingCallback(pending); 1025 device_ptr->PushPendingCallback(pending);
998 if (disconnect) { 1026 if (disconnect) {
999 device_ptr->SetConnected(false); 1027 device_ptr->SetConnected(false);
1000 base::ThreadTaskRunnerHandle::Get()->PostTask( 1028 base::ThreadTaskRunnerHandle::Get()->PostTask(
1001 FROM_HERE, 1029 FROM_HERE,
1002 base::Bind(&NotifyDeviceChanged, base::RetainedRef(adapter_ptr), 1030 base::Bind(&NotifyDeviceChanged, base::RetainedRef(adapter_ptr),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 device_ptr->PushPendingCallback(pending); 1072 device_ptr->PushPendingCallback(pending);
1045 if (disconnect) { 1073 if (disconnect) {
1046 device_ptr->SetConnected(false); 1074 device_ptr->SetConnected(false);
1047 base::ThreadTaskRunnerHandle::Get()->PostTask( 1075 base::ThreadTaskRunnerHandle::Get()->PostTask(
1048 FROM_HERE, 1076 FROM_HERE,
1049 base::Bind(&NotifyDeviceChanged, base::RetainedRef(adapter_ptr), 1077 base::Bind(&NotifyDeviceChanged, base::RetainedRef(adapter_ptr),
1050 device_ptr)); 1078 device_ptr));
1051 } 1079 }
1052 })); 1080 }));
1053 1081
1082 auto user_descriptor = base::MakeUnique<NiceMockBluetoothGattDescriptor>(
1083 measurement_interval.get(), kCharacteristicUserDescription,
1084 BluetoothUUID(kUserDescriptionUUID), false,
1085 device::BluetoothRemoteGattCharacteristic::PROPERTY_READ);
1086
1087 NiceMockBluetoothGattDescriptor* user_descriptor_ptr = user_descriptor.get();
1088 ON_CALL(*user_descriptor, ReadRemoteDescriptor(_, _))
1089 .WillByDefault(Invoke([adapter_ptr, device_ptr, user_descriptor_ptr,
1090 disconnect, succeeds](
1091 const BluetoothRemoteGattDescriptor::ValueCallback& callback,
1092 const BluetoothRemoteGattDescriptor::ErrorCallback& error_callback) {
1093 base::Closure pending;
1094 if (succeeds) {
1095 pending = base::Bind(
1096 &PerformDescriptorReadValue, base::RetainedRef(adapter_ptr),
1097 user_descriptor_ptr, callback, std::vector<uint8_t>({1}));
1098 } else {
1099 pending = base::Bind(error_callback,
1100 BluetoothRemoteGattService::GATT_ERROR_FAILED);
1101 }
1102 device_ptr->PushPendingCallback(pending);
1103 if (disconnect) {
1104 device_ptr->SetConnected(false);
1105 base::ThreadTaskRunnerHandle::Get()->PostTask(
1106 FROM_HERE,
1107 base::Bind(&NotifyDeviceChanged, base::RetainedRef(adapter_ptr),
1108 device_ptr));
1109 }
1110 }));
1111
1112 measurement_interval->AddMockDescriptor(std::move(user_descriptor));
1113
1054 health_thermometer->AddMockCharacteristic(std::move(measurement_interval)); 1114 health_thermometer->AddMockCharacteristic(std::move(measurement_interval));
1055 device->AddMockService(std::move(health_thermometer)); 1115 device->AddMockService(std::move(health_thermometer));
1056 adapter->AddMockDevice(std::move(device)); 1116 adapter->AddMockDevice(std::move(device));
1057 return adapter; 1117 return adapter;
1058 } 1118 }
1059 1119
1060 // static 1120 // static
1061 scoped_refptr<NiceMockBluetoothAdapter> LayoutTestBluetoothAdapterProvider:: 1121 scoped_refptr<NiceMockBluetoothAdapter> LayoutTestBluetoothAdapterProvider::
1062 GetStopNotifySessionFinishesAfterReconnectionAdapter(bool disconnect) { 1122 GetStopNotifySessionFinishesAfterReconnectionAdapter(bool disconnect) {
1063 scoped_refptr<NiceMockBluetoothAdapter> adapter(GetEmptyAdapter()); 1123 scoped_refptr<NiceMockBluetoothAdapter> adapter(GetEmptyAdapter());
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 .WillByDefault(RunCallback<1 /* error_callback */>(error_code)); 1692 .WillByDefault(RunCallback<1 /* error_callback */>(error_code));
1633 1693
1634 // Write response. 1694 // Write response.
1635 ON_CALL(*characteristic, WriteRemoteCharacteristic(_, _, _)) 1695 ON_CALL(*characteristic, WriteRemoteCharacteristic(_, _, _))
1636 .WillByDefault(RunCallback<2 /* error_callback */>(error_code)); 1696 .WillByDefault(RunCallback<2 /* error_callback */>(error_code));
1637 1697
1638 // StartNotifySession response 1698 // StartNotifySession response
1639 ON_CALL(*characteristic, StartNotifySession(_, _)) 1699 ON_CALL(*characteristic, StartNotifySession(_, _))
1640 .WillByDefault(RunCallback<1 /* error_callback */>(error_code)); 1700 .WillByDefault(RunCallback<1 /* error_callback */>(error_code));
1641 1701
1702 // Add error descriptor to |characteristic|
1703 auto error_descriptor = base::MakeUnique<NiceMockBluetoothGattDescriptor>(
1704 characteristic.get(), kCharacteristicUserDescription,
1705 BluetoothUUID(kUserDescriptionUUID), false,
1706 device::BluetoothRemoteGattCharacteristic::PROPERTY_READ);
1707
1708 ON_CALL(*error_descriptor, ReadRemoteDescriptor(_, _))
1709 .WillByDefault(RunCallback<1 /* error_callback */>(error_code));
1710
1711 characteristic->AddMockDescriptor(std::move(error_descriptor));
1712
1642 return characteristic; 1713 return characteristic;
1643 } 1714 }
1644 1715
1645 // Notify sessions 1716 // Notify sessions
1646 1717
1647 // static 1718 // static
1648 std::unique_ptr<NiceMockBluetoothGattNotifySession> 1719 std::unique_ptr<NiceMockBluetoothGattNotifySession>
1649 LayoutTestBluetoothAdapterProvider::GetBaseGATTNotifySession( 1720 LayoutTestBluetoothAdapterProvider::GetBaseGATTNotifySession(
1650 base::WeakPtr<device::BluetoothRemoteGattCharacteristic> characteristic) { 1721 base::WeakPtr<device::BluetoothRemoteGattCharacteristic> characteristic) {
1651 auto session = 1722 auto session =
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 NOTREACHED(); 1783 NOTREACHED();
1713 return BluetoothUUID(); 1784 return BluetoothUUID();
1714 } 1785 }
1715 1786
1716 // static 1787 // static
1717 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) { 1788 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) {
1718 return BluetoothDevice::CanonicalizeAddress( 1789 return BluetoothDevice::CanonicalizeAddress(
1719 base::StringPrintf("%012" PRIx64, addr)); 1790 base::StringPrintf("%012" PRIx64, addr));
1720 } 1791 }
1721 1792
1722 } // namespace content 1793 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698