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

Side by Side Diff: LayoutTests/crypto/resources/common.js

Issue 222553007: [webcrypto] Expose crypto.subtle to web workers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: check if changes... Created 6 years, 8 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
OLDNEW
1 // Verifies that the given "bytes" holds the same value as "expectedHexString". 1 // Verifies that the given "bytes" holds the same value as "expectedHexString".
2 // "bytes" can be anything recognized by "bytesToHexString()". 2 // "bytes" can be anything recognized by "bytesToHexString()".
3 function bytesShouldMatchHexString(testDescription, expectedHexString, bytes) 3 function bytesShouldMatchHexString(testDescription, expectedHexString, bytes)
4 { 4 {
5 expectedHexString = "[" + expectedHexString.toLowerCase() + "]"; 5 expectedHexString = "[" + expectedHexString.toLowerCase() + "]";
6 var actualHexString = "[" + bytesToHexString(bytes) + "]"; 6 var actualHexString = "[" + bytesToHexString(bytes) + "]";
7 7
8 if (actualHexString === expectedHexString) { 8 if (actualHexString === expectedHexString) {
9 debug("PASS: " + testDescription + " should be " + expectedHexString + " and was"); 9 debug("PASS: " + testDescription + " should be " + expectedHexString + " and was");
10 } else { 10 } else {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 function asciiToUint8Array(str) 53 function asciiToUint8Array(str)
54 { 54 {
55 var chars = []; 55 var chars = [];
56 for (var i = 0; i < str.length; ++i) 56 for (var i = 0; i < str.length; ++i)
57 chars.push(str.charCodeAt(i)); 57 chars.push(str.charCodeAt(i));
58 return new Uint8Array(chars); 58 return new Uint8Array(chars);
59 } 59 }
60 60
61 function failAndFinishJSTest(error) 61 function failAndFinishJSTest(error)
62 { 62 {
63 testFailed(error); 63 testFailed('' + error);
64 finishJSTest(); 64 finishJSTest();
65 } 65 }
66 66
67 // Returns a Promise for the cloned key. 67 // Returns a Promise for the cloned key.
68 function cloneKey(key) 68 function cloneKey(key)
69 { 69 {
70 // Sending an object through a MessagePort implicitly clones it. 70 // Sending an object through a MessagePort implicitly clones it.
71 // Use a single MessageChannel so requests complete in FIFO order. 71 // Use a single MessageChannel so requests complete in FIFO order.
72 var self = cloneKey; 72 var self = cloneKey;
73 if (!self.channel) { 73 if (!self.channel) {
(...skipping 18 matching lines...) Expand all
92 if (internals) 92 if (internals)
93 debug("Serialized key bytes: " + bytesToHexString(internals.serializeObj ect(o))); 93 debug("Serialized key bytes: " + bytesToHexString(internals.serializeObj ect(o)));
94 } 94 }
95 95
96 function shouldEvaluateAs(actual, expectedValue) 96 function shouldEvaluateAs(actual, expectedValue)
97 { 97 {
98 if (typeof expectedValue == "string") 98 if (typeof expectedValue == "string")
99 return shouldBeEqualToString(actual, expectedValue); 99 return shouldBeEqualToString(actual, expectedValue);
100 return shouldEvaluateTo(actual, expectedValue); 100 return shouldEvaluateTo(actual, expectedValue);
101 } 101 }
OLDNEW
« no previous file with comments | « LayoutTests/crypto/hmac-sign-verify.html ('k') | LayoutTests/crypto/resources/subtle-crypto-concurrent.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698