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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/streams/resources/test-utils.js

Issue 2642393002: Import wpt@40665266227e475bc4a56884247d8c09d78dfb6a (Closed)
Patch Set: rebaseline-cl Created 3 years, 11 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/external/wpt/streams/resources/test-utils.js
diff --git a/third_party/WebKit/LayoutTests/external/wpt/streams/resources/test-utils.js b/third_party/WebKit/LayoutTests/external/wpt/streams/resources/test-utils.js
index cc47898a608e93d5e5664d017607b4f4709f5370..24898af10a162c6730606f6f175136d26ef335f7 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/streams/resources/test-utils.js
+++ b/third_party/WebKit/LayoutTests/external/wpt/streams/resources/test-utils.js
@@ -6,10 +6,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 +41,10 @@ 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.
+self.flushAsyncEvents = () => delay(0).then(() => delay(0)).then(() => delay(0)).then(() => delay(0));

Powered by Google App Engine
This is Rietveld 408576698