mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 13:43:44 +00:00
994061d746
- Bug 1196631 - Make JS::ubi::Node::size return 1 by default. r=sfink (9b34eb8a6b) - Bug 1191236 - Remove extract() methods used by operation forwarding on rooting types r=terrence (fb73375f55) - Bug 1191236 - Fix UCS canonicalization, r=jonco (fb5f57c838) - Bug 1196498 - Include objects' [[class]] names in heap snapshots; r=sfink (563e562e95) - Bug 1194418 - Use only JS::ubi::* interfaces in census analyses; r=sfink (a1374c3a49) - Bug 1194422 - Expose census traversals to SpiderMonkey embedders; r=sfink (7cd731fffc) - Bug 1139476 - Part 0: Add a takeCensus method to HeapSnapshot instances; r=sfink,bholley (6aac2ae0dd) - Bug 1139476 - Part 1: Port live heap census tests to offline heap snapshots; r=sfink (2cd8e13492) - Bug 1139476 - Part 2: Add test comparing live and offline census results; r=sfink (0db23ac1a0) - Bg 1198980 - Make JS::ubi::*::identifier be uint64_t instead of uintptr_t. r=sfink (902c041cb0) - Bug 1196634 - Part 0: Define a JS::ubi::CoarseType enum; r=sfink (4606fc2845) - Bug 1196634 - Part 1: Extend the protobuf format for coarseType; r=sfink (4110d46a2f) - Bug 1196634 - Part 2: Serialize and deserialize coarseType; r=sfink (530e023b48) - Bug 1196634 - Part 3: Use coarseType() instead of is<T> in census; r=sfink (d077980d77) - Bug 1196634 - Part 4: Remove JS::ubi::Node::getCanonicalTypeName; r=sfink (4bd7131e4b) - Bug 1202048 - Root JSONParser explicitly; r=sfink (41a9034849) - Bug 1175523 - Update most (but not all) tests to use elem.srcObject over .mozSrcObject. r=pehrsons (22a6502d6d) - Bug 1201190 - Part 3: Mark every consumer of GUARD_OBJECT as MOZ_RAII, r=ehsan (f6c6381a15) - Bug 1204594 - Use MOZ_RAII to replace GUARD_OBJECT where possible in the GC; r=sfink (cec9b7f607) - Bug 1205054 - Remove isNullLike and other imprecise null checks; r=sfink (c12a6ed1d4) - Bug 1205454 - Consolidate the tagged pointer marking methods; r=sfink (7e8a823712) - js: more shared-build fixes (fdd3b957)
204 lines
7.0 KiB
HTML
204 lines
7.0 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test for mozCameras.getCamera() using an initial configuration</title>
|
|
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
</head>
|
|
<body>
|
|
<video id="viewfinder" width="200" height="200" autoplay></video>
|
|
<img src="#" alt="This image is going to load" id="testimage"/>
|
|
<script class="testbody" type="text/javascript;version=1.7">
|
|
|
|
var whichCamera = navigator.mozCameras.getListOfCameras()[0];
|
|
var options = {
|
|
mode: 'picture',
|
|
recorderProfile: 'high',
|
|
previewSize: {
|
|
width: 320,
|
|
height: 240
|
|
}
|
|
};
|
|
|
|
var config = {
|
|
dateTime: Date.now() / 1000,
|
|
pictureSize: null,
|
|
fileFormat: 'jpeg',
|
|
rotation: 90
|
|
};
|
|
|
|
function onError(e) {
|
|
ok(false, "Error " + e);
|
|
}
|
|
|
|
var capabilities = [ 'previewSizes', 'pictureSizes', 'fileFormats', 'maxFocusAreas', 'minExposureCompensation',
|
|
'maxExposureCompensation', 'stepExposureCompensation', 'maxMeteringAreas', 'videoSizes',
|
|
'recorderProfiles'];
|
|
|
|
var Camera = {
|
|
cameraObj: null,
|
|
_recording: false,
|
|
_currentTest: null,
|
|
_autoFocusSupported: 0,
|
|
_manuallyFocused: false,
|
|
_flashmodes: null,
|
|
_pictureSizes: null,
|
|
_previewSizes: null,
|
|
_whiteBalanceModes: null,
|
|
_zoomRatios: null,
|
|
_sceneModes: null,
|
|
_focusModes: null,
|
|
_testsCompleted: 0,
|
|
_shutter: 0,
|
|
_config: {
|
|
dateTime: Date.now() / 1000,
|
|
pictureSize: null,
|
|
fileFormat: 'jpeg',
|
|
rotation: 90
|
|
},
|
|
_tests: null,
|
|
get viewfinder() {
|
|
return document.getElementById('viewfinder');
|
|
},
|
|
setFlashMode: function camera_setFlash(mode) {
|
|
this.cameraObj.flashMode = mode;
|
|
},
|
|
setFocus: function camera_setfocus(mode) {
|
|
this.cameraObj.focus = mode;
|
|
},
|
|
getFileFormats: function camera_formats() {
|
|
this._fileFormats = this.cameraObj.capabilities.fileFormats;
|
|
},
|
|
getFlashModes: function camera_getFlash() {
|
|
this._flashmodes = this.cameraObj.capabilities.flashModes;
|
|
},
|
|
getFocusModes: function camera_getFocus() {
|
|
this._focusModes = this.cameraObj.capabilities.focusModes;
|
|
},
|
|
getSceneModes: function camera_getScene() {
|
|
this._sceneModes = this.cameraObj.capabilities.sceneModes;
|
|
},
|
|
getZoomRatios: function camera_getZoom() {
|
|
this._zoomRatios = this.cameraObj.capabilities.zoomRatios;
|
|
},
|
|
getWhiteBalance: function camera_white() {
|
|
this._whitebalanceModes = this.cameraObj.capabilities.whiteBalanceModes;
|
|
},
|
|
getPictureSizes: function camera_sizes() {
|
|
this._pictureSizes = this.cameraObj.capabilities.pictureSizes;
|
|
},
|
|
getPreviewSizes: function camera_preview() {
|
|
this._previewSizes = this.cameraObj.capabilities.previewSizes;
|
|
},
|
|
takePictureSuccess: function taken_foto(blob) {
|
|
var img = new Image();
|
|
var test = this._currentTest;
|
|
img.onload = function Imgsize() {
|
|
ok(this.width == test.pictureSize.width, "The image taken has the width " +
|
|
this.width + " pictureSize width = " + test.pictureSize.width);
|
|
ok(this.height == test.pictureSize.height, "The image taken has the height " +
|
|
this.height + " picturesize height = " + test.pictureSize.height);
|
|
Camera._testsCompleted++;
|
|
if(Camera._testsCompleted == Camera._tests.length) {
|
|
ok(true, "test finishing");
|
|
SimpleTest.finish();
|
|
} else {
|
|
Camera.runTests();
|
|
}
|
|
}
|
|
ok(blob.size > 100 , "Blob Size Gathered = " + blob.size);
|
|
ok("image/" + test.fileFormat == blob.type, "Blob Type = " + blob.type);
|
|
img.src = window.URL.createObjectURL(blob);
|
|
},
|
|
shutter: function onShutter () {
|
|
Camera._shutter++;
|
|
|
|
ok(Camera._shutter == (Camera._testsCompleted + 1), "on Shutter has been called " +
|
|
Camera._shutter + " times");
|
|
|
|
},
|
|
onPreviewStateChange: function onPreviewStateChange(e) {
|
|
ok(true, "viewfinder state change " + e);
|
|
if (e.newState === 'started') {
|
|
ok(true, "viewfinder is ready and playing");
|
|
Camera.cameraObj.removeEventListener('previewstatechange', Camera.onPreviewStateChange);
|
|
Camera.onReady();
|
|
}
|
|
},
|
|
onReady: function onReady() {
|
|
var camcap = Camera.cameraObj.capabilities;
|
|
var tests = {};
|
|
for (var prop in capabilities) {
|
|
prop = capabilities[prop];
|
|
ok(camcap[prop] || isFinite(camcap[prop]) || camcap[prop] == null, "Camera Capability: " +
|
|
prop + " is exposed, value = " + JSON.stringify(camcap[prop]));
|
|
}
|
|
for (var prop in camcap) {
|
|
if(camcap[prop] && camcap[prop].length > 1) {
|
|
tests[prop] = camcap[prop];
|
|
}
|
|
}
|
|
Camera.getPictureSizes();
|
|
Camera.getPreviewSizes();
|
|
Camera.getFileFormats();
|
|
Camera.getFocusModes();
|
|
ok(Camera._previewSizes.length > 0, "previewSizes length = " + Camera._previewSizes.length);
|
|
ok(Camera._pictureSizes.length > 0, "picturesizes length = " + Camera._pictureSizes.length);
|
|
ok(Camera._fileFormats.length > 0, "file formats length = " + Camera._fileFormats.length);
|
|
Camera._tests = new Array();
|
|
for (var i in Camera._pictureSizes) {
|
|
for (var l in Camera._fileFormats) {
|
|
var config = {
|
|
pictureSize: Camera._pictureSizes[i],
|
|
fileFormat: Camera._fileFormats[l]
|
|
};
|
|
Camera._tests.push(config);
|
|
}
|
|
}
|
|
Camera.runTests();
|
|
},
|
|
runTests: function run_tests() {
|
|
var test = this._tests[this._testsCompleted];
|
|
this._currentTest = test;
|
|
Camera.setFlashMode(test.flashMode);
|
|
config.fileFormat = test.fileFormat;
|
|
config.pictureSize = test.pictureSize;
|
|
ok(true, "testing picture size " + JSON.stringify(config.pictureSize));
|
|
Camera.cameraObj.takePicture(config).then(this.takePictureSuccess.bind(this), onError);
|
|
},
|
|
setUp: function setup_tests() {
|
|
function onSuccess(d) {
|
|
var config = d.configuration;
|
|
ok(true, "Camera Control object has been successfully initialized");
|
|
ok(config.mode === options.mode, "configuration mode = " + config.mode);
|
|
ok(config.recorderProfile === options.recorderProfile, "recorder profile = " + config.recorderProfile);
|
|
ok(config.previewSize.width === options.previewSize.width &&
|
|
config.previewSize.height === options.previewSize.height,
|
|
"preview size (w x h) = " + config.previewSize.width + " x " + config.previewSize.height);
|
|
Camera.cameraObj = d.camera;
|
|
Camera.cameraObj.addEventListener('previewstatechange', Camera.onPreviewStateChange);
|
|
Camera.cameraObj.addEventListener('shutter', Camera.shutter);
|
|
Camera.viewfinder.srcObject = d.camera;
|
|
Camera.viewfinder.play();
|
|
SimpleTest.expectAssertions(0);
|
|
};
|
|
navigator.mozCameras.getCamera(whichCamera, options).then(onSuccess, onError);
|
|
}
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
window.addEventListener('beforeunload', function() {
|
|
Camera.viewfinder.srcObject = null;
|
|
Camera.cameraObj.release();
|
|
Camera.cameraObj = null;
|
|
});
|
|
|
|
Camera.setUp();
|
|
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|