1 importScripts('../../../resources/js-test.js');
3 self.jsTestIsAsync = true;
5 description('Test createImageBitmap with invalid arguments in workers.');
9 function shouldBeRejected(promise, message) {
10 return promise.then(function() {
11 testFailed('Resolved unexpectedly: ' + message);
14 testPassed('Rejected as expected: ' + message);
15 shouldBeTrue('reason instanceof Error');
22 self.addEventListener('message', function(e) {
24 Promise.resolve().then(function() {
25 return shouldBeRejected(createImageBitmap(null, 0, 0, 10, 10), 'null');
27 return shouldBeRejected(createImageBitmap(data, 0, 0, 10, 0), 'invalid area');
29 return shouldBeRejected(createImageBitmap(data, 0, 0, 0, 10), 'invalid area');
30 }).catch(function(e) {
31 testFailed('Unexpected rejection: ' + e);
32 }).then(finishJSTest, finishJSTest);