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

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

Issue 1149883011: bluetooth: Browser-side implementation of readValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-get-characteristic-initial
Patch Set: Fix merge conflicts Created 5 years, 6 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 7f3563fe98c6fe9414363da271b42ac815098454..d7c1c845827d911aa8f54509a6b11963bf224882 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
@@ -178,16 +178,27 @@ LayoutTestBluetoothAdapterProvider::GetEmptyDevice(
scoped_ptr<NiceMock<MockBluetoothGattService>> generic_access(
GetGattService(empty_device.get(), "1800" /* Generic Access */));
- generic_access->AddMockCharacteristic(
+ scoped_ptr<NiceMock<MockBluetoothGattCharacteristic>> device_name(
GetGattCharacteristic(generic_access.get(), "2A00" /* Device Name */));
- scoped_ptr<NiceMock<MockBluetoothGattService>> generic_attribute(
- GetGattService(empty_device.get(), "1801" /* Generic Attribute */));
- generic_attribute->AddMockCharacteristic(GetGattCharacteristic(
- generic_attribute.get(), "2A05" /* Service Changed */));
+ std::string value_str("Empty Mock Device name");
+ std::vector<uint8_t> value(value_str.begin(), value_str.end());
+ ON_CALL(*device_name, ReadRemoteCharacteristic(_, _))
+ .WillByDefault(RunCallback<0>(value));
+
+ generic_access->AddMockCharacteristic(device_name.Pass());
+
+ scoped_ptr<NiceMock<MockBluetoothGattCharacteristic>> reconnection_address(
+ GetGattCharacteristic(generic_access.get(),
+ "2A03" /* Reconnection Address */));
+
+ ON_CALL(*reconnection_address, ReadRemoteCharacteristic(_, _))
+ .WillByDefault(
+ RunCallback<1>(BluetoothGattService::GATT_ERROR_NOT_PERMITTED));
+
+ generic_access->AddMockCharacteristic(reconnection_address.Pass());
empty_device->AddMockService(generic_access.Pass());
- empty_device->AddMockService(generic_attribute.Pass());
// Using Invoke allows the device returned from this method to be futher
// modified and have more services added to it. The call to ::GetGattServices
@@ -250,6 +261,11 @@ LayoutTestBluetoothAdapterProvider::GetGattService(MockBluetoothDevice* device,
ON_CALL(*service, GetCharacteristics())
.WillByDefault(Invoke(service.get(),
&MockBluetoothGattService::GetMockCharacteristics));
+
+ ON_CALL(*service, GetCharacteristic(_))
+ .WillByDefault(Invoke(service.get(),
+ &MockBluetoothGattService::GetMockCharacteristic));
+
return service.Pass();
}

Powered by Google App Engine
This is Rietveld 408576698