| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Subscribing with an applicationServerKey should return a standard
ized endpoint</title> | 4 <title>Subscribing with an applicationServerKey should return a standard
ized endpoint</title> |
| 5 <script src="resources/push-constants.js"></script> |
| 5 <script src="../resources/testharness.js"></script> | 6 <script src="../resources/testharness.js"></script> |
| 6 <script src="../resources/testharnessreport.js"></script> | 7 <script src="../resources/testharnessreport.js"></script> |
| 7 <script src="../resources/testharness-helpers.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 const PUBLIC_KEY = [ | |
| 13 0x04, 0x56, 0x23, 0xC0, 0x45, 0xD7, 0x6C, 0x5D, 0x45, 0x1A, 0x29
, | |
| 14 0x19, 0xAA, 0xE5, 0x02, 0x2F, 0x43, 0x55, 0xC2, 0x5C, 0x59, 0x86
, | |
| 15 0x69, 0xA0, 0xAD, 0xD7, 0x2D, 0x54, 0x22, 0xD8, 0x43, 0xB6, 0xCD
, | |
| 16 0xE3, 0x33, 0xB4, 0xBB, 0x66, 0x2F, 0x47, 0xE5, 0xE6, 0x20, 0xFF
, | |
| 17 0x0E, 0x10, 0x7F, 0xCD, 0xA3, 0x44, 0x8C, 0x65, 0x54, 0x64, 0x7E
, | |
| 18 0x25, 0xF3, 0x67, 0xF4, 0x7C, 0x4B, 0x0C, 0xBD, 0xCF, 0xF4 | |
| 19 ]; | |
| 20 | |
| 21 // When running this test manually, grant permission when prompted. | 13 // When running this test manually, grant permission when prompted. |
| 22 // This test verifies that push subscriptions made with a valid P-25
6 | 14 // This test verifies that push subscriptions made with a valid P-25
6 |
| 23 // applicationServerKey return the standardized endpoint. | 15 // applicationServerKey return the standardized endpoint. |
| 24 promise_test(function(test) { | 16 promise_test(function(test) { |
| 25 var workerUrl = 'resources/empty_worker.js'; | 17 var workerUrl = 'resources/empty_worker.js'; |
| 26 var workerScope = 'resources/scope/' + location.pathname; | 18 var workerScope = 'resources/scope/' + location.pathname; |
| 27 var swRegistration; | 19 var swRegistration; |
| 28 | 20 |
| 29 return service_worker_unregister_and_register(test, workerUrl, w
orkerScope) | 21 return service_worker_unregister_and_register(test, workerUrl, w
orkerScope) |
| 30 .then(function(serviceWorkerRegistration) { | 22 .then(function(serviceWorkerRegistration) { |
| 31 swRegistration = serviceWorkerRegistration; | 23 swRegistration = serviceWorkerRegistration; |
| 32 return wait_for_state(test, swRegistration.installing, '
activated'); | 24 return wait_for_state(test, swRegistration.installing, '
activated'); |
| 33 }) | 25 }) |
| 34 .then(function() { | 26 .then(function() { |
| 35 if (window.testRunner) | 27 if (window.testRunner) |
| 36 testRunner.setPermission('push-messaging', 'granted'
, location.origin, location.origin); | 28 testRunner.setPermission('push-messaging', 'granted'
, location.origin, location.origin); |
| 37 | 29 |
| 38 return swRegistration.pushManager.subscribe({ | 30 return swRegistration.pushManager.subscribe({ |
| 39 userVisibleOnly: true, | 31 userVisibleOnly: true, |
| 40 applicationServerKey: new Uint8Array(PUBLIC_KEY) | 32 applicationServerKey: new Uint8Array(PUBLIC_KEY) |
| 41 }); | 33 }); |
| 42 }) | 34 }) |
| 43 .then(function(pushSubscription) { | 35 .then(function(pushSubscription) { |
| 44 assert_true(pushSubscription.endpoint.includes('Standard
izedEndpoint')); | 36 assert_true(pushSubscription.endpoint.includes('Standard
izedEndpoint')); |
| 45 }); | 37 }); |
| 46 | 38 |
| 47 }, 'Subscribing with an applicationServerKey should return the stand
ardized endpoint'); | 39 }, 'Subscribing with an applicationServerKey should return the stand
ardized endpoint'); |
| 48 </script> | 40 </script> |
| 49 </body> | 41 </body> |
| 50 </html> | 42 </html> |
| OLD | NEW |