Bug 1463333 [wpt PR 6499] - Initial Merge of WritableStreams Tests w/Upstream W3C, a=testonly
authorBrandon Maslen <Brandon@dr0idz.com>
Thu, 31 May 2018 19:13:27 +0000
changeset 475630 16ee3f81a5277fb940c0ef0a9d900ce2f2035fe7
parent 475629 fc2c785effde6ef2dcf3544dfc4f1907111da69a
child 475631 9ef474e6cce053b0a77b34e95711cce2819cc075
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1463333
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/streams/writable-streams/general.js
testing/web-platform/tests/streams/writable-streams/start.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -610747,17 +610747,17 @@
    "8583d80450b090c16ed0795170340d040449bbc1",
    "testharness"
   ],
   "streams/writable-streams/general.html": [
    "e48bbd4dc77262037901c0f0da486ca53a84c939",
    "testharness"
   ],
   "streams/writable-streams/general.js": [
-   "af1848e49d119ba4e57b8354052e161ac8e80632",
+   "754d9bdf7b7ca32cc44a27c908831172741642b1",
    "support"
   ],
   "streams/writable-streams/general.serviceworker.https.html": [
    "1792d6c45a5687777291a4dab031a954aa053752",
    "testharness"
   ],
   "streams/writable-streams/general.sharedworker.html": [
    "44f9ceaa3bfc9d8b92885997d322486bd0f237a6",
@@ -610807,17 +610807,17 @@
    "cef789c53d44cdb3e20a1187c90aae8c5d25d488",
    "testharness"
   ],
   "streams/writable-streams/start.html": [
    "fd89e0ef48512dc37a612722ee3d5c54dd661e7e",
    "testharness"
   ],
   "streams/writable-streams/start.js": [
-   "efd4b220ff356a542efdd57293993e5deff3a884",
+   "a756691be0e331bda99aa92b4e2de85d0d652805",
    "support"
   ],
   "streams/writable-streams/start.serviceworker.https.html": [
    "3d8b4b8eb8e1b7dcc6629e82fc0c5eb5e3be8633",
    "testharness"
   ],
   "streams/writable-streams/start.sharedworker.html": [
    "1117ab179967063a1cdfba17cfc1c47b013bf39d",
--- a/testing/web-platform/tests/streams/writable-streams/general.js
+++ b/testing/web-platform/tests/streams/writable-streams/general.js
@@ -106,66 +106,64 @@ promise_test(() => {
         v => assert_unreached('writer.ready fulfilled unexpectedly with: ' + v),
         readyRejection => assert_equals(readyRejection, closedRejection,
           'ready promise should reject with the same error')
       );
     }
   );
 }, '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 => {
   function functionWithOverloads() {}
   functionWithOverloads.apply = t.unreached_func('apply() should not be called');
   functionWithOverloads.call = t.unreached_func('call() should not be called');
   const underlyingSink = {
     start: functionWithOverloads,
--- a/testing/web-platform/tests/streams/writable-streams/start.js
+++ b/testing/web-platform/tests/streams/writable-streams/start.js
@@ -149,17 +149,17 @@ promise_test(t => {
                                () => {
                                  events.push(name);
                                }));
   }
   const ws = new WritableStream({
     start() {
       return Promise.reject();
     }
-  }, new CountQueuingStrategy({ highWaterMark: 0 }));
+  }, { highWaterMark: 0 });
   const writer = ws.getWriter();
   catchAndRecord(writer.ready, 'ready');
   catchAndRecord(writer.closed, 'closed');
   catchAndRecord(writer.write(), 'write');
   return Promise.all(promises)
       .then(() => {
         assert_array_equals(events, ['ready', 'write', 'closed'], 'promises should reject in standard order');
       });