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

Side by Side Diff: LayoutTests/http/tests/notifications/serviceworker-notificationclick-event-data-reflection.html

Issue 1262893005: Add NotificationEvent.action property in SW events (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@actions3_fix
Patch Set: Address review comments Created 5 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: data property reflection in the "notificationclick" ev ent.</title> 4 <title>Notifications: data property reflection in the "notificationclick" ev ent.</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 notification available in the "notificationclick" event in the 12 // Tests that the notification available in the "notificationclick" event in the
13 // Service Worker accurately reflects the data attributes of several type 13 // Service Worker accurately reflects the data attributes of several type
14 // with which the notification was created (for this test --) in the docum ent. 14 // with which the notification was created (for this test --) in the docum ent.
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 // Set notification's data of several type to a structured clone of op tions's data. 20 // Set notification's data of several type to a structured clone of op tions's data.
21 var notificationDataList = new Array( 21 var notificationDataList = new Array(
22 true, // Check Boolean type 22 true, // Check Boolean type
23 1024, // Check Number type 23 1024, // Check Number type
24 Number.NaN, // Check Number.NaN type 24 Number.NaN, // Check Number.NaN type
25 'any data', // Check String type 25 'any data', // Check String type
26 new Array('Saab', 'Volve', 'BMW'), // Check Array type 26 new Array('Saab', 'Volvo', 'BMW'), // Check Array type
27 { first: 'first', second: 'second' } // Check object 27 { first: 'first', second: 'second' } // Check object
28 ); 28 );
29 29
30 testRunner.setPermission('notifications', 'granted', location.origin, location.origin); 30 testRunner.setPermission('notifications', 'granted', location.origin, location.origin);
31 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(workerInfo) { 31 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(workerInfo) {
32 // (1) Tell the Service Worker to display a Web Notification. 32 // (1) Tell the Service Worker to display a Web Notification.
33 var assertNotificationDataReflects = function(pos) { 33 var assertNotificationDataReflects = function(pos) {
34 workerInfo.port.postMessage({ 34 workerInfo.port.postMessage({
35 command: 'show', 35 command: 'show',
36 36
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 test.done(); 72 test.done();
73 }); 73 });
74 74
75 assertNotificationDataReflects(0); 75 assertNotificationDataReflects(0);
76 }).catch(unreached_rejection(test)); 76 }).catch(unreached_rejection(test));
77 77
78 }, 'Clicking on a notification displayed by a Service Worker the notificat ionclick event.'); 78 }, 'Clicking on a notification displayed by a Service Worker the notificat ionclick event.');
79 </script> 79 </script>
80 </body> 80 </body>
81 </html> 81 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698