Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / files / resources / blob-slice-common.js
blobba7a2517f6a8631c09af751c505eb155aeb7bf37
1 var blob, file; // Populated by runTests() in individual tests.
2 var sliceParams = []; // Populated by individual tests.
3 var testIndex = 0;
5 function testSlicing(start, end, expectedResult, blob, doneCallback)
7 var blobClass = blob.constructor.name;
8 var sliced;
9 var reader = new FileReader();
10 var message = ".slice";
11 if (start === null && end === null) {
12 message += "()";
13 sliced = blob.slice();
14 } else if (end == undefined) {
15 message += "(" + start + ")";
16 sliced = blob.slice(start);
17 } else {
18 message += "(" + start + ", " + end + ")";
19 sliced = blob.slice(start, end);
21 reader.onloadend = function(event) {
22 var error = event.target.error;
23 if (error) {
24 testFailed("File read error " + message + error);
25 doneCallback();
26 return;
28 var blobContentsVar = blobClass.toLowerCase() + "Contents";
29 window[blobContentsVar] = event.target.result;
30 shouldBeEqualToString(blobContentsVar, expectedResult);
31 doneCallback();
33 debug(blobClass + " " + message);
34 reader.readAsText(sliced);
37 function runNextTest()
39 if (testIndex >= sliceTestCases.length) {
40 finishJSTest();
41 return;
44 var testCase = sliceTestCases[testIndex];
45 testIndex++;
46 testSlicing(testCase[0], testCase[1], testCase[2], blob, function() {
47 testSlicing(testCase[0], testCase[1], testCase[2], file, runNextTest);
48 });