Bug 1467961 [wpt PR 11441] - Clean up FileAPI idlharness tests, a=testonly
authorLuke Bjerring <lukebjerring@users.noreply.github.com>
Fri, 06 Jul 2018 14:00:21 +0000
changeset 425828 437f872093cb38634a55df954ffaeb901b57280e
parent 425827 77de3661e3376cd31d49c37c8408d66bd7dce824
child 425829 96df24278a6cbca9a03b0750b55c6fc834ad4742
push id34267
push userrgurzau@mozilla.com
push dateWed, 11 Jul 2018 22:05:21 +0000
treeherdermozilla-central@3aca103e4915 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1467961, 11441, 10338
milestone63.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 1467961 [wpt PR 11441] - Clean up FileAPI idlharness tests, a=testonly Automatic update from web-platform-testsClean up FileAPI idlharness tests After fixing #10338, we can leverage add_dependency_idls to import the 'real' untested idl from sources cleanly. -- wpt-commits: ce580dab49d64f723453cf56c2c501bb54beb7bc wpt-pr: 11441
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/FileAPI/idlharness-manual.html
testing/web-platform/tests/FileAPI/idlharness.html
testing/web-platform/tests/FileAPI/idlharness.worker.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -410471,25 +410471,25 @@
    "fa1e9bd48a2e1f5fe91e6f9b3aa401b4ccf15dfa",
    "support"
   ],
   "FileAPI/historical.https.html": [
    "8a0e866521c4cbfb010260c29777f1c93101a576",
    "testharness"
   ],
   "FileAPI/idlharness-manual.html": [
-   "df5170b0704955d185dfd7e3e3c44516cdc4292a",
+   "6e4da9409074c74bf5e82a9759a38ed805273250",
    "manual"
   ],
   "FileAPI/idlharness.html": [
-   "b12d3e9d4d69b4b922f8fb588f94db7bbdacbef9",
+   "8758857fee6e2c4504368ed4d8ca5e818bf84171",
    "testharness"
   ],
   "FileAPI/idlharness.worker.js": [
-   "cda6c4911582d2cd707598bbb7be17400eab2517",
+   "3564b7fa9eaecdc3796ba25606159ae031942ca0",
    "testharness"
   ],
   "FileAPI/progress-manual.html": [
    "72850fdd8164131b2236c62b083972b41c49bec9",
    "manual"
   ],
   "FileAPI/reading-data-section/Determining-Encoding.html": [
    "082f6b8887bba9b627509babbe251d4fb0f8e7fe",
--- a/testing/web-platform/tests/FileAPI/idlharness-manual.html
+++ b/testing/web-platform/tests/FileAPI/idlharness-manual.html
@@ -22,138 +22,35 @@
     </div>
 
     <form name="uploadData">
       <input type="file" id="fileChooser">
     </form>
 
     <div id="log"></div>
 
-    <pre id="untested_idl" style="display: none">
-      interface ArrayBuffer {
-      };
-
-      interface ArrayBufferView {
-      };
-
-      interface URL {
-      };
-
-      interface EventTarget {
-      };
-
-      interface Event {
-      };
-
-      [TreatNonCallableAsNull]
-      callback EventHandlerNonNull = any (Event event);
-      typedef EventHandlerNonNull? EventHandler;
-    </pre>
-
-    <pre id="idl" style="display: none">
-[Constructor,
- Constructor(sequence<(ArrayBuffer or ArrayBufferView or Blob or DOMString)> blobParts, optional BlobPropertyBag options), Exposed=Window,Worker]
-interface Blob {
-
-  readonly attribute unsigned long long size;
-  readonly attribute DOMString type;
-
-  //slice Blob into byte-ranged chunks
-
-  Blob slice([Clamp] optional long long start,
-             [Clamp] optional long long end,
-             optional DOMString contentType);
-};
-
-dictionary BlobPropertyBag {
-  DOMString type = "";
-};
-
-[Constructor(sequence<(Blob or DOMString or ArrayBufferView or ArrayBuffer)> fileBits,
-[EnsureUTF16] DOMString fileName, optional FilePropertyBag options), Exposed=Window,Worker]
-interface File : Blob {
-
-  readonly attribute DOMString name;
-  readonly attribute long long lastModified;
-
-};
-
-dictionary FilePropertyBag {
-
-  DOMString type = "";
-  long long lastModified;
-
-};
-
-[Exposed=Window,Worker] interface FileList {
-  getter File? item(unsigned long index);
-  readonly attribute unsigned long length;
-};
-
-[Constructor, Exposed=Window,Worker]
-interface FileReader: EventTarget {
-
-  // async read methods
-  void readAsArrayBuffer(Blob blob);
-  void readAsText(Blob blob, optional DOMString label);
-  void readAsDataURL(Blob blob);
-
-  void abort();
-
-  // states
-  const unsigned short EMPTY = 0;
-  const unsigned short LOADING = 1;
-  const unsigned short DONE = 2;
-
-  readonly attribute unsigned short readyState;
-
-  // File or Blob data
-  readonly attribute (DOMString or ArrayBuffer)? result;
-
-  readonly attribute DOMException? error;
-
-  // event handler attributes
-  attribute EventHandler onloadstart;
-  attribute EventHandler onprogress;
-  attribute EventHandler onload;
-  attribute EventHandler onabort;
-  attribute EventHandler onerror;
-  attribute EventHandler onloadend;
-
-};
-
-[Constructor, Exposed=Worker]
-interface FileReaderSync {
-
-  // Synchronously return strings
-
-  ArrayBuffer readAsArrayBuffer(Blob blob);
-  DOMString readAsText(Blob blob, optional DOMString label);
-  DOMString readAsDataURL(Blob blob);
-};
-
-partial interface URL {
-
-  static DOMString createObjectURL(Blob blob);
-  static void revokeObjectURL(DOMString url);
-
-};
-    </pre>
-
     <script>
       var fileInput;
 
       setup(function() {
         fileInput = document.querySelector("#fileChooser")
       }, {explicit_done: true, explicit_timeout: true});
 
-      on_event(fileInput, "change", function(evt) {
-        var idl_array = new IdlArray();
-        idl_array.add_untested_idls(document.getElementById("untested_idl").textContent);
-        idl_array.add_idls(document.getElementById("idl").textContent);
+      on_event(fileInput, "change", async function(evt) {
+        const idl = await fetch('/interfaces/FileAPI.idl').then(r => r.text());
+        const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
+        const html = await fetch('/interfaces/html.idl').then(r => r.text());
+        const url = await fetch('/interfaces/url.idl').then(r => r.text());
+
+        const idl_array = new IdlArray();
+        idl_array.add_idls(idl);
+        idl_array.add_dependency_idls(url);
+        idl_array.add_dependency_idls(html);
+        idl_array.add_dependency_idls(dom);
+        idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ArrayBuffer {};");
 
         idl_array.add_objects({
           FileList: [fileInput.files],
           File: [fileInput.files[0]],
         });
         idl_array.test();
 
         done();
--- a/testing/web-platform/tests/FileAPI/idlharness.html
+++ b/testing/web-platform/tests/FileAPI/idlharness.html
@@ -15,43 +15,36 @@
 
     <div id="log"></div>
 
     <form name="uploadData">
       <input type="file" id="fileChooser">
     </form>
 
     <script>
-var file_input;
-setup(function() {
-    var idl_array = new IdlArray();
+      'use strict';
 
-    var request = new XMLHttpRequest();
-    request.open("GET", "/interfaces/FileAPI.idl");
-    request.send();
-    request.onload = function() {
-        var idls = request.responseText;
+      promise_test(async () => {
+        const idl = await fetch('/interfaces/FileAPI.idl').then(r => r.text());
+        const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
+        const html = await fetch('/interfaces/html.idl').then(r => r.text());
+        const url = await fetch('/interfaces/url.idl').then(r => r.text());
 
+        const idl_array = new IdlArray();
+        idl_array.add_idls(idl);
+        idl_array.add_dependency_idls(url);
+        idl_array.add_dependency_idls(html);
+        idl_array.add_dependency_idls(dom);
         idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ArrayBuffer {};");
-        idl_array.add_untested_idls("interface URL {};");
-        idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface EventTarget {};");
-        idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface Event {};");
-        idl_array.add_untested_idls("[TreatNonCallableAsNull] callback EventHandlerNonNull = any (Event event);");
-        idl_array.add_untested_idls("typedef EventHandlerNonNull? EventHandler;");
 
-        idl_array.add_idls(idls);
-
-        file_input = document.querySelector("#fileChooser");
         idl_array.add_objects({
-            Blob: ['new Blob(["TEST"])'],
-            File: ['new File(["myFileBits"], "myFileName")'],
-            FileList: ['file_input.files'],
-            FileReader: ['new FileReader()']
+          Blob: ['new Blob(["TEST"])'],
+          File: ['new File(["myFileBits"], "myFileName")'],
+          FileList: ['document.querySelector("#fileChooser").files'],
+          FileReader: ['new FileReader()']
         });
 
         idl_array.test();
-        done();
-  };
-}, {explicit_done: true});
+      }, 'Test FileAPI IDL implementation');
     </script>
 
   </body>
 </html>
--- a/testing/web-platform/tests/FileAPI/idlharness.worker.js
+++ b/testing/web-platform/tests/FileAPI/idlharness.worker.js
@@ -1,31 +1,25 @@
 importScripts("/resources/testharness.js");
 importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js");
 
-var request = new XMLHttpRequest();
-request.open("GET", "/interfaces/FileAPI.idl");
-request.send();
-request.onload = function() {
-    var idl_array = new IdlArray();
-    var idls = request.responseText;
-
-    idl_array.add_untested_idls("[Global] interface Window { };");
+promise_test(async () => {
+  const idl = await fetch('/interfaces/FileAPI.idl').then(r => r.text());
+  const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
+  const html = await fetch('/interfaces/html.idl').then(r => r.text());
+  const url = await fetch('/interfaces/url.idl').then(r => r.text());
 
-    idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ArrayBuffer {};");
-    idl_array.add_untested_idls("interface URL {};");
-    idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface EventTarget {};");
-    idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface Event {};");
-    idl_array.add_untested_idls("[TreatNonCallableAsNull] callback EventHandlerNonNull = any (Event event);");
-    idl_array.add_untested_idls("typedef EventHandlerNonNull? EventHandler;");
-
-    idl_array.add_idls(idls);
+  const idl_array = new IdlArray();
+  idl_array.add_idls(idl);
+  idl_array.add_dependency_idls(dom);
+  idl_array.add_dependency_idls(html);
+  idl_array.add_dependency_idls(url);
+  idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ArrayBuffer {};");
+  idl_array.add_objects({
+    Blob: ['new Blob(["TEST"])'],
+    File: ['new File(["myFileBits"], "myFileName")'],
+    FileReader: ['new FileReader()'],
+    FileReaderSync: ['new FileReaderSync()']
+  });
 
-    idl_array.add_objects({
-        Blob: ['new Blob(["TEST"])'],
-        File: ['new File(["myFileBits"], "myFileName")'],
-        FileReader: ['new FileReader()'],
-        FileReaderSync: ['new FileReaderSync()']
-    });
-
-    idl_array.test();
-    done();
-};
+  idl_array.test();
+}, 'Test FileAPI IDL implementation');
+done();