summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/notifications
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/notifications
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/notifications')
-rw-r--r--testing/web-platform/tests/notifications/OWNERS4
-rw-r--r--testing/web-platform/tests/notifications/body-basic-manual.html28
-rw-r--r--testing/web-platform/tests/notifications/body-empty-manual.html31
-rw-r--r--testing/web-platform/tests/notifications/common.js48
-rw-r--r--testing/web-platform/tests/notifications/constructor-basic.html21
-rw-r--r--testing/web-platform/tests/notifications/constructor-invalid.html19
-rw-r--r--testing/web-platform/tests/notifications/event-onclick-manual.html25
-rw-r--r--testing/web-platform/tests/notifications/event-onclose.html26
-rw-r--r--testing/web-platform/tests/notifications/event-onerror-default-manual.html27
-rw-r--r--testing/web-platform/tests/notifications/event-onerror-denied-manual.html26
-rw-r--r--testing/web-platform/tests/notifications/event-onshow.html25
-rw-r--r--testing/web-platform/tests/notifications/icon-basic-manual.html28
-rw-r--r--testing/web-platform/tests/notifications/icon-empty-manual.html27
-rw-r--r--testing/web-platform/tests/notifications/instance.html63
-rw-r--r--testing/web-platform/tests/notifications/interfaces.html80
-rw-r--r--testing/web-platform/tests/notifications/lang.html63
-rw-r--r--testing/web-platform/tests/notifications/permission.html14
-rw-r--r--testing/web-platform/tests/notifications/requestPermission-denied-manual.html22
-rw-r--r--testing/web-platform/tests/notifications/requestPermission-granted-manual.html18
-rw-r--r--testing/web-platform/tests/notifications/tag-different-manual.html37
-rw-r--r--testing/web-platform/tests/notifications/tag-same-manual.html37
21 files changed, 669 insertions, 0 deletions
diff --git a/testing/web-platform/tests/notifications/OWNERS b/testing/web-platform/tests/notifications/OWNERS
new file mode 100644
index 000000000..992402311
--- /dev/null
+++ b/testing/web-platform/tests/notifications/OWNERS
@@ -0,0 +1,4 @@
+@chunywang
+@sideshowbarker
+@xinliux
+@ibelem
diff --git a/testing/web-platform/tests/notifications/body-basic-manual.html b/testing/web-platform/tests/notifications/body-basic-manual.html
new file mode 100644
index 000000000..a479917ae
--- /dev/null
+++ b/testing/web-platform/tests/notifications/body-basic-manual.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.body (basic)</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="common.js"></script>
+<div id=passfail></div>
+<script>
+setup({ explicit_timeout: true })
+if (hasNotificationPermission()) {
+ async_test(function (t) {
+ t.step(function () {
+ var notification = null,
+ notifications = [],
+ text = "This is the body content: Room 101"
+ createPassFail("If a notification appears containing the text"
+ + " \"" + text + "\"",
+ t, closeNotifications, notifications)
+ notification = new Notification("", {
+ body: text
+ })
+ notifications.push(notification)
+ })
+ })
+}
+</script>
diff --git a/testing/web-platform/tests/notifications/body-empty-manual.html b/testing/web-platform/tests/notifications/body-empty-manual.html
new file mode 100644
index 000000000..a94f08e1c
--- /dev/null
+++ b/testing/web-platform/tests/notifications/body-empty-manual.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.body (empty string)</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="common.js"></script>
+<div id=passfail></div>
+<script>
+setup({ explicit_timeout: true })
+if (hasNotificationPermission()) {
+ async_test(function (t) {
+ t.step(function () {
+ var notification = null,
+ notifications = [],
+ text = "This is the title: New e-mail received"
+ createPassFail("If a notification appears containing the text "
+ + "\"" + text + "\""
+ + " but containing no body text other than any boilerplate"
+ + " content the browser may automatically add to all"
+ + " notifications (for example, some browsers show the origin"
+ + " in the notification)", t, closeNotifications, notifications)
+ notification = new Notification(text, {
+ body: ""
+ })
+ notifications.push(notification)
+ })
+ })
+}
+</script>
diff --git a/testing/web-platform/tests/notifications/common.js b/testing/web-platform/tests/notifications/common.js
new file mode 100644
index 000000000..ecfa0e3c2
--- /dev/null
+++ b/testing/web-platform/tests/notifications/common.js
@@ -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
+}
diff --git a/testing/web-platform/tests/notifications/constructor-basic.html b/testing/web-platform/tests/notifications/constructor-basic.html
new file mode 100644
index 000000000..a36a8ce30
--- /dev/null
+++ b/testing/web-platform/tests/notifications/constructor-basic.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification constructor (basic)</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<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>
diff --git a/testing/web-platform/tests/notifications/constructor-invalid.html b/testing/web-platform/tests/notifications/constructor-invalid.html
new file mode 100644
index 000000000..88df165e1
--- /dev/null
+++ b/testing/web-platform/tests/notifications/constructor-invalid.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification constructor (invalid)</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<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>
diff --git a/testing/web-platform/tests/notifications/event-onclick-manual.html b/testing/web-platform/tests/notifications/event-onclick-manual.html
new file mode 100644
index 000000000..0d48d06ae
--- /dev/null
+++ b/testing/web-platform/tests/notifications/event-onclick-manual.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.onclick (basic)</title>
+<link rel="author" title="Apple Inc." href="http://www.apple.com/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="common.js"></script>
+<script>
+setup({ explicit_timeout: true })
+if (hasNotificationPermission()) {
+ async_test(function (t) {
+ t.step(function () {
+ var notification =
+ new Notification("Please click on the notification.", {
+ body: "Click me to test clicking on notifications."
+ })
+ notification.onclick = function(e) {
+ assert_equals(Object.prototype.toString.call(e), "[object Event]")
+ assert_equals(e.type, "click")
+ t.done()
+ }
+ })
+ })
+}
+</script>
diff --git a/testing/web-platform/tests/notifications/event-onclose.html b/testing/web-platform/tests/notifications/event-onclose.html
new file mode 100644
index 000000000..aee321369
--- /dev/null
+++ b/testing/web-platform/tests/notifications/event-onclose.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.onclose (basic)</title>
+<link rel="author" title="Apple Inc." href="http://www.apple.com/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<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>
diff --git a/testing/web-platform/tests/notifications/event-onerror-default-manual.html b/testing/web-platform/tests/notifications/event-onerror-default-manual.html
new file mode 100644
index 000000000..4a50de736
--- /dev/null
+++ b/testing/web-platform/tests/notifications/event-onerror-default-manual.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.onerror (permission=default)</title>
+<link rel="author" title="Apple Inc." href="http://www.apple.com/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+setup({ explicit_timeout: true })
+if (Notification.permission != "default") {
+ alert("TEST NOT RUN. Change your browser settings so that the notification"
+ + " settings for this origin are completely cleared/removed, (so your"
+ + " browser default settings are used for this origin), and then reload"
+ + " this page.")
+} else {
+ async_test(function (t) {
+ t.step(function () {
+ var notification = new Notification("New Email Received")
+ notification.onerror = function(e) {
+ assert_equals(Object.prototype.toString.call(e), "[object Event]")
+ assert_equals(e.type, "error")
+ Notification.requestPermission()
+ t.done()
+ }
+ })
+ })
+}
+</script>
diff --git a/testing/web-platform/tests/notifications/event-onerror-denied-manual.html b/testing/web-platform/tests/notifications/event-onerror-denied-manual.html
new file mode 100644
index 000000000..b90fb38cc
--- /dev/null
+++ b/testing/web-platform/tests/notifications/event-onerror-denied-manual.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.onerror (permission=denied)</title>
+<link rel="author" title="Apple Inc." href="http://www.apple.com/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+setup({ explicit_timeout: true })
+Notification.requestPermission()
+if (Notification.permission != "denied") {
+ alert("TEST NOT RUN. Change your browser settings so that notifications"
+ + " for this origin are blocked, and then reload this page.")
+} else {
+ async_test(function (t) {
+ t.step(function () {
+ var notification = new Notification("New Email Received")
+ notification.onerror = function(e) {
+ assert_equals(Object.prototype.toString.call(e), "[object Event]")
+ assert_equals(e.type, "error")
+ Notification.requestPermission()
+ t.done()
+ }
+ })
+ })
+}
+</script>
diff --git a/testing/web-platform/tests/notifications/event-onshow.html b/testing/web-platform/tests/notifications/event-onshow.html
new file mode 100644
index 000000000..7cc2be9de
--- /dev/null
+++ b/testing/web-platform/tests/notifications/event-onshow.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.onshow (basic)</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<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>
diff --git a/testing/web-platform/tests/notifications/icon-basic-manual.html b/testing/web-platform/tests/notifications/icon-basic-manual.html
new file mode 100644
index 000000000..32e8e0bbb
--- /dev/null
+++ b/testing/web-platform/tests/notifications/icon-basic-manual.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.icon (basic)</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="common.js"></script>
+<div id=passfail></div>
+<script>
+setup({ explicit_timeout: true })
+if (hasNotificationPermission()) {
+ async_test(function (t) {
+ t.step(function () {
+ var notification = null,
+ notifications = []
+ createPassFail("If a notification appears containing"
+ + " an image of a cat",
+ t, closeNotifications, notifications)
+ notification = new Notification("New Email Received", {
+ body: "Room 101",
+ icon: "http://test.csswg.org/source/support/cat.png"
+ })
+ notifications.push(notification)
+ })
+ })
+}
+</script>
diff --git a/testing/web-platform/tests/notifications/icon-empty-manual.html b/testing/web-platform/tests/notifications/icon-empty-manual.html
new file mode 100644
index 000000000..a4b288fa5
--- /dev/null
+++ b/testing/web-platform/tests/notifications/icon-empty-manual.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.icon (empty string)</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="common.js"></script>
+<div id=passfail></div>
+<script>
+setup({ explicit_timeout: true })
+if (hasNotificationPermission()) {
+ async_test(function (t) {
+ t.step(function () {
+ var notification = null,
+ notifications = []
+ createPassFail("If a notification appears containing no image",
+ t, closeNotifications, notifications)
+ notification = new Notification("New Email Received", {
+ body: "Room 101",
+ icon: ""
+ })
+ notifications.push(notification)
+ })
+ })
+}
+</script>
diff --git a/testing/web-platform/tests/notifications/instance.html b/testing/web-platform/tests/notifications/instance.html
new file mode 100644
index 000000000..c0ebe7e69
--- /dev/null
+++ b/testing/web-platform/tests/notifications/instance.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification instance basic tests</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<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>
diff --git a/testing/web-platform/tests/notifications/interfaces.html b/testing/web-platform/tests/notifications/interfaces.html
new file mode 100644
index 000000000..95d648d7a
--- /dev/null
+++ b/testing/web-platform/tests/notifications/interfaces.html
@@ -0,0 +1,80 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Notification interface IDL tests</title>
+<div id=log></div>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=/resources/WebIDLParser.js></script>
+<script src=/resources/idlharness.js></script>
+<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>
diff --git a/testing/web-platform/tests/notifications/lang.html b/testing/web-platform/tests/notifications/lang.html
new file mode 100644
index 000000000..be1795c8c
--- /dev/null
+++ b/testing/web-platform/tests/notifications/lang.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.lang</title>
+<link rel="author" title="Apple Inc." href="http://www.apple.com/">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<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>
diff --git a/testing/web-platform/tests/notifications/permission.html b/testing/web-platform/tests/notifications/permission.html
new file mode 100644
index 000000000..d8b201e42
--- /dev/null
+++ b/testing/web-platform/tests/notifications/permission.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.permission (basic)</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ assert_in_array(Notification.permission,
+ ["default", "denied", "granted"],
+ "Notification.permission")
+}, "Checked the Notification.permission property.")
+</script>
diff --git a/testing/web-platform/tests/notifications/requestPermission-denied-manual.html b/testing/web-platform/tests/notifications/requestPermission-denied-manual.html
new file mode 100644
index 000000000..a7ec052db
--- /dev/null
+++ b/testing/web-platform/tests/notifications/requestPermission-denied-manual.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.requestPermission (permission=denied)</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+setup({ explicit_timeout: true })
+Notification.requestPermission()
+if (Notification.permission != "denied") {
+ alert("TEST NOT RUN. Change your browser settings so that notifications"
+ + " for this origin are blocked, and then reload this page.")
+} else {
+ async_test(function (t) {
+ t.step(function () {
+ Notification.requestPermission()
+ t.done()
+ })
+ })
+}
+</script>
diff --git a/testing/web-platform/tests/notifications/requestPermission-granted-manual.html b/testing/web-platform/tests/notifications/requestPermission-granted-manual.html
new file mode 100644
index 000000000..970f4e3cb
--- /dev/null
+++ b/testing/web-platform/tests/notifications/requestPermission-granted-manual.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.requestPermission (permission=granted)</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="common.js"></script>
+<script>
+setup({ explicit_timeout: true })
+if (hasNotificationPermission()) {
+ async_test(function (t) {
+ t.step(function () {
+ t.done()
+ })
+ })
+}
+</script>
diff --git a/testing/web-platform/tests/notifications/tag-different-manual.html b/testing/web-platform/tests/notifications/tag-different-manual.html
new file mode 100644
index 000000000..e463e9767
--- /dev/null
+++ b/testing/web-platform/tests/notifications/tag-different-manual.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.tag (two tags with different values)</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="common.js"></script>
+<div id=passfail></div>
+<script>
+setup({ explicit_timeout: true })
+if (hasNotificationPermission()) {
+ async_test(function (t) {
+ t.step(function () {
+ var notification1 = null,
+ notification2 = null,
+ notifications = [],
+ text1 = "This is the body: Room 101",
+ text2 = "This is the body: Room 202"
+ createPassFail("If two notifications appear: First one with the"
+ + " text \"" + text1 + "\", followed by one with the text \""
+ + text2 + "\"",
+ t, closeNotifications, notifications)
+ notification1 = new Notification("New Email Received", {
+ body: text1,
+ tag: "Tom"
+ })
+ notification2 = new Notification("New Email Received", {
+ body: text2,
+ tag: "Rose"
+ })
+ notifications.push(notification1)
+ notifications.push(notification2)
+ })
+ })
+}
+</script>
diff --git a/testing/web-platform/tests/notifications/tag-same-manual.html b/testing/web-platform/tests/notifications/tag-same-manual.html
new file mode 100644
index 000000000..4454944c5
--- /dev/null
+++ b/testing/web-platform/tests/notifications/tag-same-manual.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Notification.tag (two tags with same value)</title>
+<link rel="author" title="Intel" href="http://www.intel.com/">
+<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="common.js"></script>
+<div id=passfail></div>
+<script>
+setup({ explicit_timeout: true })
+if (hasNotificationPermission()) {
+ async_test(function (t) {
+ t.step(function () {
+ var notification1 = null,
+ notification2 = null,
+ notifications = [],
+ text1 = "This is the body: Room 101",
+ text2 = "This is the body: Room 202"
+ createPassFail("If a notification with the text \""
+ + text2 + "\", replaces the notification with the text \""
+ + text1 + "\" in the same position",
+ t, closeNotifications, notifications)
+ notification1 = new Notification("New Email Received", {
+ body: text1,
+ tag: "Tom"
+ })
+ notification2 = new Notification("New Email Received", {
+ body: text2,
+ tag: "Tom"
+ })
+ notifications.push(notification1)
+ notifications.push(notification2)
+ })
+ })
+}
+</script>