Bug 1069222 - testcase for ImageCapture on gonk. r=roc

This commit is contained in:
Alfredo Yang 2014-10-14 00:28:00 +02:00
Родитель 88e9509938
Коммит 9109fa8b69
1 изменённых файлов: 19 добавлений и 5 удалений

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

@ -38,6 +38,7 @@ function gcTest(track) {
imageCapture.takePhoto();
}
info("Call gc ");
SpecialPowers.gc();
});
}
@ -111,8 +112,20 @@ function trackTest(track) {
function init() {
return new Promise(function(resolve, reject) {
var constraints;
if (SpecialPowers.Services.appinfo.name == "B2G") {
info("B2G ImageCapture test");
// Reduce repeat count due to b2g emulator is very slow.
repeat = 20;
// Use gonk camera, MedieEngine will be the backend of ImageCapture.
constraints = {video: true};
} else {
// use fake camera, MediaStreamGraph will be the backend of ImageCapture.
constraints = {video: true, fake: true}
}
window.navigator.mozGetUserMedia(
{video: true, fake: true},
constraints,
function(stream) {
var track = stream.getVideoTracks()[0];
resolve(track);
@ -137,14 +150,15 @@ function start() {
}).then(function(track) {
info("ImageCapture multiple instances test.");
return gcTest(track);
}).then(function() {
SimpleTest.finish();
});
}).then(SimpleTest.finish);
}
SimpleTest.requestCompleteLog();
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.imagecapture.enabled", true]]}, start);
SpecialPowers.pushPrefEnv({"set": [["dom.imagecapture.enabled", true],
["media.navigator.permission.disabled", true]
]}, start);
</script>
</pre>
</body>