Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-grabFrame.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-grabFrame.html b/third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-grabFrame.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b89c24f05a9dd63bcd5b4d14ea6dfd5c71e972c1 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-grabFrame.html |
| @@ -0,0 +1,30 @@ |
| +<!DOCTYPE html> |
| +<script src=../../resources/testharness.js></script> |
| +<script src=../../resources/testharnessreport.js></script> |
| +<body> |
| +<canvas id='canvas0' width=10 height=10/> |
| +</body> |
| +<script> |
| + |
| +// This test verifies that ImageCapture can grabFrame()s. |
| + |
| +var test = async_test(function() { |
| + var canvas = document.getElementById('canvas0'); |
| + // We need to paint something on the canvas to force it to create a context. |
|
Justin Novosad
2016/04/27 15:03:17
This comment smells like there is an underlying bu
mcasas
2016/04/27 17:48:18
What I meant is that canvas.captureStream() in
l.
|
| + canvas.getContext("2d").fillRect(0, 0, 1, 1); |
| + |
| + var stream = canvas.captureStream(); |
| + var capturer = new ImageCapture(stream.getVideoTracks()[0]); |
| + |
| + capturer.grabFrame() |
| + .then(bitmap => { |
| + assert_equals(document.getElementById('canvas0').width, bitmap.width); |
| + assert_equals(document.getElementById('canvas0').height, bitmap.height); |
|
Justin Novosad
2016/04/27 15:03:17
Test is incomplete. You should verify that the pix
mcasas
2016/04/27 17:48:18
Done.
|
| + this.done(); |
| + }) |
| + .catch(error => { |
| + assert_unreached('Error during grabFrame(): '+ error); |
| + }); |
| +}, 'exercises the ImageCapture API creation and grabFrame().'); |
| + |
| +</script> |