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

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

Issue 2565913002: [Onion Soup] Move WebBluetoothImpl from //content/renderer/bluetooth to Blink's bluetooth module (Closed)
Patch Set: renamed BluetoothUUID.typemap to Bluetooth.typemap Created 3 years, 12 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: third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js
diff --git a/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js b/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js
index 3a9f8ee5cbde3ee831626f21b89afec7b1f6858c..fdde3c64b8a26f8ece55911649083827945a8419 100644
--- a/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js
+++ b/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js
@@ -234,7 +234,10 @@ function eventPromise(target, type, options) {
// reject if the event is fired before |object|.|func|() resolves.
// Returns a promise that fulfills with the result of |object|.|func()|
// and |event.target.value| of each of the other promises.
-function assert_event_fires_after_promise(object, func, event, num_listeners) {
+// If |ignore_event_promise_order| is set true, this function will ignore
+// the relative order of the event and the promise; otherwise it will assert
+// the event is triggered after the promise is resolved.
+function assert_event_fires_after_promise(object, func, event, num_listeners, ignore_event_promise_order) {
num_listeners = num_listeners !== undefined ? num_listeners : 1;
if (object[func] === undefined) {
@@ -246,7 +249,7 @@ function assert_event_fires_after_promise(object, func, event, num_listeners) {
event_promises.push(new Promise((resolve, reject) => {
let event_listener = (e) => {
object.removeEventListener(event, event_listener);
- if (should_resolve) {
+ if (should_resolve || ignore_event_promise_order) {
resolve(e.target.value);
} else {
reject(event + ' was triggered before the promise resolved.');

Powered by Google App Engine
This is Rietveld 408576698