fune/testing/web-platform/tests/WebCryptoAPI/getRandomValues.js
Sebastian Hengst 97648da641 Backed out changeset e7024412b94e (bug 1356225)
MozReview-Commit-ID: Ib8aOAM6cQ2

--HG--
rename : testing/web-platform/tests/content-security-policy/media-src/media-src-7_1_2.sub.html.sub.headers => testing/web-platform/tests/content-security-policy/media-src/media-src-7_1_2.html.sub.headers
rename : testing/web-platform/tests/content-security-policy/media-src/media-src-7_2_2.sub.html.sub.headers => testing/web-platform/tests/content-security-policy/media-src/media-src-7_2_2.html.sub.headers
rename : testing/web-platform/tests/content-security-policy/media-src/media-src-7_3_2.sub.html.sub.headers => testing/web-platform/tests/content-security-policy/media-src/media-src-7_3_2.html.sub.headers
rename : testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-nested-frame.html => testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/test.html
rename : testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/resources/frameElement-window-post.html => testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/testcase3.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/PresentationAvailability_onchange-manual.https.html => testing/web-platform/tests/presentation-api/controlling-ua/PresentationAvailability_onchange-manual.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/PresentationConnection_onmessage-manual.https.html => testing/web-platform/tests/presentation-api/controlling-ua/PresentationConnection_onmessage-manual.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/PresentationConnection_send-manual.https.html => testing/web-platform/tests/presentation-api/controlling-ua/PresentationConnection_send-manual.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/PresentationRequest_error.https.html => testing/web-platform/tests/presentation-api/controlling-ua/PresentationRequest_error.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/PresentationRequest_onconnectionavailable-manual.https.html => testing/web-platform/tests/presentation-api/controlling-ua/PresentationRequest_onconnectionavailable-manual.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/PresentationRequest_sandboxing_error.https.html => testing/web-platform/tests/presentation-api/controlling-ua/PresentationRequest_sandboxing_error.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/PresentationRequest_sandboxing_success.https.html => testing/web-platform/tests/presentation-api/controlling-ua/PresentationRequest_sandboxing_success.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/PresentationRequest_success.https.html => testing/web-platform/tests/presentation-api/controlling-ua/PresentationRequest_success.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/defaultRequest_success-manual.https.html => testing/web-platform/tests/presentation-api/controlling-ua/defaultRequest_success-manual.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/getAvailability.https.html => testing/web-platform/tests/presentation-api/controlling-ua/getAvailability.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/getAvailability_sandboxing_success.https.html => testing/web-platform/tests/presentation-api/controlling-ua/getAvailability_sandboxing_success.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/reconnectToPresentation_notfound_error.https.html => testing/web-platform/tests/presentation-api/controlling-ua/reconnectToPresentation_notfound_error.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/reconnectToPresentation_sandboxing_success.https.html => testing/web-platform/tests/presentation-api/controlling-ua/reconnectToPresentation_sandboxing_success.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/reconnectToPresentation_success-manual.https.html => testing/web-platform/tests/presentation-api/controlling-ua/reconnectToPresentation_success-manual.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_displaynotallowed-manual.https.html => testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_displaynotallowed-manual.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_displaynotfound-manual.https.html => testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_displaynotfound-manual.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_error.https.html => testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_error.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_sandboxing_success-manual.https.html => testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_sandboxing_success-manual.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_success-manual.https.html => testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_success-manual.html
rename : testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_unsettledpromise-manual.https.html => testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_unsettledpromise-manual.html
rename : testing/web-platform/tests/presentation-api/receiving-ua/idlharness-manual.https.html => testing/web-platform/tests/presentation-api/receiving-ua/idlharness-manual.html
rename : testing/web-platform/tests/presentation-api/receiving-ua/support/idlharness_receiving-ua.https.html => testing/web-platform/tests/presentation-api/receiving-ua/support/idlharness_receiving-ua.html
rename : testing/web-platform/tests/webdriver/support/http_request.py => testing/web-platform/tests/webdriver/util/http_request.py
2017-04-14 17:18:47 +02:00

50 lines
1.7 KiB
JavaScript

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")
}