Update web-platform-tests to revision 4d96cccabc2feacd48e1dab9afc22b8af2225572

This commit is contained in:
Ms2ger 2015-06-23 16:47:26 +02:00
parent 0d236288cc
commit c66c6af0ba
1067 changed files with 63768 additions and 10900 deletions

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Web Notifications Test: notification - onclick (basic)</title>
<link rel="author" title="Apple Inc." href="http://www.apple.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>
var t = async_test("the notification.onclick event can be invoked", {timeout: 50000});
Notification.requestPermission(t.step_func(function(permission) {
assert_equals(permission, "granted", "notification permission");
var notification = new Notification("Please click on the notification.", {
body: "Click me to test clicking on notifications."
});
notification.onclick = t.step_func(function(e) {
assert_equals(Object.prototype.toString.call(e), "[object Event]", "the type of event");
assert_equals(e.type, "click", "The event is the expected type.")
t.done();
});
}));
</script>
</body>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Web Notifications Test: notification - onclose (basic)</title>
<link rel="author" title="Apple Inc." href="http://www.apple.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>
var t = async_test("the notification.onclose event can be invoked", {timeout: 50000});
Notification.requestPermission(t.step_func(function(permission) {
assert_equals(permission, "granted", "notification permission");
var notification = new Notification("This notification will close.", {
body: "This notification will close."
});
notification.onshow = t.step_func(function(e) {
e.target.close();
});
notification.onclose = t.step_func(function(e) {
assert_equals(Object.prototype.toString.call(e), "[object Event]", "the type of event");
assert_equals(e.type, "close", "The event is the expected type.")
t.done();
});
}));
</script>
</body>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Web Notifications Test: notification - onerror (basic)</title>
<link rel="author" title="Apple Inc." href="http://www.apple.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>
if (Notification.permission != "default") {
document.getElementById("log").innerHTML = "Please clear your notification settings for web-platform.test and retry.";
} else {
t = async_test("the notification.onerror event can be invoked", {timeout: 50000});
var notification = new Notification("New Email Received", {
body: "Room 101"
});
notification.onerror = t.step_func(function(e) {
assert_equals(Object.prototype.toString.call(e), "[object Event]", "the type of event");
assert_equals(e.type, "error", "The event is the expected type.")
t.done();
});
}
</script>
</body>

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Web Notifications Test: notification - onerror (basic)</title>
<link rel="author" title="Apple Inc." href="http://www.apple.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="message"></div>
<div id="log"></div>
<script>
var t = async_test("the notification.onerror event can be invoked", {timeout: 50000});
function onerror_test() {
var notification = new Notification("New Email Received", {
body: "Room 101"
});
notification.onerror = t.step_func(function(e) {
assert_equals(Object.prototype.toString.call(e), "[object Event]", "the type of event");
assert_equals(e.type, "error", "The event is the expected type.")
t.done();
});
}
if (Notification.permission != "denied") {
document.getElementById("message").innerHTML = "Please deny web-platform.test in your browser's notification preferences and retry";
Notification.requestPermission(t.step_func(function(permission) {
assert_equals(permission, "denied", "notification permission");
onerror_test();
}));
} else {
onerror_test();
}
</script>
</body>

View file

@ -10,14 +10,20 @@
<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"
var t = async_test("the notification.onshow event can be invoked", {timeout: 50000});
Notification.requestPermission(t.step_func(function(permission) {
assert_equals(permission, "granted", "notification permission");
var notification = new Notification("This is a notification.", {
body: "Can you see this?."
});
notification.onshow = t.step_func(function(e) {
assert_equals(Object.prototype.toString.call(e), "[object Event]", "the type of event");
t.done();
assert_equals(Object.prototype.toString.call(e), "[object Event]", "the type of event");
assert_equals(e.type, "show", "The event is the expected type.")
t.done();
});
}));
</script>
</body>

View file

@ -0,0 +1,73 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Web Notifications Test: notification.lang</title>
<link rel="author" title="Apple Inc." href="http://www.apple.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>
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() {
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 + "\".");
}
var permission_test = async_test("We have permission to use the notifications API.");
Notification.requestPermission(permission_test.step_func(function(permission) {
assert_equals(permission, "granted", "notification permission");
permission_test.done();
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>
</body>