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

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

Issue 1247553002: bluetooth: Implement FailingConnectionsAdapter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-tests-small-5
Patch Set: Use PRIx64 macro instead of 'lx' 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 3a5a932a99c41540a02ab52a428b952de738574f..511798da8bde644b27231aecb8ffa5a06d91567c 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
@@ -103,6 +103,26 @@ class LayoutTestBluetoothAdapterProvider {
static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
GetMissingCharacteristicGenericAccessAdapter();
+ // |FailingConnectionsAdapter|
+ // Inherits from BaseAdapter
+ // FailingConnectionsAdapter holds a device for each type of connection error
+ // that can occur. This way we don’t need to create an adapter for each type
+ // of error. Each of the devices has a service with a different UUID so that
+ // they can be accessed by using different filters.
+ // See errorUUID() declaration below.
+ // Internal Structure:
+ // - UnconnectableDevice(BluetoothDevice::ERROR_UNKNOWN) errorUUID(0x0)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_INPROGRESS) errorUUID(0x1)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_FAILED) errorUUID(0x2)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_FAILED) errorUUID(0x3)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_CANCELED) errorUUID(0x4)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_REJECTED) errorUUID(0x5)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_TIMEOUT) errorUUID(0x6)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_UNSUPPORTED_DEVICE)
+ // errorUUID(0x7)
+ static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
+ GetFailingConnectionsAdapter();
+
// Discovery Sessions
// |DiscoverySession|
@@ -199,6 +219,21 @@ class LayoutTestBluetoothAdapterProvider {
const std::string& device_name = "Connectable Device",
device::BluetoothDevice::UUIDList = device::BluetoothDevice::UUIDList());
+ // |UnconnectableDevice|
+ // Inherits from BaseDevice(adapter, device_name)
+ // Adv UUIDs Added:
+ // - errorUUID(error_code)
+ // Services Added:
+ // None.
+ // Mock Functions:
+ // - CreateGATTConnection:
+ // - Run error callback with error_type
+ static scoped_ptr<testing::NiceMock<device::MockBluetoothDevice>>
+ GetUnconnectableDevice(
+ device::MockBluetoothAdapter* adapter,
+ device::BluetoothDevice::ConnectErrorCode error_code,
+ const std::string& device_name = "Unconnectable Device");
+
// |GenericAccessDevice|
// Inherits from ConnectableDevice(adapter, device_name)
// Adv UUIDs Added:
@@ -236,6 +271,20 @@ class LayoutTestBluetoothAdapterProvider {
GetBaseGATTService(device::MockBluetoothDevice* device,
const std::string& uuid);
+ // Helper functions:
+
+ // errorUUID(alias) returns a UUID with the top 32 bits of
+ // "00000000-97e5-4cd7-b9f1-f5a427670c59" replaced with the bits of |alias|.
+ // For example, errorUUID(0xDEADBEEF) returns
+ // "deadbeef-97e5-4cd7-b9f1-f5a427670c59". The bottom 96 bits of error UUIDs
+ // were generated as a type 4 (random) UUID.
+ static std::string errorUUID(uint32_t alias);
+
+ // Function to turn an integer into an MAC address of the form
+ // XX:XX:XX:XX:XX:XX. For example makeMACAddress(0xdeadbeef)
+ // returns "00:00:DE:AD:BE:EF".
+ static std::string makeMACAddress(uint64_t addr);
+
// The functions after this haven't been updated to the new design yet.
// Returns "SingleEmptyDeviceAdapter" fake BluetoothAdapter with the following
« 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