mirror of
https://github.com/servo/servo.git
synced 2025-08-12 17:05:33 +01:00
Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255
This commit is contained in:
parent
b2a5225831
commit
1a81b18b9f
12321 changed files with 544385 additions and 6 deletions
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: 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">
|
||||
<link rel="help" title="4.3 Permission" href="http://www.w3.org/TR/notifications/#permission">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_in_array(Notification.permission, ["default", "denied", "granted"], "Notification.permission");
|
||||
}, "Test checks that notification the value of permission is in array");
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: Notification - requestPermission (deny)</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
|
||||
<link rel="help" title="4.3 Permission" href="http://www.w3.org/TR/notifications/#permission">
|
||||
<meta name="flags" content="interact">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<p>Test Step:</p>
|
||||
<p>1. When ask the user whether showing notifications, make sure choose deny.</p>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
t = async_test("the notification the value of permission is denied", {timeout: 50000});
|
||||
Notification.requestPermission(t.step_func(function(permission) {
|
||||
assert_equals(permission, "denied", "notification permission");
|
||||
t.done();
|
||||
}));
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: Notification - requestPermission (allow)</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
|
||||
<link rel="help" title="4.3 Permission" href="http://www.w3.org/TR/notifications/#permission">
|
||||
<meta name="flags" content="interact">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<p>Test Step:</p>
|
||||
<p>1. When ask the user whether showing notifications, make sure choose allow.</p>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
t = async_test("the notification the value of permission is granted", {timeout: 50000});
|
||||
Notification.requestPermission(t.step_func(function(permission) {
|
||||
assert_equals(permission, "granted", "notification permission");
|
||||
t.done();
|
||||
}));
|
||||
</script>
|
||||
</body>
|
||||
|
5
tests/wpt/web-platform-tests/notifications/README.md
Normal file
5
tests/wpt/web-platform-tests/notifications/README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
Web Notifications test suite.
|
||||
|
||||
Latest Editor's Draft: http://dvcs.w3.org/hg/notifications/raw-file/tip/Overview.html
|
||||
|
||||
Latest Technical Report: http://www.w3.org/TR/notifications/
|
23
tests/wpt/web-platform-tests/notifications/event-onshow.html
Normal file
23
tests/wpt/web-platform-tests/notifications/event-onshow.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: 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">
|
||||
<link rel="help" title="5 API" href="http://www.w3.org/TR/notifications/">
|
||||
<meta name="flags" content="">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
t = async_test("the notification.onshow event can be invoked", {timeout: 50000});
|
||||
var notification = new Notification("New Email Received", {
|
||||
body: "Room 101"
|
||||
});
|
||||
notification.onshow = t.step_func(function(e) {
|
||||
assert_equals(Object.prototype.toString.call(e), "[object Event]", "the type of event");
|
||||
t.done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
52
tests/wpt/web-platform-tests/notifications/instance.html
Normal file
52
tests/wpt/web-platform-tests/notifications/instance.html
Normal file
|
@ -0,0 +1,52 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Basic Notification instance tests</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
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",
|
||||
}
|
||||
);
|
||||
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>
|
80
tests/wpt/web-platform-tests/notifications/interfaces.html
Normal file
80
tests/wpt/web-platform-tests/notifications/interfaces.html
Normal file
|
@ -0,0 +1,80 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Web Notifications 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 void 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("foo")'],
|
||||
});
|
||||
idlArray.test();
|
||||
</script>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: 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">
|
||||
<link rel="help" title="5 API" href="http://www.w3.org/TR/notifications/">
|
||||
<meta name="flags" content="interact">
|
||||
<meta name="assert" content="The body attribute must return the notification's body and the empty string otherwise.">
|
||||
<body>
|
||||
<p>Test passes if a notification popups and the notification's body content is "Room 101".</p>
|
||||
<script>
|
||||
var notification = new Notification("New Email Received", {
|
||||
body: "Room 101"
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: 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">
|
||||
<link rel="help" title="5 API" href="http://www.w3.org/TR/notifications/">
|
||||
<meta name="flags" content="interact">
|
||||
<meta name="assert" content="The body attribute set empty string, then the notification's body content show nothing.">
|
||||
<body>
|
||||
<p>Test passes if a notification popups and the notification have no body content.</p>
|
||||
<script>
|
||||
var notification = new Notification("New Email Received", {
|
||||
body: ""
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: notification - close (basic)</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
|
||||
<link rel="help" title="4.6 Closing a notification" href="http://www.w3.org/TR/notifications/#closing-a-notification">
|
||||
<meta name="flags" content="interact">
|
||||
<meta name="assert" content="The notification.close() method will close this notification.">
|
||||
<body>
|
||||
<p>Test passes if a notification popups and it disappears after a while(about 3 seconds).</p>
|
||||
<script>
|
||||
var closetime = 3000;
|
||||
var notification = new Notification("New Email Received", {
|
||||
body: "Room 101"
|
||||
});
|
||||
setTimeout(function() {
|
||||
notification.close();
|
||||
}, closetime);
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: 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">
|
||||
<link rel="help" title="5 API" href="http://www.w3.org/TR/notifications/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var notification = new Notification("New Email Received", {
|
||||
body: "Room 101"
|
||||
});
|
||||
assert_equals(typeof notification, "object");
|
||||
}, "Test checks that notification constructor is correct");
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: 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">
|
||||
<link rel="help" title="5 API" href="http://www.w3.org/TR/notifications/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_throws("new TypeError()", function() {
|
||||
var notification = new Notification();
|
||||
});
|
||||
}, "Test checks that notification constructor arguments can't be empty");
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: notification - dir (dir attribute set to "auto")</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
|
||||
<link rel="help" title="4.1 Direction" href="http://www.w3.org/TR/notifications/#direction-0">
|
||||
<meta name="flags" content="interact">
|
||||
<meta name="assert" content="The dir attribute set 'auto', then the notification's direction is the left edge.">
|
||||
<body>
|
||||
<p>Test passes if a notification popups and the notification's direction is the left edge.</p>
|
||||
<script>
|
||||
var notification = new Notification("New Email Received", {
|
||||
body: "Room 101",
|
||||
dir: "auto"
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: notification - dir (dir attribute set to "ltr")</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
|
||||
<link rel="help" title="4.1 Direction" href="http://www.w3.org/TR/notifications/#direction-0">
|
||||
<meta name="flags" content="interact">
|
||||
<meta name="assert" content="The dir attribute set 'ltr', then the notification's direction is the left edge.">
|
||||
<body>
|
||||
<p>Test passes if a notification popups and the notification's direction is the left edge.</p>
|
||||
<script>
|
||||
var notification = new Notification("New Email Received", {
|
||||
body: "Room 101",
|
||||
dir: "ltr"
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: notification - dir (dir attribute set to "rtl")</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
|
||||
<link rel="help" title="4.1 Direction" href="http://www.w3.org/TR/notifications/#direction-0">
|
||||
<meta name="flags" content="interact">
|
||||
<meta name="assert" content="The dir attribute set 'rtl', then the notification's direction is the right edge.">
|
||||
<body>
|
||||
<p>Test passes if a notification popups and the notification's direction is the right edge.</p>
|
||||
<script>
|
||||
var notification = new Notification("New Email Received", {
|
||||
body: "Room 101",
|
||||
dir: "rtl"
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: 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">
|
||||
<link rel="help" title="5 API" href="http://www.w3.org/TR/notifications/">
|
||||
<meta name="flags" content="interact">
|
||||
<meta name="assert" content="The icon attribute set valid URL, then notificaiton icon content will show a pictrue.">
|
||||
<body>
|
||||
<p><strong>Make sure connect to network.</strong></p>
|
||||
<p>Test passes if a notificaiton popups with a cat pictrue.</p>
|
||||
<script>
|
||||
var notification = new Notification("New Email Received", {
|
||||
body: "Room 101",
|
||||
icon: "http://test.csswg.org/source/support/cat.png"
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: notification - icon (invalid)</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
|
||||
<link rel="help" title="5 API" href="http://www.w3.org/TR/notifications/">
|
||||
<meta name="flags" content="interact">
|
||||
<meta name="assert" content="The icon attribute set invalid URL, then notificaiton icon content will show nothing.">
|
||||
<body>
|
||||
<p>Test passes if a notificaiton popups and notification's icon content show nothing.</p>
|
||||
<script>
|
||||
var notification = new Notification("New Email Received", {
|
||||
body: "Room 101",
|
||||
icon: ""
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: notification - tag (with different tag)</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
|
||||
<link rel="help" title="5 API" href="http://www.w3.org/TR/notifications/">
|
||||
<meta name="flags" content="interact">
|
||||
<meta name="assert" content="The tag attribute set different, then the notification's body show different.">
|
||||
<body>
|
||||
<p>Test passes if two notifications popups and the notification's body are different.</p>
|
||||
<script>
|
||||
var notification1 = new Notification("New Email Received", {
|
||||
body: "Room 101",
|
||||
tag: "Tom"
|
||||
});
|
||||
|
||||
var notification2 = new Notification("New Email Received", {
|
||||
body: "Room 202",
|
||||
tag: "Rose"
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Web Notifications Test: notification - tag (with same tag)</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<link rel="author" title="Xin Liu" href="mailto:xinx.liu@intel.com">
|
||||
<link rel="help" title="5 API" href="http://www.w3.org/TR/notifications/">
|
||||
<meta name="flags" content="interact">
|
||||
<meta name="assert" content="The tag attribute set same, then the notification's body only show the latest one.">
|
||||
<body>
|
||||
<p>Test passes if only one notification popups and the notification's body is "Room 202".</p>
|
||||
<script>
|
||||
var notification1 = new Notification("New Email Received", {
|
||||
body: "Room 101",
|
||||
tag: "Tom"
|
||||
});
|
||||
|
||||
var notification2 = new Notification("New Email Received", {
|
||||
body: "Room 202",
|
||||
tag: "Tom"
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue