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

Unified Diff: LayoutTests/bluetooth/resources/bluetooth-helpers.js

Issue 1304353004: Test that the right events are sent to the Bluetooth chooser. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@pinned
Patch Set: Fix ortuno's comments Created 5 years, 3 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: 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);
+ }
+}
« LayoutTests/bluetooth/requestDevice.html ('K') | « LayoutTests/bluetooth/requestDevice.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698