Commit 442a4559 authored by yhirano@chromium.org's avatar yhirano@chromium.org

Fix broken Promise-related layout tests.

Because of the bindings change related to Promise-returning functions (see
http://crbug.com/359411), some layout tests that had been written before that
have been broken. As the bindings change is done, this CL fixes these tests.

BUG=362992

Review URL: https://codereview.chromium.org/669353002

git-svn-id: svn://svn.chromium.org/blink/trunk@184319 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c82dfa31
...@@ -900,14 +900,6 @@ crbug.com/365400 [ Mac ] compositing/images/direct-pdf-image.html [ Pass ImageOn ...@@ -900,14 +900,6 @@ crbug.com/365400 [ Mac ] compositing/images/direct-pdf-image.html [ Pass ImageOn
crbug.com/306222 fast/hidpi/image-srcset-relative-svg-canvas.html [ Skip ] crbug.com/306222 fast/hidpi/image-srcset-relative-svg-canvas.html [ Skip ]
crbug.com/306222 fast/hidpi/image-srcset-relative-svg-canvas-2x.html [ Skip ] crbug.com/306222 fast/hidpi/image-srcset-relative-svg-canvas-2x.html [ Skip ]
crbug.com/362992 fast/canvas/canvas-createImageBitmap-invalid-args-in-workers.html [ Skip ]
crbug.com/362992 fast/canvas/canvas-createImageBitmap-invalid-args.html [ Skip ]
crbug.com/362992 http/tests/security/cross-origin-createImageBitmap.html [ Skip ]
crbug.com/362992 storage/quota/storagequota-query-info.html [ Skip ]
crbug.com/362992 storage/quota/storagequota-request-persistent-quota.html [ Skip ]
crbug.com/362992 virtual/gpu/fast/canvas/canvas-createImageBitmap-invalid-args-in-workers.html [ Skip ]
crbug.com/362992 virtual/gpu/fast/canvas/canvas-createImageBitmap-invalid-args.html [ Skip ]
crbug.com/362434 [ Mac ] compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents.html [ ImageOnlyFailure Pass ] crbug.com/362434 [ Mac ] compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents.html [ ImageOnlyFailure Pass ]
crbug.com/362434 [ Mac ] virtual/prefer_compositing_to_lcd_text/compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents.html [ ImageOnlyFailure Pass ] crbug.com/362434 [ Mac ] virtual/prefer_compositing_to_lcd_text/compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents.html [ ImageOnlyFailure Pass ]
......
...@@ -3,26 +3,66 @@ Ensure correct behavior of createImageBitmap for invalid inputs. ...@@ -3,26 +3,66 @@ Ensure correct behavior of createImageBitmap for invalid inputs.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS createImageBitmap(image) threw exception InvalidStateError: Failed to execute 'createImageBitmap' on 'Window': No image can be retrieved from the provided element.. PASS Rejected as expected: undefined
PASS createImageBitmap(video) threw exception InvalidStateError: Failed to execute 'createImageBitmap' on 'Window': No player can be retrieved from the provided video element.. PASS reason instanceof Error is true
PASS createImageBitmap(undefined) threw exception TypeError: Failed to execute 'createImageBitmap' on 'Window': No function was found that matched the signature provided.. TypeError: Failed to execute 'createImageBitmap' on 'Window': No function was found that matched the signature provided.
PASS createImageBitmap(null) threw exception TypeError: Failed to execute 'createImageBitmap' on 'Window': No function was found that matched the signature provided.. PASS Rejected as expected: null
PASS createImageBitmap(image, 0, 0, 10, 0) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source height provided is 0.. PASS reason instanceof Error is true
PASS createImageBitmap(image, 0, 0, 0, 10) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source width provided is 0.. TypeError: Failed to execute 'createImageBitmap' on 'Window': No function was found that matched the signature provided.
PASS createImageBitmap(video, 0, 0, 10, 0) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source height provided is 0.. PASS Rejected as expected: empty image
PASS createImageBitmap(video, 0, 0, 0, 10) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source width provided is 0.. PASS reason instanceof Error is true
PASS createImageBitmap(aCanvas, 0, 0, 10, 0) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source height provided is 0.. InvalidStateError: Failed to execute 'createImageBitmap' on 'Window': No image can be retrieved from the provided element.
PASS createImageBitmap(aCanvas, 0, 0, 0, 10) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source width provided is 0.. PASS Rejected as expected: empty video
PASS createImageBitmap(d, 0, 0, 10, 0) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source height provided is 0.. PASS reason instanceof Error is true
PASS createImageBitmap(d, 0, 0, 0, 10) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source width provided is 0.. InvalidStateError: Failed to execute 'createImageBitmap' on 'Window': The provided element has not retrieved data.
PASS createImageBitmap(aCtx, 0, 0, 10, 0) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source height provided is 0.. PASS Rejected as expected: image / invalid range
PASS createImageBitmap(aCtx, 0, 0, 0, 10) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source width provided is 0.. PASS reason instanceof Error is true
PASS createImageBitmap(testBitmap, 0, 0, 10, 0) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source height provided is 0.. IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source height provided is 0.
PASS createImageBitmap(testBitmap, 0, 0, 0, 10) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source width provided is 0.. PASS Rejected as expected: image / invalid range
PASS createImageBitmap(blob, 0, 0, 10, 0) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source height provided is 0.. PASS reason instanceof Error is true
PASS createImageBitmap(blob, 0, 0, 0, 10) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source width provided is 0.. IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source width provided is 0.
PASS createImageBitmap(invalidBlob) was rejected. PASS Rejected as expected: video / invalid range
PASS createImageBitmap(invalidCanvas) was rejected. PASS reason instanceof Error is true
IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source height provided is 0.
PASS Rejected as expected: video / invalid range
PASS reason instanceof Error is true
IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source width provided is 0.
PASS Rejected as expected: canvas / invalid range
PASS reason instanceof Error is true
IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source height provided is 0.
PASS Rejected as expected: canvas / invalid range
PASS reason instanceof Error is true
IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source width provided is 0.
PASS Rejected as expected: canvas context / invalid range
PASS reason instanceof Error is true
IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source height provided is 0.
PASS Rejected as expected: canvas context / invalid range
PASS reason instanceof Error is true
IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source width provided is 0.
PASS Rejected as expected: canvas imagedata / invalid range
PASS reason instanceof Error is true
IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source height provided is 0.
PASS Rejected as expected: canvas imagedata / invalid range
PASS reason instanceof Error is true
IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source width provided is 0.
PASS Rejected as expected: image bitmap / invalid range
PASS reason instanceof Error is true
IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source height provided is 0.
PASS Rejected as expected: image bitmap / invalid range
PASS reason instanceof Error is true
IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source width provided is 0.
PASS Rejected as expected: blob / invalid range
PASS reason instanceof Error is true
IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source height provided is 0.
PASS Rejected as expected: blob / invalid range
PASS reason instanceof Error is true
IndexSizeError: Failed to execute 'createImageBitmap' on 'Window': The source width provided is 0.
PASS Rejected as expected: invalid blob
FAIL reason instanceof Error should be true. Was false.
null
PASS Rejected as expected: invalid canvas
FAIL reason instanceof Error should be true. Was false.
null
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
......
...@@ -4,9 +4,15 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -4,9 +4,15 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Starting worker: ./resources/canvas-createImageBitmap-invalid-args-in-workers.js Starting worker: ./resources/canvas-createImageBitmap-invalid-args-in-workers.js
PASS [Worker] createImageBitmap(null, 0, 0, 10, 10) threw exception TypeError: Failed to execute 'createImageBitmap' on 'WorkerGlobalScope': No function was found that matched the signature provided.. PASS [Worker] Rejected as expected: null
PASS [Worker] createImageBitmap(data, 0, 0, 10, 0) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'WorkerGlobalScope': The source height provided is 0.. PASS [Worker] reason instanceof Error is true
PASS [Worker] createImageBitmap(data, 0, 0, 0, 10) threw exception IndexSizeError: Failed to execute 'createImageBitmap' on 'WorkerGlobalScope': The source width provided is 0.. [Worker] TypeError: Failed to execute 'createImageBitmap' on 'WorkerGlobalScope': No function was found that matched the signature provided.
PASS [Worker] Rejected as expected: invalid area
PASS [Worker] reason instanceof Error is true
[Worker] IndexSizeError: Failed to execute 'createImageBitmap' on 'WorkerGlobalScope': The source height provided is 0.
PASS [Worker] Rejected as expected: invalid area
PASS [Worker] reason instanceof Error is true
[Worker] IndexSizeError: Failed to execute 'createImageBitmap' on 'WorkerGlobalScope': The source width provided is 0.
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
......
...@@ -8,150 +8,130 @@ ...@@ -8,150 +8,130 @@
description("Ensure correct behavior of createImageBitmap for invalid inputs."); description("Ensure correct behavior of createImageBitmap for invalid inputs.");
window.jsTestIsAsync = true; window.jsTestIsAsync = true;
var TypeError = "TypeError: Failed to execute 'createImageBitmap' on 'Window': No function was found that matched the signature provided."; var reason;
var IndexSizeError = "IndexSizeError: Index or size was negative, or greater than the allowed value.";
function shouldBeRejected(promise, message) {
var image; return promise.then(function() {
var testBitmap; // an ImageBitmap that is uncropped. We use this to test createImageBitmap(testBitmap) testFailed('Resolved unexpectedly: ' + message);
var d; // image.imageData }, function(e) {
var blob; reason = e;
var invalidBlob; testPassed('Rejected as expected: ' + message);
var invalidBlobTestPassed = false; shouldBeTrue('reason instanceof Error');
var invalidCanvasTestPassed = false; debug(e);
});
// Draw to an auxillary canvas.
var aCanvas = document.createElement("canvas");
aCanvas.setAttribute("width", "200");
aCanvas.setAttribute("height", "200");
var aCtx = aCanvas.getContext("2d");
// Create a terapixel canvas to generate an invalid canvas through allocation failure
var invalidCanvas = document.createElement("canvas");
invalidCanvas.setAttribute("width", "1000000");
invalidCanvas.setAttribute("height", "1000000");
image = new Image();
image.onload = imageLoaded;
// Before image loads
shouldThrow("createImageBitmap(image)");
image.src = aCanvas.toDataURL();
video = document.createElement("video");
video.addEventListener("canplaythrough", videoLoaded, false);
// Before video loads
shouldThrow("createImageBitmap(video)");
video.src = "../../compositing/resources/video.ogv";
var imageLoaded = false;
var videoLoaded = false;
var imageBitmapLoaded = false;
var blobLoaded = false;
var invalidBlobLoaded = false;
function imageLoaded() {
createImageBitmap(image).then(imageBitmapLoadedCallback, function() {
testFailed("Promise was rejected.");
finishJSTest();
});
d = aCtx.getImageData(0, 0, 200, 200);
imageLoaded = true;
loaded();
} }
function videoLoaded() { function checkInvalidRange(source, message) {
videoLoaded = true; return Promise.resolve().then(function() {
loaded(); return shouldBeRejected(createImageBitmap(source, 0, 0, 10, 0), message + ' / invalid range');
}).then(function() {
return shouldBeRejected(createImageBitmap(source, 0, 0, 0, 10), message + ' / invalid range');
});
} }
function imageBitmapLoadedCallback(imageBitmap) { function createCanvas() {
testBitmap = imageBitmap; return new Promise(function(resolve, reject) {
imageBitmapLoaded = true; var canvas = document.createElement('canvas');
loaded(); canvas.setAttribute('width', '200');
canvas.setAttribute('height', '200');
resolve(canvas);
});
} }
var xhr = new XMLHttpRequest(); function createInvalidCanvas() {
xhr.open("GET", 'resources/pattern.png'); // Create a terapixel canvas to generate an invalid canvas through
xhr.responseType = 'blob'; // allocation failure
xhr.send(); return new Promise(function(resolve, reject) {
xhr.onload = function() { var canvas = document.createElement('canvas');
blob = xhr.response; canvas.setAttribute('width', '100000000');
blobLoaded = true; canvas.setAttribute('height', '100000000');
loaded(); resolve(canvas);
});
} }
var xhr2 = new XMLHttpRequest(); function createVideo() {
xhr2.open("GET", 'resources/shadow-offset.js'); return new Promise(function(resolve, reject) {
xhr2.responseType = 'blob'; var video = document.createElement('video');
xhr2.send(); video.addEventListener('canplaythrough', resolve.bind(undefined, video), false);
xhr2.onload = function() { video.src = '../../compositing/resources/video.ogv';
invalidBlob = xhr2.response; });
invalidBlobLoaded = true;
loaded();
} }
var finishIfDoneCallsRemaining = 2; function createImage() {
function finishIfDone() { return createCanvas().then(function(canvas) {
finishIfDoneCallsRemaining--; var image = new Image();
if (!finishIfDoneCallsRemaining) { var promise = new Promise(function(resolve, reject) {
// Because promise fulfillment is asynchonous, pass/fail messages image.onload = resolve.bind(undefined, image);
// must be handled here to ensure a deterministic message order. });
if (invalidBlobTestPassed) { image.src = canvas.toDataURL();
testPassed("createImageBitmap(invalidBlob) was rejected."); return promise;
} else { });
testFailed("Invalid blob fulfilled.");
}
if (invalidCanvasTestPassed) {
testPassed("createImageBitmap(invalidCanvas) was rejected.");
} else {
testFailed("Invalid canvas fulfilled.");
}
finishJSTest();
}
} }
function loaded() { function createBlob(url) {
if (imageLoaded && videoLoaded && imageBitmapLoaded && blobLoaded && invalidBlobLoaded) { return new Promise(function(resolve, reject) {
shouldThrow("createImageBitmap(undefined)", "TypeError"); var xhr = new XMLHttpRequest();
shouldThrow("createImageBitmap(null)", "TypeError"); xhr.open('GET', url);
xhr.responseType = 'blob';
shouldThrow("createImageBitmap(image, 0, 0, 10, 0)"); xhr.onload = function() {
shouldThrow("createImageBitmap(image, 0, 0, 0, 10)"); resolve(xhr.response);
};
shouldThrow("createImageBitmap(video, 0, 0, 10, 0)"); xhr.onerror = reject;
shouldThrow("createImageBitmap(video, 0, 0, 0, 10)"); xhr.send();
});
shouldThrow("createImageBitmap(aCanvas, 0, 0, 10, 0)"); }
shouldThrow("createImageBitmap(aCanvas, 0, 0, 0, 10)");
shouldThrow("createImageBitmap(d, 0, 0, 10, 0)");
shouldThrow("createImageBitmap(d, 0, 0, 0, 10)");
shouldThrow("createImageBitmap(aCtx, 0, 0, 10, 0)");
shouldThrow("createImageBitmap(aCtx, 0, 0, 0, 10)");
shouldThrow("createImageBitmap(testBitmap, 0, 0, 10, 0)");
shouldThrow("createImageBitmap(testBitmap, 0, 0, 0, 10)");
shouldThrow("createImageBitmap(blob, 0, 0, 10, 0)");
shouldThrow("createImageBitmap(blob, 0, 0, 0, 10)");
createImageBitmap(invalidBlob).then(function() { Promise.resolve().then(function() {
finishIfDone(); return shouldBeRejected(createImageBitmap(undefined), 'undefined');
}, function() { }).then(function() {
invalidBlobTestPassed = true; return shouldBeRejected(createImageBitmap(null), 'null');
finishIfDone(); }).then(function() {
}); return shouldBeRejected(createImageBitmap(new Image), 'empty image');
}).then(function() {
return shouldBeRejected(createImageBitmap(document.createElement('video')), 'empty video');
}).then(function() {
return createImage().then(function(image) {
return checkInvalidRange(image, 'image');
});
}).then(function() {
return createVideo().then(function(video) {
return checkInvalidRange(video, 'video');
});
}).then(function() {
return createCanvas().then(function(canvas) {
return checkInvalidRange(canvas, 'canvas');
});
}).then(function() {
return createCanvas().then(function(canvas) {
return checkInvalidRange(canvas.getContext('2d'), 'canvas context');
});
}).then(function() {
return createCanvas().then(function(canvas) {
var imagedata = canvas.getContext('2d').getImageData(0, 0, canvas.width, canvas.height);
return checkInvalidRange(imagedata, 'canvas imagedata')
});
}).then(function() {
return createImage().then(function(image) {
return createImageBitmap(image);
}).then(function(bitmap) {
return checkInvalidRange(bitmap, 'image bitmap');
});
}).then(function() {
return createBlob('resources/pattern.png').then(function(blob) {
return checkInvalidRange(blob, 'blob');
});
}).then(function() {
return createBlob('resources/shadow-offset.js').then(function(blob) {
return shouldBeRejected(createImageBitmap(blob), 'invalid blob');
});
}).then(function() {
return createInvalidCanvas().then(function(invalidCanvas) {
return shouldBeRejected(createImageBitmap(invalidCanvas), 'invalid canvas');
});
}).catch(function(e) {
testFailed('Unexpected rejection: ' + e);
}).then(finishJSTest, finishJSTest);
createImageBitmap(invalidCanvas).then(function() {
finishIfDone();
}, function() {
invalidCanvasTestPassed = true;
finishIfDone();
});
}
}
</script> </script>
</body> </body>
</html> </html>
...@@ -4,12 +4,30 @@ self.jsTestIsAsync = true; ...@@ -4,12 +4,30 @@ self.jsTestIsAsync = true;
description('Test createImageBitmap with invalid arguments in workers.'); description('Test createImageBitmap with invalid arguments in workers.');
var reason;
function shouldBeRejected(promise, message) {
return promise.then(function() {
testFailed('Resolved unexpectedly: ' + message);
}, function(e) {
reason = e;
testPassed('Rejected as expected: ' + message);
shouldBeTrue('reason instanceof Error');
debug(String(e));
});
}
var data; var data;
self.addEventListener('message', function(e) { self.addEventListener('message', function(e) {
data = e.data; data = e.data;
shouldThrow("createImageBitmap(null, 0, 0, 10, 10)"); Promise.resolve().then(function() {
shouldThrow("createImageBitmap(data, 0, 0, 10, 0)"); return shouldBeRejected(createImageBitmap(null, 0, 0, 10, 10), 'null');
shouldThrow("createImageBitmap(data, 0, 0, 0, 10)"); }).then(function() {
finishJSTest(); return shouldBeRejected(createImageBitmap(data, 0, 0, 10, 0), 'invalid area');
}).then(function() {
return shouldBeRejected(createImageBitmap(data, 0, 0, 0, 10), 'invalid area');
}).catch(function(e) {
testFailed('Unexpected rejection: ' + e);
}).then(finishJSTest, finishJSTest);
}); });
...@@ -3,8 +3,12 @@ The image bitmap factories should throw exceptions on cross-origin access. ...@@ -3,8 +3,12 @@ The image bitmap factories should throw exceptions on cross-origin access.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS createImageBitmap(img, 0, 0, 10, 10) threw exception SecurityError: Failed to execute 'createImageBitmap' on 'Window': Cross-origin access to the source image is denied.. PASS Rejected as expected: image
PASS createImageBitmap(vid, 0, 0, 10, 10) threw exception SecurityError: Failed to execute 'createImageBitmap' on 'Window': Cross-origin access to the source video is denied.. PASS reason instanceof Error is true
SecurityError: Failed to execute 'createImageBitmap' on 'Window': Cross-origin access to the source image is denied.
PASS Rejected as expected: video
PASS reason instanceof Error is true
SecurityError: Failed to execute 'createImageBitmap' on 'Window': Cross-origin access to the source video is denied.
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
......
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<body> <body>
<script src="/js-test-resources/js-test.js"></script> <script src="/js-test-resources/js-test.js"></script>
<script> <script>
description("The image bitmap factories should throw exceptions on cross-origin access."); description("The image bitmap factories should throw exceptions on cross-origin access.");
window.jsTestIsAsync = true; window.jsTestIsAsync = true;
var reason;
var img = document.createElement('img'); function shouldBeRejected(promise, message) {
var vid = document.createElement('video'); return promise.then(function() {
testFailed('Resolved unexpectedly: ' + message);
}, function(e) {
reason = e;
testPassed('Rejected as expected: ' + message);
shouldBeTrue('reason instanceof Error');
debug(e);
});
}
document.body.appendChild(img); Promise.resolve().then(function() {
img.src = 'http://localhost:8080/security/resources/abe.png'; return new Promise(function(resolve, reject) {
img.addEventListener('load', function () { var image = document.createElement('img');
shouldThrow('createImageBitmap(img, 0, 0, 10, 10)', '"SecurityError: Failed to execute \'createImageBitmap\' on \'Window\': Cross-origin access to the source image is denied."'); image.addEventListener('load', resolve.bind(undefined, image));
image.src = 'http://localhost:8080/security/resources/abe.png';
vid.src = 'http://localhost:8080/media/resources/load-video.php?name=test.ogv&amp;type=video/ogv'; document.body.appendChild(image);
vid.addEventListener('playing', function () { }).then(function(image) {
shouldThrow('createImageBitmap(vid, 0, 0, 10, 10)', '"SecurityError: Failed to execute \'createImageBitmap\' on \'Window\': Cross-origin access to the source video is denied."'); return shouldBeRejected(createImageBitmap(image, 0, 0, 10, 10), 'image');
finishJSTest(); });
}); }).then(function() {
document.body.appendChild(vid); return new Promise(function(resolve, reject) {
vid.play(); var video = document.createElement('video');
}); video.src = 'http://localhost:8080/media/resources/load-video.php?name=test.ogv&amp;type=video/ogv';
</script> video.addEventListener('playing', resolve.bind(undefined, video));
document.body.appendChild(video);
video.play();
}).then(function(video) {
return shouldBeRejected(createImageBitmap(video, 0, 0, 10, 10), 'video');
});
}).catch(function(e) {
testFailed('Unexpected rejection: ' + e);
}).then(finishJSTest, finishJSTest);
</script>
</body> </body>
</html> </html>
...@@ -10,9 +10,9 @@ PASS quota is >= usage ...@@ -10,9 +10,9 @@ PASS quota is >= usage
PASS usage is >= 0 PASS usage is >= 0
PASS quota is >= usage PASS quota is >= usage
* Querying about unknown storage. * Querying about unknown storage.
PASS navigator.storageQuota.queryInfo('unknown') threw exception TypeError: Failed to execute 'queryInfo' on 'StorageQuota': parameter 1 ('unknown') is not a valid enum value.. PASS rejected as expected: TypeError: Failed to execute 'queryInfo' on 'StorageQuota': parameter 1 ('unknown') is not a valid enum value.
* Querying with missing storage type. * Querying with missing storage type.
PASS navigator.storageQuota.queryInfo() threw exception TypeError: Failed to execute 'queryInfo' on 'StorageQuota': 1 argument required, but only 0 present.. PASS rejected as expected: TypeError: Failed to execute 'queryInfo' on 'StorageQuota': 1 argument required, but only 0 present.
Finished running tests. Finished running tests.
PASS successfullyParsed is true PASS successfullyParsed is true
......
...@@ -46,14 +46,20 @@ function runQueryPersistentTest() { ...@@ -46,14 +46,20 @@ function runQueryPersistentTest() {
function runQueryUnknownTest() { function runQueryUnknownTest() {
debug("* Querying about unknown storage."); debug("* Querying about unknown storage.");
shouldThrow("navigator.storageQuota.queryInfo('unknown')"); navigator.storageQuota.queryInfo('unknown').then(function() {
runNextTest(); testFailed('resolved unexpectedly');
}, function(e) {
testPassed('rejected as expected: ' + e);
}).then(runNextTest);
} }
function runQueryWithMissingArgumentTest() { function runQueryWithMissingArgumentTest() {
debug("* Querying with missing storage type."); debug("* Querying with missing storage type.");
shouldThrow("navigator.storageQuota.queryInfo()"); navigator.storageQuota.queryInfo().then(function() {
runNextTest(); testFailed('resolved unexpectedly');
}, function(e) {
testPassed('rejected as expected: ' + e);
}).then(runNextTest);
} }
// End of test body functions --------------------------------------------- // End of test body functions ---------------------------------------------
......
...@@ -7,7 +7,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -7,7 +7,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS usage is >= 0 PASS usage is >= 0
PASS grantedQuota is non-zero. PASS grantedQuota is non-zero.
* Requesting persistent quota with missing argument. * Requesting persistent quota with missing argument.
PASS navigator.storageQuota.requestPersistentQuota() threw exception TypeError: Failed to execute 'requestPersistentQuota' on 'StorageQuota': 1 argument required, but only 0 present.. PASS rejected as expected: TypeError: Failed to execute 'requestPersistentQuota' on 'StorageQuota': 1 argument required, but only 0 present.
* Requesting persistent quota with negative value. * Requesting persistent quota with negative value.
PASS usage is >= 0 PASS usage is >= 0
PASS grantedQuota is 0 PASS grantedQuota is 0
......
...@@ -32,8 +32,11 @@ function runRequestQuotaTest() { ...@@ -32,8 +32,11 @@ function runRequestQuotaTest() {
function runRequestQuotaWithMisingArgumentTest() { function runRequestQuotaWithMisingArgumentTest() {
debug("* Requesting persistent quota with missing argument."); debug("* Requesting persistent quota with missing argument.");
shouldThrow("navigator.storageQuota.requestPersistentQuota()"); navigator.storageQuota.requestPersistentQuota().then(function() {
runNextTest(); testFailed('resolved unexpectedly');
}, function(e) {
testPassed('rejected as expected: ' + e);
}).then(runNextTest);
} }
function runRequestQuotaWithNegativeValueTest() { function runRequestQuotaWithNegativeValueTest() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment