Import media recorder api WPT tests
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2018 20:55:29 +0000 (20:55 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Sep 2018 20:55:29 +0000 (20:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189526

Patch by YUHAN WU <yuhan_wu@apple.com> on 2018-09-12
Reviewed by Youenn Fablet.

* resources/import-expectations.json:
* web-platform-tests/mediacapture-record/BlobEvent-constructor-expected.txt: Added.
* web-platform-tests/mediacapture-record/BlobEvent-constructor.html: Added.
* web-platform-tests/mediacapture-record/META.yml: Added.
* web-platform-tests/mediacapture-record/idlharness.window-expected.txt: Added.
* web-platform-tests/mediacapture-record/idlharness.window.html: Added.
* web-platform-tests/mediacapture-record/idlharness.window.js: Added.
(idl_array.catch):
* web-platform-tests/mediacapture-record/w3c-import.log: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235947 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/resources/import-expectations.json
LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/BlobEvent-constructor-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/BlobEvent-constructor.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/META.yml [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/idlharness.window-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/idlharness.window.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/idlharness.window.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/w3c-import.log [new file with mode: 0644]

index e51f781..095d7c3 100644 (file)
@@ -1,3 +1,20 @@
+2018-09-12  YUHAN WU  <yuhan_wu@apple.com>
+
+        Import media recorder api WPT tests
+        https://bugs.webkit.org/show_bug.cgi?id=189526
+
+        Reviewed by Youenn Fablet.
+
+        * resources/import-expectations.json:
+        * web-platform-tests/mediacapture-record/BlobEvent-constructor-expected.txt: Added.
+        * web-platform-tests/mediacapture-record/BlobEvent-constructor.html: Added.
+        * web-platform-tests/mediacapture-record/META.yml: Added.
+        * web-platform-tests/mediacapture-record/idlharness.window-expected.txt: Added.
+        * web-platform-tests/mediacapture-record/idlharness.window.html: Added.
+        * web-platform-tests/mediacapture-record/idlharness.window.js: Added.
+        (idl_array.catch):
+        * web-platform-tests/mediacapture-record/w3c-import.log: Added.
+
 2018-09-12  Ali Juma  <ajuma@chromium.org>
 
         [IntersectionObserver] Implement rootMargin expansion
index a2eee7b..090d256 100644 (file)
     "web-platform-tests/media-capabilities": "skip", 
     "web-platform-tests/media-source": "import", 
     "web-platform-tests/mediacapture-image": "skip", 
-    "web-platform-tests/mediacapture-record": "skip", 
+    "web-platform-tests/mediacapture-record": "import", 
     "web-platform-tests/mediacapture-streams": "import", 
     "web-platform-tests/mediasession": "skip", 
     "web-platform-tests/microdata": "skip", 
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/BlobEvent-constructor-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/BlobEvent-constructor-expected.txt
new file mode 100644 (file)
index 0000000..45fc930
--- /dev/null
@@ -0,0 +1,7 @@
+
+FAIL The BlobEventInit dictionary is required Can't find variable: BlobEvent
+FAIL The BlobEventInit dictionary's data member is required. assert_throws: function "function () {
+    new BlobEvent("type", {});
+  }" threw object "ReferenceError: Can't find variable: BlobEvent" ("ReferenceError") expected object "TypeError" ("TypeError")
+FAIL The BlobEvent instance's data attribute is set. Can't find variable: BlobEvent
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/BlobEvent-constructor.html b/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/BlobEvent-constructor.html
new file mode 100644 (file)
index 0000000..3bcf429
--- /dev/null
@@ -0,0 +1,38 @@
+<!doctype html>
+<title>BlobEvent constructor</title>
+<link rel="help" href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#blob-event">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+test(function() {
+  assert_equals(BlobEvent.length, 2);
+  assert_throws(new TypeError, function() {
+    new BlobEvent("type");
+  });
+  assert_throws(new TypeError, function() {
+    new BlobEvent("type", null);
+  });
+  assert_throws(new TypeError, function() {
+    new BlobEvent("type", undefined);
+  });
+}, "The BlobEventInit dictionary is required");
+
+test(function() {
+  assert_throws(new TypeError, function() {
+    new BlobEvent("type", {});
+  });
+  assert_throws(new TypeError, function() {
+    new BlobEvent("type", { data: null });
+  });
+  assert_throws(new TypeError, function() {
+    new BlobEvent("type", { data: undefined });
+  });
+}, "The BlobEventInit dictionary's data member is required.");
+
+test(function() {
+  var blob = new Blob();
+  var event = new BlobEvent("type", { data: blob });
+  assert_equals(event.type, "type");
+  assert_equals(event.data, blob);
+}, "The BlobEvent instance's data attribute is set.");
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/META.yml b/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/META.yml
new file mode 100644 (file)
index 0000000..d59e5e3
--- /dev/null
@@ -0,0 +1,3 @@
+spec: https://w3c.github.io/mediacapture-record/
+suggested_reviewers:
+  - yellowdoge
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/idlharness.window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/idlharness.window-expected.txt
new file mode 100644 (file)
index 0000000..a7ea327
--- /dev/null
@@ -0,0 +1,30 @@
+
+FAIL idl_test setup promise_test: Unhandled rejection with value: object "Got an error before parsing any named definition: Unrecognised tokens, line 1 (tokens: "{\"error\": {\"message\"")
+[
+    {
+        "type": "{",
+        "value": "{",
+        "trivia": ""
+    },
+    {
+        "type": "string",
+        "value": "\"error\"",
+        "trivia": ""
+    },
+    {
+        "type": ":",
+        "value": ":",
+        "trivia": ""
+    },
+    {
+        "type": "{",
+        "value": "{",
+        "trivia": " "
+    },
+    {
+        "type": "string",
+        "value": "\"message\"",
+        "trivia": ""
+    }
+]"
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/idlharness.window.html b/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/idlharness.window.html
new file mode 100644 (file)
index 0000000..2382913
--- /dev/null
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/idlharness.window.js b/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/idlharness.window.js
new file mode 100644 (file)
index 0000000..86f5a15
--- /dev/null
@@ -0,0 +1,38 @@
+// META: script=/resources/WebIDLParser.js
+// META: script=/resources/idlharness.js
+
+'use strict';
+
+// https://w3c.github.io/mediacapture-record/
+
+idl_test(
+  ['mediastream-recording'],
+  ['mediacapture-streams', 'FileAPI', 'html', 'dom'],
+  idl_array => {
+    // Ignored errors will be surfaced in idlharness.js's test_object below.
+    let recorder, blob, error;
+    try {
+      const canvas = document.createElement('canvas');
+      document.body.appendChild(canvas);
+      const context = canvas.getContext("2d");
+      context.fillStyle = "red";
+      context.fillRect(0, 0, 10, 10);
+      const stream = canvas.captureStream();
+      recorder = new MediaRecorder(stream);
+    } catch(e) {}
+    idl_array.add_objects({ MediaRecorder: [recorder] });
+
+    try {
+      blob = new BlobEvent("type", {
+        data: new Blob(),
+        timecode: performance.now(),
+      });
+    } catch(e) {}
+    idl_array.add_objects({ BlobEvent: [blob] });
+
+    try {
+      error = new MediaRecorderErrorEvent("type", {});
+    } catch(e) {}
+    idl_array.add_objects({ MediaRecorderErrorEvent: [error] });
+  }
+);
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/w3c-import.log
new file mode 100644 (file)
index 0000000..6410f95
--- /dev/null
@@ -0,0 +1,19 @@
+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+       https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/BlobEvent-constructor.html
+/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/META.yml
+/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/idlharness.window.js