Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/imagecapture/takephoto.html |
| diff --git a/third_party/WebKit/LayoutTests/imagecapture/takephoto.html b/third_party/WebKit/LayoutTests/imagecapture/takephoto.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..09f0e952a51ffae2258be344a06b7907b1cda3fc |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/imagecapture/takephoto.html |
| @@ -0,0 +1,40 @@ |
| +<!DOCTYPE html> |
| +<body> |
| +<canvas id='canvas' width=10 height=10/> |
| +</body> |
|
mlamouri (slow - plz ping)
2016/05/12 13:19:32
I would recommend having this after the scripts. I
mcasas
2016/05/12 16:32:01
Done.
|
| + |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="../resources/mojo-helpers.js"></script> |
| +<script src="resources/mock-imagecapture.js"></script> |
| +<script> |
| + |
| +// This test verifies that ImageCapture can takePhoto()s, with a mock Mojo |
| +// interface implementation. |
| + |
| +var test = async_test(function() { |
|
mlamouri (slow - plz ping)
2016/05/12 13:19:32
You don't need |test|, right?
You can do:
`async_
mcasas
2016/05/12 16:32:00
Done.
|
| + var canvas = document.getElementById('canvas'); |
| + var context = canvas.getContext("2d"); |
| + context.fillStyle = "red"; |
| + context.fillRect(0, 0, 10, 10); |
| + var stream = canvas.captureStream(); |
| + |
| + mockImageCaptureReady |
| + .then((mock) => { |
| + var capturer = new ImageCapture(stream.getVideoTracks()[0]); |
| + |
| + capturer.takePhoto() |
| + .then(blob => { |
| + assert_true(blob.size > 0); |
| + this.done(); |
|
mlamouri (slow - plz ping)
2016/05/12 13:19:32
I would recommend using `t`, this is how it is usu
mcasas
2016/05/12 16:32:00
Done.
|
| + }) |
| + .catch(error => { |
| + assert_unreached("Error during takePhoto(): " + error); |
| + }); |
| + }) |
| + .catch(error => { |
| + assert_unreached("Error creating MockImageCapture: " + error); |
| + }); |
| +}, 'exercises the ImageCapture API takePhoto()'); |
| + |
| +</script> |