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

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: 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
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..9d4c5094584793fe9444ad921a61a20c2094e05b 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
@@ -22,6 +22,12 @@ namespace content {
// a Generic Access service with a Device Name characteristic with a descriptor.
// The other adapters are named based on their particular non-expected behavior.
+// errorUUID note:
+// This algorithm consists of replacing the top 32 bits of
+// "00000000-97e5-4cd7-b9f1-f5a427670c59" with the bits of the alias.
Jeffrey Yasskin 2015/07/21 23:08:58 You don't need the "The algorithm consists of" wor
ortuno 2015/07/22 01:06:20 Done.
+// For example, errorUUID(0xDEADBEEF) turns into
+// "deadbeef-97e5-4cd7-b9f1-f5a427670c59".
+
class LayoutTestBluetoothAdapterProvider {
public:
// Returns a BluetoothAdapter. Its behavior depends on |fake_adapter_name|.
@@ -103,6 +109,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 different UUID so that they can be
Jeffrey Yasskin 2015/07/21 23:08:58 "has a service with a different UUID"
ortuno 2015/07/22 01:06:20 Done.
+ // accessed by using different filters.
+ // See errorUUID note at the top for errorUUID() explanation.
+ // Internal Structure:
+ // - UnconnectableDevice(BluetoothDevice::ERROR_UNKNOWN) errorUUID(0x0)
Jeffrey Yasskin 2015/07/21 23:08:58 This set of error codes isn't going to generalize
Jeffrey Yasskin 2015/07/21 23:09:33 @scheib, thoughts?
scheib 2015/07/22 00:15:58 In thinking over this, I agree, these tests have v
ortuno 2015/07/22 01:06:20 I think we are removing connection_errors. I will
+ // - 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 +225,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:
+ // - uuid
Jeffrey Yasskin 2015/07/21 23:08:58 'uuid' isn't one of the arguments.
ortuno 2015/07/22 01:06:20 Done.
+ // 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:

Powered by Google App Engine
This is Rietveld 408576698