Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Unified Diff: LayoutTests/http/tests/notifications/serviceworkerregistration-document-invalid-language.html

Issue 1110223002: Use and add layout tests for BCP 47 language tag syntax validation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/notifications/serviceworkerregistration-document-invalid-language.html
diff --git a/LayoutTests/http/tests/notifications/serviceworkerregistration-document-invalid-language.html b/LayoutTests/http/tests/notifications/serviceworkerregistration-document-invalid-language.html
new file mode 100644
index 0000000000000000000000000000000000000000..120ba9b91eb68fb349230e14fc610b804b47924f
--- /dev/null
+++ b/LayoutTests/http/tests/notifications/serviceworkerregistration-document-invalid-language.html
@@ -0,0 +1,42 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Notifications: ServiceWorkerRegistration.showNotification() should validate the syntax of the language tag of a notification.</title>
+ <script src="../resources/testharness.js"></script>
+ <script src="../resources/testharnessreport.js"></script>
+ <script src="../serviceworker/resources/test-helpers.js"></script>
+ <script src="resources/test-helpers.js"></script>
+ </head>
+ <body>
+ <script>
+ // Tests that the showNotification() function validates the language tag of the
+ // notification, by making sure that the tag is empty when an invalid BCP 47
+ // language has been supplied on getting the notifications.
+
+ async_test(function(test) {
+ var scope = 'resources/spec/' + location.pathname,
+ script = 'resources/instrumentation-service-worker.js';
+
+ testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
+
+ var registration = null;
+ getActiveServiceWorkerWithMessagePort(test, script, scope).then(function(info) {
+ registration = info.registration;
+
+ // (1) Display a Web Notification from the document.
+ return registration.showNotification(scope, {
+ lang: 'invalid language'
+ });
+ }).then(function() {
+ return registration.getNotifications();
+ }).then(function(notifications) {
+ assert_equals(notifications.length, 1);
+ assert_equals(notifications[0].lang, '');
+
+ test.done();
+ }).catch(unreached_rejection(test));
+
+ }, 'ServiceWorkerRegistration.showNotification() should validate the syntax of the language tag of a notification.');
+ </script>
+ </body>
+</html>
« no previous file with comments | « LayoutTests/http/tests/notifications/notification-properties.html ('k') | Source/modules/mediasource/TrackDefault.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698