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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/streams/resources/test-utils.js

Issue 1404523005: Implement author-constructible ReadableStream using V8 extras (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor test tweaks Created 5 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 'use strict';
2
3 self.getterRejects = (t, obj, getterName, target) => {
4 const getter = Object.getOwnPropertyDescriptor(obj, getterName).get;
5
6 return promise_rejects(t, new TypeError(), getter.call(target));
7 };
8
9 self.methodRejects = (t, obj, methodName, target) => {
10 const method = obj[methodName];
11
12 return promise_rejects(t, new TypeError(), method.call(target));
13 };
14
15 self.getterThrows = (obj, getterName, target) => {
16 const getter = Object.getOwnPropertyDescriptor(obj, getterName).get;
17
18 assert_throws(new TypeError(), () => getter.call(target), getterName + ' shoul d throw a TypeError');
19 };
20
21 self.methodThrows = (obj, methodName, target, args) => {
22 const method = obj[methodName];
23
24 assert_throws(new TypeError(), () => method.apply(target, args), methodName + ' should throw a TypeError');
25 };
26
27 self.garbageCollect = () => {
28 if (self.gc) {
29 // Use --expose_gc for V8 (and Node.js)
30 // Exposed in SpiderMonkey shell as well
31 self.gc();
32 } else if (self.GCController) {
33 // Present in some WebKit development environments
34 GCController.collect();
35 } else {
36 /* eslint-disable no-console */
37 console.warn('Tests are running without the ability to do manual garbage col lection. They will still work, but ' +
38 'coverage will be suboptimal.');
39 /* eslint-enable no-console */
40 }
41 };
42
43 self.delay = ms => new Promise(resolve => setTimeout(resolve, ms));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698