зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset e81517c2358c (bug 1305230)
--HG-- rename : dom/file/tests/test_fileapi_twice.html => dom/file/tests/test_fileapi.html rename : dom/file/tests/test_fileapi_twice_worker.html => dom/file/tests/test_fileapi_worker.html
This commit is contained in:
Родитель
2f49a0c0b7
Коммит
3c21e7d99d
|
@ -72,22 +72,15 @@ function test_setup() {
|
|||
});
|
||||
}
|
||||
|
||||
function runBasicTests(data) {
|
||||
function runTests(data) {
|
||||
return test_basic()
|
||||
.then(() => {
|
||||
return test_readAsText(data.blobs.asciiFile, data.data.ascii);
|
||||
})
|
||||
.then(() => {
|
||||
return test_readAsBinaryString(data.blobs.binaryFile, data.data.binary);
|
||||
return test_readAsTextWithEncoding(data.blobs.asciiFile, data.data.ascii,
|
||||
data.data.ascii.length, "");
|
||||
})
|
||||
.then(() => {
|
||||
return test_readAsArrayBuffer(data.blobs.binaryFile, data.data.binary);
|
||||
});
|
||||
}
|
||||
|
||||
function runEncodingTests(data) {
|
||||
return test_readAsTextWithEncoding(data.blobs.asciiFile, data.data.ascii,
|
||||
data.data.ascii.length, "")
|
||||
.then(() => {
|
||||
return test_readAsTextWithEncoding(data.blobs.asciiFile, data.data.ascii,
|
||||
data.data.ascii.length, "iso8859-1");
|
||||
|
@ -102,6 +95,18 @@ function runEncodingTests(data) {
|
|||
convertToUTF16(data.data.text).length,
|
||||
"utf-16");
|
||||
})
|
||||
.then(() => {
|
||||
return test_readAsBinaryString(data.blobs.binaryFile, data.data.binary);
|
||||
})
|
||||
.then(() => {
|
||||
return test_readAsArrayBuffer(data.blobs.binaryFile, data.data.binary);
|
||||
})
|
||||
.then(() => {
|
||||
return test_onlyResult()
|
||||
})
|
||||
.then(() => {
|
||||
return test_readAsText(data.blobs.emptyFile, "");
|
||||
})
|
||||
.then(() => {
|
||||
return test_readAsTextWithEncoding(data.blobs.emptyFile, "", 0, "");
|
||||
})
|
||||
|
@ -110,13 +115,6 @@ function runEncodingTests(data) {
|
|||
})
|
||||
.then(() => {
|
||||
return test_readAsTextWithEncoding(data.blobs.emptyFile, "", 0, "utf-16");
|
||||
});
|
||||
}
|
||||
|
||||
function runEmptyTests(data) {
|
||||
return test_onlyResult()
|
||||
.then(() => {
|
||||
return test_readAsText(data.blobs.emptyFile, "");
|
||||
})
|
||||
.then(() => {
|
||||
return test_readAsBinaryString(data.blobs.emptyFile, "");
|
||||
|
@ -126,11 +124,10 @@ function runEmptyTests(data) {
|
|||
})
|
||||
.then(() => {
|
||||
return test_readAsDataURL(data.blobs.emptyFile, convertToDataURL(""), 0);
|
||||
});
|
||||
}
|
||||
|
||||
function runTwiceTests(data) {
|
||||
return test_readAsTextTwice(data.blobs.asciiFile, data.data.ascii)
|
||||
})
|
||||
.then(() => {
|
||||
return test_readAsTextTwice(data.blobs.asciiFile, data.data.ascii);
|
||||
})
|
||||
.then(() => {
|
||||
return test_readAsBinaryStringTwice(data.blobs.binaryFile,
|
||||
data.data.binary);
|
||||
|
@ -147,13 +144,12 @@ function runTwiceTests(data) {
|
|||
.then(() => {
|
||||
return test_readAsArrayBufferTwice2(data.blobs.binaryFile,
|
||||
data.data.binary);
|
||||
});
|
||||
}
|
||||
|
||||
function runOtherTests(data) {
|
||||
return test_readAsDataURL_customLength(data.blobs.dataUrlFile0,
|
||||
convertToDataURL(data.data.url0),
|
||||
data.data.url0.length, 0)
|
||||
})
|
||||
.then(() => {
|
||||
return test_readAsDataURL_customLength(data.blobs.dataUrlFile0,
|
||||
convertToDataURL(data.data.url0),
|
||||
data.data.url0.length, 0);
|
||||
})
|
||||
.then(() => {
|
||||
return test_readAsDataURL_customLength(data.blobs.dataUrlFile1,
|
||||
convertToDataURL(data.data.url1),
|
||||
|
@ -514,7 +510,7 @@ function test_abort_readAsX(blob, text) {
|
|||
return new Promise(resolve => {
|
||||
let reuseAbortHasRun = false;
|
||||
|
||||
let r = new FileReader();
|
||||
letr = new FileReader();
|
||||
r.onabort = function (event) {
|
||||
is(reuseAbortHasRun, false, "abort should only fire once");
|
||||
reuseAbortHasRun = true;
|
||||
|
|
|
@ -11,7 +11,6 @@ support-files =
|
|||
file_mozfiledataurl_inner.html
|
||||
file_nonascii_blob_url.html
|
||||
fileapi_chromeScript.js
|
||||
worker_fileReader.js
|
||||
!/dom/html/test/form_submit_server.sjs
|
||||
!/dom/xhr/tests/file_XHRSendData.sjs
|
||||
|
||||
|
@ -23,14 +22,9 @@ support-files =
|
|||
support-files = file_ipc_messagemanager_blob.html
|
||||
[test_nonascii_blob_url.html]
|
||||
[test_file_negative_date.html]
|
||||
[test_fileapi_basic.html]
|
||||
[test_fileapi_encoding.html]
|
||||
[test_fileapi_twice.html]
|
||||
[test_fileapi_other.html]
|
||||
[test_fileapi_basic_worker.html]
|
||||
[test_fileapi_encoding_worker.html]
|
||||
[test_fileapi_twice_worker.html]
|
||||
[test_fileapi_other_worker.html]
|
||||
[test_fileapi.html]
|
||||
[test_fileapi_worker.html]
|
||||
support-files = worker_fileReader.js
|
||||
[test_fileapi_slice_realFile_1.html]
|
||||
skip-if = (toolkit == 'android') # Android: Bug 775227
|
||||
[test_fileapi_slice_realFile_2.html]
|
||||
|
|
|
@ -11,11 +11,10 @@
|
|||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestLongerTimeout(3);
|
||||
|
||||
test_setup()
|
||||
.then(data => {
|
||||
return runBasicTests(data);
|
||||
return runTests(data);
|
||||
})
|
||||
.then(SimpleTest.finish);
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for FileReader API in workers</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="common_fileReader.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestLongerTimeout(3);
|
||||
|
||||
test_setup()
|
||||
.then(data => {
|
||||
let worker = new Worker('worker_fileReader.js');
|
||||
worker.postMessage({ tests: 'basic', data });
|
||||
|
||||
worker.onmessage = event => {
|
||||
if (event.data.type == 'finish') {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.data.type == 'check') {
|
||||
ok(event.data.status, event.data.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
ok(false, "Unknown message.");
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,24 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for FileReader API</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="common_fileReader.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestLongerTimeout(3);
|
||||
|
||||
test_setup()
|
||||
.then(data => {
|
||||
return runEncodingTests(data);
|
||||
})
|
||||
.then(SimpleTest.finish);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,38 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for FileReader API in workers</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="common_fileReader.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestLongerTimeout(3);
|
||||
|
||||
test_setup()
|
||||
.then(data => {
|
||||
let worker = new Worker('worker_fileReader.js');
|
||||
worker.postMessage({ tests: 'encoding', data });
|
||||
|
||||
worker.onmessage = event => {
|
||||
if (event.data.type == 'finish') {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.data.type == 'check') {
|
||||
ok(event.data.status, event.data.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
ok(false, "Unknown message.");
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,24 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for FileReader API</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="common_fileReader.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestLongerTimeout(3);
|
||||
|
||||
test_setup()
|
||||
.then(data => {
|
||||
return runOtherTests(data);
|
||||
})
|
||||
.then(SimpleTest.finish);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,24 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for FileReader API</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="common_fileReader.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestLongerTimeout(3);
|
||||
|
||||
test_setup()
|
||||
.then(data => {
|
||||
return runTwiceTests(data);
|
||||
})
|
||||
.then(SimpleTest.finish);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,38 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for FileReader API in workers</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="common_fileReader.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestLongerTimeout(3);
|
||||
|
||||
test_setup()
|
||||
.then(data => {
|
||||
let worker = new Worker('worker_fileReader.js');
|
||||
worker.postMessage({ tests: 'twice', data });
|
||||
|
||||
worker.onmessage = event => {
|
||||
if (event.data.type == 'finish') {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.data.type == 'check') {
|
||||
ok(event.data.status, event.data.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
ok(false, "Unknown message.");
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -11,12 +11,11 @@
|
|||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestLongerTimeout(3);
|
||||
|
||||
test_setup()
|
||||
.then(data => {
|
||||
let worker = new Worker('worker_fileReader.js');
|
||||
worker.postMessage({ tests: 'other', data });
|
||||
worker.postMessage(data);
|
||||
|
||||
worker.onmessage = event => {
|
||||
if (event.data.type == 'finish') {
|
|
@ -9,22 +9,7 @@ function is(a, b, msg) {
|
|||
}
|
||||
|
||||
onmessage = event => {
|
||||
let p;
|
||||
|
||||
if (event.data.tests == 'basic') {
|
||||
p = runBasicTests(event.data.data);
|
||||
} else if (event.data.tests == 'encoding') {
|
||||
p = runEncodingTests(event.data.data);
|
||||
} else if (event.data.tests == 'twice') {
|
||||
p = runTwiceTests(event.data.data);
|
||||
} else if (event.data.tests == 'other') {
|
||||
p = runOtherTests(event.data.data);
|
||||
} else {
|
||||
postMessage({type: 'error'});
|
||||
return;
|
||||
}
|
||||
|
||||
p.then(() => {
|
||||
runTests(event.data).then(() => {
|
||||
postMessage({ type: 'finish' });
|
||||
});
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче