Index: LayoutTests/bluetooth/resources/bluetooth-helpers.js |
diff --git a/LayoutTests/bluetooth/resources/bluetooth-helpers.js b/LayoutTests/bluetooth/resources/bluetooth-helpers.js |
index 064880493c829a79d49516cd89c63e9b8beff53e..8389adaf01a0e3d7544e7944a5eef40a5019e597 100644 |
--- a/LayoutTests/bluetooth/resources/bluetooth-helpers.js |
+++ b/LayoutTests/bluetooth/resources/bluetooth-helpers.js |
@@ -85,3 +85,24 @@ function assert_promise_rejects_with_message(promise, expected, description) { |
} |
}); |
} |
+ |
+// Parses add-device(name)=id lines in |
+// testRunner.getBluetoothManualChooserEvents() output, and exposes the name->id |
+// mapping. |
+class AddDeviceEventSet { |
+ constructor() { |
+ this._idsByName = new Map(); |
+ this._addDeviceRegex = /^add-device\(([^)]+)\)=(.+)$/; |
+ } |
+ assert_add_device_event(event, description) { |
+ let match = this._addDeviceRegex.exec(event); |
+ assert_true(!!match, event + "isn't an add-device event: " + description); |
+ this._idsByName.set(match[1], match[2]); |
+ } |
+ has(name) { |
+ return this._idsByName.has(name); |
+ } |
+ get(name) { |
+ return this._idsByName.get(name); |
+ } |
+} |