Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: LayoutTests/fast/files/blob-slice-test.html

Issue 57483002: Implement File constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Answered feedback, part 2. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/files/blob-slice-test.html
diff --git a/LayoutTests/fast/files/blob-slice-test.html b/LayoutTests/fast/files/blob-slice-test.html
index 06fec6e4cbc5a427761a131a9f4908be0609185f..8ddad325952d6e5ded6e408594ac92643c48773a 100644
--- a/LayoutTests/fast/files/blob-slice-test.html
+++ b/LayoutTests/fast/files/blob-slice-test.html
@@ -1,9 +1,8 @@
<!DOCTYPE html>
<html>
<head>
+<script src="resources/blob-slice-common.js"></script>
<script>
-var blob;
-var testIndex = 0;
var sliceParams = [
[2, 3],
[2, 12],
@@ -34,55 +33,10 @@ var sliceParams = [
[],
];
-function log(message)
-{
- document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
-}
-
-function testSlicing(start, end)
-{
- var subBlob;
- var reader = new FileReader();
- var message = "Slicing ";
- if (start == undefined && end == undefined) {
- message += "without parameters";
- subBlob = blob.slice();
- } else if (end == undefined) {
- message += "from " + start;
- subBlob = blob.slice(start);
- } else {
- message += "from " + start + " to " + end;
- subBlob = blob.slice(start, end);
- }
- message += ": ";
- reader.onload = function(event) {
- log(message + event.target.result);
- runNextTest();
- };
- reader.onerror = function(event) {
- log(message + "error " + event.target.error.code);
- runNextTest();
- };
- reader.readAsText(subBlob);
-}
-
-function runNextTest()
-{
- if (testIndex >= sliceParams.length) {
- if (window.testRunner)
- testRunner.notifyDone();
- return;
- }
-
- var start = sliceParams[testIndex][0];
- var end = sliceParams[testIndex][1];
- testIndex++;
- testSlicing(start, end);
-}
-
function runTests()
{
blob = new Blob(["0123456789"]);
+ file = new File(["0123456789"], "slice-test.txt");
runNextTest();
}

Powered by Google App Engine
This is Rietveld 408576698