Chromium Code Reviews| 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..c9f4e034c9ecda01764cbc58133dd5560591a395 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 assert |
| +// the event is triggered after the promise is resolved; otherwise it will |
| +// ignore their relative order. |
|
Reilly Grant (use Gerrit)
2016/12/20 02:08:16
I think this explanation is backwards.
juncai
2016/12/20 22:33:42
Done.
|
| +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.'); |