| OLD | NEW |
| 1 function logError(error) | 1 function logError(error) |
| 2 { | 2 { |
| 3 debug("error is: " + error.toString()); | 3 debug("error is: " + error.toString()); |
| 4 } | 4 } |
| 5 | 5 |
| 6 // Verifies that the given "bytes" holds the same value as "expectedHexString". | 6 // Verifies that the given "bytes" holds the same value as "expectedHexString". |
| 7 // "bytes" can be anything recognized by "bytesToHexString()". | 7 // "bytes" can be anything recognized by "bytesToHexString()". |
| 8 function bytesShouldMatchHexString(testDescription, expectedHexString, bytes) | 8 function bytesShouldMatchHexString(testDescription, expectedHexString, bytes) |
| 9 { | 9 { |
| 10 expectedHexString = "[" + expectedHexString.toLowerCase() + "]"; | 10 expectedHexString = "[" + expectedHexString.toLowerCase() + "]"; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 self.channel.port2.postMessage(key); | 106 self.channel.port2.postMessage(key); |
| 107 }); | 107 }); |
| 108 } | 108 } |
| 109 | 109 |
| 110 // Logging the serialized format ensures that if it changes it will break tests. | 110 // Logging the serialized format ensures that if it changes it will break tests. |
| 111 function logSerializedKey(o) | 111 function logSerializedKey(o) |
| 112 { | 112 { |
| 113 if (internals) { | 113 if (internals) { |
| 114 // Removing the version tag from the output so serialization format chan
ges don't need to update all the crypto tests. | 114 // Removing the version tag from the output so serialization format chan
ges don't need to update all the crypto tests. |
| 115 var serialized = internals.serializeObject(o); | 115 var serialized = internals.serializeObject(o); |
| 116 var serializedWithoutVersion = new Uint8Array(serialized, 2); | 116 var serializedWithoutVersion = new Uint8Array(serialized, 4); |
| 117 debug("Serialized key bytes: " + bytesToHexString(serializedWithoutVersi
on)); | 117 debug("Serialized key bytes: " + bytesToHexString(serializedWithoutVersi
on)); |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 function shouldEvaluateAs(actual, expectedValue) | 121 function shouldEvaluateAs(actual, expectedValue) |
| 122 { | 122 { |
| 123 if (typeof expectedValue == "string") | 123 if (typeof expectedValue == "string") |
| 124 return shouldBeEqualToString(actual, expectedValue); | 124 return shouldBeEqualToString(actual, expectedValue); |
| 125 return shouldEvaluateTo(actual, expectedValue); | 125 return shouldEvaluateTo(actual, expectedValue); |
| 126 } | 126 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 157 // Expected to succeed. | 157 // Expected to succeed. |
| 158 debug("SUCCESS"); | 158 debug("SUCCESS"); |
| 159 return result; | 159 return result; |
| 160 }, function(error) { | 160 }, function(error) { |
| 161 debug("FAILED: " + error.toString()); | 161 debug("FAILED: " + error.toString()); |
| 162 | 162 |
| 163 // Re-throw the error. | 163 // Re-throw the error. |
| 164 throw new Error("Test FAILED: " + message); | 164 throw new Error("Test FAILED: " + message); |
| 165 }); | 165 }); |
| 166 } | 166 } |
| OLD | NEW |