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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/notifications/serviceworkerregistration-service-worker-click.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: ServiceWorkerRegistration.showNotification().</title> 4 <title>Notifications: ServiceWorkerRegistration.showNotification().</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 19 matching lines...) Expand all
30 workerInfo.port.addEventListener('message', function(event) { 30 workerInfo.port.addEventListener('message', function(event) {
31 if (typeof event.data != 'object' || !event.data.command) { 31 if (typeof event.data != 'object' || !event.data.command) {
32 assert_unreached('Invalid message from the Service Worker. '); 32 assert_unreached('Invalid message from the Service Worker. ');
33 return; 33 return;
34 } 34 }
35 35
36 // (2) Listen for confirmation from the Service Worker that th e 36 // (2) Listen for confirmation from the Service Worker that th e
37 // notification's display promise has been resolved. 37 // notification's display promise has been resolved.
38 if (event.data.command == 'show') { 38 if (event.data.command == 'show') {
39 assert_true(event.data.success, 'The notification must hav e been displayed.'); 39 assert_true(event.data.success, 'The notification must hav e been displayed.');
40 testRunner.simulateWebNotificationClick(scope); 40 testRunner.simulateWebNotificationClick(scope, -1 /* actio n_index */);
41 return; 41 return;
42 } 42 }
43 43
44 // (3) Listen for confirmation from the Service Worker that th e 44 // (3) Listen for confirmation from the Service Worker that th e
45 // notification has been clicked on. 45 // notification has been clicked on.
46 if (event.data.command == 'click') { 46 if (event.data.command == 'click') {
47 assert_equals(event.data.notification.title, scope, 'The r ight notification must have been clicked.'); 47 assert_equals(event.data.notification.title, scope, 'The r ight notification must have been clicked.');
48 48
49 test.done(); 49 test.done();
50 return; 50 return;
51 } 51 }
52 52
53 assert_unreached('Unexpected message from the Service Worker: ' + event.data.command); 53 assert_unreached('Unexpected message from the Service Worker: ' + event.data.command);
54 }); 54 });
55 }).catch(unreached_rejection(test)); 55 }).catch(unreached_rejection(test));
56 56
57 }, 'Clicking on a notification displayed by a Service Worker the notificat ionclick event.'); 57 }, 'Clicking on a notification displayed by a Service Worker the notificat ionclick event.');
58 </script> 58 </script>
59 </body> 59 </body>
60 </html> 60 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698