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

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: Created 5 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 'use strict';
2
3 self.getterRejects = function(test, obj, getterName, target, endTest) {
4 var getter = Object.getOwnPropertyDescriptor(obj, getterName).get;
5
6 getter.call(target).then(
7 test.step_func(function() { assert_unreached(getterName + ' should not f ulfill'); }),
8 test.step_func(function(e) {
9 assert_throws(new TypeError(), function() { throw e; }, getterName + ' should reject with a TypeError');
10 if (endTest === true) {
11 test.done();
12 }
13 }));
14 };
15
16 self.methodRejects = function (test, obj, methodName, target, endTest) {
17 var method = obj[methodName];
18
19 method.call(target).then(
20 test.step_func(function() { assert_unreached(methodName + ' should not f ulfill'); }),
21 test.step_func(function(e) {
22 assert_throws(new TypeError(), function() { throw e; }, methodName + ' should reject with a TypeError');
23 if (endTest === true) {
24 test.done();
25 }
26 }));
27 };
28
29 self.getterThrows = function (obj, getterName, target) {
30 var getter = Object.getOwnPropertyDescriptor(obj, getterName).get;
31
32 assert_throws(new TypeError(), function() { getter.call(target); }, getterNa me + ' should throw a TypeError');
33 };
34
35 self.methodThrows = function (obj, methodName, target) {
36 var method = obj[methodName];
37
38 assert_throws(new TypeError(), function() { method.call(target); }, methodNa me + ' should throw a TypeError');
39 };
40
41 self.garbageCollect = () => {
42 if (self.gc) {
43 // Use --expose_gc for V8 (and Node.js)
44 // Exposed in SpiderMonkey shell as well
45 self.gc();
46 } else if (self.GCController) {
47 // Present in some WebKit development environments
48 GCController.collect();
49 } else {
50 console.warn('Tests are running without the ability to do manual garbage collection. They will still work, but ' +
51 'coverage will be suboptimal.');
52 }
53 };
54
55 self.delay = ms => new Promise(resolve => setTimeout(resolve, ms));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698