| Index: third_party/WebKit/LayoutTests/http/tests/streams/resources/test-utils.js
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/streams/resources/test-utils.js b/third_party/WebKit/LayoutTests/http/tests/streams/resources/test-utils.js
|
| index cc47898a608e93d5e5664d017607b4f4709f5370..723021e6153862dcb58df27a6cfdec5000270802 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/streams/resources/test-utils.js
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/streams/resources/test-utils.js
|
| @@ -1,4 +1,6 @@
|
| 'use strict';
|
| +// This file already exists upstream. We are duplicating and updating it here. Be sure to override the existing one
|
| +// when upstreaming.
|
|
|
| self.getterRejects = (t, obj, getterName, target) => {
|
| const getter = Object.getOwnPropertyDescriptor(obj, getterName).get;
|
| @@ -6,10 +8,10 @@ self.getterRejects = (t, obj, getterName, target) => {
|
| return promise_rejects(t, new TypeError(), getter.call(target));
|
| };
|
|
|
| -self.methodRejects = (t, obj, methodName, target) => {
|
| +self.methodRejects = (t, obj, methodName, target, args) => {
|
| const method = obj[methodName];
|
|
|
| - return promise_rejects(t, new TypeError(), method.call(target));
|
| + return promise_rejects(t, new TypeError(), method.apply(target, args));
|
| };
|
|
|
| self.getterThrows = (obj, getterName, target) => {
|
| @@ -41,3 +43,11 @@ self.garbageCollect = () => {
|
| };
|
|
|
| self.delay = ms => new Promise(resolve => step_timeout(resolve, ms));
|
| +
|
| +// For tests which verify that the implementation doesn't do something it shouldn't, it's better not to use a
|
| +// timeout. Instead, assume that any reasonable implementation is going to finish work after 2 times around the event
|
| +// loop, and use flushAsyncEvents().then(() => assert_array_equals(...));
|
| +// Some tests include promise resolutions which may mean the test code takes a couple of event loop visits itself. So go
|
| +// around an extra 2 times to avoid complicating those tests.
|
| +// TODO(ricea): Upstream this function to w3c repository.
|
| +self.flushAsyncEvents = () => delay(0).then(() => delay(0)).then(() => delay(0)).then(() => delay(0));
|
|
|