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

Unified Diff: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc

Issue 1697873002: bluetooth: Test Web Bluetooth getCharacteristic calls against blacklist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt-blacklist-integration-
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
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 cced25f3d6d64638ad1772868956ff37e20becf3..e9f5dea909f641fdedd34361a92096c60ee49c7a 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
@@ -61,14 +61,16 @@ typedef testing::NiceMock<MockBluetoothGattNotifySession>
namespace {
// Bluetooth UUIDs suitable to pass to BluetoothUUID().
const char kBatteryServiceUUID[] = "180f";
+const char kBodySensorLocation[] = "2a38";
+const char kDeviceInformationServiceUUID[] = "180A";
ortuno 2016/02/23 22:37:58 Use lower-case i.e. 180a
scheib 2016/02/24 19:51:29 Done.
+const char kDeviceNameUUID[] = "2a00";
const char kGenericAccessServiceUUID[] = "1800";
const char kGlucoseServiceUUID[] = "1808";
+const char kHeartRateMeasurementUUID[] = "2a37";
const char kHeartRateServiceUUID[] = "180d";
const char kHumanInterfaceDeviceServiceUUID[] = "1812";
+const char kSerialNumberStringUUID[] = "2A25";
ortuno 2016/02/23 22:37:59 Same here use lower-case. 2a25
scheib 2016/02/24 19:51:29 Done.
const char kTxPowerServiceUUID[] = "1804";
-const char kHeartRateMeasurementUUID[] = "2a37";
ortuno 2016/02/23 22:37:58 Unsure if alphabetical is the right order. I think
scheib 2016/02/24 19:51:29 Splitting the Services and Characteristics SGTM.
-const char kBodySensorLocation[] = "2a38";
-const char kDeviceNameUUID[] = "2a00";
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 +482,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));
@@ -499,7 +501,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));
@@ -702,9 +705,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);
+
+ 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));

Powered by Google App Engine
This is Rietveld 408576698