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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-applyConstraints.html

Issue 2804653003: Image Capture: make sure applyConstraints() only works for ImageCapture constraints (Closed)
Patch Set: LayoutTests Created 3 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-getConstraints.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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='canvas' width=10 height=10/> 5 <canvas id='canvas' width=10 height=10/>
6 </body> 6 </body>
7 <script> 7 <script>
8 8
9 // This test verifies that MediaStreamTrack.applyConstraints() exists and that, 9 // This test verifies that MediaStreamTrack.applyConstraints() exists and that,
10 // when called with no parameters, returns a Promise that is resolved. This 10 // when called with no parameters, returns a Promise that is resolved. This
11 // might not make sense: https://github.com/w3c/mediacapture-main/issues/438 . 11 // might not make sense: https://github.com/w3c/mediacapture-main/issues/438 .
12 // Other tests go deeper. 12 // Other tests go deeper.
13 promise_test(function(t) { 13 promise_test(function(t) {
14 var canvas = document.getElementById('canvas'); 14 var canvas = document.getElementById('canvas');
15 var context = canvas.getContext("2d"); 15 var context = canvas.getContext("2d");
16 context.fillStyle = "red"; 16 context.fillStyle = "red";
17 context.fillRect(0, 0, 10, 10); 17 context.fillRect(0, 0, 10, 10);
18 18
19 var stream = canvas.captureStream(); 19 var stream = canvas.captureStream();
20 assert_equals(stream.getAudioTracks().length, 0); 20 assert_equals(stream.getAudioTracks().length, 0);
21 assert_equals(stream.getVideoTracks().length, 1); 21 assert_equals(stream.getVideoTracks().length, 1);
22 22
23 var videoTrack = stream.getVideoTracks()[0]; 23 var videoTrack = stream.getVideoTracks()[0];
24 assert_equals(typeof videoTrack.applyConstraints, 'function'); 24 assert_equals(typeof videoTrack.applyConstraints, 'function');
25 25
26 return videoTrack.applyConstraints(); 26 return videoTrack.applyConstraints();
27 }, 'MediaStreamTrack.applyConstraints()'); 27 }, 'MediaStreamTrack.applyConstraints()');
28 28
29
30 // This test verifies that applyConstraints() rejects the returned Promise if
31 // passed a non-supported constraint.
32 // TODO(mcasas): remove entirely after https://crbug.com/338503.
33 promise_test(function(t) {
34 var canvas = document.getElementById('canvas');
35 var context = canvas.getContext("2d");
36 context.fillStyle = "red";
37 context.fillRect(0, 0, 10, 10);
38
39 var stream = canvas.captureStream();
40 var videoTrack = stream.getVideoTracks()[0];
41
42 var expectedException = new DOMException(
43 'Only Image-Capture constraints supported (https://crbug.com/338503)',
44 'NotSupportedError');
45
46 return promise_rejects(
47 t, expectedException,
48 videoTrack.applyConstraints({advanced : [ {width : 640} ]}));
49 }, 'MediaStreamTrack.applyConstraints() with non Image-Capture constraint');
50
29 </script> 51 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-getConstraints.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698