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

Unified Diff: LayoutTests/crypto/resources/common.js

Issue 298023002: [webcrypto] Import WebKit's webcrypto tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove FIXME for unrecognized jwk usages (supported now) Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/crypto/jwk-import-use-values-expected.txt ('k') | LayoutTests/crypto/rsa-export-key.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/crypto/resources/common.js
diff --git a/LayoutTests/crypto/resources/common.js b/LayoutTests/crypto/resources/common.js
index 8169e9be66654a7a8200edeb3168499318d6b15b..0f195f6958264662a93101ed7f959334b7e03d67 100644
--- a/LayoutTests/crypto/resources/common.js
+++ b/LayoutTests/crypto/resources/common.js
@@ -39,6 +39,11 @@ function bytesToHexString(bytes)
return hexBytes.join("");
}
+function bytesToASCIIString(bytes)
+{
+ return String.fromCharCode.apply(null, new Uint8Array(bytes));
+}
+
function hexStringToUint8Array(hexString)
{
if (hexString.length % 2 != 0)
@@ -63,6 +68,17 @@ function asciiToUint8Array(str)
return new Uint8Array(chars);
}
+var Base64URL = {
+ stringify: function (a) {
+ var base64string = btoa(String.fromCharCode.apply(0, a));
+ return base64string.replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
+ },
+ parse: function (s) {
+ s = s.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, '');
+ return new Uint8Array(Array.prototype.map.call(atob(s), function (c) { return c.charCodeAt(0) }));
+ }
+};
+
function failAndFinishJSTest(error)
{
testFailed('' + error);
« no previous file with comments | « LayoutTests/crypto/jwk-import-use-values-expected.txt ('k') | LayoutTests/crypto/rsa-export-key.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698