Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Push API: permissionState resolves with prompt when no permission is set< /title> | 4 <title>Push API: permissionState fails with NotSupported if userVisible is not u sed</title> |
|
Peter Beverloo
2015/05/07 15:28:21
NotSupported -> NotSupportedError; userVisible ->
Miguel Garcia
2015/05/07 19:40:45
Done.
| |
| 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="../serviceworker/resources/test-helpers.js"></script> | 8 <script src="../serviceworker/resources/test-helpers.js"></script> |
| 9 </head> | 9 </head> |
| 10 <body> | 10 <body> |
| 11 <script> | 11 <script> |
| 12 async_test(function(test) { | 12 async_test(function(test) { |
| 13 if (window.testRunner) | 13 if (window.testRunner) |
| 14 testRunner.setPermission('push-messaging', 'prompt', location.origin, lo cation.origin); | 14 testRunner.setPermission('push-messaging', 'prompt', location.origin, lo cation.origin); |
| 15 | 15 |
| 16 var workerUrl = 'resources/empty_worker.js'; | 16 var workerUrl = 'resources/empty_worker.js'; |
| 17 var workerScope = 'resources/scope/' + location.pathname; | 17 var workerScope = 'resources/scope/' + location.pathname; |
| 18 service_worker_unregister_and_register(test, workerUrl, workerScope) | 18 service_worker_unregister_and_register(test, workerUrl, workerScope) |
| 19 .then(function(serviceWorkerRegistration) { | 19 .then(function(serviceWorkerRegistration) { |
| 20 // If running manually, clear permissions before running this test. | 20 // If running manually, clear permissions before running this test. |
|
Peter Beverloo
2015/05/07 15:28:21
Blink indents with four spaces.
Miguel Garcia
2015/05/07 19:40:46
Done.
| |
| 21 return serviceWorkerRegistration.pushManager.permissionState(); | 21 return serviceWorkerRegistration.pushManager.permissionState(); |
| 22 }) | 22 }) |
| 23 .then(function(permissionStatus) { | 23 .then(function(permissionStatus) { |
| 24 assert_equals(permissionStatus, 'prompt'); | 24 assert_unreached('permissionStatus should have failed with a NotSuppor ted exception'); |
| 25 return service_worker_unregister_and_done(test, workerScope); | 25 }, function(error) { |
| 26 }) | 26 assert_equals(error.name, "NotSupportedError"); |
|
Peter Beverloo
2015/05/07 15:28:21
nit: Please be consistent with ' vs. "
Miguel Garcia
2015/05/07 19:40:45
Done.
| |
| 27 .catch(unreached_rejection(test)); | 27 assert_equals(error.message, "non-visible push messages are not suppor ted."); |
| 28 }, 'Push API: permissionState() resolves with prompt when permission is not set' ); | 28 test.done(); |
| 29 }).catch(unreached_rejection(test)); | |
| 30 }, 'Push API: permissionState fails with NotSupported if userVisible is not used '); | |
| 29 </script> | 31 </script> |
| 30 </body> | 32 </body> |
| 31 </html> | 33 </html> |
| OLD | NEW |