Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1426)

Unified Diff: third_party/WebKit/LayoutTests/imagecapture/takephoto.html

Issue 1966083003: ImageCapture: takePhoto() mock LayoutTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: offline reillyg@ comments on mock-imagecapture.js Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/imagecapture/resources/mock-imagecapture.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « third_party/WebKit/LayoutTests/imagecapture/resources/mock-imagecapture.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698