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

Side by Side Diff: third_party/WebKit/LayoutTests/imagecapture/setoptions.html

Issue 2164473002: ImageCapture: wire PhotoCapabilities' ISO, width, height and PhotoSettings' width and height (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reillyg@ comment Created 4 years, 5 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 <script src="../resources/mojo-helpers.js"></script> 4 <script src="../resources/mojo-helpers.js"></script>
5 <script src="resources/mock-imagecapture.js"></script> 5 <script src="resources/mock-imagecapture.js"></script>
6 <body> 6 <body>
7 <canvas id='canvas' width=10 height=10/> 7 <canvas id='canvas' width=10 height=10/>
8 </body> 8 </body>
9 <script> 9 <script>
10 10
11 // This test verifies that ImageCapture can call setOptions()s, with a mock Mojo 11 // This test verifies that ImageCapture can call setOptions()s, with a mock Mojo
12 // interface implementation. 12 // interface implementation.
13 13
14 async_test(function(t) { 14 async_test(function(t) {
15 var canvas = document.getElementById('canvas'); 15 var canvas = document.getElementById('canvas');
16 var context = canvas.getContext("2d"); 16 var context = canvas.getContext("2d");
17 context.fillStyle = "red"; 17 context.fillStyle = "red";
18 context.fillRect(0, 0, 10, 10); 18 context.fillRect(0, 0, 10, 10);
19 var stream = canvas.captureStream(); 19 var stream = canvas.captureStream();
20 20
21 var theMock = null; 21 var theMock = null;
22 const optionsDict = { zoom : 7 }; 22 const optionsDict = { zoom : 7, imageWidth : 1080, imageHeight : 100 };
23 mockImageCaptureReady 23 mockImageCaptureReady
24 .then(mock => { 24 .then(mock => {
25 theMock = mock; 25 theMock = mock;
26 return new ImageCapture(stream.getVideoTracks()[0]); 26 return new ImageCapture(stream.getVideoTracks()[0]);
27 }) 27 })
28 .catch(error => { 28 .catch(error => {
29 assert_unreached("Error creating MockImageCapture: " + error); 29 assert_unreached("Error creating MockImageCapture: " + error);
30 }) 30 })
31 .then(capturer => { 31 .then(capturer => {
32 return capturer.setOptions(optionsDict); 32 return capturer.setOptions(optionsDict);
33 }) 33 })
34 .then(function() { 34 .then(function() {
35 assert_equals(1, theMock.options().has_zoom, 'has_zoom must be true'); 35 assert_equals(true, theMock.options().has_zoom, 'has_zoom must be true');
foolip 2016/07/22 01:42:34 assert_true instead?
mcasas 2016/07/22 02:00:04 Done.
36 assert_equals(optionsDict.zoom, theMock.options().zoom, 'zoom value'); 36 assert_equals(optionsDict.zoom, theMock.options().zoom, 'zoom value');
37 assert_equals(true, theMock.options().has_width, 'has_width must be true') ;
38 assert_equals(optionsDict.imageWidth, theMock.options().width, 'width valu e');
39 assert_equals(true, theMock.options().has_height, 'has_height must be true ');
40 assert_equals(optionsDict.imageHeight, theMock.options().height, 'height v alue');
37 t.done(); 41 t.done();
38 }) 42 })
39 .catch(error => { 43 .catch(error => {
40 assert_unreached("Error during setOptions(): " + error); 44 assert_unreached("Error during setOptions(): " + error);
41 }); 45 });
42 }, 'exercises the ImageCapture API setOptions()'); 46 }, 'exercises the ImageCapture API setOptions()');
43 47
44 </script> 48 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698