blob: 69f8dfedcea1e1c277748e18d9d222e1fa33d247 [file] [log] [blame]
<!DOCTYPE html>
<script src=../../resources/testharness.js></script>
<script src=../../resources/testharnessreport.js></script>
<script>
// This test verifies that captureStream() throws the right exceptions.
test(function() {
var canvas = document.createElement('canvas');
assert_throws("NotSupportedError", function() { canvas.captureStream(-0.5) },
"cannot have negative frame rate");
}, 'check captureStream() throws Exception with invalid frame rate');
function makeAsyncTest() {
return async_test(function(test) {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext("2d");
var image = document.createElement('img');
image.onerror = test.step_func(function() { assert_not_reached("image loading failed"); });
image.onload = test.step_func(function() {
var pattern = ctx.createPattern(image, 'repeat');
ctx.fillStyle = pattern;
ctx.fillRect(0, 0, 100, 100);
assert_throws("SecurityError", function() { canvas.captureStream() },
"cannot have cross origin");
test.done();
});
image.src = "resources/svg-with-image-with-foreignobject.svg";
}, 'check captureStream() throws Exception with cross origin content');
}
makeAsyncTest();
</script>