OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
5 <script src="resources/common.js"></script> | 5 <script src="subtle/resources/common.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <p id="description"></p> | 8 <p id="description"></p> |
9 <div id="console"></div> | 9 <div id="console"></div> |
10 | 10 |
11 <script> | 11 <script> |
12 description("Test that an ArrayBufferView with offset is processed correctly."); | 12 description("Test that an ArrayBufferView with offset is processed correctly."); |
13 | 13 |
14 jsTestIsAsync = true; | 14 jsTestIsAsync = true; |
15 | 15 |
16 Promise.resolve(null).then(function() { | 16 Promise.resolve(null).then(function() { |
17 var originalData = new Uint8Array([0xf, 0xf, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 0xf, 0xf, 0xf]); | 17 var originalData = new Uint8Array([0xf, 0xf, 0xf, 0, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 0xf, 0xf, 0xf]); |
18 var slicedData = new Uint8Array(originalData.buffer, 3, 11); | 18 var slicedData = new Uint8Array(originalData.buffer, 3, 11); |
19 return crypto.subtle.digest({name: 'sha-1'}, slicedData); | 19 return crypto.subtle.digest({name: 'sha-1'}, slicedData); |
20 }).then(function(result) { | 20 }).then(function(result) { |
21 digest = result; | 21 digest = result; |
22 // Expected result for [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. | 22 // Expected result for [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. |
23 shouldBe("bytesToHexString(new Uint8Array(digest))", "'2c7e7c384f7829694282b
1e3a6216def8082d055'"); | 23 shouldBe("bytesToHexString(new Uint8Array(digest))", "'2c7e7c384f7829694282b
1e3a6216def8082d055'"); |
24 finishJSTest(); | 24 finishJSTest(); |
25 }); | 25 }); |
26 </script> | 26 </script> |
27 | 27 |
28 </body> | 28 </body> |
29 </html> | 29 </html> |
OLD | NEW |