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

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

Issue 1644063002: Simplify TestRunnerBindings::SimulateWebNotificationClick param handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 workerInfo.port.addEventListener('message', function(event) { 47 workerInfo.port.addEventListener('message', function(event) {
48 if (typeof event.data != 'object' || !event.data.command) { 48 if (typeof event.data != 'object' || !event.data.command) {
49 assert_unreached('Invalid message from the Service Worker. '); 49 assert_unreached('Invalid message from the Service Worker. ');
50 return; 50 return;
51 } 51 }
52 52
53 // (2) Listen for confirmation from the Service Worker that th e 53 // (2) Listen for confirmation from the Service Worker that th e
54 // notification's display promise has been resolved. 54 // notification's display promise has been resolved.
55 if (event.data.command == 'show') { 55 if (event.data.command == 'show') {
56 assert_true(event.data.success, 'The notification must hav e been displayed.'); 56 assert_true(event.data.success, 'The notification must hav e been displayed.');
57 testRunner.simulateWebNotificationClick(scope); 57 testRunner.simulateWebNotificationClick(scope, -1 /* actio n_index */);
58 return; 58 return;
59 } 59 }
60 60
61 // (3) Listen for confirmation from the Service Worker that th e 61 // (3) Listen for confirmation from the Service Worker that th e
62 // notification has been clicked on. Make sure that all proper ties 62 // notification has been clicked on. Make sure that all proper ties
63 // set on the Notification object are as expected. 63 // set on the Notification object are as expected.
64 assert_equals(event.data.command, 'click', 'The notification w as expected to be clicked.'); 64 assert_equals(event.data.command, 'click', 'The notification w as expected to be clicked.');
65 65
66 var pos = event.data.notification.tag; 66 var pos = event.data.notification.tag;
67 67
68 if (typeof notificationDataList[pos] === 'object' && notificat ionDataList[pos] !== null) 68 if (typeof notificationDataList[pos] === 'object' && notificat ionDataList[pos] !== null)
69 assert_object_equals(event.data.notification.data, notific ationDataList[pos], 'The data field must be the same.'); 69 assert_object_equals(event.data.notification.data, notific ationDataList[pos], 'The data field must be the same.');
70 else 70 else
71 assert_equals(event.data.notification.data, notificationDa taList[pos], 'The data field must be the same.'); 71 assert_equals(event.data.notification.data, notificationDa taList[pos], 'The data field must be the same.');
72 72
73 if (++pos < notificationDataList.length) 73 if (++pos < notificationDataList.length)
74 assertNotificationDataReflects(pos); 74 assertNotificationDataReflects(pos);
75 else 75 else
76 test.done(); 76 test.done();
77 }); 77 });
78 78
79 assertNotificationDataReflects(0); 79 assertNotificationDataReflects(0);
80 }).catch(unreached_rejection(test)); 80 }).catch(unreached_rejection(test));
81 81
82 }, 'Clicking on a notification displayed by a Service Worker the notificat ionclick event.'); 82 }, 'Clicking on a notification displayed by a Service Worker the notificat ionclick event.');
83 </script> 83 </script>
84 </body> 84 </body>
85 </html> 85 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698