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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/imagecapture/ImageCapture-takePhoto.html

Issue 1952463002: Media Stream Image Capture (4): wire takePhoto and implement in FakeVCDevice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tommi@ and mlamouri@ comments 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src=../../resources/testharness.js></script> 2 <script src=../../resources/testharness.js></script>
3 <script src=../../resources/testharnessreport.js></script> 3 <script src=../../resources/testharnessreport.js></script>
4 <body> 4 <body>
5 <canvas id='canvas0' width=10 height=10/> 5 <canvas id='canvas0' width=10 height=10/>
6 </body> 6 </body>
7 <script> 7 <script>
8 8
9 // This test verifies ImageCapture's takePhoto(). 9 // This test verifies ImageCapture's takePhoto().
10 10
11 var test = async_test(function() { 11 var test = async_test(function() {
12 var canvas0 = document.getElementById('canvas0'); 12 var canvas0 = document.getElementById('canvas0');
13 var context0 = canvas0.getContext("2d"); 13 var context0 = canvas0.getContext("2d");
14 context0.fillStyle = "red"; 14 context0.fillStyle = "red";
15 context0.fillRect(0, 0, 10, 10); 15 context0.fillRect(0, 0, 10, 10);
16 16
17 var stream = canvas0.captureStream(); 17 var stream = canvas0.captureStream();
18 18
19 var capturer = new ImageCapture(stream.getVideoTracks()[0]); 19 var capturer = new ImageCapture(stream.getVideoTracks()[0]);
20 20
21 capturer.takePhoto() 21 capturer.takePhoto()
22 .then(blob => { 22 .then(blob => {
23 assert_true(blob.type.length > 0); 23 assert_unreached('takePhoto() should not have been resolved');
24 assert_true(blob.size > 0);
25 this.done();
26 }) 24 })
27 .catch(error => { 25 .catch(error => {
28 assert_unreached('Error during takePhoto(): '+ error); 26 // LayoutTests do not have a real or a fake camera whatsoever, so content
27 // will not find a matching device for the Track's source id, and the
28 // promise will be rejected.
29 // TODO(mcasas): Revisit all this when https://crbug.com/610333 is solved.
30 this.done();
29 }); 31 });
30 }, 'exercises the ImageCapture API takePhoto().'); 32 }, 'exercises the ImageCapture API takePhoto().');
31 33
32 </script> 34 </script>
OLDNEW
« no previous file with comments | « media/capture/video/video_capture_device.cc ('k') | third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698