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

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

Issue 1052693002: Add some layout tests for Notification.data on persistent notifications (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix indentation 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
« no previous file with comments | « LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-reflection.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-invalid.html
diff --git a/LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-invalid.html b/LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-invalid.html
new file mode 100644
index 0000000000000000000000000000000000000000..6f2f52f40927a851e64966042d1798a96f02f8ce
--- /dev/null
+++ b/LayoutTests/http/tests/notifications/serviceworkerregistration-document-data-invalid.html
@@ -0,0 +1,41 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Notifications: ServiceWorkerRegistration.showNotification() fails on too much data.</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 rejects the promise when the
+ // developer-provided data exceeds a megabyte. This is an implementation-
+ // defined limit to prevent abuse.
+
+ async_test(function(test) {
+ var scope = 'resources/scope/' + location.pathname,
+ script = 'resources/instrumentation-service-worker.js';
+
+ testRunner.grantWebNotificationPermission(location.origin, true);
+
+ var workerInfo = null;
+ getActiveServiceWorkerWithMessagePort(test, script, scope).then(function(info) {
+ workerInfo = info;
+
+ // (1) Display a Web Notification from the document.
+ assert_inherits(workerInfo.registration, 'showNotification', 'showNotification() must be exposed.');
+ return workerInfo.registration.showNotification(scope, {
+ body: 'Hello, world!',
+ icon: '/icon.png',
+ data: new Array(1024 * 1024 * 2).join('.'), // 2 million dots
+ });
+ }).then(unreached_fulfillment(test))
+ .catch(function() {
+ test.done();
+ });
+
+ }, 'ServiceWorkerRegistration.showNotification() fails on too much data.');
+ </script>
+ </body>
+</html>
« no previous file with comments | « LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-reflection.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698