mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 08:18:41 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
49
testing/web-platform/tests/FileAPI/support/Blob.js
Normal file
49
testing/web-platform/tests/FileAPI/support/Blob.js
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
function test_blob(fn, expectations) {
|
||||
var expected = expectations.expected,
|
||||
type = expectations.type,
|
||||
desc = expectations.desc;
|
||||
|
||||
var t = async_test(desc);
|
||||
t.step(function() {
|
||||
var blob = fn();
|
||||
assert_true(blob instanceof Blob);
|
||||
assert_false(blob instanceof File);
|
||||
assert_equals(blob.type, type);
|
||||
assert_equals(blob.size, expected.length);
|
||||
|
||||
var fr = new FileReader();
|
||||
fr.onload = t.step_func_done(function(event) {
|
||||
assert_equals(this.result, expected);
|
||||
}, fr);
|
||||
fr.onerror = t.step_func(function(e) {
|
||||
assert_unreached("got error event on FileReader");
|
||||
});
|
||||
fr.readAsText(blob, "UTF-8");
|
||||
});
|
||||
}
|
||||
|
||||
function test_blob_binary(fn, expectations) {
|
||||
var expected = expectations.expected,
|
||||
type = expectations.type,
|
||||
desc = expectations.desc;
|
||||
|
||||
var t = async_test(desc);
|
||||
t.step(function() {
|
||||
var blob = fn();
|
||||
assert_true(blob instanceof Blob);
|
||||
assert_false(blob instanceof File);
|
||||
assert_equals(blob.type, type);
|
||||
assert_equals(blob.size, expected.length);
|
||||
|
||||
var fr = new FileReader();
|
||||
fr.onload = t.step_func_done(function(event) {
|
||||
assert_true(this.result instanceof ArrayBuffer,
|
||||
"Result should be an ArrayBuffer");
|
||||
assert_array_equals(new Uint8Array(this.result), expected);
|
||||
}, fr);
|
||||
fr.onerror = t.step_func(function(e) {
|
||||
assert_unreached("got error event on FileReader");
|
||||
});
|
||||
fr.readAsArrayBuffer(blob);
|
||||
});
|
||||
}
|
||||
1
testing/web-platform/tests/FileAPI/support/upload.txt
Normal file
1
testing/web-platform/tests/FileAPI/support/upload.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
Hello
|
||||
Loading…
Add table
Add a link
Reference in a new issue