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

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

Issue 1907443007: Use promises in notifications tests and enable controlling the page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Address peter's comments. Created 4 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.getNotifications() with no n otifications.</title> 4 <title>Notifications: ServiceWorkerRegistration.getNotifications() with no n otifications.</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 with out 12 // Tests that the getNotifications() function when used in a document with out
13 // notifications returns a promise that gets resolved with an empty array. 13 // notifications returns a promise that gets resolved with an empty array.
14 async_test(function(test) { 14 async_test(function(test) {
15 var scope = 'resources/scope/' + location.pathname, 15 var scope = 'resources/scope/' + location.pathname,
16 script = 'resources/instrumentation-service-worker.js'; 16 script = 'instrumentation-service-worker.js';
17 17
18 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(workerInfo) { 18 getActiveServiceWorkerWithMessagePort(test, script, scope).then(functi on(workerInfo) {
19 return workerInfo.registration.getNotifications(); 19 return workerInfo.registration.getNotifications();
20 }).then(function(notifications) { 20 }).then(function(notifications) {
21 assert_array_equals(notifications, []); 21 assert_array_equals(notifications, []);
22 test.done(); 22 test.done();
23 }).catch(unreached_rejection(test)); 23 }).catch(unreached_rejection(test));
24 24
25 }, 'ServiceWorkerRegistration.getNotifications() with no notifications.'); 25 }, 'ServiceWorkerRegistration.getNotifications() with no notifications.');
26 </script> 26 </script>
27 </body> 27 </body>
28 </html> 28 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698