Title: [216979] trunk/LayoutTests
Revision
216979
Author
cdu...@apple.com
Date
2017-05-17 10:23:20 -0700 (Wed, 17 May 2017)

Log Message

Import Notification tests from web-platform-tests
https://bugs.webkit.org/show_bug.cgi?id=172196

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

* resources/import-expectations.json:
* web-platform-tests/notifications/OWNERS: Added.
* web-platform-tests/notifications/common.js: Added.
(createPassFail):
(clearPassFail):
(closeNotifications):
(hasNotificationPermission):
* web-platform-tests/notifications/constructor-basic-expected.txt: Added.
* web-platform-tests/notifications/constructor-basic.html: Added.
* web-platform-tests/notifications/constructor-invalid-expected.txt: Added.
* web-platform-tests/notifications/constructor-invalid.html: Added.
* web-platform-tests/notifications/event-onclose-expected.txt: Added.
* web-platform-tests/notifications/event-onclose.html: Added.
* web-platform-tests/notifications/event-onshow-expected.txt: Added.
* web-platform-tests/notifications/event-onshow.html: Added.
* web-platform-tests/notifications/instance-expected.txt: Added.
* web-platform-tests/notifications/instance.html: Added.
* web-platform-tests/notifications/interfaces-expected.txt: Added.
* web-platform-tests/notifications/interfaces.html: Added.
* web-platform-tests/notifications/lang-expected.txt: Added.
* web-platform-tests/notifications/lang.html: Added.
* web-platform-tests/notifications/permission-expected.txt: Added.
* web-platform-tests/notifications/permission.html: Added.
* web-platform-tests/notifications/resources/icon.png: Added.
* web-platform-tests/notifications/resources/shownotification-sw.js: Added.
(self.onmessage.event.then):
* web-platform-tests/notifications/resources/w3c-import.log: Added.
* web-platform-tests/notifications/shownotification-resolve-manual.https-expected.txt: Added.
* web-platform-tests/notifications/shownotification-resolve-manual.https.html: Added.
* web-platform-tests/notifications/w3c-import.log: Added.

LayoutTests:

* resources/testharnessreport.js:
Allow notifications as this is a pre-requirement for web-platform-tests.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (216978 => 216979)


--- trunk/LayoutTests/ChangeLog	2017-05-17 17:15:45 UTC (rev 216978)
+++ trunk/LayoutTests/ChangeLog	2017-05-17 17:23:20 UTC (rev 216979)
@@ -1,3 +1,13 @@
+2017-05-17  Chris Dumez  <cdu...@apple.com>
+
+        Import Notification tests from web-platform-tests
+        https://bugs.webkit.org/show_bug.cgi?id=172196
+
+        Reviewed by Youenn Fablet.
+
+        * resources/testharnessreport.js:
+        Allow notifications as this is a pre-requirement for web-platform-tests.
+
 2017-05-17  Ryosuke Niwa  <rn...@webkit.org>
 
         getElementById can return a wrong elemnt when a matching element is removed during beforeload event

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (216978 => 216979)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-05-17 17:15:45 UTC (rev 216978)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-05-17 17:23:20 UTC (rev 216979)
@@ -1,3 +1,41 @@
+2017-05-17  Chris Dumez  <cdu...@apple.com>
+
+        Import Notification tests from web-platform-tests
+        https://bugs.webkit.org/show_bug.cgi?id=172196
+
+        Reviewed by Youenn Fablet.
+
+        * resources/import-expectations.json:
+        * web-platform-tests/notifications/OWNERS: Added.
+        * web-platform-tests/notifications/common.js: Added.
+        (createPassFail):
+        (clearPassFail):
+        (closeNotifications):
+        (hasNotificationPermission):
+        * web-platform-tests/notifications/constructor-basic-expected.txt: Added.
+        * web-platform-tests/notifications/constructor-basic.html: Added.
+        * web-platform-tests/notifications/constructor-invalid-expected.txt: Added.
+        * web-platform-tests/notifications/constructor-invalid.html: Added.
+        * web-platform-tests/notifications/event-onclose-expected.txt: Added.
+        * web-platform-tests/notifications/event-onclose.html: Added.
+        * web-platform-tests/notifications/event-onshow-expected.txt: Added.
+        * web-platform-tests/notifications/event-onshow.html: Added.
+        * web-platform-tests/notifications/instance-expected.txt: Added.
+        * web-platform-tests/notifications/instance.html: Added.
+        * web-platform-tests/notifications/interfaces-expected.txt: Added.
+        * web-platform-tests/notifications/interfaces.html: Added.
+        * web-platform-tests/notifications/lang-expected.txt: Added.
+        * web-platform-tests/notifications/lang.html: Added.
+        * web-platform-tests/notifications/permission-expected.txt: Added.
+        * web-platform-tests/notifications/permission.html: Added.
+        * web-platform-tests/notifications/resources/icon.png: Added.
+        * web-platform-tests/notifications/resources/shownotification-sw.js: Added.
+        (self.onmessage.event.then):
+        * web-platform-tests/notifications/resources/w3c-import.log: Added.
+        * web-platform-tests/notifications/shownotification-resolve-manual.https-expected.txt: Added.
+        * web-platform-tests/notifications/shownotification-resolve-manual.https.html: Added.
+        * web-platform-tests/notifications/w3c-import.log: Added.
+
 2017-05-17  Ben Kelly  <b...@wanderview.com>
 
         Import FileAPI WPT tests.

Modified: trunk/LayoutTests/imported/w3c/resources/import-expectations.json (216978 => 216979)


--- trunk/LayoutTests/imported/w3c/resources/import-expectations.json	2017-05-17 17:15:45 UTC (rev 216978)
+++ trunk/LayoutTests/imported/w3c/resources/import-expectations.json	2017-05-17 17:23:20 UTC (rev 216979)
@@ -223,7 +223,7 @@
     "web-platform-tests/microdata": "skip", 
     "web-platform-tests/mixed-content": "skip", 
     "web-platform-tests/navigation-timing": "skip", 
-    "web-platform-tests/notifications": "skip", 
+    "web-platform-tests/notifications": "import", 
     "web-platform-tests/offscreen-canvas": "skip", 
     "web-platform-tests/old-tests": "skip", 
     "web-platform-tests/orientation-event": "skip", 
@@ -277,4 +277,4 @@
     "web-platform-tests/webvr": "skip", 
     "web-platform-tests/webvtt": "skip", 
     "web-platform-tests/workers": "skip"
-}
+}
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/OWNERS (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/OWNERS	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/OWNERS	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,4 @@
+@chunywang
+@sideshowbarker
+@xinliux
+@ibelem

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/common.js (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/common.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/common.js	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,48 @@
+function createPassFail(condition, test, cleanup, cleanupParam) {
+    var div = document.querySelector("#passfail")
+    var para = document.createElement("p")
+    var pass = document.createElement("button")
+    var fail = document.createElement("button")
+    var style = "font-family: monospace"
+    para.innerHTML = condition
+        + ', press the PASS button;'
+        + ' otherwise press the FAIL button.',
+    pass.innerHTML = "PASS"
+    fail.innerHTML = "FAIL"
+    pass.setAttribute("style", style)
+    fail.setAttribute("style", style)
+    pass.addEventListener("click", function () {
+        clearPassFail()
+        cleanup(cleanupParam)
+        test.done()
+    }, false)
+    fail.addEventListener("click", function () {
+        clearPassFail()
+        cleanup(cleanupParam)
+        test.force_timeout()
+        test.set_status(test.FAIL)
+        test.done()
+    }, false)
+    document.body.appendChild(div)
+    div.appendChild(para)
+    div.appendChild(pass)
+    div.appendChild(fail)
+}
+function clearPassFail() {
+    document.querySelector("#passfail").innerHTML = ""
+}
+function closeNotifications(notifications) {
+    for (var i=0; i < notifications.length; i++) {
+        notifications[i].close()
+    }
+}
+function hasNotificationPermission() {
+    Notification.requestPermission()
+    if (Notification.permission != "granted") {
+        alert("TEST NOT RUN. Change your browser settings so that"
+            + " notifications for this origin are allowed, and then re-run"
+            + " this test.")
+        return false
+    }
+    return true
+}

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/constructor-basic-expected.txt (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/constructor-basic-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/constructor-basic-expected.txt	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,3 @@
+
+PASS Called the notification constructor with one argument. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/constructor-basic.html (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/constructor-basic.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/constructor-basic.html	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification constructor (basic)</title>
+<link rel="author" title="Intel" href=""
+<link rel="author" title="Xin Liu" href=""
+<script src=""
+<script src=""
+<script>
+test(function() {
+    if (Notification.permission != "granted") {
+        this.force_timeout()
+        this.set_status(this.NOTRUN, "You must allow notifications for this"
+            + " origin before running this test.")
+    }
+    var notification = new Notification("New Email Received")
+    assert_true(notification instanceof Notification)
+    notification._onshow_ = function() {
+        notification.close()
+    }
+}, "Called the notification constructor with one argument.")
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/constructor-invalid-expected.txt (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/constructor-invalid-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/constructor-invalid-expected.txt	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,3 @@
+
+PASS Called the notification constructor with no arguments. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/constructor-invalid.html (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/constructor-invalid.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/constructor-invalid.html	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification constructor (invalid)</title>
+<link rel="author" title="Intel" href=""
+<link rel="author" title="Xin Liu" href=""
+<script src=""
+<script src=""
+<script>
+test(function() {
+    if (Notification.permission != "granted") {
+        this.force_timeout()
+        this.set_status(this.NOTRUN, "You must allow notifications for this"
+            + " origin before running this test.")
+    }
+    assert_throws(new TypeError(), function() {
+        new Notification()
+    })
+}, "Called the notification constructor with no arguments.")
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/event-onclose-expected.txt (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/event-onclose-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/event-onclose-expected.txt	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,4 @@
+
+PASS Checked test prerequisites. 
+PASS Invoked the onclose event handler. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/event-onclose.html (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/event-onclose.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/event-onclose.html	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.onclose (basic)</title>
+<link rel="author" title="Apple Inc." href=""
+<script src=""
+<script src=""
+<script>
+test(function() {
+    if (Notification.permission != "granted") {
+        this.force_timeout()
+        this.set_status(this.NOTRUN, "You must allow notifications for this"
+            + "origin before running this test.")
+    } else {
+        var t = async_test("Invoked the onclose event handler.")
+        var notification = new Notification("New Email Received")
+        notification._onshow_ = t.step_func(function() {
+            notification.close()
+        })
+        notification._onclose_ = t.step_func(function(e) {
+            assert_equals(Object.prototype.toString.call(e), "[object Event]")
+            assert_equals(e.type, "close", "Checked the event type.")
+            t.done()
+        })
+    }
+}, "Checked test prerequisites.")
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/event-onshow-expected.txt (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/event-onshow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/event-onshow-expected.txt	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,4 @@
+
+PASS Checked test prerequisites. 
+PASS Invoked the onshow event handler. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/event-onshow.html (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/event-onshow.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/event-onshow.html	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.onshow (basic)</title>
+<link rel="author" title="Intel" href=""
+<link rel="author" title="Xin Liu" href=""
+<script src=""
+<script src=""
+<script>
+test(function() {
+    if (Notification.permission != "granted") {
+        this.force_timeout()
+        this.set_status(this.NOTRUN, "You must allow notifications for this"
+            + " origin before running this test.")
+    } else {
+        var t = async_test("Invoked the onshow event handler.")
+        var notification = new Notification("New Email Received")
+        notification._onshow_ = t.step_func(function(e) {
+            assert_equals(Object.prototype.toString.call(e), "[object Event]")
+            assert_equals(e.type, "show", "Checked the event type.")
+            notification.close()
+            t.done()
+        })
+    }
+}, "Checked test prerequisites.")
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/instance-expected.txt (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/instance-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/instance-expected.txt	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,14 @@
+
+PASS Notification instance exists. 
+PASS Attribute exists: close 
+PASS Attribute exists: onclick 
+PASS Attribute exists: onshow 
+PASS Attribute exists: onerror 
+PASS Attribute exists: onclose 
+PASS Attribute exists with expected value: title 
+PASS Attribute exists with expected value: dir 
+PASS Attribute exists with expected value: lang 
+PASS Attribute exists with expected value: body 
+PASS Attribute exists with expected value: tag 
+PASS Attribute exists with expected value: icon 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/instance.html (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/instance.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/instance.html	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification instance basic tests</title>
+<script src=""
+<script src=""
+<script>
+if (Notification.permission != "granted") {
+    test(function() {
+        this.force_timeout()
+        this.set_status(this.NOTRUN, "You must allow notifications for this"
+            + " origin before running this test.")
+    })
+} else {
+    var n = new Notification("Radio check",
+      {
+          dir: "ltr",
+         lang: "aa",
+         body: "This is a radio check.",
+          tag: "radio_check999",
+         icon: "http://example.com/icon.png",
+      }
+    )
+    n._onshow_ = function() {
+        n.close()
+    }
+    test(function() {
+        assert_true(n instanceof Notification)
+    },"Notification instance exists.")
+    test(function() {
+        assert_true("close" in n)
+    },"Attribute exists: close")
+    test(function() {
+        assert_true("onclick" in n)
+    },"Attribute exists: onclick")
+    test(function() {
+        assert_true("onshow" in n)
+    },"Attribute exists: onshow")
+    test(function() {
+        assert_true("onerror" in n)
+    },"Attribute exists: onerror")
+    test(function() {
+        assert_true("onclose" in n)
+    },"Attribute exists: onclose")
+    test(function() {
+        assert_equals("Radio check", n.title)
+    },"Attribute exists with expected value: title")
+    test(function() {
+        assert_equals("ltr", n.dir)
+    },"Attribute exists with expected value: dir")
+    test(function() {
+        assert_equals("aa", n.lang)
+    },"Attribute exists with expected value: lang")
+    test(function() {
+        assert_equals("This is a radio check.", n.body)
+    },"Attribute exists with expected value: body")
+    test(function() {
+        assert_equals("radio_check999", n.tag)
+    },"Attribute exists with expected value: tag")
+    test(function() {
+        assert_equals("http://example.com/icon.png", n.icon)
+    },"Attribute exists with expected value: icon")
+}
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/interfaces-expected.txt (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/interfaces-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/interfaces-expected.txt	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,44 @@
+CONSOLE MESSAGE: line 251: callback not yet supported
+CONSOLE MESSAGE: line 251: callback not yet supported
+
+PASS Notification interface: existence and properties of interface object 
+PASS Notification interface object length 
+PASS Notification interface object name 
+PASS Notification interface: existence and properties of interface prototype object 
+PASS Notification interface: existence and properties of interface prototype object's "constructor" property 
+PASS Notification interface: attribute permission 
+PASS Notification interface: operation requestPermission(NotificationPermissionCallback) 
+PASS Notification interface: attribute onclick 
+PASS Notification interface: attribute onshow 
+PASS Notification interface: attribute onerror 
+PASS Notification interface: attribute onclose 
+PASS Notification interface: attribute title 
+PASS Notification interface: attribute dir 
+PASS Notification interface: attribute lang 
+PASS Notification interface: attribute body 
+PASS Notification interface: attribute tag 
+PASS Notification interface: attribute icon 
+PASS Notification interface: operation close() 
+PASS Notification must be primary interface of new Notification("Running idlharness.") 
+PASS Stringification of new Notification("Running idlharness.") 
+PASS Notification interface: new Notification("Running idlharness.") must inherit property "permission" with the proper type (0) 
+PASS Notification interface: new Notification("Running idlharness.") must inherit property "requestPermission" with the proper type (1) 
+PASS Notification interface: calling requestPermission(NotificationPermissionCallback) on new Notification("Running idlharness.") with too few arguments must throw TypeError 
+PASS Notification interface: new Notification("Running idlharness.") must inherit property "onclick" with the proper type (2) 
+PASS Notification interface: new Notification("Running idlharness.") must inherit property "onshow" with the proper type (3) 
+PASS Notification interface: new Notification("Running idlharness.") must inherit property "onerror" with the proper type (4) 
+PASS Notification interface: new Notification("Running idlharness.") must inherit property "onclose" with the proper type (5) 
+PASS Notification interface: new Notification("Running idlharness.") must inherit property "title" with the proper type (6) 
+PASS Notification interface: new Notification("Running idlharness.") must inherit property "dir" with the proper type (7) 
+PASS Notification interface: new Notification("Running idlharness.") must inherit property "lang" with the proper type (8) 
+PASS Notification interface: new Notification("Running idlharness.") must inherit property "body" with the proper type (9) 
+PASS Notification interface: new Notification("Running idlharness.") must inherit property "tag" with the proper type (10) 
+PASS Notification interface: new Notification("Running idlharness.") must inherit property "icon" with the proper type (11) 
+PASS Notification interface: new Notification("Running idlharness.") must inherit property "close" with the proper type (12) 
+PASS EventTarget interface: new Notification("Running idlharness.") must inherit property "addEventListener" with the proper type (0) 
+PASS EventTarget interface: calling addEventListener(DOMString,EventListener,boolean) on new Notification("Running idlharness.") with too few arguments must throw TypeError 
+PASS EventTarget interface: new Notification("Running idlharness.") must inherit property "removeEventListener" with the proper type (1) 
+PASS EventTarget interface: calling removeEventListener(DOMString,EventListener,boolean) on new Notification("Running idlharness.") with too few arguments must throw TypeError 
+PASS EventTarget interface: new Notification("Running idlharness.") must inherit property "dispatchEvent" with the proper type (2) 
+PASS EventTarget interface: calling dispatchEvent(Event) on new Notification("Running idlharness.") with too few arguments must throw TypeError 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/interfaces.html (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/interfaces.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/interfaces.html	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,80 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Notification interface IDL tests</title>
+<div id=log></div>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script type=text/plain class=untested>
+interface EventTarget {
+  void addEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */);
+  void removeEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */);
+  boolean dispatchEvent(Event event);
+};
+[TreatNonCallableAsNull]
+callback EventHandlerNonNull = any (Event event);
+typedef EventHandlerNonNull? EventHandler;
+</script>
+<script type=text/plain>
+[Constructor(DOMString title, optional NotificationOptions options)]
+interface Notification : EventTarget {
+  static readonly attribute NotificationPermission permission;
+  static Promise<NotificationPermission> requestPermission(optional NotificationPermissionCallback callback);
+
+  attribute EventHandler onclick;
+  attribute EventHandler onshow;
+  attribute EventHandler onerror;
+  attribute EventHandler onclose;
+
+  readonly attribute DOMString title;
+  readonly attribute NotificationDirection dir;
+  readonly attribute DOMString lang;
+  readonly attribute DOMString body;
+  readonly attribute DOMString tag;
+  readonly attribute DOMString icon;
+
+  void close();
+};
+
+dictionary NotificationOptions {
+  NotificationDirection dir = "auto";
+  DOMString lang = "";
+  DOMString body;
+  DOMString tag;
+  DOMString icon;
+};
+
+dictionary GetNotificationsOptions {
+  DOMString tag;
+};
+
+enum NotificationPermission {
+  "default",
+  "denied",
+  "granted"
+};
+
+callback NotificationPermissionCallback = void (NotificationPermission permission);
+
+enum NotificationDirection {
+  "auto",
+  "ltr",
+  "rtl"
+};
+</script>
+<script>
+"use strict";
+var idlArray = new IdlArray();
+[].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
+  if (node.className == "untested") {
+    idlArray.add_untested_idls(node.textContent);
+  } else {
+    idlArray.add_idls(node.textContent);
+  }
+});
+idlArray.add_objects({
+  Notification: ['new Notification("Running idlharness.")'],
+});
+idlArray.test();
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/lang-expected.txt (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/lang-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/lang-expected.txt	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,39 @@
+
+PASS Roundtripping lang "". Expecting "". 
+PASS Roundtripping lang "en". Expecting "en". 
+PASS Roundtripping lang "en-US-x-hixie". Expecting "en-US-x-hixie". 
+PASS Roundtripping lang "de-DE". Expecting "de-DE". 
+PASS Roundtripping lang "de-de". Expecting "de-de". 
+PASS Roundtripping lang "de-De". Expecting "de-De". 
+PASS Roundtripping lang "de-dE". Expecting "de-dE". 
+PASS Roundtripping lang "de-DE-1996". Expecting "de-DE-1996". 
+PASS Roundtripping lang "de-Latn-DE". Expecting "de-Latn-DE". 
+PASS Roundtripping lang "de-Latf-DE". Expecting "de-Latf-DE". 
+PASS Roundtripping lang "de-Latn-DE-1996". Expecting "de-Latn-DE-1996". 
+PASS Roundtripping lang "de-CH". Expecting "de-CH". 
+PASS Roundtripping lang "it-CH". Expecting "it-CH". 
+PASS Roundtripping lang "fr-CH". Expecting "fr-CH". 
+PASS Roundtripping lang "rm-CH". Expecting "rm-CH". 
+PASS Roundtripping lang "es-CH". Expecting "es-CH". 
+FAIL Roundtripping lang "Latn-de". Expecting "". assert_equals: notification.lang expected "" but got "Latn-de"
+FAIL Roundtripping lang "Latf-de". Expecting "". assert_equals: notification.lang expected "" but got "Latf-de"
+FAIL Roundtripping lang "tic-tac-tac-toe". Expecting "". assert_equals: notification.lang expected "" but got "tic-tac-tac-toe"
+FAIL Roundtripping lang "cocoa-1-bar". Expecting "". assert_equals: notification.lang expected "" but got "cocoa-1-bar"
+FAIL Roundtripping lang "cocoa-a-bar". Expecting "". assert_equals: notification.lang expected "" but got "cocoa-a-bar"
+FAIL Roundtripping lang "en-". Expecting "". assert_equals: notification.lang expected "" but got "en-"
+FAIL Roundtripping lang "en--". Expecting "". assert_equals: notification.lang expected "" but got "en--"
+FAIL Roundtripping lang "foo--bar". Expecting "". assert_equals: notification.lang expected "" but got "foo--bar"
+FAIL Roundtripping lang "id---Java". Expecting "". assert_equals: notification.lang expected "" but got "id---Java"
+FAIL Roundtripping lang "fr-x". Expecting "". assert_equals: notification.lang expected "" but got "fr-x"
+FAIL Roundtripping lang "fr-xenomorph". Expecting "". assert_equals: notification.lang expected "" but got "fr-xenomorph"
+FAIL Roundtripping lang "fr-x-xenomorph". Expecting "". assert_equals: notification.lang expected "" but got "fr-x-xenomorph"
+FAIL Roundtripping lang "a". Expecting "". assert_equals: notification.lang expected "" but got "a"
+FAIL Roundtripping lang "a-fr-lang". Expecting "". assert_equals: notification.lang expected "" but got "a-fr-lang"
+FAIL Roundtripping lang "b-fr-lang". Expecting "". assert_equals: notification.lang expected "" but got "b-fr-lang"
+FAIL Roundtripping lang "es1-KK-aa-bb-cc-dd". Expecting "". assert_equals: notification.lang expected "" but got "es1-KK-aa-bb-cc-dd"
+FAIL Roundtripping lang "es2-KL-aa-bb-cc-dd". Expecting "". assert_equals: notification.lang expected "" but got "es2-KL-aa-bb-cc-dd"
+FAIL Roundtripping lang "es3-KM-aa-bb-cc-dd". Expecting "". assert_equals: notification.lang expected "" but got "es3-KM-aa-bb-cc-dd"
+FAIL Roundtripping lang "fooÉ". Expecting "". assert_equals: notification.lang expected "" but got "fooÉ"
+FAIL Roundtripping lang "foöÉ-bÁr". Expecting "". assert_equals: notification.lang expected "" but got "foöÉ-bÁr"
+FAIL Roundtripping lang "foöÉbÁr". Expecting "". assert_equals: notification.lang expected "" but got "foöÉbÁr"
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/lang.html (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/lang.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/lang.html	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.lang</title>
+<link rel="author" title="Apple Inc." href=""
+<script src=""
+<script src=""
+<script>
+setup({ explicit_done: true });
+
+/* Validity and well-formedness was determined by using the BCP 47
+   Validator at http://schneegans.de/lv/ */
+
+/* The empty string is valid, as well as any valid BCP 47 language tag. */
+var valid_langs = ["", "en", "en-US-x-hixie", "de-DE", "de-de", "de-De",
+                   "de-dE", "de-DE-1996", "de-Latn-DE", "de-Latf-DE",
+                   "de-Latn-DE-1996", "de-CH", "it-CH", "fr-CH",
+                   "rm-CH", "es-CH"];
+
+/* Well-formed but invalid BCP 47 language tags should not round-trip;
+   they should come back as the empty string. */
+var well_formed_langs = ["Latn-de", "Latf-de", "tic-tac-tac-toe",
+                         "cocoa-1-bar", "cocoa-a-bar"];
+
+/* Invalid BCP 47 language tags should not round-trip; they should come
+   back as the empty string. */
+var invalid_langs = ["en-", "en-\-", "foo-\-bar", "id-\-\-Java", "fr-x",
+                     "fr-xenomorph", "fr-x-xenomorph", "a", "a-fr-lang",
+                     "b-fr-lang", "es1-KK-aa-bb-cc-dd",
+                     "es2-KL-aa-bb-cc-dd", "es3-KM-aa-bb-cc-dd", "fooÉ",
+                     "foöÉ-bÁr", "foöÉbÁr"];
+
+function test_lang(language, should_passthrough) {
+    var expected = should_passthrough ? language : "";
+    test(function() {
+        if (Notification.permission != "granted") {
+            this.force_timeout()
+            this.set_status(this.NOTRUN, "You must allow notifications for this origin before running this test.")
+        }
+        var notification = new Notification("This is a notification.", {
+            lang: language
+        });
+        assert_equals(notification.lang, expected, "notification.lang");
+        notification._onshow_ = function() {
+            notification.close();
+        };
+    },
+    "Roundtripping lang \"" + language + "\". Expecting \"" + expected + "\".");
+}
+
+for (var i=0; i<valid_langs.length; i++) {
+    test_lang(valid_langs[i], true);
+}
+
+for (var i=0; i<well_formed_langs.length; i++) {
+    test_lang(well_formed_langs[i], false);
+}
+
+for (var i=0; i<invalid_langs.length; i++) {
+    test_lang(invalid_langs[i], false);
+}
+
+done();
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/permission-expected.txt (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/permission-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/permission-expected.txt	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,3 @@
+
+PASS Checked the Notification.permission property. 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/permission.html (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/permission.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/permission.html	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.permission (basic)</title>
+<link rel="author" title="Intel" href=""
+<link rel="author" title="Xin Liu" href=""
+<script src=""
+<script src=""
+<script>
+test(function() {
+    assert_in_array(Notification.permission,
+        ["default", "denied", "granted"],
+        "Notification.permission")
+}, "Checked the Notification.permission property.")
+</script>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/resources/icon.png


(Binary files differ)
Index: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/resources/icon.png =================================================================== --- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/resources/icon.png 2017-05-17 17:15:45 UTC (rev 216978) +++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/resources/icon.png 2017-05-17 17:23:20 UTC (rev 216979) Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/resources/icon.png ___________________________________________________________________

Added: svn:mime-type

+image/png \ No newline at end of property

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/resources/shownotification-sw.js (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/resources/shownotification-sw.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/resources/shownotification-sw.js	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,27 @@
+self._onmessage_ = event => {
+  // Checking for a particular value, so more tests can be added in future.
+  if (event.data !== 'test-shownotification') return;
+
+  // Random number, so we can identify the notification we create.
+  const random = Math.random().toString();
+  const start = Date.now();
+
+  event.waitUntil(
+    self.registration.showNotification('test', {
+      tag: random,
+      // ?pipe=trickle(d2) delays the icon request by two seconds
+      icon: 'icon.png?pipe=trickle(d2)'
+    }).then(() => {
+      const resolveDuration = Date.now() - start;
+
+      return self.registration.getNotifications().then(notifications => {
+        event.source.postMessage({
+          type: 'notification-data',
+          resolveDuration,
+          // Check if our notification is in notifications
+          notificationReturned: notifications.some(n => n.tag == random)
+        });
+      });
+    })
+  );
+};
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/resources/w3c-import.log (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/resources/w3c-import.log	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/resources/w3c-import.log	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,18 @@
+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/w3c/web-platform-tests
+
+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/notifications/resources/icon.png
+/LayoutTests/imported/w3c/web-platform-tests/notifications/resources/shownotification-sw.js

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/w3c-import.log (0 => 216979)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/w3c-import.log	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/notifications/w3c-import.log	2017-05-17 17:23:20 UTC (rev 216979)
@@ -0,0 +1,26 @@
+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/w3c/web-platform-tests
+
+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/notifications/OWNERS
+/LayoutTests/imported/w3c/web-platform-tests/notifications/common.js
+/LayoutTests/imported/w3c/web-platform-tests/notifications/constructor-basic.html
+/LayoutTests/imported/w3c/web-platform-tests/notifications/constructor-invalid.html
+/LayoutTests/imported/w3c/web-platform-tests/notifications/event-onclose.html
+/LayoutTests/imported/w3c/web-platform-tests/notifications/event-onshow.html
+/LayoutTests/imported/w3c/web-platform-tests/notifications/instance.html
+/LayoutTests/imported/w3c/web-platform-tests/notifications/interfaces.html
+/LayoutTests/imported/w3c/web-platform-tests/notifications/lang.html
+/LayoutTests/imported/w3c/web-platform-tests/notifications/permission.html

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (216978 => 216979)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2017-05-17 17:15:45 UTC (rev 216978)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2017-05-17 17:23:20 UTC (rev 216979)
@@ -217,6 +217,9 @@
 # This hit-test test doesn't work on DRT
 webkit.org/b/156084 accessibility/mac/video-tag-hit-test.html [ Skip ]
 
+# This newly imported test times out on WK1 but passes on WK2.
+webkit.org/b/172222 imported/w3c/web-platform-tests/notifications/event-onclose.html [ Skip ]
+
 # <a download> is not supported in WK1 yet.
 webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-nodownload-set.html [ Failure ]
 webkit.org/b/156069 fast/dom/HTMLAnchorElement/anchor-download.html [ Failure ]

Modified: trunk/LayoutTests/resources/testharnessreport.js (216978 => 216979)


--- trunk/LayoutTests/resources/testharnessreport.js	2017-05-17 17:15:45 UTC (rev 216978)
+++ trunk/LayoutTests/resources/testharnessreport.js	2017-05-17 17:23:20 UTC (rev 216979)
@@ -15,6 +15,7 @@
     testRunner.dumpAsText();
     testRunner.waitUntilDone();
     testRunner.setCanOpenWindows();
+    testRunner.grantWebNotificationPermission("http://localhost:8800");
     // Let's restrict calling testharness timeout() to wptserve tests for the moment.
     // That will limit the impact to a small number of tests.
     // The risk is that testharness timeout() might be called to late on slow bots to finish properly.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to