| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>PushSubscriptionOptions should be correctly reflected on PushSubs
cription objects</title> | 4 <title>PushSubscriptionOptions should be correctly reflected on PushSubs
cription objects</title> |
| 5 <link rel="manifest" href="resources/push_manifest.json"> | 5 <link rel="manifest" href="resources/push_manifest.json"> |
| 6 <script src="resources/push-constants.js"></script> |
| 6 <script src="../resources/testharness.js"></script> | 7 <script src="../resources/testharness.js"></script> |
| 7 <script src="../resources/testharnessreport.js"></script> | 8 <script src="../resources/testharnessreport.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 // When running this test manually, grant permission when prompted. | 13 // When running this test manually, grant permission when prompted. |
| 13 if (window.testRunner) | 14 if (window.testRunner) |
| 14 testRunner.setPermission('push-messaging', 'granted', location.o
rigin, location.origin); | 15 testRunner.setPermission('push-messaging', 'granted', location.o
rigin, location.origin); |
| 15 | 16 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 description + ": applicationServerKey[" +
i + "]"); | 56 description + ": applicationServerKey[" +
i + "]"); |
| 56 } | 57 } |
| 57 | 58 |
| 58 // The applicationServerKey is actually mutable (https://git
hub.com/w3c/push-api/issues/198). | 59 // The applicationServerKey is actually mutable (https://git
hub.com/w3c/push-api/issues/198). |
| 59 new Uint8Array(actual_options.applicationServerKey)[0] = 0x7
F; | 60 new Uint8Array(actual_options.applicationServerKey)[0] = 0x7
F; |
| 60 assert_equals(new Uint8Array(actual_subscription.options.app
licationServerKey)[0], 0x7F, | 61 assert_equals(new Uint8Array(actual_subscription.options.app
licationServerKey)[0], 0x7F, |
| 61 description + ": applicationServerKey mutable"
); | 62 description + ": applicationServerKey mutable"
); |
| 62 } | 63 } |
| 63 } | 64 } |
| 64 | 65 |
| 65 const PUBLIC_KEY = [ | |
| 66 0x04, 0x56, 0x23, 0xC0, 0x45, 0xD7, 0x6C, 0x5D, 0x45, 0x1A, 0x29
, | |
| 67 0x19, 0xAA, 0xE5, 0x02, 0x2F, 0x43, 0x55, 0xC2, 0x5C, 0x59, 0x86
, | |
| 68 0x69, 0xA0, 0xAD, 0xD7, 0x2D, 0x54, 0x22, 0xD8, 0x43, 0xB6, 0xCD
, | |
| 69 0xE3, 0x33, 0xB4, 0xBB, 0x66, 0x2F, 0x47, 0xE5, 0xE6, 0x20, 0xFF
, | |
| 70 0x0E, 0x10, 0x7F, 0xCD, 0xA3, 0x44, 0x8C, 0x65, 0x54, 0x64, 0x7E
, | |
| 71 0x25, 0xF3, 0x67, 0xF4, 0x7C, 0x4B, 0x0C, 0xBD, 0xCF, 0xF4 | |
| 72 ]; | |
| 73 const VAPID_OPTIONS = { | 66 const VAPID_OPTIONS = { |
| 74 userVisibleOnly: true, | 67 userVisibleOnly: true, |
| 75 applicationServerKey: new Uint8Array(PUBLIC_KEY) | 68 applicationServerKey: new Uint8Array(PUBLIC_KEY) |
| 76 }; | 69 }; |
| 77 const SENDER_ID_OPTIONS = { | 70 const SENDER_ID_OPTIONS = { |
| 78 userVisibleOnly: true, | 71 userVisibleOnly: true, |
| 79 // This is equal to the gcm_sender_id in push_manifest.json | 72 // This is equal to the gcm_sender_id in push_manifest.json |
| 80 applicationServerKey: new TextEncoder().encode('1234567890') | 73 applicationServerKey: new TextEncoder().encode('1234567890') |
| 81 }; | 74 }; |
| 82 const MANIFEST_OPTIONS = { | 75 const MANIFEST_OPTIONS = { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 "subscribe with MANIFEST_OPTIONS")
; | 128 "subscribe with MANIFEST_OPTIONS")
; |
| 136 return pushManager.getSubscription(); | 129 return pushManager.getSubscription(); |
| 137 }).then(pushSubscription => { | 130 }).then(pushSubscription => { |
| 138 assert_options_equals(pushSubscription, SENDER_ID_OPTION
S, | 131 assert_options_equals(pushSubscription, SENDER_ID_OPTION
S, |
| 139 "getSubscription with MANIFEST_OPT
IONS"); | 132 "getSubscription with MANIFEST_OPT
IONS"); |
| 140 }); | 133 }); |
| 141 | 134 |
| 142 }, "PushSubscriptionOptions should be correctly reflected on PushSub
scription objects"); | 135 }, "PushSubscriptionOptions should be correctly reflected on PushSub
scription objects"); |
| 143 </script> | 136 </script> |
| 144 </body> | 137 </body> |
| 145 </html> | 138 </html> |
| OLD | NEW |