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

Unified Diff: third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-getConstraints.html

Issue 2758063002: Image Capture: cache constraints and append them to MediaStreamTrack.getConstraints() (Closed)
Patch Set: guidou@ TODO()s 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/imagecapture/ImageCapture.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-getConstraints.html
diff --git a/third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-getConstraints.html b/third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-getConstraints.html
new file mode 100644
index 0000000000000000000000000000000000000000..c2b604a357d0227b2a65bf06821d2ea35d57f8e9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/imagecapture/MediaStreamTrack-getConstraints.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<script src=../../resources/testharness.js></script>
+<script src=../../resources/testharnessreport.js></script>
+<body>
+<canvas id='canvas' width=10 height=10/>
+</body>
+<script>
+
+const constraints = { whiteBalanceMode : "manual",
+ exposureMode : "continuous",
+ focusMode : "single-shot",
+
+ exposureCompensation : 133.77,
+ colorTemperature : 6000,
+ iso : 120.0,
+
+ brightness : 3,
+ contrast : 4,
+ saturation : 5,
+ sharpness : 6,
+
+ zoom : 3.141592
+ // TODO: torch https://crbug.com/700607.
+ };
+
+var canvas = document.getElementById('canvas');
+var context = canvas.getContext("2d");
+context.fillStyle = "red";
+context.fillRect(0, 0, 10, 10);
+
+// These tests verify that MediaStreamTrack.getConstraints() exists and that,
+// returns the constraints passed beforehand with applyConstraints.
+var makeAsyncTest = function(c) {
+ async_test(function(t) {
+ var stream = canvas.captureStream();
+ var videoTrack = stream.getVideoTracks()[0];
+
+ const constraintsIn = { advanced : [ c ]};
+
+ // Method applyConstraints() will fail since there is no Image Capture
+ // service in this Layout Test, but |constraintsIn| should be cached.
+ videoTrack.applyConstraints(constraintsIn)
+ .then(() => { /* ignore */ })
+ .catch((e) => { /* ignore */ })
+ .then(() => {
+ const constraintsOut = videoTrack.getConstraints();
+ assert_object_equals(constraintsOut, constraintsIn, "constraints");
+ t.done();
+ });
+
+ });
+};
+
+// Send each line of |constraints| in turn and then the whole dictionary.
+for (key in constraints) {
+ var one_constraint = {};
+ one_constraint[key] = constraints[key];
+ generate_tests(
+ makeAsyncTest,
+ [[ 'MediaStreamTrack.getConstraints(), key: ' + key, one_constraint ]]);
+}
+
+generate_tests(makeAsyncTest, [[
+ 'MediaStreamTrack.getConstraints(), complete ', constraints
+ ]]);
+
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/imagecapture/ImageCapture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698