Index: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc |
diff --git a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc |
index 91ca04410941e8927ea12f1bc9e737ad52d023cd..d4f169983cd938f300f03fa70c9af3c78909ec2a 100644 |
--- a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc |
+++ b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc |
@@ -59,16 +59,20 @@ typedef testing::NiceMock<MockBluetoothGattNotifySession> |
NiceMockBluetoothGattNotifySession; |
namespace { |
-// Bluetooth UUIDs suitable to pass to BluetoothUUID(). |
+// Bluetooth UUIDs suitable to pass to BluetoothUUID(): |
+// Services: |
const char kBatteryServiceUUID[] = "180f"; |
+const char kDeviceInformationServiceUUID[] = "180a"; |
const char kGenericAccessServiceUUID[] = "1800"; |
const char kGlucoseServiceUUID[] = "1808"; |
const char kHeartRateServiceUUID[] = "180d"; |
const char kHumanInterfaceDeviceServiceUUID[] = "1812"; |
const char kTxPowerServiceUUID[] = "1804"; |
-const char kHeartRateMeasurementUUID[] = "2a37"; |
+// Characteristics: |
const char kBodySensorLocation[] = "2a38"; |
const char kDeviceNameUUID[] = "2a00"; |
+const char kHeartRateMeasurementUUID[] = "2a37"; |
+const char kSerialNumberStringUUID[] = "2a25"; |
const int kDefaultTxPower = -10; // TxPower of a device broadcasting at 0.1mW. |
const int kDefaultRssi = -51; // RSSI at 1m from a device broadcasting at |
@@ -480,7 +484,7 @@ LayoutTestBluetoothAdapterProvider::GetHeartRateAdapter() { |
// TODO(ortuno): Implement the rest of the service's characteristics |
// See: http://crbug.com/529975 |
- device->AddMockService(GetGenericAccessService(adapter.get(), device.get())); |
+ device->AddMockService(GetGenericAccessService(device.get())); |
device->AddMockService(GetHeartRateService(adapter.get(), device.get())); |
adapter->AddMockDevice(std::move(device)); |
@@ -500,7 +504,8 @@ LayoutTestBluetoothAdapterProvider::GetHeartRateAndHIDAdapter() { |
scoped_ptr<NiceMockBluetoothDevice> device( |
GetConnectableDevice(adapter.get(), "Heart Rate And HID Device", uuids)); |
- device->AddMockService(GetGenericAccessService(adapter.get(), device.get())); |
+ device->AddMockService(GetDeviceInformationService(device.get())); |
+ device->AddMockService(GetGenericAccessService(device.get())); |
device->AddMockService(GetHeartRateService(adapter.get(), device.get())); |
device->AddMockService( |
GetBaseGATTService(device.get(), kHumanInterfaceDeviceServiceUUID)); |
@@ -705,9 +710,27 @@ LayoutTestBluetoothAdapterProvider::GetBaseGATTService( |
// static |
scoped_ptr<NiceMockBluetoothGattService> |
+LayoutTestBluetoothAdapterProvider::GetDeviceInformationService( |
+ device::MockBluetoothDevice* device) { |
+ scoped_ptr<NiceMockBluetoothGattService> device_information( |
+ GetBaseGATTService(device, kDeviceInformationServiceUUID)); |
+ |
+ scoped_ptr<NiceMockBluetoothGattCharacteristic> serial_number_string( |
+ GetBaseGATTCharacteristic(device_information.get(), |
+ kSerialNumberStringUUID, |
+ BluetoothGattCharacteristic::PROPERTY_READ)); |
+ |
+ EXPECT_CALL(*serial_number_string, ReadRemoteCharacteristic(_, _)).Times(0); |
ortuno
2016/02/24 23:08:17
I think you should just CHECK. I've had cases in w
scheib
2016/02/24 23:38:52
Done.
|
+ |
+ device_information->AddMockCharacteristic(std::move(serial_number_string)); |
+ |
+ return device_information; |
+} |
+ |
+// static |
+scoped_ptr<NiceMockBluetoothGattService> |
LayoutTestBluetoothAdapterProvider::GetGenericAccessService( |
- MockBluetoothAdapter* adapter, |
- MockBluetoothDevice* device) { |
+ device::MockBluetoothDevice* device) { |
scoped_ptr<NiceMockBluetoothGattService> generic_access( |
GetBaseGATTService(device, kGenericAccessServiceUUID)); |