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

Side by Side Diff: LayoutTests/http/tests/push_messaging/subscribe_success.html

Issue 821303006: bindings: Fixes layouttests when moving attributes to prototype chains. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed performance memory tests and addressed review comments. Created 5 years, 11 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 | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>subscribe() succeeds when permission is granted and resolves with a valid subscription</title> 4 <title>subscribe() succeeds when permission is granted and resolves with a valid subscription</title>
5 <link rel="manifest" href="resources/push_manifest.json"> 5 <link rel="manifest" href="resources/push_manifest.json">
6 <script src="../resources/testharness.js"></script> 6 <script src="../resources/testharness.js"></script>
7 <script src="../resources/testharnessreport.js"></script> 7 <script src="../resources/testharnessreport.js"></script>
8 <script src="../resources/testharness-helpers.js"></script>
8 <script src="../serviceworker/resources/test-helpers.js"></script> 9 <script src="../serviceworker/resources/test-helpers.js"></script>
9 </head> 10 </head>
10 <body> 11 <body>
11 <script> 12 <script>
12 async_test(function(test) { 13 async_test(function(test) {
13 var workerUrl = 'resources/empty_worker.js'; 14 var workerUrl = 'resources/empty_worker.js';
14 var workerScope = 'resources/scope/' + location.pathname; 15 var workerScope = 'resources/scope/' + location.pathname;
15 var swRegistration; 16 var swRegistration;
16 service_worker_unregister_and_register(test, workerUrl, workerScope) 17 service_worker_unregister_and_register(test, workerUrl, workerScope)
17 .then(function(serviceWorkerRegistration) { 18 .then(function(serviceWorkerRegistration) {
18 swRegistration = serviceWorkerRegistration; 19 swRegistration = serviceWorkerRegistration;
19 return wait_for_state(test, swRegistration.installing, 'activated'); 20 return wait_for_state(test, swRegistration.installing, 'activated');
20 }) 21 })
21 .then(function() { 22 .then(function() {
22 // If running manually, grant permission when prompted. 23 // If running manually, grant permission when prompted.
23 if (self.testRunner) 24 if (self.testRunner)
24 testRunner.setPushMessagingPermission(location.origin, true); 25 testRunner.setPushMessagingPermission(location.origin, true);
25 return swRegistration.pushManager.subscribe(); 26 return swRegistration.pushManager.subscribe();
26 }) 27 })
27 .then(function(pushSubscription) { 28 .then(function(pushSubscription) {
28 assert_own_property(pushSubscription, 'subscriptionId'); 29 assert_will_be_idl_attribute(pushSubscription, 'subscriptionId');
29 assert_equals(typeof pushSubscription.subscriptionId, 'string'); 30 assert_equals(typeof pushSubscription.subscriptionId, 'string');
30 31
31 assert_own_property(pushSubscription, 'endpoint'); 32 assert_will_be_idl_attribute(pushSubscription, 'endpoint');
32 assert_equals(typeof pushSubscription.endpoint, 'string'); 33 assert_equals(typeof pushSubscription.endpoint, 'string');
33 try { 34 try {
34 var endpointUrl = new URL(pushSubscription.endpoint); 35 var endpointUrl = new URL(pushSubscription.endpoint);
35 } catch(e) { 36 } catch(e) {
36 assert_unreached('Constructing a URL from the endpoint should not throw.'); 37 assert_unreached('Constructing a URL from the endpoint should not throw.');
37 } 38 }
38 39
39 return service_worker_unregister_and_done(test, workerScope); 40 return service_worker_unregister_and_done(test, workerScope);
40 }) 41 })
41 .catch(unreached_rejection(test)); 42 .catch(unreached_rejection(test));
42 }, 'subscribe() succeeds when permission is granted and resolves with a valid su bscription'); 43 }, 'subscribe() succeeds when permission is granted and resolves with a valid su bscription');
43 </script> 44 </script>
44 </body> 45 </body>
45 </html> 46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698