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

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

Issue 1464443002: bluetooth: android: Add BluetoothDevice::ConnectErrorCode enums (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: VI Created 4 years, 11 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.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 c9fc50330936540eed46f471065ccfba38264fb0..85b7d78e95ca487657614fd7fc6244fbbff29016 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
@@ -223,17 +223,38 @@ class LayoutTestBluetoothAdapterProvider {
// 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.
+ // See connectErrorUUID() 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_UNKNOWN)
+ // connectErrorUUID(0x0)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_INPROGRESS)
+ // connectErrorUUID(0x1)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_FAILED)
+ // connectErrorUUID(0x2)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_FAILED)
+ // connectErrorUUID(0x3)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_CANCELED)
+ // connectErrorUUID(0x4)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_REJECTED)
+ // connectErrorUUID(0x5)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_AUTH_TIMEOUT)
+ // connectErrorUUID(0x6)
// - UnconnectableDevice(BluetoothDevice::ERROR_UNSUPPORTED_DEVICE)
- // errorUUID(0x7)
+ // connectErrorUUID(0x7)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_ATTRIBUTE_LENGTH_INVALID)
+ // connectErrorUUID(0x8)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_CONNECTION_CONGESTED)
+ // connectErrorUUID(0x9)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_INSUFFICIENT_ENCRYPTION)
+ // connectErrorUUID(0xa)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_OFFSET_INVALID)
+ // connectErrorUUID(0xb)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_READ_NOT_PERMITTED)
+ // connectErrorUUID(0xc)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_REQUEST_NOT_SUPPORTED)
+ // connectErrorUUID(0xd)
+ // - UnconnectableDevice(BluetoothDevice::ERROR_WRITE_NOT_PERMITTED)
+ // connectErrorUUID(0xe)
static scoped_refptr<testing::NiceMock<device::MockBluetoothAdapter>>
GetFailingConnectionsAdapter();
@@ -511,6 +532,10 @@ class LayoutTestBluetoothAdapterProvider {
// Helper functions:
+ // DEPRECATED: This is a poor practice as it exposes the specific
+ // enum values of this code base into the UUIDs used
+ // by the test data. Prefer methods such as
+ // connectErrorUUID.
// 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
@@ -518,6 +543,11 @@ class LayoutTestBluetoothAdapterProvider {
// were generated as a type 4 (random) UUID.
static std::string errorUUID(uint32_t alias);
+ // Returns a stable test data UUID associated with a given
+ // BluetoothDevice::ConnectErrorCode.
+ static device::BluetoothUUID connectErrorUUID(
+ device::BluetoothDevice::ConnectErrorCode error_code);
+
// 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".

Powered by Google App Engine
This is Rietveld 408576698