| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../fast/js/resources/js-test-pre.js"></script> |
| 5 <script src="resources/common.js"></script> |
| 5 </head> | 6 </head> |
| 6 <body> | 7 <body> |
| 7 <p id="description"></p> | 8 <p id="description"></p> |
| 8 <div id="console"></div> | 9 <div id="console"></div> |
| 9 | 10 |
| 10 <script> | 11 <script> |
| 11 description("Tests cypto.subtle.digest."); | 12 description("Tests cypto.subtle.digest."); |
| 12 | 13 |
| 13 jsTestIsAsync = true; | 14 jsTestIsAsync = true; |
| 14 | 15 |
| 15 // Builds a hex string representation of any array-like input (array or | |
| 16 // ArrayBufferView). The output looks like this: | |
| 17 // [ab 03 4c 99] | |
| 18 function byteArrayToHexString(bytes) | |
| 19 { | |
| 20 var hexBytes = []; | |
| 21 | |
| 22 for (var i = 0; i < bytes.length; ++i) { | |
| 23 var byteString = bytes[i].toString(16); | |
| 24 if (byteString.length < 2) | |
| 25 byteString = "0" + byteString; | |
| 26 hexBytes.push(byteString); | |
| 27 } | |
| 28 | |
| 29 return "[" + hexBytes.join(" ") + "]"; | |
| 30 } | |
| 31 | |
| 32 // Each sub-test run in this file is asynchronous. Chaining them together | 16 // Each sub-test run in this file is asynchronous. Chaining them together |
| 33 // manually leads to very unreadable code, due to having closures within | 17 // manually leads to very unreadable code, due to having closures within |
| 34 // closures within closures. Instead of doing that, each subtest calls | 18 // closures within closures. Instead of doing that, each subtest calls |
| 35 // "startNextTest()" once it has completed. | 19 // "startNextTest()" once it has completed. |
| 36 | 20 |
| 37 currentTestIndex = 0; | 21 currentTestIndex = 0; |
| 38 | 22 |
| 39 function startNextTest() | 23 function startNextTest() |
| 40 { | 24 { |
| 41 var currentTest = allTests[currentTestIndex++]; | 25 var currentTest = allTests[currentTestIndex++]; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 ]; | 188 ]; |
| 205 | 189 |
| 206 // Begin! | 190 // Begin! |
| 207 startNextTest(); | 191 startNextTest(); |
| 208 | 192 |
| 209 </script> | 193 </script> |
| 210 | 194 |
| 211 <script src="../fast/js/resources/js-test-post.js"></script> | 195 <script src="../fast/js/resources/js-test-post.js"></script> |
| 212 </body> | 196 </body> |
| 213 </html> | 197 </html> |
| OLD | NEW |