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

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

Issue 1159523002: bluetooth: Browser side partial implementation of getPrimaryService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address jyasskin comments Created 5 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 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 f3516e718318924f4d0ad74d0954a62aa9e293cc..3c3dda085ed562654e58879c000ca5d54eca2361 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
@@ -18,11 +18,13 @@ using device::BluetoothAdapterFactory;
using device::BluetoothDevice;
using device::BluetoothDiscoverySession;
using device::BluetoothGattConnection;
+using device::BluetoothGattService;
using device::BluetoothUUID;
using device::MockBluetoothAdapter;
using device::MockBluetoothDevice;
using device::MockBluetoothDiscoverySession;
using device::MockBluetoothGattConnection;
+using device::MockBluetoothGattService;
using testing::Between;
using testing::Invoke;
using testing::Return;
@@ -171,6 +173,20 @@ LayoutTestBluetoothAdapterProvider::GetEmptyDevice(
list.push_back(BluetoothUUID("1800"));
list.push_back(BluetoothUUID("1801"));
ON_CALL(*empty_device, GetUUIDs()).WillByDefault(Return(list));
+
+ empty_device->AddMockService(
+ GetMockService(empty_device.get(), "1800" /* Generic Access */));
+ empty_device->AddMockService(
+ GetMockService(empty_device.get(), "1801" /* Generic Attribute */));
+
+ // Using Invoke allows the device returned from this method to be futher
+ // modified and have more services added to it. The call to ::GetGattServices
+ // will invoke ::GetMockServices, returning all services added up to that
+ // time.
+ ON_CALL(*empty_device, GetGattServices())
+ .WillByDefault(
+ Invoke(empty_device.get(), &MockBluetoothDevice::GetMockServices));
+
return empty_device.Pass();
}
@@ -205,4 +221,13 @@ LayoutTestBluetoothAdapterProvider::GetUnconnectableDevice(
return device.Pass();
}
+// static
+scoped_ptr<NiceMock<MockBluetoothGattService>>
+LayoutTestBluetoothAdapterProvider::GetMockService(MockBluetoothDevice* device,
+ const std::string& uuid) {
+ return make_scoped_ptr(new NiceMock<MockBluetoothGattService>(
+ device, uuid /* identifier */, BluetoothUUID(uuid), true /* is_primary */,
+ false /* is_local */));
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698