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

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

Issue 1230023010: bluetooth: Refactor MultiDeviceAdapter, ScanFilterCheckingAdapter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-tests-small-1
Patch Set: Fix adapter name. Created 5 years, 5 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
« no previous file with comments | « no previous file | content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h
diff --git a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h
index fe77cd4363d176d06c3ac24a1b1c0e560f9000dc..2d27eb840c26db1c6776e52d8e90b3eb7aca63e1 100644
--- a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h
+++ b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h
@@ -43,6 +43,21 @@ class LayoutTestBluetoothAdapterProvider {
static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
GetBaseAdapter();
+ // |ScanFilterCheckingAdapter|
+ // Inherits from |BaseAdapter|
+ // BluetoothAdapter that asserts that its StartDiscoverySessionWithFilter()
+ // method is called with a filter consisting of the standard battery, heart
+ // rate, and glucose services.
+ // Devices added:
+ // - BatteryDevice
+ // Mock Functions:
+ // - StartDiscoverySessionWithFilter:
+ // - With correct arguments: Run success callback.
+ // - With incorrect arguments: Mock complains that function with
+ // correct arguments was never called and error callback is called.
+ static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
+ GetScanFilterCheckingAdapter();
+
// |FailStartDiscoveryAdapter|
// Inherits from |BaseAdapter|
// Devices added:
@@ -55,7 +70,7 @@ class LayoutTestBluetoothAdapterProvider {
// |EmptyAdapter|
// Inherits from |BaseAdapter|
- // Devices added:
+ // Devices Added:
// None.
// Mock Functions:
// - StartDiscoverySessionWithFilter:
@@ -63,6 +78,14 @@ class LayoutTestBluetoothAdapterProvider {
static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
GetEmptyAdapter();
+ // |GlucoseHeartRateAdapter|
+ // Inherits from |EmptyAdapter|
+ // Devices added:
+ // - |GlucoseDevice|
+ // - |HeartRateDevice|
+ static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
+ GetGlucoseHeartRateAdapter();
+
// Discovery Sessions
// |DiscoverySession|
@@ -72,17 +95,79 @@ class LayoutTestBluetoothAdapterProvider {
static scoped_ptr<testing::NiceMock<device::MockBluetoothDiscoverySession>>
GetDiscoverySession();
- // The functions after this haven't been updated to the new design yet.
+ // Devices
- // Returns a fake BluetoothAdapter that asserts that its
- // StartDiscoverySessionWithFilter() method is called with a filter consisting
- // of the standard battery, heart rate, and glucose services.
- // - |StartDiscoverySessionWithFilter(correct arguments)| runs the success
- // callback with |DiscoverySession| as the argument. With incorrect
- // arguments, it runs the failure callback.
- // - |GetDevices| returns a device with a Battery service.
- static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
- GetScanFilterCheckingAdapter();
+ // |BaseDevice|
+ // Adv UUIDs added:
+ // None.
+ // Services added:
+ // None.
+ // MockFunctions:
+ // - GetUUIDs:
+ // Returns uuids
+ // - GetGattServices:
+ // Returns a list of all services added to the device.
+ // - GetGattService:
+ // Return a service matching the identifier provided if the service was
+ // added to the mock.
+ // - GetAddress:
+ // Returns: address
+ // - GetName:
+ // Returns: device_name.
+ // - GetBluetoothClass:
+ // Returns: 0x1F00. “Unspecified Device Class” see
+ // bluetooth.org/en-us/specification/assigned-numbers/baseband
+ // - GetVendorIDSource:
+ // Returns: BluetoothDevice::VENDOR_ID_BLUETOOTH.
+ // - GetVendorID:
+ // Returns: 0xFFFF.
+ // - GetProductID:
+ // Returns: 1.
+ // - GetDeviceID:
+ // Returns: 2.
+ // - IsPaired:
+ // Returns true.
+ static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>>
+ GetBaseDevice(device::MockBluetoothAdapter* adapter,
+ const std::string& device_name = "Base Device",
+ device::BluetoothDevice::UUIDList uuids =
+ device::BluetoothDevice::UUIDList(),
+ const std::string& address = "00:00:00:00:00");
+
+ // |BatteryDevice|
+ // Inherits from BaseDevice(adapter, "Battery Device", uuids,
+ // "00:00:00:00:01")
+ // Adv UUIDs added:
+ // - Generic Access (0x1800)
+ // - Battery Service UUID (0x180F)
+ // Services added:
+ // None.
+ static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>>
+ GetBatteryDevice(device::MockBluetoothAdapter* adapter);
+
+ // |GlucoseDevice|
+ // Inherits from BaseDevice(adapter, "Glucose Device", uuids,
+ // "00:00:00:00:02")
+ // Adv UUIDs added:
+ // - Generic Access (0x1800)
+ // - Glucose UUID (0x1808)
+ // Services added:
+ // None.
+ static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>>
+ GetGlucoseDevice(device::MockBluetoothAdapter* adapter);
+
+ // |HeartRateDevice|
+ // Inherits from BaseDevice(adapter, "Heart Rate Device", uuids,
+ // "00:00:00:00:03")
+ // Adv UUIDs added:
+ // - Generic Access (0x1800)
+ // - Heart Rate UUID (0x180D)
+ // Services added:
+ // None.
+ static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>>
+ GetHeartRateDevice(device::MockBluetoothAdapter* adapter);
+
+ // The functions after this haven't been updated to the new design yet.
// Returns "SingleEmptyDeviceAdapter" fake BluetoothAdapter with the following
// characteristics:
@@ -93,19 +178,6 @@ class LayoutTestBluetoothAdapterProvider {
static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
GetSingleEmptyDeviceAdapter();
- // Returns "MultiDeviceAdapter", a fake BluetoothAdapter with the following
- // characteristics:
- // - |StartDiscoverySessionWithFilter| runs the success callback with
- // |DiscoverySession|
- // as argument.
- // - |GetDevices| returns a list with 2 devices:
- // - GetUUIDs() returns a Heart Rate Service,
- // and GetName() returns "Heart Rate Device".
- // - GetUUIDs() returns a Glucose Service,
- // and GetName() returns "Glucose Device".
- static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
- GetMultiDeviceAdapter();
-
// Returns "ConnectableDeviceAdapter" fake BluetoothAdapter with the
// following characteristics:
// - |StartDiscoverySessionWithFilter| runs the success callback with
« no previous file with comments | « no previous file | content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698