Backed out changeset f4f3b1e4a0e5 (bug 1020497) for b2g debug emulator mochitest-1 failures

This commit is contained in:
Wes Kocher 2014-06-06 15:17:55 -07:00
Родитель 2c2075ae2f
Коммит fa47ff339c
4 изменённых файлов: 30 добавлений и 20 удалений

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

@ -505,10 +505,17 @@ nsDOMCameraControl::GetFocusDistanceFar(ErrorResult& aRv)
}
void
nsDOMCameraControl::SetExposureCompensation(double aCompensation, ErrorResult& aRv)
nsDOMCameraControl::SetExposureCompensation(const Optional<double>& aCompensation, ErrorResult& aRv)
{
MOZ_ASSERT(mCameraControl);
aRv = mCameraControl->Set(CAMERA_PARAM_EXPOSURECOMPENSATION, aCompensation);
if (!aCompensation.WasPassed()) {
// use NaN to switch the camera back into auto mode
aRv = mCameraControl->Set(CAMERA_PARAM_EXPOSURECOMPENSATION, NAN);
return;
}
aRv = mCameraControl->Set(CAMERA_PARAM_EXPOSURECOMPENSATION, aCompensation.Value());
}
double

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

@ -76,7 +76,7 @@ public:
double GetFocusDistanceNear(ErrorResult& aRv);
double GetFocusDistanceOptimum(ErrorResult& aRv);
double GetFocusDistanceFar(ErrorResult& aRv);
void SetExposureCompensation(double aCompensation, ErrorResult& aRv);
void SetExposureCompensation(const dom::Optional<double>& aCompensation, ErrorResult& aRv);
double GetExposureCompensation(ErrorResult& aRv);
int32_t SensorAngle();
already_AddRefed<dom::CameraCapabilities> Capabilities();

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

@ -228,43 +228,43 @@ var tests = [
"exposureCompensation = " + cam.exposureCompensation);
// Check normal values
cam.exposureCompensation = 0.0;
cam.setExposureCompensation(0.0);
ok(cam.exposureCompensation == 0.0,
"exposureCompensation = " + cam.exposureCompensation);
cam.exposureCompensation = cap.minExposureCompensation;
cam.setExposureCompensation(cap.minExposureCompensation);
ok(cam.exposureCompensation == cap.minExposureCompensation,
"exposureCompensation(min) = " + cam.exposureCompensation);
cam.exposureCompensation = cap.maxExposureCompensation;
cam.setExposureCompensation(cap.maxExposureCompensation);
ok(cam.exposureCompensation == cap.maxExposureCompensation,
"exposureCompensation(max) = " + cam.exposureCompensation);
// Rounding
cam.exposureCompensation = 1.24;
cam.setExposureCompensation(1.24);
ok(cam.exposureCompensation == 1.0,
"exposureCompensation(1.24) = " + cam.exposureCompensation);
cam.exposureCompensation = 1.25;
cam.setExposureCompensation(1.25);
ok(cam.exposureCompensation == 1.5,
"exposureCompensation(1.25) = " + cam.exposureCompensation);
cam.exposureCompensation = -1.24;
cam.setExposureCompensation(-1.24);
ok(cam.exposureCompensation == -1.0,
"exposureCompensation(-1.24) = " + cam.exposureCompensation);
cam.exposureCompensation = -1.25;
cam.setExposureCompensation(-1.25);
ok(cam.exposureCompensation == -1.5,
"exposureCompensation(-1.25) = " + cam.exposureCompensation);
// Check out-of-bounds values
cam.exposureCompensation = cap.minExposureCompensation - 1.0;
cam.setExposureCompensation(cap.minExposureCompensation - 1.0);
ok(cam.exposureCompensation == cap.minExposureCompensation,
"exposureCompensation(min - 1.0) = " + cam.exposureCompensation);
cam.exposureCompensation = cap.maxExposureCompensation + 1.0;
cam.setExposureCompensation(cap.maxExposureCompensation + 1.0);
ok(cam.exposureCompensation == cap.maxExposureCompensation,
"exposureCompensation(max + 1.0) = " + cam.exposureCompensation);
// Check extreme values
cam.exposureCompensation = -1 * Math.pow(2, 32);
cam.setExposureCompensation(-1 * Math.pow(2, 32));
ok(cam.exposureCompensation == cap.minExposureCompensation,
"exposureCompensation(-2^32) = " + cam.exposureCompensation);
cam.exposureCompensation = Math.pow(2, 32);
cam.setExposureCompensation(Math.pow(2, 32));
ok(cam.exposureCompensation == cap.maxExposureCompensation,
"exposureCompensation(2^32) = " + cam.exposureCompensation);

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

@ -218,13 +218,16 @@ interface CameraControl : MediaStream
[Throws]
readonly attribute unrestricted double focusDistanceFar;
/* over- or under-expose the image; acceptable values must range from
minExposureCompensation to maxExposureCompensation in steps of
stepExposureCompensation. Invalid values will be rounded to the nearest
valid value; out-of-bounds values will be limited to the range
supported by the camera. */
/* 'compensation' is optional, and if missing, will
set the camera to use automatic exposure compensation.
acceptable values must range from minExposureCompensation
to maxExposureCompensation in steps of stepExposureCompensation;
invalid values will be rounded to the nearest valid value. */
[Throws]
attribute double exposureCompensation;
void setExposureCompensation(optional double compensation);
[Throws]
readonly attribute unrestricted double exposureCompensation;
/* one of the values chosen from capabilities.isoModes; default
value is "auto" if supported. */