Index: third_party/WebKit/LayoutTests/http/tests/streams/byte-length-queuing-strategy.js |
diff --git a/third_party/WebKit/LayoutTests/http/tests/streams/byte-length-queuing-strategy.js b/third_party/WebKit/LayoutTests/http/tests/streams/byte-length-queuing-strategy.js |
index 1aaccfe6c0d824db73cfd9a6ec40a16f64343c03..54407af99138893b8b5292aa2481004162e72e5a 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/streams/byte-length-queuing-strategy.js |
+++ b/third_party/WebKit/LayoutTests/http/tests/streams/byte-length-queuing-strategy.js |
@@ -6,7 +6,7 @@ if (self.importScripts) { |
test(() => { |
- const strategy = new ByteLengthQueuingStrategy({ highWaterMark: 4 }); |
+ new ByteLengthQueuingStrategy({ highWaterMark: 4 }); |
}, 'Can construct a ByteLengthQueuingStrategy with a valid high water mark'); |
@@ -23,11 +23,11 @@ test(() => { |
const highWaterMark = 1; |
const highWaterMarkObjectGetter = { |
- get highWaterMark() { return highWaterMark; }, |
+ get highWaterMark() { return highWaterMark; } |
}; |
const error = new Error('wow!'); |
const highWaterMarkObjectGetterThrowing = { |
- get highWaterMark() { throw error; }, |
+ get highWaterMark() { throw error; } |
}; |
assert_throws({ name: 'TypeError' }, () => new ByteLengthQueuingStrategy(), 'construction fails with undefined'); |
@@ -47,12 +47,12 @@ test(() => { |
const size = 1024; |
const chunk = { byteLength: size }; |
const chunkGetter = { |
- get byteLength() { return size; }, |
- } |
+ get byteLength() { return size; } |
+ }; |
const error = new Error('wow!'); |
const chunkGetterThrowing = { |
- get byteLength() { throw error; }, |
- } |
+ get byteLength() { throw error; } |
+ }; |
assert_throws({ name: 'TypeError' }, () => ByteLengthQueuingStrategy.prototype.size(), 'size fails with undefined'); |
assert_throws({ name: 'TypeError' }, () => ByteLengthQueuingStrategy.prototype.size(null), 'size fails with null'); |
assert_equals(ByteLengthQueuingStrategy.prototype.size('potato'), undefined, |
@@ -70,6 +70,18 @@ test(() => { |
test(() => { |
+ const thisValue = null; |
+ const returnValue = { 'returned from': 'byteLength getter' }; |
+ const chunk = { |
+ get byteLength() { return returnValue; } |
+ }; |
+ |
+ assert_equals(ByteLengthQueuingStrategy.prototype.size.call(thisValue, chunk), returnValue); |
+ |
+}, 'ByteLengthQueuingStrategy.prototype.size should work generically on its this and its arguments'); |
+ |
+test(() => { |
+ |
const strategy = new ByteLengthQueuingStrategy({ highWaterMark: 4 }); |
assert_object_equals(Object.getOwnPropertyDescriptor(strategy, 'highWaterMark'), |
@@ -87,8 +99,8 @@ test(() => { |
strategy.highWaterMark = 10; |
assert_equals(strategy.highWaterMark, 10); |
- strategy.highWaterMark = "banana"; |
- assert_equals(strategy.highWaterMark, "banana"); |
+ strategy.highWaterMark = 'banana'; |
+ assert_equals(strategy.highWaterMark, 'banana'); |
}, 'ByteLengthQueuingStrategy\'s highWaterMark property can be set to anything'); |