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

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

Issue 2766473002: Image Capture: wire getSettings() from MediaStreamTrack (Closed)
Patch Set: reillyg@s comments Created 3 years, 9 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
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <script src="../resources/mojo-helpers.js"></script>
5 <script src="resources/mock-imagecapture.js"></script>
6 <body>
7 <canvas id='canvas' width=10 height=10/>
8 </body>
9 <script>
10
11 // This test verifies that the |constraints| configured in the mock Mojo
12 // service implementation, are returned by MediaStreamTrack.getSettings().
13
14 async_test(function(t) {
15 var canvas = document.getElementById('canvas');
16 var context = canvas.getContext("2d");
17 context.fillStyle = "red";
18 context.fillRect(0, 0, 10, 10);
19
20 const constraints = { advanced : [{ whiteBalanceMode : "manual",
21 exposureMode : "continuous",
22 focusMode : "single-shot",
23
24 exposureCompensation : 133.77,
25 colorTemperature : 6000,
26 iso : 120.0,
27
28 brightness : 3,
29 contrast : 4,
30 saturation : 5,
31 sharpness : 6,
32
33 zoom : 3.141592
34 // TODO: torch https://crbug.com/700607.
35 }]};
36 var theMock = null;
37 var videoTrack = null;
38 mockImageCaptureReady
39 .then(mock => {
40 theMock = mock;
41 },
42 error => {
43 assert_unreached("Error creating MockImageCapture: " + error);
44 })
45 .then(() => {
46 // |stream| must be created _after_ |mock| is constructed to give the
47 // latter time to override the bindings.
48 var stream = canvas.captureStream();
49 videoTrack = stream.getVideoTracks()[0];
50
51 return videoTrack.applyConstraints(constraints);
52 })
53 .then(function() {
54
55 settings = videoTrack.getSettings();
56 assert_equals(typeof settings, 'object');
57
58 assert_equals(constraints.advanced[0].whiteBalanceMode,
59 settings.whiteBalanceMode, 'whiteBalanceMode');
60 assert_equals(constraints.advanced[0].exposureMode, settings.exposureMode,
61 'exposureMode');
62 assert_equals(constraints.advanced[0].focusMode, settings.focusMode,
63 'focusMode');
64
65 assert_equals(constraints.advanced[0].exposureCompensation,
66 settings.exposureCompensation, 'exposure_compensation');
67 assert_equals(constraints.advanced[0].colorTemperature,
68 settings.colorTemperature, 'color_temperature');
69 assert_equals(constraints.advanced[0].iso, settings.iso, 'iso');
70
71 assert_equals(constraints.advanced[0].brightness, settings.brightness,
72 'brightness');
73 assert_equals(constraints.advanced[0].contrast, settings.contrast,
74 'contrast');
75 assert_equals(constraints.advanced[0].saturation, settings.saturation,
76 'saturation');
77 assert_equals(constraints.advanced[0].sharpness, settings.sharpness,
78 'sharpness');
79
80 assert_equals(constraints.advanced[0].zoom, settings.zoom, 'zoom');
81
82 // TODO(mcasas): check |torch| when the mojom interface is updated,
83 // https://crbug.com/700607.
84
85 t.done();
86 })
87 .catch(error => {
88 assert_unreached("Error applying constraints: " + error.message);
89 });
90
91 }, 'exercises an applyConstraints() - getSettings() cycle');
92
93 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698