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

Side by Side Diff: third_party/WebKit/LayoutTests/imagecapture/MediaStreamTrack-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 const meteringModeNames = ["none", "manual", "single-shot", "continuous"];
12 const fillLightModeNames = ["none", "off", "auto", "flash", "torch"];
13
14 // This test verifies that the settings defined in the mock Mojo service
15 // implementation are the same as those returned by the corresponding
16 // MediaStreamTrack.getSettings().
17
18 async_test(function(t) {
19 var canvas = document.getElementById('canvas');
20 var context = canvas.getContext("2d");
21 context.fillStyle = "red";
22 context.fillRect(0, 0, 10, 10);
23
24 var mock_settings;
25 mockImageCaptureReady
26 .then(mock => {
27 mock_settings = mock.capabilities();
28
29 // |stream| must be created _after_ |mock| is constructed to give the
30 // latter time to override the bindings.
31 var stream = canvas.captureStream();
32 var videoTrack = stream.getVideoTracks()[0];
33
34 // |videoTrack|s settings retrieval, just like the actual capture, is a
35 // process kicked right after creation, we introduce a small delay to
36 // allow for those to be collected.
37 setTimeout(() => {
38 settings = videoTrack.getSettings();
39 assert_equals(typeof settings, 'object');
40
41 assert_equals(settings.whiteBalanceMode,
42 meteringModeNames[mock_settings.white_balance_mode],
43 'whiteBalanceMode');
44 assert_equals(settings.exposureMode,
45 meteringModeNames[mock_settings.exposure_mode], 'exposureMode;');
46 assert_equals(settings.focusMode,
47 meteringModeNames[mock_settings.focus_mode], 'focusMode');
48
49 assert_equals(settings.exposureCompensation,
50 mock_settings.exposure_compensation.current);
51 assert_equals(settings.colorTemperature,
52 mock_settings.color_temperature.current);
53 assert_equals(settings.iso, mock_settings.iso.current);
54
55 assert_equals(settings.brightness, mock_settings.brightness.current);
56 assert_equals(settings.contrast, mock_settings.contrast.current);
57 assert_equals(settings.saturation, mock_settings.saturation.current);
58 assert_equals(settings.sharpness, mock_settings.sharpness.current);
59
60 assert_equals(settings.zoom, mock_settings.zoom.current);
61
62 // TODO(mcasas): check |torch| when the mojom interface is updated,
63 // https://crbug.com/700607.
64
65 t.done();
66 }, 100);
67 },
68 error => {
69 assert_unreached("Error creating MockImageCapture: " + error);
70 });
71
72 }, 'exercises MediaStreamTrack.getSettings()');
73
74 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698