Bug 1490689 [wpt PR 12967] - [Image Capture] Add exposureTime constraint., a=testonly

Automatic update from web-platform-tests[Image Capture] Add exposureTime constraint.

This CL adds exposureTime to ImageCapture API.
Spec discussion:
https://github.com/w3c/mediacapture-image/issues/199
This was added to the spec in
https://github.com/w3c/mediacapture-image/pull/200

Layout tests and mock tests are updated to support the same.
Support for Android is added.

TEST= run the demo in https://codepen.io/rijuB/pen/eKwLXB
use slider to change exposureTime.

BUG=823316

Intent to Implement and Ship discussions:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/ls3wQSoHOUY

Change-Id: Ic3a546d734c02df31cd8ca08ece01f006ae8d906
Reviewed-on: https://chromium-review.googlesource.com/1136439
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Miguel Casas <mcasas@chromium.org>
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Commit-Queue: Rijubrata Bhaumik <rijubrata.bhaumik@intel.com>
Cr-Commit-Position: refs/heads/master@{#591946}

--

wpt-commits: 397f3e38fe8d7383b303cb18a388b55a7ddf2e1b
wpt-pr: 12967
This commit is contained in:
Rijubrata Bhaumik 2018-09-19 12:55:14 +00:00 коммит произвёл moz-wptsync-bot
Родитель ca5924356d
Коммит 35ced2698f
10 изменённых файлов: 115 добавлений и 66 удалений

Просмотреть файл

@ -620597,7 +620597,7 @@
"testharness"
],
"mediacapture-image/ImageCapture-MediaTrackSupportedConstraints.html": [
"59a54f51d600fa5c8ee1c092afa5a07f6ae2ae3f",
"9ec5261b9dc48ea143c60946d72233a9eb5d7261",
"testharness"
],
"mediacapture-image/ImageCapture-creation.https.html": [
@ -620621,15 +620621,15 @@
"testharness"
],
"mediacapture-image/MediaStreamTrack-applyConstraints-getSettings.html": [
"1a1b58e5415f9e04ddeb8d1874448c3b98af35e3",
"4900336549f4a92f449233d24abf97f84f055102",
"testharness"
],
"mediacapture-image/MediaStreamTrack-applyConstraints-reject.html": [
"8f08d250fd1a569d84ecd4ce36fe5ffa29f583f7",
"21719636ea870f0cfe8e3b8c8a0c838512c1eb87",
"testharness"
],
"mediacapture-image/MediaStreamTrack-applyConstraints.html": [
"8dcff926173266c9e5f14c37ff408832a8a07d7e",
"c87f954c682cb6869040ebc67f6245902cec1267",
"testharness"
],
"mediacapture-image/MediaStreamTrack-getCapabilities-fast.html": [
@ -620637,11 +620637,11 @@
"testharness"
],
"mediacapture-image/MediaStreamTrack-getCapabilities.html": [
"eceaf5b1a8665211e42094730619d38143782fdc",
"9e34f2389cc4e446767df2aa4991cb43b8c95c7a",
"testharness"
],
"mediacapture-image/MediaStreamTrack-getConstraints-fast.html": [
"5a5ce5f2dad58cb47e8b4215bc563e24b34b3119",
"16f869cf119faa7eaa043ff6d65fa31b2998315b",
"testharness"
],
"mediacapture-image/MediaStreamTrack-getSettings-fast.html": [
@ -620649,7 +620649,7 @@
"testharness"
],
"mediacapture-image/MediaStreamTrack-getSettings.html": [
"5e9256eeb740663675ea93d692481556efd97628",
"8535f298bfab2ebca9dd3b37a0cc4f8538623203",
"testharness"
],
"mediacapture-image/detached-HTMLCanvasElement.html": [
@ -640769,11 +640769,11 @@
"support"
],
"resources/chromium/image_capture.mojom.js": [
"11123feb87d06d53f8e933aa18fad118ae6c8737",
"bf8dd16ca75d4be1095808138d09a9c400159b86",
"support"
],
"resources/chromium/mock-imagecapture.js": [
"878f59eb0095b65cabffe95c5538bcb79fa97b0d",
"329cbc3a761dc5720b7a67ed09ef68aec6a8bc3d",
"support"
],
"resources/chromium/mojo_bindings.js": [

Просмотреть файл

@ -12,6 +12,7 @@ test(function() {
assert_true(supported_constraints.focusMode);
assert_true(supported_constraints.pointsOfInterest);
assert_true(supported_constraints.exposureCompensation);
assert_true(supported_constraints.exposureTime);
assert_true(supported_constraints.colorTemperature);
assert_true(supported_constraints.iso);
assert_true(supported_constraints.brightness);

Просмотреть файл

@ -17,13 +17,15 @@ image_capture_test(async t => {
context.fillRect(0, 0, 10, 10);
const constraints = { advanced : [{ whiteBalanceMode : 'single-shot',
exposureMode : 'continuous',
exposureMode : 'manual',
focusMode : 'single-shot',
pointsOfInterest : [{x : 0.1, y : 0.2},
{x : 0.3, y : 0.4}],
exposureCompensation : 133.77,
// in nano-seconds.
exposureTime : 10000,
colorTemperature : 6000,
iso : 120.0,
@ -70,6 +72,8 @@ image_capture_test(async t => {
assert_equals(constraints.advanced[0].exposureCompensation,
settings.exposureCompensation, 'exposureCompensation');
assert_equals(constraints.advanced[0].exposureTime,
settings.exposureTime, 'exposureTime');
assert_equals(constraints.advanced[0].colorTemperature,
settings.colorTemperature, 'colorTemperature');
assert_equals(constraints.advanced[0].iso, settings.iso, 'iso');

Просмотреть файл

@ -43,7 +43,7 @@ var makePromiseTest = function(getConstraint) {
const constraintGenerators = [
capabilities => ({ whiteBalanceMode: 'manual' }),
capabilities => ({ exposureMode: 'manual' }),
capabilities => ({ exposureMode: 'none' }),
capabilities => ({ focusMode: 'continuous' }),
capabilities => ({
exposureCompensation: capabilities.exposureCompensation.max + 1

Просмотреть файл

@ -19,13 +19,14 @@ image_capture_test(async (t, imageCaptureTest) => {
context.fillRect(0, 0, 10, 10);
const constraints = { advanced : [{ whiteBalanceMode : 'single-shot',
exposureMode : 'continuous',
exposureMode : 'manual',
focusMode : 'single-shot',
pointsOfInterest : [{x : 0.1, y : 0.2},
{x : 0.3, y : 0.4}],
exposureCompensation : 133.77,
exposureTime : 10000,
colorTemperature : 6000,
iso : 120.0,
@ -90,6 +91,9 @@ image_capture_test(async (t, imageCaptureTest) => {
assert_equals(constraintsDict.exposureCompensation,
theMock.options().exposureCompensation,
'exposureCompensation');
assert_equals(constraintsDict.exposureTime,
theMock.options().exposureTime,
'exposureTime');
assert_equals(constraintsDict.colorTemperature,
theMock.options().colorTemperature, 'colorTemperature');
assert_equals(constraintsDict.iso, theMock.options().iso, 'iso');

Просмотреть файл

@ -78,6 +78,15 @@ image_capture_test(async (t, imageCaptureTest) => {
assert_equals(capabilities.exposureCompensation.step,
mockCapabilities.exposureCompensation.step);
assert_true(capabilities.exposureTime instanceof
MediaSettingsRange);
assert_equals(capabilities.exposureTime.max,
mockCapabilities.exposureTime.max);
assert_equals(capabilities.exposureTime.min,
mockCapabilities.exposureTime.min);
assert_equals(capabilities.exposureTime.step,
mockCapabilities.exposureTime.step);
assert_true(capabilities.colorTemperature instanceof
MediaSettingsRange);
assert_equals(capabilities.colorTemperature.max,

Просмотреть файл

@ -7,10 +7,11 @@
<script>
const constraints = { whiteBalanceMode : "manual",
exposureMode : "continuous",
exposureMode : "manual",
focusMode : "single-shot",
exposureCompensation : 133.77,
exposureTime : 10000, // in nano-seconds.
colorTemperature : 6000,
iso : 120.0,

Просмотреть файл

@ -49,6 +49,8 @@ image_capture_test(async (t, imageCaptureTest) => {
assert_equals(settings.exposureCompensation,
mockSettings.exposureCompensation.current);
assert_equals(settings.exposureTime,
mockSettings.exposureTime.current);
assert_equals(settings.colorTemperature,
mockSettings.colorTemperature.current);
assert_equals(settings.iso, mockSettings.iso.current);

Просмотреть файл

@ -167,6 +167,7 @@
this.torch = false;
this.pointsOfInterest = null;
this.exposureCompensation = null;
this.exposureTime = null;
this.colorTemperature = null;
this.iso = null;
this.brightness = null;
@ -194,7 +195,7 @@
return err;
var kVersionSizes = [
{version: 0, numBytes: 160}
{version: 0, numBytes: 168}
];
err = messageValidator.validateStructVersion(offset, kVersionSizes);
if (err !== validator.validationError.NONE)
@ -249,83 +250,89 @@
return err;
// validate PhotoState.colorTemperature
// validate PhotoState.exposureTime
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 56, Range, false);
if (err !== validator.validationError.NONE)
return err;
// validate PhotoState.iso
// validate PhotoState.colorTemperature
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 64, Range, false);
if (err !== validator.validationError.NONE)
return err;
// validate PhotoState.brightness
// validate PhotoState.iso
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 72, Range, false);
if (err !== validator.validationError.NONE)
return err;
// validate PhotoState.contrast
// validate PhotoState.brightness
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 80, Range, false);
if (err !== validator.validationError.NONE)
return err;
// validate PhotoState.saturation
// validate PhotoState.contrast
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 88, Range, false);
if (err !== validator.validationError.NONE)
return err;
// validate PhotoState.sharpness
// validate PhotoState.saturation
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 96, Range, false);
if (err !== validator.validationError.NONE)
return err;
// validate PhotoState.focusDistance
// validate PhotoState.sharpness
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 104, Range, false);
if (err !== validator.validationError.NONE)
return err;
// validate PhotoState.zoom
// validate PhotoState.focusDistance
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 112, Range, false);
if (err !== validator.validationError.NONE)
return err;
// validate PhotoState.zoom
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 120, Range, false);
if (err !== validator.validationError.NONE)
return err;
// validate PhotoState.redEyeReduction
err = messageValidator.validateEnum(offset + codec.kStructHeaderSize + 120, RedEyeReduction);
err = messageValidator.validateEnum(offset + codec.kStructHeaderSize + 128, RedEyeReduction);
if (err !== validator.validationError.NONE)
return err;
// validate PhotoState.height
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 128, Range, false);
if (err !== validator.validationError.NONE)
return err;
// validate PhotoState.width
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 136, Range, false);
if (err !== validator.validationError.NONE)
return err;
// validate PhotoState.width
err = messageValidator.validateStructPointer(offset + codec.kStructHeaderSize + 144, Range, false);
if (err !== validator.validationError.NONE)
return err;
// validate PhotoState.fillLightMode
err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 144, 4, new codec.Enum(FillLightMode), false, [0], 0);
err = messageValidator.validateArrayPointer(offset + codec.kStructHeaderSize + 152, 4, new codec.Enum(FillLightMode), false, [0], 0);
if (err !== validator.validationError.NONE)
return err;
return validator.validationError.NONE;
};
PhotoState.encodedSize = codec.kStructHeaderSize + 152;
PhotoState.encodedSize = codec.kStructHeaderSize + 160;
PhotoState.decode = function(decoder) {
var packed;
@ -346,6 +353,7 @@
decoder.skip(1);
val.pointsOfInterest = decoder.decodeArrayPointer(new codec.PointerTo(Point2D));
val.exposureCompensation = decoder.decodeStructPointer(Range);
val.exposureTime = decoder.decodeStructPointer(Range);
val.colorTemperature = decoder.decodeStructPointer(Range);
val.iso = decoder.decodeStructPointer(Range);
val.brightness = decoder.decodeStructPointer(Range);
@ -384,6 +392,7 @@
encoder.skip(1);
encoder.encodeArrayPointer(new codec.PointerTo(Point2D), val.pointsOfInterest);
encoder.encodeStructPointer(Range, val.exposureCompensation);
encoder.encodeStructPointer(Range, val.exposureTime);
encoder.encodeStructPointer(Range, val.colorTemperature);
encoder.encodeStructPointer(Range, val.iso);
encoder.encodeStructPointer(Range, val.brightness);
@ -466,6 +475,7 @@
this.hasExposureMode = false;
this.hasFocusMode = false;
this.hasExposureCompensation = false;
this.hasExposureTime = false;
this.hasColorTemperature = false;
this.hasIso = false;
this.hasBrightness = false;
@ -486,6 +496,7 @@
this.focusMode = 0;
this.pointsOfInterest = null;
this.exposureCompensation = 0;
this.exposureTime = 0;
this.colorTemperature = 0;
this.iso = 0;
this.brightness = 0;
@ -512,7 +523,7 @@
return err;
var kVersionSizes = [
{version: 0, numBytes: 128}
{version: 0, numBytes: 136}
];
err = messageValidator.validateStructVersion(offset, kVersionSizes);
if (err !== validator.validationError.NONE)
@ -564,11 +575,13 @@
// validate PhotoSettings.fillLightMode
err = messageValidator.validateEnum(offset + codec.kStructHeaderSize + 96, FillLightMode);
err = messageValidator.validateEnum(offset + codec.kStructHeaderSize + 104, FillLightMode);
if (err !== validator.validationError.NONE)
return err;
@ -581,7 +594,7 @@
return validator.validationError.NONE;
};
PhotoSettings.encodedSize = codec.kStructHeaderSize + 120;
PhotoSettings.encodedSize = codec.kStructHeaderSize + 128;
PhotoSettings.decode = function(decoder) {
var packed;
@ -593,29 +606,31 @@
val.hasExposureMode = (packed >> 1) & 1 ? true : false;
val.hasFocusMode = (packed >> 2) & 1 ? true : false;
val.hasExposureCompensation = (packed >> 3) & 1 ? true : false;
val.hasColorTemperature = (packed >> 4) & 1 ? true : false;
val.hasIso = (packed >> 5) & 1 ? true : false;
val.hasBrightness = (packed >> 6) & 1 ? true : false;
val.hasContrast = (packed >> 7) & 1 ? true : false;
val.hasExposureTime = (packed >> 4) & 1 ? true : false;
val.hasColorTemperature = (packed >> 5) & 1 ? true : false;
val.hasIso = (packed >> 6) & 1 ? true : false;
val.hasBrightness = (packed >> 7) & 1 ? true : false;
packed = decoder.readUint8();
val.hasSaturation = (packed >> 0) & 1 ? true : false;
val.hasSharpness = (packed >> 1) & 1 ? true : false;
val.hasFocusDistance = (packed >> 2) & 1 ? true : false;
val.hasZoom = (packed >> 3) & 1 ? true : false;
val.hasTorch = (packed >> 4) & 1 ? true : false;
val.torch = (packed >> 5) & 1 ? true : false;
val.hasFillLightMode = (packed >> 6) & 1 ? true : false;
val.hasWidth = (packed >> 7) & 1 ? true : false;
val.hasContrast = (packed >> 0) & 1 ? true : false;
val.hasSaturation = (packed >> 1) & 1 ? true : false;
val.hasSharpness = (packed >> 2) & 1 ? true : false;
val.hasFocusDistance = (packed >> 3) & 1 ? true : false;
val.hasZoom = (packed >> 4) & 1 ? true : false;
val.hasTorch = (packed >> 5) & 1 ? true : false;
val.torch = (packed >> 6) & 1 ? true : false;
val.hasFillLightMode = (packed >> 7) & 1 ? true : false;
packed = decoder.readUint8();
val.hasHeight = (packed >> 0) & 1 ? true : false;
val.hasRedEyeReduction = (packed >> 1) & 1 ? true : false;
val.redEyeReduction = (packed >> 2) & 1 ? true : false;
val.hasWidth = (packed >> 0) & 1 ? true : false;
val.hasHeight = (packed >> 1) & 1 ? true : false;
val.hasRedEyeReduction = (packed >> 2) & 1 ? true : false;
val.redEyeReduction = (packed >> 3) & 1 ? true : false;
decoder.skip(1);
val.whiteBalanceMode = decoder.decodeStruct(codec.Int32);
val.exposureMode = decoder.decodeStruct(codec.Int32);
val.focusMode = decoder.decodeStruct(codec.Int32);
val.pointsOfInterest = decoder.decodeArrayPointer(new codec.PointerTo(Point2D));
val.exposureCompensation = decoder.decodeStruct(codec.Double);
val.exposureTime = decoder.decodeStruct(codec.Double);
val.colorTemperature = decoder.decodeStruct(codec.Double);
val.iso = decoder.decodeStruct(codec.Double);
val.brightness = decoder.decodeStruct(codec.Double);
@ -643,25 +658,26 @@
packed |= (val.hasExposureMode & 1) << 1
packed |= (val.hasFocusMode & 1) << 2
packed |= (val.hasExposureCompensation & 1) << 3
packed |= (val.hasColorTemperature & 1) << 4
packed |= (val.hasIso & 1) << 5
packed |= (val.hasBrightness & 1) << 6
packed |= (val.hasContrast & 1) << 7
packed |= (val.hasExposureTime & 1) << 4
packed |= (val.hasColorTemperature & 1) << 5
packed |= (val.hasIso & 1) << 6
packed |= (val.hasBrightness & 1) << 7
encoder.writeUint8(packed);
packed = 0;
packed |= (val.hasSaturation & 1) << 0
packed |= (val.hasSharpness & 1) << 1
packed |= (val.hasFocusDistance & 1) << 2
packed |= (val.hasZoom & 1) << 3
packed |= (val.hasTorch & 1) << 4
packed |= (val.torch & 1) << 5
packed |= (val.hasFillLightMode & 1) << 6
packed |= (val.hasWidth & 1) << 7
packed |= (val.hasContrast & 1) << 0
packed |= (val.hasSaturation & 1) << 1
packed |= (val.hasSharpness & 1) << 2
packed |= (val.hasFocusDistance & 1) << 3
packed |= (val.hasZoom & 1) << 4
packed |= (val.hasTorch & 1) << 5
packed |= (val.torch & 1) << 6
packed |= (val.hasFillLightMode & 1) << 7
encoder.writeUint8(packed);
packed = 0;
packed |= (val.hasHeight & 1) << 0
packed |= (val.hasRedEyeReduction & 1) << 1
packed |= (val.redEyeReduction & 1) << 2
packed |= (val.hasWidth & 1) << 0
packed |= (val.hasHeight & 1) << 1
packed |= (val.hasRedEyeReduction & 1) << 2
packed |= (val.redEyeReduction & 1) << 3
encoder.writeUint8(packed);
encoder.skip(1);
encoder.encodeStruct(codec.Int32, val.whiteBalanceMode);
@ -669,6 +685,7 @@
encoder.encodeStruct(codec.Int32, val.focusMode);
encoder.encodeArrayPointer(new codec.PointerTo(Point2D), val.pointsOfInterest);
encoder.encodeStruct(codec.Double, val.exposureCompensation);
encoder.encodeStruct(codec.Double, val.exposureTime);
encoder.encodeStruct(codec.Double, val.colorTemperature);
encoder.encodeStruct(codec.Double, val.iso);
encoder.encodeStruct(codec.Double, val.brightness);

Просмотреть файл

@ -19,10 +19,11 @@ var ImageCaptureTest = (() => {
],
currentWhiteBalanceMode: media.mojom.MeteringMode.CONTINUOUS,
supportedExposureModes: [
media.mojom.MeteringMode.MANUAL,
media.mojom.MeteringMode.SINGLE_SHOT,
media.mojom.MeteringMode.CONTINUOUS
],
currentExposureMode: media.mojom.MeteringMode.SINGLE_SHOT,
currentExposureMode: media.mojom.MeteringMode.MANUAL,
supportedFocusModes: [
media.mojom.MeteringMode.MANUAL,
media.mojom.MeteringMode.SINGLE_SHOT
@ -39,6 +40,12 @@ var ImageCaptureTest = (() => {
current: 33.0,
step: 33.0
},
exposureTime: {
min: 100.0,
max: 100000.0,
current: 1000.0,
step: 100.0
},
colorTemperature: {
min: 2500.0,
max: 6500.0,
@ -152,6 +159,10 @@ var ImageCaptureTest = (() => {
this.state_.state.exposureCompensation.current =
settings.exposureCompensation;
}
if (settings.hasExposureTime) {
this.state_.state.exposureTime.current =
settings.exposureTime;
}
if (settings.hasWhiteBalanceMode) {
this.state_.state.currentWhiteBalanceMode =
settings.whiteBalanceMode;