зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1141979 - part18 - mochitest - cases while calling mapDataInto should throw; r=jrmuizel
MozReview-Commit-ID: 3QUJy5E907G --HG-- extra : transplant_source : %F4%B37U%F6%BC%F8%16%10%A8%E2%DE%FD%E7%C7%96%1E%F7%5E%29
This commit is contained in:
Родитель
4eed785c7d
Коммит
b2731d7654
|
@ -41,6 +41,7 @@ function runTests() {
|
|||
then(testDraw()).
|
||||
then(testExceptions).
|
||||
then(testColorConversions()).
|
||||
then(function() { return testInvalidAccess([gVideo, gImage, gCanvas, gCtx, gImageData, gImageBitmap, gPNGBlob, gJPEGBlob]); } ).
|
||||
then(function() {window.parent.postMessage({"type": "finish"}, "*");}, function(ev) { failed(ev); window.parent.postMessage({"type": "finish"}, "*"); });
|
||||
}
|
||||
|
||||
|
|
|
@ -88,6 +88,32 @@ function testExceptions() {
|
|||
]);
|
||||
}
|
||||
|
||||
function testInvalidAccess(sources) {
|
||||
|
||||
function callMapDataIntoWithImageBitmapCroppedOutSideOfTheSourceImage(source) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var p = createImageBitmap(source, -1, -1, 2, 2);
|
||||
p.then(
|
||||
function(bitmap) {
|
||||
var format = bitmap.findOptimalFormat();
|
||||
var length = bitmap.mappedDataLength(format);
|
||||
var buffer = new ArrayBuffer(length);
|
||||
bitmap.mapDataInto(format, buffer, 0).then(
|
||||
function(layout) { resolve(); },
|
||||
function(error) { reject(error); }
|
||||
);
|
||||
},
|
||||
function() { resolve(); });
|
||||
});
|
||||
};
|
||||
|
||||
var testCases = sources.map( function(source) {
|
||||
return promiseThrows(callMapDataIntoWithImageBitmapCroppedOutSideOfTheSourceImage(source),
|
||||
"[Exception] mapDataInto() should throw with transparent black."); });
|
||||
|
||||
return Promise.all(testCases);
|
||||
}
|
||||
|
||||
function testColorConversions() {
|
||||
return Promise.all([// From RGBA32
|
||||
testColorConversion("RGBA32", "RGBA32"),
|
||||
|
|
|
@ -42,5 +42,6 @@ function runTests() {
|
|||
testCreateFromArrayBffer_randomTest("PNG", gPNGBlob, 0),
|
||||
testCreateFromArrayBffer_randomTest("JPEG", gJPEGBlob, 10) // JPEG loses information
|
||||
]); }).
|
||||
then(function() { return testInvalidAccess([gImageData, gImageBitmap, gPNGBlob, gJPEGBlob]); } ).
|
||||
then(function() {postMessage({"type": "finish"});}, function(ev) { failed(ev); postMessage({"type": "finish"}); });
|
||||
}
|
Загрузка…
Ссылка в новой задаче