Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / crypto / array-buffer-view-offset.html
blob597a92ecb83a6d7bf343462eec1a24c87e36234b
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 <script src="subtle/resources/common.js"></script>
6 </head>
7 <body>
8 <p id="description"></p>
9 <div id="console"></div>
11 <script>
12 description("Test that an ArrayBufferView with offset is processed correctly.");
14 jsTestIsAsync = true;
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]);
18 var slicedData = new Uint8Array(originalData.buffer, 3, 11);
19 return crypto.subtle.digest({name: 'sha-1'}, slicedData);
20 }).then(function(result) {
21 digest = result;
22 // Expected result for [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].
23 shouldBe("bytesToHexString(new Uint8Array(digest))", "'2c7e7c384f7829694282b1e3a6216def8082d055'");
24 finishJSTest();
25 });
26 </script>
28 </body>
29 </html>