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

Side by Side Diff: LayoutTests/http/tests/push_messaging/subscribe-encryption-public-key.html

Issue 1309723004: Change PushSubscription.curve25519dh to PushSubscription.getKey() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Subscribing should provide a Curve25519 ECDH public key.</title> 4 <title>Subscribing should provide a Curve25519 ECDH public key.</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="../resources/testharness-helpers.js"></script>
9 <script src="../serviceworker/resources/test-helpers.js"></script> 9 <script src="../serviceworker/resources/test-helpers.js"></script>
10 </head> 10 </head>
(...skipping 20 matching lines...) Expand all
31 swRegistration = serviceWorkerRegistration; 31 swRegistration = serviceWorkerRegistration;
32 return wait_for_state(test, swRegistration.installing, ' activated'); 32 return wait_for_state(test, swRegistration.installing, ' activated');
33 }) 33 })
34 .then(function() { 34 .then(function() {
35 if (window.testRunner) 35 if (window.testRunner)
36 testRunner.setPermission('push-messaging', 'granted' , location.origin, location.origin); 36 testRunner.setPermission('push-messaging', 'granted' , location.origin, location.origin);
37 37
38 return swRegistration.pushManager.subscribe(); 38 return swRegistration.pushManager.subscribe();
39 }) 39 })
40 .then(function(pushSubscription) { 40 .then(function(pushSubscription) {
41 // TODO(peter): Remove support for the attribute when th e embedder has been updated.
41 assert_idl_attribute(pushSubscription, 'curve25519dh'); 42 assert_idl_attribute(pushSubscription, 'curve25519dh');
42 assert_equals(pushSubscription.curve25519dh, pushSubscri ption.curve25519dh);
43 assert_readonly(pushSubscription, 'curve25519dh');
44 assert_equals(pushSubscription.curve25519dh.byteLength, EXPECTED_KEY_LENGTH);
45 43
46 encryptionKey = SerializeArrayBuffer(pushSubscription.cu rve25519dh); 44 assert_own_property(PushSubscription.prototype, 'getKey' );
45 assert_not_equals(pushSubscription.getKey('curve25519dh' ), null);
46 assert_equals(pushSubscription.getKey('curve25519dh').by teLength, EXPECTED_KEY_LENGTH);
47
48 // The returned ArrayBuffers are expected to be the same .
49 assert_equals(pushSubscription.getKey('curve25519dh'), p ushSubscription.getKey('curve25519dh'));
50
51 // Getting a key with an unsupported algorithm should th row an exception.
52 assert_throws(TypeError(), () => pushSubscription.getKey ('petercurve9001'));
53
54 encryptionKey = SerializeArrayBuffer(pushSubscription.ge tKey('curve25519dh'));
47 55
48 return swRegistration.pushManager.getSubscription(); 56 return swRegistration.pushManager.getSubscription();
49 }) 57 })
50 .then(function(pushSubscription) { 58 .then(function(pushSubscription) {
51 assert_equals(SerializeArrayBuffer(pushSubscription.curv e25519dh), encryptionKey); 59 assert_equals(SerializeArrayBuffer(pushSubscription.getK ey('curve25519dh')), encryptionKey);
52 60
53 return service_worker_unregister_and_done(test, workerSc ope); 61 return service_worker_unregister_and_done(test, workerSc ope);
54 }) 62 })
55 .catch(unreached_rejection(test)); 63 .catch(unreached_rejection(test));
56 64
57 }, 'Subscribing should provide a Curve25519 ECDH public key'); 65 }, 'Subscribing should provide a Curve25519 ECDH public key');
58 </script> 66 </script>
59 </body> 67 </body>
60 </html> 68 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698