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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-get-replacement.html

Issue 2223943002: Eagerly delete replaced notifications from the database (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Eagerly delete replaced notifications from the database Created 4 years, 4 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.getNotifications() with a fi lter.</title> 4 <title>Notifications: ServiceWorkerRegistration.getNotifications() with a no tification replacement.</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 getNotifications() function when used in a document retu rns 12 // Tests that the getNotifications() function when used in a document retu rns
13 // an array of the notifications which were previously displayed using the 13 // an array of the notifications which were previously displayed using a f ilter.
14 // same Service Worker registration id, having the same filter. 14 // Notifications replaced using the `tag` should not be included anymore.
15 async_test(function(test) { 15 async_test(function(test) {
16 var scope = 'resources/scope/' + location.pathname, 16 var scope = 'resources/scope/' + location.pathname,
17 script = 'instrumentation-service-worker.js'; 17 script = 'instrumentation-service-worker.js';
18 18
19 testRunner.setPermission('notifications', 'granted', location.origin, location.origin); 19 testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
20 20
21 var registration = null; 21 var registration = null;
22 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(workerInfo) { 22 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(workerInfo) {
23 registration = workerInfo.registration; 23 registration = workerInfo.registration;
24 24
25 return registration.showNotification('Hello, world!', { 25 return registration.showNotification('Hello, world!', {
26 body: 'First notification', 26 body: 'First notification',
27 tag: 'banana', 27 tag: 'banana',
28 }); 28 });
29 }).then(function() { 29 }).then(function() {
30 return registration.showNotification('Hello again, world!', { 30 return registration.showNotification('Hello again, world!', {
31 body: 'Second notification', 31 body: 'Second notification',
32 tag: 'strawberry', 32 tag: 'banana',
33 }); 33 });
34 }).then(function() { 34 }).then(function() {
35 return registration.getNotifications({ tag: 'strawberry' }); 35 return registration.getNotifications({ tag: 'banana' });
36 }).then(function(notifications) { 36 }).then(function(notifications) {
37 assert_equals(notifications.length, 1); 37 assert_equals(notifications.length, 1);
38 38
39 assert_equals(notifications[0].title, 'Hello again, world!'); 39 assert_equals(notifications[0].title, 'Hello again, world!');
40 assert_equals(notifications[0].body, 'Second notification'); 40 assert_equals(notifications[0].body, 'Second notification');
41 41
42 test.done(); 42 test.done();
43 }).catch(unreached_rejection(test)); 43 }).catch(unreached_rejection(test));
44 44
45 }, 'ServiceWorkerRegistration.getNotifications() returns the opened notifi cations with the same filter.'); 45 }, 'ServiceWorkerRegistration.getNotifications() does not return replaced notifications.');
46 </script> 46 </script>
47 </body> 47 </body>
48 </html> 48 </html>
OLDNEW
« no previous file with comments | « content/browser/notifications/platform_notification_context_unittest.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698