Update web-platform-tests to revision 58eb04cecbbec2e18531ab440225e38944a9c444

This commit is contained in:
Josh Matthews 2017-04-17 12:06:02 +10:00 committed by Anthony Ramine
parent 25e8bf69e6
commit 665817d2a6
35333 changed files with 1818077 additions and 16036 deletions

View file

@ -1,4 +1,3 @@
@Wafflespeanut
@Ms2ger
@jimsch
@engelke

View file

@ -0,0 +1,48 @@
// Step 1.
test(function() {
assert_throws("TypeMismatchError", function() {
self.crypto.getRandomValues(new Float32Array(6))
}, "Float32Array")
assert_throws("TypeMismatchError", function() {
self.crypto.getRandomValues(new Float64Array(6))
}, "Float64Array")
assert_throws("TypeMismatchError", function() {
self.crypto.getRandomValues(new Float32Array(65537))
}, "Float32Array (too long)")
assert_throws("TypeMismatchError", function() {
self.crypto.getRandomValues(new Float64Array(65537))
}, "Float64Array (too long)")
}, "Float arrays")
var arrays = {
'Int8Array': Int8Array,
'Int16Array': Int16Array,
'Int32Array': Int32Array,
'Uint8Array': Uint8Array,
'Uint8ClampedArray': Uint8ClampedArray,
'Uint16Array': Uint16Array,
'Uint32Array': Uint32Array,
};
test(function() {
for (var array in arrays) {
assert_equals(self.crypto.getRandomValues(new arrays[array](8)).constructor,
arrays[array], "crypto.getRandomValues(new " + array + "(8))")
}
}, "Integer array")
test(function() {
for (var array in arrays) {
var maxlength = 65536 / (arrays[array].BYTES_PER_ELEMENT);
assert_throws("QuotaExceededError", function() {
self.crypto.getRandomValues(new arrays[array](maxlength + 1))
}, "crypto.getRandomValues length over 65536")
}
}, "Large length")
test(function() {
for (var array in arrays) {
assert_true(self.crypto.getRandomValues(new arrays[array](0)).length == 0)
}
}, "Null arrays")

View file

@ -1,50 +0,0 @@
function run_test() {
// Step 1.
test(function() {
assert_throws("TypeMismatchError", function() {
self.crypto.getRandomValues(new Float32Array(6))
}, "Float32Array")
assert_throws("TypeMismatchError", function() {
self.crypto.getRandomValues(new Float64Array(6))
}, "Float64Array")
assert_throws("TypeMismatchError", function() {
self.crypto.getRandomValues(new Float32Array(65537))
}, "Float32Array (too long)")
assert_throws("TypeMismatchError", function() {
self.crypto.getRandomValues(new Float64Array(65537))
}, "Float64Array (too long)")
}, "Float arrays")
var arrays = {
'Int8Array': Int8Array,
'Int16Array': Int16Array,
'Int32Array': Int32Array,
'Uint8Array': Uint8Array,
'Uint8ClampedArray': Uint8ClampedArray,
'Uint16Array': Uint16Array,
'Uint32Array': Uint32Array,
};
test(function() {
for (var array in arrays) {
assert_equals(self.crypto.getRandomValues(new arrays[array](8)).constructor,
arrays[array], "crypto.getRandomValues(new " + array + "(8))")
}
}, "Integer array")
test(function() {
for (var array in arrays) {
var maxlength = 65536 / (arrays[array].BYTES_PER_ELEMENT);
assert_throws("QuotaExceededError", function() {
self.crypto.getRandomValues(new arrays[array](maxlength + 1))
}, "crypto.getRandomValues length over 65536")
}
}, "Large length")
test(function() {
for (var array in arrays) {
assert_true(self.crypto.getRandomValues(new arrays[array](0)).length == 0)
}
}, "Null arrays")
}

View file

@ -1,4 +0,0 @@
importScripts("/resources/testharness.js");
importScripts("getRandomValues.js");
run_test();
done();

View file

@ -1,12 +0,0 @@
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>WebCryptoAPI: getRandomValues()</title>
<link rel="author" title="Sunil Yoo" href="mailto:usuanday83@gmail.com">
<link rel="help" href="https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#dfn-Crypto-method-getRandomValues">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="getRandomValues.js"></script>
<div id="log"></div>
<script>
run_test();
</script>