зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1463333 [wpt PR 6499] - Initial Merge of WritableStreams Tests w/Upstream W3C, a=testonly
Automatic update from web-platform-testsInitial Merge of WritableStreams Tests w/Upstream W3C (#6499) Clean ups of WritableStream general tests. -- wpt-commits: a695026c7758c2f2d78aad1d2f511be5c9195b2d wpt-pr: 6499
This commit is contained in:
Родитель
272b9eeecd
Коммит
1d89d30d52
|
@ -610752,7 +610752,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"streams/writable-streams/general.js": [
|
||||
"af1848e49d119ba4e57b8354052e161ac8e80632",
|
||||
"754d9bdf7b7ca32cc44a27c908831172741642b1",
|
||||
"support"
|
||||
],
|
||||
"streams/writable-streams/general.serviceworker.https.html": [
|
||||
|
@ -610812,7 +610812,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"streams/writable-streams/start.js": [
|
||||
"efd4b220ff356a542efdd57293993e5deff3a884",
|
||||
"a756691be0e331bda99aa92b4e2de85d0d652805",
|
||||
"support"
|
||||
],
|
||||
"streams/writable-streams/start.serviceworker.https.html": [
|
||||
|
|
|
@ -111,56 +111,54 @@ promise_test(() => {
|
|||
);
|
||||
}, 'closed and ready on a released writer');
|
||||
|
||||
promise_test(() => {
|
||||
const promises = {};
|
||||
const resolvers = {};
|
||||
for (const methodName of ['start', 'write', 'close', 'abort']) {
|
||||
promises[methodName] = new Promise(resolve => {
|
||||
resolvers[methodName] = resolve;
|
||||
});
|
||||
}
|
||||
|
||||
promise_test(t => {
|
||||
let thisObject = null;
|
||||
// Calls to Sink methods after the first are implicitly ignored. Only the first value that is passed to the resolver
|
||||
// is used.
|
||||
class Sink {
|
||||
start() {
|
||||
// Called twice
|
||||
resolvers.start(this);
|
||||
t.step(() => {
|
||||
assert_equals(this, thisObject, 'start should be called as a method');
|
||||
});
|
||||
}
|
||||
|
||||
write() {
|
||||
resolvers.write(this);
|
||||
t.step(() => {
|
||||
assert_equals(this, thisObject, 'write should be called as a method');
|
||||
});
|
||||
}
|
||||
|
||||
close() {
|
||||
resolvers.close(this);
|
||||
t.step(() => {
|
||||
assert_equals(this, thisObject, 'close should be called as a method');
|
||||
});
|
||||
}
|
||||
|
||||
abort() {
|
||||
resolvers.abort(this);
|
||||
t.step(() => {
|
||||
assert_equals(this, thisObject, 'abort should be called as a method');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const theSink = new Sink();
|
||||
thisObject = theSink;
|
||||
const ws = new WritableStream(theSink);
|
||||
|
||||
const writer = ws.getWriter();
|
||||
|
||||
writer.write('a');
|
||||
writer.close();
|
||||
const closePromise = writer.close();
|
||||
|
||||
const ws2 = new WritableStream(theSink);
|
||||
const writer2 = ws2.getWriter();
|
||||
writer2.abort();
|
||||
const abortPromise = writer2.abort();
|
||||
|
||||
return promises.start
|
||||
.then(thisValue => assert_equals(thisValue, theSink, 'start should be called as a method'))
|
||||
.then(() => promises.write)
|
||||
.then(thisValue => assert_equals(thisValue, theSink, 'write should be called as a method'))
|
||||
.then(() => promises.close)
|
||||
.then(thisValue => assert_equals(thisValue, theSink, 'close should be called as a method'))
|
||||
.then(() => promises.abort)
|
||||
.then(thisValue => assert_equals(thisValue, theSink, 'abort should be called as a method'));
|
||||
return Promise.all([
|
||||
closePromise,
|
||||
abortPromise
|
||||
]);
|
||||
}, 'WritableStream should call underlying sink methods as methods');
|
||||
|
||||
promise_test(t => {
|
||||
|
|
|
@ -154,7 +154,7 @@ promise_test(t => {
|
|||
start() {
|
||||
return Promise.reject();
|
||||
}
|
||||
}, new CountQueuingStrategy({ highWaterMark: 0 }));
|
||||
}, { highWaterMark: 0 });
|
||||
const writer = ws.getWriter();
|
||||
catchAndRecord(writer.ready, 'ready');
|
||||
catchAndRecord(writer.closed, 'closed');
|
||||
|
|
Загрузка…
Ссылка в новой задаче