Title: [281973] trunk/LayoutTests
Revision
281973
Author
commit-qu...@webkit.org
Date
2021-09-02 19:21:53 -0700 (Thu, 02 Sep 2021)

Log Message

Web Share tests are out of date
https://bugs.webkit.org/show_bug.cgi?id=229489

Patch by Marcos Caceres <mar...@marcosc.com> on 2021-09-02
Reviewed by Tim Horton.

LayoutTests/imported/w3c:

* web-platform-tests/web-share/canShare.https.html:
* web-platform-tests/web-share/share-consume-activation.https.html:
* web-platform-tests/web-share/share-empty.https.html:
* web-platform-tests/web-share/share-securecontext.http.html:
* web-platform-tests/web-share/share-simple-manual.https.html:

LayoutTests:

* platform/mac-wk2/imported/w3c/web-platform-tests/web-share/canShare.https-expected.txt:
* platform/mac-wk2/imported/w3c/web-platform-tests/web-share/share-empty.https-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (281972 => 281973)


--- trunk/LayoutTests/ChangeLog	2021-09-03 02:14:37 UTC (rev 281972)
+++ trunk/LayoutTests/ChangeLog	2021-09-03 02:21:53 UTC (rev 281973)
@@ -1,3 +1,13 @@
+2021-09-02  Marcos Caceres  <mar...@marcosc.com>
+
+        Web Share tests are out of date
+        https://bugs.webkit.org/show_bug.cgi?id=229489
+
+        Reviewed by Tim Horton.
+
+        * platform/mac-wk2/imported/w3c/web-platform-tests/web-share/canShare.https-expected.txt:
+        * platform/mac-wk2/imported/w3c/web-platform-tests/web-share/share-empty.https-expected.txt:
+
 2021-09-02  Wenson Hsieh  <wenson_hs...@apple.com>
 
         REGRESSION (r280767): Caret color is black after pasting rich text in Mail compose in dark mode

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (281972 => 281973)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-03 02:14:37 UTC (rev 281972)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-03 02:21:53 UTC (rev 281973)
@@ -1,3 +1,16 @@
+2021-09-02  Marcos Caceres  <mar...@marcosc.com>
+
+        Web Share tests are out of date
+        https://bugs.webkit.org/show_bug.cgi?id=229489
+
+        Reviewed by Tim Horton.
+
+        * web-platform-tests/web-share/canShare.https.html:
+        * web-platform-tests/web-share/share-consume-activation.https.html:
+        * web-platform-tests/web-share/share-empty.https.html:
+        * web-platform-tests/web-share/share-securecontext.http.html:
+        * web-platform-tests/web-share/share-simple-manual.https.html:
+
 2021-09-02  Alex Christensen  <achristen...@webkit.org>
 
         Reject non-IPv4 hostnames that end in numbers

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/canShare.https.html (281972 => 281973)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/canShare.https.html	2021-09-03 02:14:37 UTC (rev 281972)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/canShare.https.html	2021-09-03 02:21:53 UTC (rev 281973)
@@ -1,85 +1,159 @@
 <!DOCTYPE html>
 <html>
   <head>
-    <meta charset="utf-8">
-    <title>WebShare Test: canShare without files</title>
+    <meta charset="utf-8" />
+    <title>WebShare Test: canShare method tests</title>
     <script src=""
     <script src=""
   </head>
   <body>
     <script>
-      'use strict';
-
       test(() => {
-        assert_equals(navigator.canShare(), false);
-      }, 'canShare with no arguments (same as empty dictionary)');
+        assert_false(
+          navigator.canShare(),
+          "no arguments (uses default argument value, which is empty dictionary)"
+        );
 
-      test(() => {
-        assert_equals(navigator.canShare({}), false);
-      }, 'canShare with an empty dictionary');
+        assert_false(navigator.canShare({}), "empty dictionary not allowed");
 
-      test(() => {
-        assert_equals(navigator.canShare(undefined), false);
-      }, 'canShare with a undefined argument (same as empty dictionary)');
+        assert_false(navigator.canShare(undefined), "empty dictionary not allowed");
 
-      test(() => {
-        assert_equals(navigator.canShare(null), false);
-      }, 'canShare with a null argument (same as empty dictionary)');
+        assert_false(navigator.canShare(null), "empty dictionary not allowed");
 
-      test(() => {
-        assert_equals(navigator.canShare({unused: 'unexpected field'}), false);
-      }, 'canShare with a dictionary containing only surplus fields');
+        assert_false(
+          navigator.canShare({ unused: "unexpected field" }),
+          "results in empty dictionary, which is not allowed"
+        );
+      }, "canShare() empty and default dictionary");
 
       test(() => {
-        // URL is invalid in that the URL Parser returns failure (port is too
-        // large).
-        const url = '';
-        assert_equals(navigator.canShare({url}), false);
-      }, 'canShare with an invalid URL');
+        assert_true(navigator.canShare({ url: "http://a.b" }), "http URL is ok");
 
-      test(() => {
-        assert_equals(navigator.canShare({title: undefined}), false);
-      }, 'canShare with attribute undefined is equivalent to omitting the attribute');
+        assert_true(navigator.canShare({ url: "https://a.b" }), "https URL is ok");
 
-      test(() => {
-        assert_equals(navigator.canShare({title: 'subject'}), true);
-      }, 'canShare with title');
+        assert_false(
+          navigator.canShare({ url: "http://a.b:65536" }),
+          "URL is invalid"
+        );
 
-      test(() => {
-        assert_equals(navigator.canShare({text: 'body'}), true);
-      }, 'canShare with text');
+        assert_false(
+          navigator.canShare({ url: "data:the url" }),
+          "data URL is not allowed"
+        );
 
-      test(() => {
-        assert_equals(navigator.canShare({url: 'https://www.example.com/some/path?some_query#some_fragment'}), true);
-      }, 'canShare with URL');
+        assert_false(
+          navigator.canShare({ url: "file:///usr/" }),
+          "file URL is not allowed"
+        );
 
-      test(() => {
-        assert_equals(navigator.canShare({title: null}), true);
-      }, 'canShare with null attribute');
+        assert_true(
+          navigator.canShare({
+            url: "https://a.b/path?query#fragment",
+          }),
+          "canShare with URL"
+        );
 
-      test(() => {
-        assert_equals(navigator.canShare({text: 123}), true);
-      }, 'canShare with number');
+        assert_true(
+          navigator.canShare({
+            url: {
+              toString() {
+                return "https://a.b/";
+              },
+            },
+          }),
+          "canShare URL as with object with stringifier"
+        );
 
-      test(() => {
-        assert_equals(navigator.canShare({url: {toString() { return 'https://example.com/'; }}}), true);
-      }, 'canShare with object');
+        assert_true(
+          navigator.canShare(
+            { url: "" },
+            "canShare with empty URL, which resolves as the doc's base URL"
+          )
+        );
 
+        assert_true(
+          navigator.canShare({
+            url: "//a.b/path?query#fragment",
+          }),
+          "canShare with URL having no scheme"
+        );
+
+        assert_true(
+          navigator.canShare({
+            url: "relative",
+          }),
+          "canShare relative URL, resolved against API base URL"
+        );
+      }, "canShare() url member");
+
       test(() => {
-        assert_equals(navigator.canShare({title: 'subject', text: 'body', url: 'https://example.com/', unused: 'unexpected field'}), true);
-      }, 'canShare with unexpected field');
+        assert_false(
+          navigator.canShare({ title: undefined }),
+          "canShare with attribute undefined is equivalent to omitting the attribute"
+        );
 
+        assert_true(navigator.canShare({ title: "subject" }), "canShare with title");
+
+        assert_true(navigator.canShare({ title: null }), "stringified null");
+      }, "canShare() title member");
+
       test(() => {
-        assert_equals(navigator.canShare({url: 'data:the url'}), true);
-      }, 'canShare with data URL');
+        assert_true(navigator.canShare({ text: "" }), "ok to share empty text");
 
+        assert_true(
+          navigator.canShare({ text: "some text 🤔" }),
+          "ok to share unicode"
+        );
+
+        assert_true(navigator.canShare({ text: 123 }), "number is stringified");
+      }, "canShare() text member");
+
       test(() => {
-        assert_equals(navigator.canShare({url: ''}), true);
-      }, 'canShare with empty URL');
+        const file = new File(["hello"], "file", { type: "text/plain" });
+        const file2 = new File([], "file2");
 
+        assert_false(navigator.canShare({ files: [] }), "empty list is not allowed");
+
+        assert_false(
+          navigator.canShare({
+            url: "https://a.b:800000",
+            files: [file, file2],
+          }),
+          "invalid URL invalidates the share"
+        );
+
+        assert_true(
+          navigator.canShare({ files: [file] }),
+          "single file is ok to share"
+        );
+
+        assert_true(
+          navigator.canShare({ files: [file, file2, file] }),
+          "repeated files is ok to share"
+        );
+
+        assert_true(
+          navigator.canShare({
+            files: [file, file2],
+            text: "some texts",
+            url: "https://example.com/",
+          }),
+          "is ok to share files, text, and url together"
+        );
+      }, "canShare() files member");
+
       test(() => {
-        assert_equals(navigator.canShare({url: '//www.example.com/some/path?some_query#some_fragment'}), true);
-      }, 'canShare with URL having no scheme');
+        assert_true(
+          navigator.canShare({
+            title: "subject",
+            text: "body",
+            url: "https://a.b/",
+            files: [new File([], "file")],
+            unused: "unexpected field",
+          }),
+          "canShare with unexpected field"
+        );
+      }, "canShare() multiple members");
     </script>
   </body>
 </html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/share-consume-activation.https.html (281972 => 281973)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/share-consume-activation.https.html	2021-09-03 02:14:37 UTC (rev 281972)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/share-consume-activation.https.html	2021-09-03 02:21:53 UTC (rev 281973)
@@ -3,9 +3,9 @@
   <head>
     <meta charset="utf-8" />
     <title>WebShare Test: consume user activation</title>
+    <link rel="help" href=""
     <script src=""
     <script src=""
-    <script src=""
     <script src=""
     <script src=""
   </head>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/share-empty.https.html (281972 => 281973)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/share-empty.https.html	2021-09-03 02:14:37 UTC (rev 281972)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/share-empty.https.html	2021-09-03 02:21:53 UTC (rev 281973)
@@ -3,9 +3,9 @@
   <head>
     <meta charset="utf-8" />
     <title>WebShare Test: Share no known fields</title>
+    <link rel="help" href=""
     <script src=""
     <script src=""
-    <script src=""
     <script src=""
     <script src=""
   </head>
@@ -44,6 +44,11 @@
           );
         });
       }, "share with a dictionary containing only surplus fields");
+
+      promise_test(async t => {
+        await test_driver.bless("web share");
+        await promise_rejects_js(t, TypeError, navigator.share({ files: [] }));
+      }, "share with an empty files member")
     </script>
   </body>
 </html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/share-securecontext.http.html (281972 => 281973)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/share-securecontext.http.html	2021-09-03 02:14:37 UTC (rev 281972)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/share-securecontext.http.html	2021-09-03 02:21:53 UTC (rev 281973)
@@ -3,6 +3,7 @@
   <head>
     <meta charset="utf-8">
     <title>WebShare Test: Share from non-secure context</title>
+    <link rel="help" href=""
     <script src=""
     <script src=""
   </head>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/share-simple-manual.https.html (281972 => 281973)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/share-simple-manual.https.html	2021-09-03 02:14:37 UTC (rev 281972)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/share-simple-manual.https.html	2021-09-03 02:21:53 UTC (rev 281973)
@@ -12,9 +12,9 @@
         setup({explicit_timeout: true});
 
         const url = '';
-        setupManualShareTest({title: 'the title', text: 'the message', url});
-        callWhenButtonClicked(() => navigator.share(
-              {title: 'the title', text: 'the message', url})).then(
+        const data = "" 'the title', text: 'the message', url, files: []};
+        setupManualShareTest(data);
+        callWhenButtonClicked(() => navigator.share(data)).then(
               result => {
                 // Check that promise resolved with undefined. This is guarded
                 // by an if statement because we do not want it to register as a

Modified: trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/web-share/canShare.https-expected.txt (281972 => 281973)


--- trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/web-share/canShare.https-expected.txt	2021-09-03 02:14:37 UTC (rev 281972)
+++ trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/web-share/canShare.https-expected.txt	2021-09-03 02:21:53 UTC (rev 281973)
@@ -1,19 +1,8 @@
 
-PASS canShare with no arguments (same as empty dictionary)
-PASS canShare with an empty dictionary
-PASS canShare with a undefined argument (same as empty dictionary)
-PASS canShare with a null argument (same as empty dictionary)
-PASS canShare with a dictionary containing only surplus fields
-PASS canShare with an invalid URL
-PASS canShare with attribute undefined is equivalent to omitting the attribute
-PASS canShare with title
-PASS canShare with text
-PASS canShare with URL
-PASS canShare with null attribute
-PASS canShare with number
-PASS canShare with object
-PASS canShare with unexpected field
-PASS canShare with data URL
-PASS canShare with empty URL
-PASS canShare with URL having no scheme
+PASS canShare() empty and default dictionary
+FAIL canShare() url member assert_false: data URL is not allowed expected false got true
+PASS canShare() title member
+PASS canShare() text member
+FAIL canShare() files member assert_false: invalid URL invalidates the share expected false got true
+PASS canShare() multiple members
 

Modified: trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/web-share/share-empty.https-expected.txt (281972 => 281973)


--- trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/web-share/share-empty.https-expected.txt	2021-09-03 02:14:37 UTC (rev 281972)
+++ trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/web-share/share-empty.https-expected.txt	2021-09-03 02:21:53 UTC (rev 281973)
@@ -4,4 +4,5 @@
 PASS share with a undefined argument (same as empty dictionary)
 PASS share with a null argument (same as empty dictionary)
 PASS share with a dictionary containing only surplus fields
+PASS share with an empty files member
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to