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

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

Issue 1100163002: Notifications: stop using notifications specific permission methods in LayoutTests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@notifications_testrunner_setpermission
Patch Set: update 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 unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Notifications: ServiceWorkerRegistration.showNotification() fails on too much data.</title> 4 <title>Notifications: ServiceWorkerRegistration.showNotification() fails on too much data.</title>
5 <script src="../resources/testharness.js"></script> 5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script> 6 <script src="../resources/testharnessreport.js"></script>
7 <script src="../serviceworker/resources/test-helpers.js"></script> 7 <script src="../serviceworker/resources/test-helpers.js"></script>
8 <script src="resources/test-helpers.js"></script> 8 <script src="resources/test-helpers.js"></script>
9 </head> 9 </head>
10 <body> 10 <body>
11 <script> 11 <script>
12 // Tests that the showNotification() function rejects the promise when the 12 // Tests that the showNotification() function rejects the promise when the
13 // developer-provided data exceeds a megabyte. This is an implementation- 13 // developer-provided data exceeds a megabyte. This is an implementation-
14 // defined limit to prevent abuse. 14 // defined limit to prevent abuse.
15 15
16 async_test(function(test) { 16 async_test(function(test) {
17 var scope = 'resources/scope/' + location.pathname, 17 var scope = 'resources/scope/' + location.pathname,
18 script = 'resources/instrumentation-service-worker.js'; 18 script = 'resources/instrumentation-service-worker.js';
19 19
20 testRunner.setPermission('notifications', 'granted', location.origin, location.origin); 20 testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
21 testRunner.grantWebNotificationPermission(location.origin, true);
22 21
23 var workerInfo = null; 22 var workerInfo = null;
24 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(info) { 23 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(info) {
25 workerInfo = info; 24 workerInfo = info;
26 25
27 // (1) Display a Web Notification from the document. 26 // (1) Display a Web Notification from the document.
28 assert_inherits(workerInfo.registration, 'showNotification', 'show Notification() must be exposed.'); 27 assert_inherits(workerInfo.registration, 'showNotification', 'show Notification() must be exposed.');
29 return workerInfo.registration.showNotification(scope, { 28 return workerInfo.registration.showNotification(scope, {
30 body: 'Hello, world!', 29 body: 'Hello, world!',
31 icon: '/icon.png', 30 icon: '/icon.png',
32 data: new Array(1024 * 1024 * 2).join('.'), // 2 million dots 31 data: new Array(1024 * 1024 * 2).join('.'), // 2 million dots
33 }); 32 });
34 }).then(unreached_fulfillment(test)) 33 }).then(unreached_fulfillment(test))
35 .catch(function() { 34 .catch(function() {
36 test.done(); 35 test.done();
37 }); 36 });
38 37
39 }, 'ServiceWorkerRegistration.showNotification() fails on too much data.') ; 38 }, 'ServiceWorkerRegistration.showNotification() fails on too much data.') ;
40 </script> 39 </script>
41 </body> 40 </body>
42 </html> 41 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698