This commit is contained in:
Phil Ringnalda 2015-04-19 20:32:59 -07:00
Родитель c9aefca214 640567be24
Коммит ed766a314a
57 изменённых файлов: 1394 добавлений и 435 удалений

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="ef937d1aca7c4cf89ecb5cc43ae8c21c2000a9db"> <project name="platform_build" path="build" remote="b2g" revision="ef937d1aca7c4cf89ecb5cc43ae8c21c2000a9db">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6b04efa0f31a584e6ee0a46dd2b64c1e3c29adc"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="cb41d8421da5dc4f16ea566ea2917a9b7f828154"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

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

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/> <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c6b04efa0f31a584e6ee0a46dd2b64c1e3c29adc"/> <project name="gaia.git" path="gaia" remote="mozillaorg" revision="cb41d8421da5dc4f16ea566ea2917a9b7f828154"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="93f9ba577f68d772093987c2f1c0a4ae293e1802"/> <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="93f9ba577f68d772093987c2f1c0a4ae293e1802"/>

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

@ -17,7 +17,7 @@
</project> </project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6b04efa0f31a584e6ee0a46dd2b64c1e3c29adc"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="cb41d8421da5dc4f16ea566ea2917a9b7f828154"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="adb24954bf8068f21705b570450475d183336b2d"/> <project name="moztt" path="external/moztt" remote="b2g" revision="adb24954bf8068f21705b570450475d183336b2d"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c7d4045742862a7cf3f0074902ebc7d1b339b0ee"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="c7d4045742862a7cf3f0074902ebc7d1b339b0ee"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="ef937d1aca7c4cf89ecb5cc43ae8c21c2000a9db"> <project name="platform_build" path="build" remote="b2g" revision="ef937d1aca7c4cf89ecb5cc43ae8c21c2000a9db">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6b04efa0f31a584e6ee0a46dd2b64c1e3c29adc"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="cb41d8421da5dc4f16ea566ea2917a9b7f828154"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="6b0721ca0e92788df30daf8f7a5fb2863544f9c8"> <project name="platform_build" path="build" remote="b2g" revision="6b0721ca0e92788df30daf8f7a5fb2863544f9c8">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6b04efa0f31a584e6ee0a46dd2b64c1e3c29adc"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="cb41d8421da5dc4f16ea566ea2917a9b7f828154"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

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

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/> <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c6b04efa0f31a584e6ee0a46dd2b64c1e3c29adc"/> <project name="gaia.git" path="gaia" remote="mozillaorg" revision="cb41d8421da5dc4f16ea566ea2917a9b7f828154"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="93f9ba577f68d772093987c2f1c0a4ae293e1802"/> <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="93f9ba577f68d772093987c2f1c0a4ae293e1802"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="ef937d1aca7c4cf89ecb5cc43ae8c21c2000a9db"> <project name="platform_build" path="build" remote="b2g" revision="ef937d1aca7c4cf89ecb5cc43ae8c21c2000a9db">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6b04efa0f31a584e6ee0a46dd2b64c1e3c29adc"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="cb41d8421da5dc4f16ea566ea2917a9b7f828154"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

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

@ -17,7 +17,7 @@
</project> </project>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6b04efa0f31a584e6ee0a46dd2b64c1e3c29adc"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="cb41d8421da5dc4f16ea566ea2917a9b7f828154"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="adb24954bf8068f21705b570450475d183336b2d"/> <project name="moztt" path="external/moztt" remote="b2g" revision="adb24954bf8068f21705b570450475d183336b2d"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c7d4045742862a7cf3f0074902ebc7d1b339b0ee"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="c7d4045742862a7cf3f0074902ebc7d1b339b0ee"/>

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

@ -1,9 +1,9 @@
{ {
"git": { "git": {
"git_revision": "c6b04efa0f31a584e6ee0a46dd2b64c1e3c29adc", "git_revision": "cb41d8421da5dc4f16ea566ea2917a9b7f828154",
"remote": "https://git.mozilla.org/releases/gaia.git", "remote": "https://git.mozilla.org/releases/gaia.git",
"branch": "" "branch": ""
}, },
"revision": "31b41a3f708e732cbcf8fab8a51d1620ae1ebe82", "revision": "06ea3f1fb3f2706336c6b32d31663db0ec690cd9",
"repo_path": "integration/gaia-central" "repo_path": "integration/gaia-central"
} }

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

@ -17,7 +17,7 @@
</project> </project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6b04efa0f31a584e6ee0a46dd2b64c1e3c29adc"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="cb41d8421da5dc4f16ea566ea2917a9b7f828154"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="adb24954bf8068f21705b570450475d183336b2d"/> <project name="moztt" path="external/moztt" remote="b2g" revision="adb24954bf8068f21705b570450475d183336b2d"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="c7d4045742862a7cf3f0074902ebc7d1b339b0ee"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="c7d4045742862a7cf3f0074902ebc7d1b339b0ee"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="6b0721ca0e92788df30daf8f7a5fb2863544f9c8"> <project name="platform_build" path="build" remote="b2g" revision="6b0721ca0e92788df30daf8f7a5fb2863544f9c8">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c6b04efa0f31a584e6ee0a46dd2b64c1e3c29adc"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="cb41d8421da5dc4f16ea566ea2917a9b7f828154"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="f2f2f0cbee2f2517070dd194051d509c07cdacff"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

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

@ -4,6 +4,14 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
let gEMEHandler = { let gEMEHandler = {
get uiEnabled() {
let emeUIEnabled = Services.prefs.getBoolPref("browser.eme.ui.enabled");
// Force-disable on WinXP:
if (navigator.platform.toLowerCase().startsWith("win")) {
emeUIEnabled = emeUIEnabled && parseFloat(Services.sysinfo.get("version")) >= 6;
}
return emeUIEnabled;
},
ensureEMEEnabled: function(browser, keySystem) { ensureEMEEnabled: function(browser, keySystem) {
Services.prefs.setBoolPref("media.eme.enabled", true); Services.prefs.setBoolPref("media.eme.enabled", true);
if (keySystem) { if (keySystem) {
@ -45,7 +53,7 @@ let gEMEHandler = {
} }
let {status: status, keySystem: keySystem} = parsedData; let {status: status, keySystem: keySystem} = parsedData;
// Don't need to show if disabled // Don't need to show if disabled
if (!Services.prefs.getBoolPref("browser.eme.ui.enabled")) { if (!this.uiEnabled) {
return; return;
} }

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

@ -5,12 +5,6 @@
// the "exported" symbols // the "exported" symbols
let LoopUI; let LoopUI;
XPCOMUtils.defineLazyModuleGetter(this, "injectLoopAPI", "resource:///modules/loop/MozLoopAPI.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "LoopRooms", "resource:///modules/loop/LoopRooms.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "MozLoopService", "resource:///modules/loop/MozLoopService.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PanelFrame", "resource:///modules/PanelFrame.jsm");
(function() { (function() {
const kNSXUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; const kNSXUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const kBrowserSharingNotificationId = "loop-sharing-notification"; const kBrowserSharingNotificationId = "loop-sharing-notification";
@ -134,15 +128,16 @@ XPCOMUtils.defineLazyModuleGetter(this, "PanelFrame", "resource:///modules/Panel
return; return;
} }
iframe.addEventListener("DOMContentLoaded", function documentDOMLoaded() { let documentDOMLoaded = () => {
iframe.removeEventListener("DOMContentLoaded", documentDOMLoaded, true); iframe.removeEventListener("DOMContentLoaded", documentDOMLoaded, true);
injectLoopAPI(iframe.contentWindow); this.injectLoopAPI(iframe.contentWindow);
iframe.contentWindow.addEventListener("loopPanelInitialized", function loopPanelInitialized() { iframe.contentWindow.addEventListener("loopPanelInitialized", function loopPanelInitialized() {
iframe.contentWindow.removeEventListener("loopPanelInitialized", iframe.contentWindow.removeEventListener("loopPanelInitialized",
loopPanelInitialized); loopPanelInitialized);
showTab(); showTab();
}); });
}, true); };
iframe.addEventListener("DOMContentLoaded", documentDOMLoaded, true);
}; };
// Used to clear the temporary "login" state from the button. // Used to clear the temporary "login" state from the button.
@ -153,12 +148,12 @@ XPCOMUtils.defineLazyModuleGetter(this, "PanelFrame", "resource:///modules/Panel
// Assume the conversation with the visitor wasn't open since we would // Assume the conversation with the visitor wasn't open since we would
// have resumed the tour as soon as the visitor joined if it was (and // have resumed the tour as soon as the visitor joined if it was (and
// the pref would have been set to false already. // the pref would have been set to false already.
MozLoopService.resumeTour("waiting"); this.MozLoopService.resumeTour("waiting");
resolve(); resolve();
return; return;
} }
PanelFrame.showPopup(window, event ? event.target : this.toolbarButton.node, this.PanelFrame.showPopup(window, event ? event.target : this.toolbarButton.node,
"loop", null, "about:looppanel", null, callback); "loop", null, "about:looppanel", null, callback);
}); });
}); });
@ -179,7 +174,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PanelFrame", "resource:///modules/Panel
return false; return false;
} }
if (!LoopRooms.participantsCount) { if (!this.LoopRooms.participantsCount) {
// Nobody is in the rooms // Nobody is in the rooms
return false; return false;
} }
@ -198,7 +193,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PanelFrame", "resource:///modules/Panel
*/ */
roomsWithNonOwners: function() { roomsWithNonOwners: function() {
return new Promise(resolve => { return new Promise(resolve => {
LoopRooms.getAll((error, rooms) => { this.LoopRooms.getAll((error, rooms) => {
let roomsWithNonOwners = []; let roomsWithNonOwners = [];
for (let room of rooms) { for (let room of rooms) {
if (!("participants" in room)) { if (!("participants" in room)) {
@ -223,7 +218,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PanelFrame", "resource:///modules/Panel
// Add observer notifications before the service is initialized // Add observer notifications before the service is initialized
Services.obs.addObserver(this, "loop-status-changed", false); Services.obs.addObserver(this, "loop-status-changed", false);
MozLoopService.initialize(); this.MozLoopService.initialize();
this.updateToolbarState(); this.updateToolbarState();
}, },
@ -254,15 +249,15 @@ XPCOMUtils.defineLazyModuleGetter(this, "PanelFrame", "resource:///modules/Panel
return; return;
} }
let state = ""; let state = "";
if (MozLoopService.errors.size) { if (this.MozLoopService.errors.size) {
state = "error"; state = "error";
} else if (MozLoopService.screenShareActive) { } else if (this.MozLoopService.screenShareActive) {
state = "action"; state = "action";
} else if (aReason == "login" && MozLoopService.userProfile) { } else if (aReason == "login" && this.MozLoopService.userProfile) {
state = "active"; state = "active";
} else if (MozLoopService.doNotDisturb) { } else if (this.MozLoopService.doNotDisturb) {
state = "disabled"; state = "disabled";
} else if (MozLoopService.roomsParticipantsCount > 0) { } else if (this.MozLoopService.roomsParticipantsCount > 0) {
state = "active"; state = "active";
} }
this.toolbarButton.node.setAttribute("state", state); this.toolbarButton.node.setAttribute("state", state);
@ -285,7 +280,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PanelFrame", "resource:///modules/Panel
* Opens the panel by default. * Opens the panel by default.
*/ */
showNotification: function(options) { showNotification: function(options) {
if (MozLoopService.doNotDisturb) { if (this.MozLoopService.doNotDisturb) {
return; return;
} }
@ -336,7 +331,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PanelFrame", "resource:///modules/Panel
* @param {String} name Name of the sound, like 'ringtone' or 'room-joined' * @param {String} name Name of the sound, like 'ringtone' or 'room-joined'
*/ */
playSound: function(name) { playSound: function(name) {
if (this.ActiveSound || MozLoopService.doNotDisturb) { if (this.ActiveSound || this.MozLoopService.doNotDisturb) {
return; return;
} }
@ -401,7 +396,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PanelFrame", "resource:///modules/Panel
* @return {String} * @return {String}
*/ */
_getString: function(key) { _getString: function(key) {
let str = MozLoopService.getStrings(key); let str = this.MozLoopService.getStrings(key);
if (str) { if (str) {
str = JSON.parse(str).textContent; str = JSON.parse(str).textContent;
} }
@ -417,7 +412,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PanelFrame", "resource:///modules/Panel
this._hideBrowserSharingInfoBar(); this._hideBrowserSharingInfoBar();
// Don't show the infobar if it's been permanently disabled from the menu. // Don't show the infobar if it's been permanently disabled from the menu.
if (!MozLoopService.getLoopPref(kPrefBrowserSharingInfoBar)) { if (!this.MozLoopService.getLoopPref(kPrefBrowserSharingInfoBar)) {
return; return;
} }
@ -473,7 +468,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PanelFrame", "resource:///modules/Panel
} }
if (permanently) { if (permanently) {
MozLoopService.setLoopPref(kPrefBrowserSharingInfoBar, false); this.MozLoopService.setLoopPref(kPrefBrowserSharingInfoBar, false);
} }
return removed; return removed;
@ -511,3 +506,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "PanelFrame", "resource:///modules/Panel
}, },
}; };
})(); })();
XPCOMUtils.defineLazyModuleGetter(LoopUI, "injectLoopAPI", "resource:///modules/loop/MozLoopAPI.jsm");
XPCOMUtils.defineLazyModuleGetter(LoopUI, "LoopRooms", "resource:///modules/loop/LoopRooms.jsm");
XPCOMUtils.defineLazyModuleGetter(LoopUI, "MozLoopService", "resource:///modules/loop/MozLoopService.jsm");
XPCOMUtils.defineLazyModuleGetter(LoopUI, "PanelFrame", "resource:///modules/PanelFrame.jsm");

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

@ -6,7 +6,7 @@
*/ */
"use strict"; "use strict";
const {injectLoopAPI} = Cu.import("resource:///modules/loop/MozLoopAPI.jsm"); const {injectLoopAPI} = Cu.import("resource:///modules/loop/MozLoopAPI.jsm", {});
gMozLoopAPI = injectLoopAPI({}); gMozLoopAPI = injectLoopAPI({});
let handlers = [ let handlers = [

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

@ -5,6 +5,7 @@ const HAWK_TOKEN_LENGTH = 64;
const { const {
LOOP_SESSION_TYPE, LOOP_SESSION_TYPE,
MozLoopServiceInternal, MozLoopServiceInternal,
MozLoopService,
} = Cu.import("resource:///modules/loop/MozLoopService.jsm", {}); } = Cu.import("resource:///modules/loop/MozLoopService.jsm", {});
const {LoopCalls} = Cu.import("resource:///modules/loop/LoopCalls.jsm", {}); const {LoopCalls} = Cu.import("resource:///modules/loop/LoopCalls.jsm", {});
const {LoopRooms} = Cu.import("resource:///modules/loop/LoopRooms.jsm", {}); const {LoopRooms} = Cu.import("resource:///modules/loop/LoopRooms.jsm", {});

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

@ -24,8 +24,12 @@ var gContentPane = {
let drmInfoURL = let drmInfoURL =
Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content"; Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content";
document.getElementById("playDRMContentLink").setAttribute("href", drmInfoURL); document.getElementById("playDRMContentLink").setAttribute("href", drmInfoURL);
document.getElementById("playDRMContentRow").hidden = let emeUIEnabled = Services.prefs.getBoolPref("browser.eme.ui.enabled");
!Services.prefs.getBoolPref("browser.eme.ui.enabled"); // Force-disable/hide on WinXP:
if (navigator.platform.toLowerCase().startsWith("win")) {
emeUIEnabled = emeUIEnabled && parseFloat(Services.sysinfo.get("version")) >= 6;
}
document.getElementById("playDRMContentRow").hidden = !emeUIEnabled;
}, },
// UTILITY FUNCTIONS // UTILITY FUNCTIONS

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

@ -44,7 +44,12 @@ var gContentPane = {
let drmInfoURL = let drmInfoURL =
Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content"; Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content";
document.getElementById("playDRMContentLink").setAttribute("href", drmInfoURL); document.getElementById("playDRMContentLink").setAttribute("href", drmInfoURL);
if (!Services.prefs.getBoolPref("browser.eme.ui.enabled")) { let emeUIEnabled = Services.prefs.getBoolPref("browser.eme.ui.enabled");
// Force-disable/hide on WinXP:
if (navigator.platform.toLowerCase().startsWith("win")) {
emeUIEnabled = emeUIEnabled && parseFloat(Services.sysinfo.get("version")) >= 6;
}
if (!emeUIEnabled) {
// Don't want to rely on .hidden for the toplevel groupbox because // Don't want to rely on .hidden for the toplevel groupbox because
// of the pane hiding/showing code potentially interfering: // of the pane hiding/showing code potentially interfering:
document.getElementById("drmGroup").setAttribute("style", "display: none !important"); document.getElementById("drmGroup").setAttribute("style", "display: none !important");

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

@ -14,7 +14,8 @@ let gElements;
function checkElements(expectedPane) { function checkElements(expectedPane) {
for (let element of gElements) { for (let element of gElements) {
// preferences elements fail is_element_visible checks because they are never visible. // preferences elements fail is_element_visible checks because they are never visible.
if (element.nodeName == "preferences") { // special-case the drmGroup item because its visibility depends on pref + OS version
if (element.nodeName == "preferences" || element.id === "drmGroup") {
continue; continue;
} }
let attributeValue = element.getAttribute("data-category"); let attributeValue = element.getAttribute("data-category");
@ -27,7 +28,6 @@ function checkElements(expectedPane) {
} }
function runTest(win) { function runTest(win) {
Services.prefs.setBoolPref("browser.eme.ui.enabled", true);
is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded"); is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded");
let tab = win.document; let tab = win.document;
@ -45,6 +45,5 @@ function runTest(win) {
gBrowser.removeCurrentTab(); gBrowser.removeCurrentTab();
win.close(); win.close();
Services.prefs.clearUserPref("browser.eme.ui.enabled");
finish(); finish();
} }

Двоичные данные
browser/themes/linux/Privacy-32.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Двоичные данные
browser/themes/linux/Privacy-48.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.3 KiB

Двоичные данные
browser/themes/linux/Privacy-64.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 4.7 KiB

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

@ -30,12 +30,16 @@
#back-button > .toolbarbutton-icon, #back-button > .toolbarbutton-icon,
#forward-button > .toolbarbutton-icon { #forward-button > .toolbarbutton-icon {
margin: 0; margin: 0;
border: none; border: 1px solid var(--chrome-nav-bar-controls-border-color);
padding: 2px 6px; padding: 2px 5px;
background: var(--chrome-nav-buttons-background); background: var(--chrome-nav-buttons-background);
box-shadow: none !important; box-shadow: none !important;
} }
#forward-button > .toolbarbutton-icon {
-moz-border-start: none;
}
/* Override a box shadow for disabled back button */ /* Override a box shadow for disabled back button */
#main-window:not([customizing]) #back-button[disabled] > .toolbarbutton-icon { #main-window:not([customizing]) #back-button[disabled] > .toolbarbutton-icon {
box-shadow: none !important; box-shadow: none !important;

Двоичные данные
browser/themes/osx/Privacy-32.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.1 KiB

Двоичные данные
browser/themes/osx/Privacy-48.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 4.0 KiB

Двоичные данные
browser/themes/osx/Privacy-64.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 6.0 KiB

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

@ -41,12 +41,21 @@
background / shadows for different states */ background / shadows for different states */
#back-button, #back-button,
#forward-button { #forward-button {
height: 22px !important; height: 24px !important;
box-shadow: none !important; box-shadow: none !important;
border: none !important; border: 1px solid var(--chrome-nav-bar-controls-border-color) !important;
background: var(--chrome-nav-buttons-background) !important; background: var(--chrome-nav-buttons-background) !important;
} }
#forward-button {
-moz-border-start: none !important;
}
#forward-button > .toolbarbutton-icon {
margin-left: 0;
margin-right: 0;
}
#back-button:hover:not([disabled="true"]), #back-button:hover:not([disabled="true"]),
#forward-button:hover:not([disabled="true"]) { #forward-button:hover:not([disabled="true"]) {
background: var(--chrome-nav-buttons-hover-background) !important; background: var(--chrome-nav-buttons-hover-background) !important;

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

@ -23,6 +23,7 @@
--chrome-nav-bar-separator-color: rgba(0,0,0,.2); --chrome-nav-bar-separator-color: rgba(0,0,0,.2);
--chrome-nav-buttons-background: #252C33; --chrome-nav-buttons-background: #252C33;
--chrome-nav-buttons-hover-background: #1B2127; --chrome-nav-buttons-hover-background: #1B2127;
--chrome-nav-bar-controls-border-color: #1D2328;
--chrome-selection-color: #fff; --chrome-selection-color: #fff;
--chrome-selection-background-color: #074D75; --chrome-selection-background-color: #074D75;
@ -80,11 +81,12 @@
--chrome-background-color: #E3E4E6; --chrome-background-color: #E3E4E6;
--chrome-color: #18191a; --chrome-color: #18191a;
--chrome-secondary-background-color: #f0f1f2; --chrome-secondary-background-color: #f5f6f7;
--chrome-navigator-toolbox-separator-color: #cccccc; --chrome-navigator-toolbox-separator-color: #cccccc;
--chrome-nav-bar-separator-color: #B6B6B8; --chrome-nav-bar-separator-color: #B6B6B8;
--chrome-nav-buttons-background: #f0f1f2; --chrome-nav-buttons-background: #fcfcfc;
--chrome-nav-buttons-hover-background: #DADBDB; --chrome-nav-buttons-hover-background: #DADBDB;
--chrome-nav-bar-controls-border-color: #ccc;
--chrome-selection-color: #f5f7fa; --chrome-selection-color: #f5f7fa;
--chrome-selection-background-color: #4c9ed9; --chrome-selection-background-color: #4c9ed9;
@ -100,13 +102,13 @@
/* Toolbar buttons */ /* Toolbar buttons */
--toolbarbutton-hover-background: #D7D7D8; --toolbarbutton-hover-background: #eaeaea;
--toolbarbutton-hover-boxshadow: none; --toolbarbutton-hover-boxshadow: none;
--toolbarbutton-hover-bordercolor: rgba(0,0,0,0.1); --toolbarbutton-hover-bordercolor: rgba(0,0,0,0.1);
--toolbarbutton-active-background: rgba(76,158,217,.5) linear-gradient(rgba(76,158,217,.5), rgba(76,158,217,.5)) border-box --toolbarbutton-active-background: #d7d7d8 border-box;
--toolbarbutton-active-boxshadow: none; --toolbarbutton-active-boxshadow: none;
--toolbarbutton-active-bordercolor: rgba(0,0,0,0.3); --toolbarbutton-active-bordercolor: rgba(0,0,0,0.15);
--toolbarbutton-checkedhover-backgroundcolor: rgba(0,0,0,0.2); --toolbarbutton-checkedhover-backgroundcolor: #d7d7d8;
--toolbarbutton-combined-boxshadow: none; --toolbarbutton-combined-boxshadow: none;
--toolbarbutton-combined-backgroundimage: linear-gradient(rgba(0,0,0,0.1) 0, rgba(0,0,0,0.1) 18px); --toolbarbutton-combined-backgroundimage: linear-gradient(rgba(0,0,0,0.1) 0, rgba(0,0,0,0.1) 18px);
@ -187,6 +189,11 @@
background-image: none; background-image: none;
} }
.browserContainer > .findbar-textbox {
background-color: var(--url-and-searchbar-background-color) !important;
color: var(--url-and-searchbar-color);
}
/* Default findbar text color doesn't look good - Bug 1125677 */ /* Default findbar text color doesn't look good - Bug 1125677 */
.browserContainer > findbar .findbar-find-status, .browserContainer > findbar .findbar-find-status,
.browserContainer > findbar .found-matches { .browserContainer > findbar .found-matches {
@ -212,17 +219,20 @@ toolbar[brighttext] #downloads-indicator-counter {
} }
/* URL bar and search bar*/ /* URL bar and search bar*/
/* XXX :root[devtoolstheme="dark"] is a workaround for bug 1096413 on the findbar. */
#urlbar, #urlbar,
#navigator-toolbox .searchbar-textbox, #navigator-toolbox .searchbar-textbox {
:root[devtoolstheme="dark"] .browserContainer > findbar .findbar-textbox {
background-color: var(--url-and-searchbar-background-color) !important; background-color: var(--url-and-searchbar-background-color) !important;
background-image: none !important; background-image: none !important;
color: var(--url-and-searchbar-color) !important; color: var(--url-and-searchbar-color) !important;
border: none !important; border: 1px solid var(--chrome-nav-bar-controls-border-color) !important;
box-shadow: none !important; box-shadow: none !important;
} }
#urlbar {
-moz-border-start: none !important;
opacity: 1 !important;
}
window:not([chromehidden~="toolbar"]) #urlbar-wrapper { window:not([chromehidden~="toolbar"]) #urlbar-wrapper {
overflow: -moz-hidden-unscrollable; overflow: -moz-hidden-unscrollable;
clip-path: none; clip-path: none;

Двоичные данные
browser/themes/windows/Privacy-32-XP.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.8 KiB

Двоичные данные
browser/themes/windows/Privacy-32.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.9 KiB

Двоичные данные
browser/themes/windows/Privacy-48-aero.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.5 KiB

Двоичные данные
browser/themes/windows/Privacy-48.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.4 KiB

Двоичные данные
browser/themes/windows/Privacy-64-aero.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 5.2 KiB

Двоичные данные
browser/themes/windows/Privacy-64.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 4.9 KiB

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

@ -577,7 +577,7 @@ menuitem.bookmark-item {
%include ../shared/toolbarbuttons.inc.css %include ../shared/toolbarbuttons.inc.css
%include ../shared/menupanel.inc.css %include ../shared/menupanel.inc.css
@media (-moz-windows-theme: luna-silver) { @media (-moz-windows-theme: luna-silver) and (max-resolution: 1dppx) {
:-moz-any(@primaryToolbarButtons@), :-moz-any(@primaryToolbarButtons@),
#bookmarks-menu-button.toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon { #bookmarks-menu-button.toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
list-style-image: url("chrome://browser/skin/Toolbar-lunaSilver.png"); list-style-image: url("chrome://browser/skin/Toolbar-lunaSilver.png");

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

@ -20,12 +20,16 @@
border-radius: 0 !important; border-radius: 0 !important;
width: auto !important; width: auto !important;
height: auto !important; height: auto !important;
padding: 2px 6px !important; padding: 2px 5px !important;
margin: 0 !important; margin: 0 !important;
border: none !important; border: 1px solid var(--chrome-nav-bar-controls-border-color) !important;
box-shadow: none !important; box-shadow: none !important;
} }
#forward-button > .toolbarbutton-icon {
-moz-border-start: none !important;
}
/* Override a box shadow for disabled back button */ /* Override a box shadow for disabled back button */
#main-window:not([customizing]) #back-button[disabled] > .toolbarbutton-icon { #main-window:not([customizing]) #back-button[disabled] > .toolbarbutton-icon {
box-shadow: none !important; box-shadow: none !important;

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

@ -84,9 +84,6 @@ browser.jar:
skin/classic/browser/pointerLock-64.png skin/classic/browser/pointerLock-64.png
skin/classic/browser/Privacy-16.png skin/classic/browser/Privacy-16.png
skin/classic/browser/Privacy-16-XP.png skin/classic/browser/Privacy-16-XP.png
skin/classic/browser/Privacy-32.png
skin/classic/browser/Privacy-32-XP.png
skin/classic/browser/Privacy-48.png
skin/classic/browser/privatebrowsing-mask-tabstrip.png skin/classic/browser/privatebrowsing-mask-tabstrip.png
skin/classic/browser/privatebrowsing-mask-tabstrip-XPVista7.png skin/classic/browser/privatebrowsing-mask-tabstrip-XPVista7.png
skin/classic/browser/privatebrowsing-mask-titlebar.png skin/classic/browser/privatebrowsing-mask-titlebar.png
@ -541,7 +538,6 @@ browser.jar:
% override chrome://browser/skin/menu-forward.png chrome://browser/skin/menu-forward-XP.png os=WINNT osversion<6 % override chrome://browser/skin/menu-forward.png chrome://browser/skin/menu-forward-XP.png os=WINNT osversion<6
% override chrome://browser/skin/pageInfo.png chrome://browser/skin/pageInfo-XP.png os=WINNT osversion<6 % override chrome://browser/skin/pageInfo.png chrome://browser/skin/pageInfo-XP.png os=WINNT osversion<6
% override chrome://browser/skin/Privacy-16.png chrome://browser/skin/Privacy-16-XP.png os=WINNT osversion<6 % override chrome://browser/skin/Privacy-16.png chrome://browser/skin/Privacy-16-XP.png os=WINNT osversion<6
% override chrome://browser/skin/Privacy-32.png chrome://browser/skin/Privacy-32-XP.png os=WINNT osversion<6
% override chrome://browser/skin/searchbar-dropdown-arrow.png chrome://browser/skin/searchbar-dropdown-arrow-XP.png os=WINNT osversion<6 % override chrome://browser/skin/searchbar-dropdown-arrow.png chrome://browser/skin/searchbar-dropdown-arrow-XP.png os=WINNT osversion<6
% override chrome://browser/skin/Secure24.png chrome://browser/skin/Secure24-XP.png os=WINNT osversion<6 % override chrome://browser/skin/Secure24.png chrome://browser/skin/Secure24-XP.png os=WINNT osversion<6
% override chrome://browser/skin/downloads/buttons.png chrome://browser/skin/downloads/buttons-XP.png os=WINNT osversion<6 % override chrome://browser/skin/downloads/buttons.png chrome://browser/skin/downloads/buttons-XP.png os=WINNT osversion<6

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

@ -74,9 +74,15 @@ MozCameraTestHardware.prototype = {
}, },
dispatchEvent: function(evt) { dispatchEvent: function(evt) {
if (this._handler) { var self = this;
this._handler.handleEvent(evt); /* We should not dispatch the event in the current thread
} context because it may be directly from a driver call
and we could hit a deadlock situation. */
this._window.setTimeout(function() {
if (self._handler) {
self._handler.handleEvent(evt);
}
}, 0);
}, },
reset: function(aWindow) { reset: function(aWindow) {

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

@ -958,8 +958,10 @@ nsDOMCameraControl::TakePicture(const CameraPictureOptions& aOptions,
if (s.width && s.height) { if (s.width && s.height) {
mCameraControl->Set(CAMERA_PARAM_PICTURE_SIZE, s); mCameraControl->Set(CAMERA_PARAM_PICTURE_SIZE, s);
} }
if (!aOptions.mFileFormat.IsEmpty()) {
mCameraControl->Set(CAMERA_PARAM_PICTURE_FILEFORMAT, aOptions.mFileFormat);
}
mCameraControl->Set(CAMERA_PARAM_PICTURE_ROTATION, aOptions.mRotation); mCameraControl->Set(CAMERA_PARAM_PICTURE_ROTATION, aOptions.mRotation);
mCameraControl->Set(CAMERA_PARAM_PICTURE_FILEFORMAT, aOptions.mFileFormat);
mCameraControl->Set(CAMERA_PARAM_PICTURE_DATETIME, aOptions.mDateTime); mCameraControl->Set(CAMERA_PARAM_PICTURE_DATETIME, aOptions.mDateTime);
mCameraControl->SetLocation(p); mCameraControl->SetLocation(p);
} }

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

@ -269,6 +269,8 @@ namespace android {
return 320; return 320;
} else if (strcmp(aParameter, "vid.height") == 0) { } else if (strcmp(aParameter, "vid.height") == 0) {
return 240; return 240;
} else if (strcmp(aParameter, "vid.fps") == 0) {
return 30;
} }
return 0; return 0;
case CAMCORDER_QUALITY_HIGH: case CAMCORDER_QUALITY_HIGH:
@ -277,6 +279,8 @@ namespace android {
return 640; return 640;
} else if (strcmp(aParameter, "vid.height") == 0) { } else if (strcmp(aParameter, "vid.height") == 0) {
return 480; return 480;
} else if (strcmp(aParameter, "vid.fps") == 0) {
return 30;
} }
return 0; return 0;
default: default:

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

@ -1255,7 +1255,7 @@ nsGonkCameraControl::StopRecordingImpl()
class RecordingComplete : public nsRunnable class RecordingComplete : public nsRunnable
{ {
public: public:
RecordingComplete(DeviceStorageFile* aFile) RecordingComplete(already_AddRefed<DeviceStorageFile> aFile)
: mFile(aFile) : mFile(aFile)
{ } { }
@ -1285,6 +1285,11 @@ nsGonkCameraControl::StopRecordingImpl()
mRecorder->stop(); mRecorder->stop();
mRecorder = nullptr; mRecorder = nullptr;
#else
if (!mVideoFile) {
return NS_OK;
}
#endif
OnRecorderStateChange(CameraControlListener::kRecorderStopped); OnRecorderStateChange(CameraControlListener::kRecorderStopped);
{ {
@ -1299,10 +1304,7 @@ nsGonkCameraControl::StopRecordingImpl()
} }
// notify DeviceStorage that the new video file is closed and ready // notify DeviceStorage that the new video file is closed and ready
return NS_DispatchToMainThread(new RecordingComplete(mVideoFile)); return NS_DispatchToMainThread(new RecordingComplete(mVideoFile.forget()));
#else
return NS_OK;
#endif
} }
nsresult nsresult

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

@ -412,6 +412,32 @@ TestGonkCameraHardware::AutoFocus()
return OK; return OK;
} }
int
TestGonkCameraHardware::CancelAutoFocus()
{
class Delegate : public ControlMessage
{
public:
Delegate(TestGonkCameraHardware* aTestHw)
: ControlMessage(aTestHw)
{ }
protected:
NS_IMETHOD
RunImpl() override
{
return mJSTestWrapper->CancelAutoFocus();
}
};
DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__);
nsresult rv = WaitWhileRunningOnMainThread(new Delegate(this));
if (NS_WARN_IF(NS_FAILED(rv))) {
return UNKNOWN_ERROR;
}
return OK;
}
int int
TestGonkCameraHardware::StartFaceDetection() TestGonkCameraHardware::StartFaceDetection()
{ {

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

@ -33,6 +33,7 @@ class TestGonkCameraHardware : public android::GonkCameraHardware
public: public:
virtual nsresult Init() override; virtual nsresult Init() override;
virtual int AutoFocus() override; virtual int AutoFocus() override;
virtual int CancelAutoFocus() override;
virtual int StartFaceDetection() override; virtual int StartFaceDetection() override;
virtual int StopFaceDetection() override; virtual int StopFaceDetection() override;
virtual int TakePicture() override; virtual int TakePicture() override;

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

@ -103,6 +103,14 @@ CameraTestSuite.prototype = {
_lowMemSet: false, _lowMemSet: false,
_reloading: false, _reloading: false,
_setupPermission: function(permission) {
if (!SpecialPowers.hasPermission(permission, document)) {
info("requesting " + permission + " permission");
SpecialPowers.addPermission(permission, true, document);
this._reloading = true;
}
},
/* Returns a promise which is resolved when the test suite is ready /* Returns a promise which is resolved when the test suite is ready
to be executing individual test cases. One may provide the expected to be executing individual test cases. One may provide the expected
hardware type here if desired; the default is to use the JS test hardware type here if desired; the default is to use the JS test
@ -111,24 +119,28 @@ CameraTestSuite.prototype = {
/* Depending on how we run the mochitest, we may not have the necessary /* Depending on how we run the mochitest, we may not have the necessary
permissions yet. If we do need to request them, then we have to reload permissions yet. If we do need to request them, then we have to reload
the window to ensure the reconfiguration propogated properly. */ the window to ensure the reconfiguration propogated properly. */
if (!SpecialPowers.hasPermission("camera", document)) { this._setupPermission("camera");
info("requesting camera permission"); this._setupPermission("device-storage:videos");
this._reloading = true; this._setupPermission("device-storage:videos-create");
SpecialPowers.addPermission("camera", true, document); this._setupPermission("device-storage:videos-write");
if (this._reloading) {
window.location.reload(); window.location.reload();
return Promise.reject(); return Promise.reject();
} }
info("has camera permission"); info("has necessary permissions");
if (!isDefined(hwType)) { if (!isDefined(hwType)) {
hwType = 'hardware'; hwType = 'hardware';
} }
this._hwType = hwType; this._hwType = hwType;
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
SpecialPowers.pushPrefEnv({'set': [['camera.control.test.permission', true]]}, function() { SpecialPowers.pushPrefEnv({'set': [['device.storage.prompt.testing', true]]}, function() {
SpecialPowers.pushPrefEnv({'set': [['camera.control.test.enabled', hwType]]}, function() { SpecialPowers.pushPrefEnv({'set': [['camera.control.test.permission', true]]}, function() {
resolve(); SpecialPowers.pushPrefEnv({'set': [['camera.control.test.enabled', hwType]]}, function() {
resolve();
});
}); });
}); });
}); });

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

@ -1,21 +1,20 @@
[DEFAULT] [DEFAULT]
support-files = camera_common.js support-files = camera_common.js
[test_camera_configuration.html]
[test_camera_release.html]
[test_camera_auto_focus.html]
[test_camera_take_picture.html]
[test_camera_record.html]
skip-if = toolkit == 'gonk'
[test_camera_face_detection.html]
[test_camera_fake_parameters.html]
[test_camera_hardware_init_failure.html]
[test_camera.html] [test_camera.html]
skip-if = toolkit != 'gonk' skip-if = toolkit != 'gonk'
[test_camera_2.html] [test_camera_2.html]
skip-if = toolkit != 'gonk' skip-if = toolkit != 'gonk'
[test_camera_3.html] [test_camera_3.html]
skip-if = toolkit != 'gonk' skip-if = toolkit != 'gonk'
[test_camera_hardware_init_failure.html]
[test_camera_hardware_failures.html]
[test_bug975472.html]
[test_camera_fake_parameters.html]
[test_camera_hardware_face_detection.html]
[test_camera_hardware_auto_focus_moving_cb.html]
[test_bug1022766.html]
[test_bug1037322.html]
[test_bug1099390.html]
[test_bug1104913.html] [test_bug1104913.html]
skip-if = toolkit != 'gonk' skip-if = toolkit != 'gonk'
[test_camera_bad_initial_config.html]

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

@ -1,63 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for bug 1022766</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="camera_common.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 suite = new CameraTestSuite();
suite.test('bug-1022766', function() {
function triggerAutoFocus(p) {
return new Promise(function(resolve, reject) {
var firstCall = false;
var secondCall = false;
function end() {
if (firstCall && secondCall) {
resolve();
}
}
// It doesn't matter if the emulator supports focus or not;
// this is just testing the sequencing.
suite.camera.autoFocus().then(function(p) {
ok(false, "First call to autoFocus() succeeded unexpectedly");
firstCall = true;
end();
}, function(e) {
ok(e.name === 'NS_ERROR_IN_PROGRESS', 'First call to autoFocus() failed with: ' + e);
firstCall = true;
end();
});
suite.camera.autoFocus().then(function(p) {
ok(true, "Second call to autoFocus() succeeded");
secondCall = true;
end();
}, function(e) {
ok(false, "Second call to autoFocus() failed unexpectedly with: " + e);
secondCall = true;
end();
});
});
}
return suite.getCamera()
.then(triggerAutoFocus, suite.rejectGetCamera)
});
suite.setup()
.then(suite.run);
</script>
</body>
</html>

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

@ -1,69 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for bug 1037322</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="camera_common.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 suite = new CameraTestSuite();
suite.test('bug-1037322', function() {
var cameraManager = navigator.mozCameras;
var whichCamera = cameraManager.getListOfCameras()[0];
var postConfig = {
mode: 'picture',
recorderProfile: 'low',
previewSize: {
width: 320,
height: 240
}
};
function resolveGetCamera(p) {
suite.camera = p.camera;
// Check the default configuration
var cfg = p.configuration;
ok(cfg.mode === "unspecified", "Initial mode = " + cfg.mode);
ok(cfg.previewSize.width === 0 && cfg.previewSize.height === 0,
"Initial preview size = " + cfg.previewSize.width + "x" + cfg.previewSize.height);
ok(cfg.recorderProfile === "default",
"Initial recorder profile = '" + cfg.recorderProfile + "'");
}
function configure(p) {
// Apply our specific configuration
return suite.camera.setConfiguration(postConfig);
}
function resolveConfigure(cfg) {
// Check our specific configuration
ok(cfg.mode === postConfig.mode, "Configured mode = " + cfg.mode);
ok(cfg.previewSize.width === postConfig.previewSize.width &&
cfg.previewSize.height === postConfig.previewSize.height,
"Configured preview size = " + cfg.previewSize.width + "x" + cfg.previewSize.height);
ok(cfg.recorderProfile === postConfig.recorderProfile,
"Configured recorder profile = '" + cfg.recorderProfile + "'");
}
return cameraManager.getCamera(whichCamera, {mode: 'unspecified'})
.then(resolveGetCamera, suite.rejectGetCamera)
.then(configure)
.then(resolveConfigure, suite.rejectConfigure);
});
suite.setup()
.then(suite.run);
</script>
</body>
</html>

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

@ -1,55 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for bug 1099390</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="camera_common.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 suite = new CameraTestSuite();
suite.test('bug-1099390', function() {
function release(p) {
return new Promise(function(resolve, reject) {
var gotCloseEvent = false;
var gotReleasePromise = false;
var onClosed = function(e) {
suite.camera.removeEventListener('close', onClosed);
ok(!gotCloseEvent, "gotCloseEvent was " + gotCloseEvent);
ok(e.reason === "HardwareReleased", "'close' event reason is: " + e.reason);
gotCloseEvent = true;
if (gotReleasePromise) {
resolve();
}
};
suite.camera.addEventListener('close', onClosed);
suite.camera.release().then(function(p) {
ok(true, "released camera");
gotReleasePromise = true;
if (gotCloseEvent) {
resolve();
}
}).catch(reject);
});
}
return suite.getCamera()
.then(release, suite.rejectGetCamera);
});
suite.setup()
.then(suite.run);
</script>
</body>
</html>

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

@ -1,20 +1,15 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=940424
-->
<head> <head>
<title>Bug 940424 - Test camera hardware API failure handling</title> <title>Test for auto focus</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script> <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="camera_common.js"></script> <script type="text/javascript" src="camera_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head> </head>
<body> <body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=940424">Mozilla Bug 940424</a> <video id="viewfinder" width="200" height="200" autoplay></video>
<video id="viewfinder" width = "200" height = "200" autoplay></video> <img src="#" alt="This image is going to load" id="testimage"/>
<img src="#" alt="This image is going to load" id="testimage"/>
<script class="testbody" type="text/javascript;version=1.7"> <script class="testbody" type="text/javascript;version=1.7">
var suite = new CameraTestSuite(); var suite = new CameraTestSuite();
@ -129,39 +124,109 @@ suite.test('auto-focus-failures', function() {
.then(suite.expectedRejectAutoFocus, rejectAutoFocusError) .then(suite.expectedRejectAutoFocus, rejectAutoFocusError)
}); });
suite.test('take-picture-failures', function() { suite.test('auto-focus-moving', function() {
function startTakePictureProcessError(p) { function triggerAutoFocusMoving(p) {
suite.hw.attach({ var sync = new Promise(function(resolve, reject) {
takePicture: function() { function onEvent(e) {
suite.hw.fireTakePictureError(); suite.camera.removeEventListener('focus', onEvent);
ok(e.newState === 'focusing', 'autofocus event state focusing == ' + e.newState);
resolve();
} }
suite.camera.addEventListener('focus', onEvent);
}); });
return suite.camera.takePicture();
suite.hw.fireAutoFocusMoving(true);
return sync;
} }
function rejectTakePictureProcessError(e) { function waitAutoFocusComplete(p) {
ok(e.name === 'NS_ERROR_FAILURE', 'takePicture() process should fail: ' + e); var sync = new Promise(function(resolve, reject) {
} function onEvent(e) {
suite.camera.removeEventListener('focus', onEvent);
function startTakePictureError(p) { ok(e.newState === 'focused', 'autofocus event state focused == ' + e.newState);
suite.hw.attach({ resolve();
takePicture: function() {
throw SpecialPowers.Cr.NS_ERROR_FAILURE;
} }
suite.camera.addEventListener('focus', onEvent);
}); });
return suite.camera.takePicture();
// Missing the fireAutoFocusComplete but it should timeout on its own
suite.hw.fireAutoFocusMoving(false);
return sync;
} }
function rejectTakePictureError(e) { function runAutoFocusCycle(p) {
ok(e.name === 'NS_ERROR_FAILURE', 'takePicture() should fail: ' + e); return triggerAutoFocusMoving(p)
.then(waitAutoFocusComplete);
}
/* If the driver doesn't supply an onAutoFocusComplete notification,
gecko will timeout and provide it. After three times, it will no
longer rely upon a timeout and fire it immediately. */
return suite.getCamera()
.then(runAutoFocusCycle)
.then(runAutoFocusCycle)
.then(runAutoFocusCycle)
.then(runAutoFocusCycle);
});
suite.test('auto-focus-interrupted', function() {
// bug 1022766
function triggerAutoFocus(p) {
return new Promise(function(resolve, reject) {
var firstCall = false;
var secondCall = false;
function end() {
if (firstCall && secondCall) {
resolve();
}
}
// It doesn't matter if the emulator supports focus or not;
// this is just testing the sequencing.
suite.camera.autoFocus().then(function(p) {
ok(false, "First call to autoFocus() succeeded unexpectedly");
firstCall = true;
end();
}, function(e) {
ok(e.name === 'NS_ERROR_IN_PROGRESS', 'First call to autoFocus() failed with: ' + e);
firstCall = true;
end();
});
suite.camera.autoFocus().then(function(p) {
ok(true, "Second call to autoFocus() succeeded");
secondCall = true;
end();
}, function(e) {
ok(false, "Second call to autoFocus() failed unexpectedly with: " + e);
secondCall = true;
end();
});
});
} }
return suite.getCamera() return suite.getCamera()
.catch(suite.rejectGetCamera) .then(triggerAutoFocus, suite.rejectGetCamera)
.then(startTakePictureProcessError) });
.then(suite.expectedRejectTakePicture, rejectTakePictureProcessError)
.then(startTakePictureError) suite.test('cancel-auto-focus', function() {
.then(suite.expectedRejectTakePicture, rejectTakePictureError) function cancelAutoFocus(p) {
var promise = new Promise(function(resolve, reject) {
suite.hw.attach({
cancelAutoFocus: function() {
ok(true, 'got cancel auto focus');
resolve();
}
});
});
suite.camera.resumeContinuousFocus();
return promise;
}
return suite.getCamera()
.then(cancelAutoFocus, suite.rejectGetCamera);
}); });
suite.setup() suite.setup()

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

@ -1,44 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for bad initial configuration</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="camera_common.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 suite = new CameraTestSuite();
suite.test('bad-initial-config', function() {
function getCamera() {
var whichCamera = navigator.mozCameras.getListOfCameras()[0];
var config = {
mode: 'picture',
recorderProfile: 'foobar',
};
return navigator.mozCameras.getCamera(whichCamera, config);
}
function rejectGetCamera(error) {
ok(error.name === "NS_ERROR_NOT_AVAILABLE",
"getCamera() failed with: " + error.name);
return Promise.resolve();
}
return getCamera()
.then(suite.expectedRejectGetCamera, rejectGetCamera);
});
suite.setup()
.then(suite.run);
</script>
</body>
</html>

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

@ -0,0 +1,545 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for camera configuration</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="camera_common.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 suite = new CameraTestSuite();
function verifyConfig(cfg, expConfig)
{
ok(cfg.mode === expConfig.mode, "Configured mode = " + cfg.mode +
", expected = " + expConfig.mode);
ok(cfg.previewSize.width === expConfig.previewSize.width &&
cfg.previewSize.height === expConfig.previewSize.height,
"Configured preview size = " + cfg.previewSize.width + "x" + cfg.previewSize.height +
", expected = " + expConfig.previewSize.width + "x" + expConfig.previewSize.height);
ok(cfg.pictureSize.width === expConfig.pictureSize.width &&
cfg.pictureSize.height === expConfig.pictureSize.height,
"Configured picture size = " + cfg.pictureSize.width + "x" + cfg.pictureSize.height +
", expected = " + expConfig.pictureSize.width + "x" + expConfig.pictureSize.height);
ok(cfg.recorderProfile === expConfig.recorderProfile,
"Configured recorder profile = '" + cfg.recorderProfile + "'" +
", expected = '" + expConfig.recorderProfile + "'");
}
function setAndVerifyConfig(setConfig, expConfig)
{
return suite.getCamera(undefined, setConfig)
.catch(suite.rejectGetCamera)
.then(function(p) {
verifyConfig(p.configuration, expConfig);
});
}
suite.test('bad-initial-config', function() {
function getCamera() {
var whichCamera = navigator.mozCameras.getListOfCameras()[0];
var config = {
mode: 'picture',
recorderProfile: 'foobar',
};
return navigator.mozCameras.getCamera(whichCamera, config);
}
function rejectGetCamera(error) {
ok(error.name === "NS_ERROR_NOT_AVAILABLE",
"getCamera() failed with: " + error.name);
return Promise.resolve();
}
return getCamera()
.then(suite.expectedRejectGetCamera, rejectGetCamera);
});
suite.test('start-unspecified', function() {
// bug 1037322
var cameraManager = navigator.mozCameras;
var whichCamera = cameraManager.getListOfCameras()[0];
var postConfig = {
mode: 'picture',
recorderProfile: 'low',
previewSize: {
width: 320,
height: 240
},
pictureSize: {
width: 320,
height: 240
}
};
function resolveGetCamera(p) {
suite.camera = p.camera;
// Check the default configuration
var cfg = p.configuration;
ok(cfg.mode === "unspecified", "Initial mode = " + cfg.mode);
ok(cfg.previewSize.width === 0 && cfg.previewSize.height === 0,
"Initial preview size = " + cfg.previewSize.width + "x" + cfg.previewSize.height);
ok(cfg.recorderProfile === "default",
"Initial recorder profile = '" + cfg.recorderProfile + "'");
}
function configure(p) {
// Apply our specific configuration
return suite.camera.setConfiguration(postConfig);
}
function resolveConfigure(cfg) {
// Check our specific configuration
verifyConfig(cfg, postConfig);
}
return cameraManager.getCamera(whichCamera, {mode: 'unspecified'})
.then(resolveGetCamera, suite.rejectGetCamera)
.then(configure)
.then(resolveConfigure, suite.rejectConfigure);
});
suite.test('picture-mode', function() {
suite.hw.params['preview-size'] = '1x1';
suite.hw.params['picture-size'] = '1x1';
suite.hw.params['preview-size-values'] = '640x480,320x240,1x1';
suite.hw.params['picture-size-values'] = '640x480,320x240,1x1';
suite.hw.params['video-size-values'] = '320x240';
var setConfig = {
mode: 'picture',
previewSize: {
width: 640,
height: 480
}
};
var expConfig = {
mode: 'picture',
recorderProfile: 'qvga',
previewSize: {
width: 640,
height: 480
},
pictureSize: {
width: 640,
height: 480
}
};
return setAndVerifyConfig(setConfig, expConfig);
});
suite.test('picture-mode-larger-picture-size', function() {
suite.hw.params['preview-size'] = '1x1';
suite.hw.params['picture-size'] = '1x1';
suite.hw.params['preview-size-values'] = '640x480,320x240,1x1';
suite.hw.params['picture-size-values'] = '1280x960,640x480,320x240,1x1';
suite.hw.params['video-size-values'] = '320x240';
var setConfig = {
mode: 'picture',
previewSize: {
width: 640,
height: 480
}
};
var expConfig = {
mode: 'picture',
recorderProfile: 'qvga',
previewSize: {
width: 640,
height: 480
},
pictureSize: {
width: 1280,
height: 960
}
};
return setAndVerifyConfig(setConfig, expConfig);
});
suite.test('picture-mode-size-unsupported-big', function() {
suite.hw.params['preview-size'] = '1x1';
suite.hw.params['picture-size'] = '1x1';
suite.hw.params['preview-size-values'] = '640x480,320x240,1x1';
suite.hw.params['picture-size-values'] = '1280x960,640x480,320x240,1x1';
suite.hw.params['video-size-values'] = '320x240';
var setConfig = {
mode: 'picture',
previewSize: {
width: 640,
height: 480
},
pictureSize: {
width: 2000,
height: 2000
},
};
var expConfig = {
mode: 'picture',
recorderProfile: 'qvga',
previewSize: {
width: 640,
height: 480
},
pictureSize: {
width: 1280,
height: 960
},
};
return setAndVerifyConfig(setConfig, expConfig);
});
suite.test('picture-mode-size-unsupported', function() {
suite.hw.params['preview-size'] = '1x1';
suite.hw.params['picture-size'] = '1x1';
suite.hw.params['preview-size-values'] = '640x480,320x240,1x1';
suite.hw.params['picture-size-values'] = '1280x960,640x480,320x240,100x100,1x1';
suite.hw.params['video-size-values'] = '320x240';
var setConfig = {
mode: 'picture',
previewSize: {
width: 640,
height: 480
},
pictureSize: {
width: 641,
height: 481,
},
};
var expConfig = {
mode: 'picture',
recorderProfile: 'qvga',
previewSize: {
width: 640,
height: 480
},
pictureSize: {
width: 640,
height: 480
},
};
return setAndVerifyConfig(setConfig, expConfig);
});
suite.test('picture-mode-asr-mismatch', function() {
suite.hw.params['preview-size'] = '320x240';
suite.hw.params['picture-size'] = '640x480';
suite.hw.params['preview-size-values'] = '640x480,320x240,50x50';
suite.hw.params['picture-size-values'] = '1280x960,640x480,320x240,100x100';
suite.hw.params['video-size-values'] = '320x240';
var setConfig = {
mode: 'picture',
previewSize: {
width: 640,
height: 480
},
pictureSize: {
width: 100,
height: 100,
},
};
var expConfig = {
mode: 'picture',
recorderProfile: 'qvga',
previewSize: {
width: 50,
height: 50
},
pictureSize: {
width: 100,
height: 100,
},
};
return setAndVerifyConfig(setConfig, expConfig);
});
suite.test('picture-mode-update-video-size', function() {
suite.hw.params['preview-size'] = '320x240';
suite.hw.params['picture-size'] = '640x480';
suite.hw.params['video-size'] = '50x50';
suite.hw.params['preview-size-values'] = '640x480,320x240,50x50';
suite.hw.params['video-size-values'] = '1280x960,640x480,320x240,50x50';
suite.hw.params['picture-size-values'] = '1280x960,640x480,320x240,100x100';
var setConfig = {
mode: 'picture',
recorderProfile: 'qvga',
previewSize: {
width: 320,
height: 240
},
pictureSize: {
width: 320,
height: 240,
},
};
var expConfig = {
mode: 'picture',
recorderProfile: 'qvga',
previewSize: {
width: 320,
height: 240
},
pictureSize: {
width: 320,
height: 240,
},
};
function checkVideoSize(p) {
ok(suite.hw.params['video-size'] === '320x240', 'video size reset with picture mode switch');
}
return setAndVerifyConfig(setConfig, expConfig)
.then(checkVideoSize);
});
suite.test('picture-mode-no-update-video-size', function() {
suite.hw.params['preview-size'] = '320x240';
suite.hw.params['picture-size'] = '640x480';
suite.hw.params['video-size'] = '1280x960';
suite.hw.params['preview-size-values'] = '640x480,320x240,50x50';
suite.hw.params['video-size-values'] = '1280x960,640x480,320x240,50x50';
suite.hw.params['picture-size-values'] = '1280x960,640x480,320x240,100x100';
var setConfig = {
mode: 'picture',
recorderProfile: 'qvga',
previewSize: {
width: 640,
height: 480
},
pictureSize: {
width: 640,
height: 480,
},
};
var expConfig = {
mode: 'picture',
recorderProfile: 'qvga',
previewSize: {
width: 640,
height: 480
},
pictureSize: {
width: 640,
height: 480,
},
};
function checkVideoSize(p) {
ok(suite.hw.params['video-size'] === '1280x960', 'video size retained with picture mode switch');
}
return setAndVerifyConfig(setConfig, expConfig)
.then(checkVideoSize);
});
suite.test('video-mode-preview-size', function() {
suite.hw.params['preview-size'] = '1x1';
suite.hw.params['picture-size'] = '1x1';
suite.hw.params['recording-hint'] = 'false';
suite.hw.params['preview-size-values'] = '640x480,320x240,1x1';
suite.hw.params['picture-size-values'] = '700x700,640x480,320x240,1x1';
var setConfig = {
mode: 'video',
recorderProfile: 'qvga'
};
var expConfig = {
mode: 'video',
recorderProfile: 'qvga',
previewSize: {
width: 320,
height: 240
},
pictureSize: {
width: 700,
height: 700
}
};
function checkRecordingHint(p) {
ok(suite.hw.params['recording-hint'] === 'true', 'recording hint enabled');
}
return setAndVerifyConfig(setConfig, expConfig)
.then(checkRecordingHint);
});
suite.test('video-mode', function() {
suite.hw.params['preview-size'] = '1x1';
suite.hw.params['picture-size'] = '1x1';
suite.hw.params['video-size'] = '1x1';
suite.hw.params['recording-hint'] = 'false';
suite.hw.params['preferred-preview-size-for-video'] = '640x480';
suite.hw.params['preview-size-values'] = '640x480,320x240,1x1';
suite.hw.params['picture-size-values'] = '700x700,640x480,320x240,1x1';
suite.hw.params['video-size-values'] = '700x700,640x480,320x240,1x1';
var setConfig = {
mode: 'video',
recorderProfile: 'qvga',
previewSize: {
width: 320,
height: 240
}
};
var expConfig = {
mode: 'video',
recorderProfile: 'qvga',
previewSize: {
width: 320,
height: 240
},
pictureSize: {
width: 700,
height: 700
}
};
function checkRecordingHint(p) {
ok(suite.hw.params['recording-hint'] === 'true', 'recording hint enabled');
}
return setAndVerifyConfig(setConfig, expConfig)
.then(checkRecordingHint);
});
suite.test('video-mode-larger-preview-size', function() {
suite.hw.params['preview-size'] = '1x1';
suite.hw.params['picture-size'] = '1x1';
suite.hw.params['video-size'] = '1x1';
suite.hw.params['recording-hint'] = 'false';
suite.hw.params['preferred-preview-size-for-video'] = '640x480';
suite.hw.params['preview-size-values'] = '640x480,320x240,1x1';
suite.hw.params['picture-size-values'] = '700x700,640x480,320x240,1x1';
suite.hw.params['video-size-values'] = '700x700,640x480,320x240,1x1';
var setConfig = {
mode: 'video',
recorderProfile: 'qvga',
previewSize: {
width: 640,
height: 480
}
};
var expConfig = {
mode: 'video',
recorderProfile: 'qvga',
previewSize: {
width: 320,
height: 240
},
pictureSize: {
width: 700,
height: 700
}
};
return setAndVerifyConfig(setConfig, expConfig);
});
suite.test('video-mode-smaller-preview-size', function() {
suite.hw.params['preview-size'] = '1x1';
suite.hw.params['picture-size'] = '1x1';
suite.hw.params['video-size'] = '1x1';
suite.hw.params['recording-hint'] = 'false';
suite.hw.params['preferred-preview-size-for-video'] = '640x480';
suite.hw.params['preview-size-values'] = '640x480,320x240,160x120,1x1';
suite.hw.params['picture-size-values'] = '700x700,640x480,320x240,1x1';
suite.hw.params['video-size-values'] = '700x700,640x480,320x240,1x1';
var setConfig = {
mode: 'video',
recorderProfile: 'qvga',
previewSize: {
width: 160,
height: 120
}
};
var expConfig = {
mode: 'video',
recorderProfile: 'qvga',
previewSize: {
width: 160,
height: 120
},
pictureSize: {
width: 700,
height: 700
}
};
return setAndVerifyConfig(setConfig, expConfig);
});
suite.test('video-mode-larger-preview-size-than-preferred', function() {
suite.hw.params['preview-size'] = '1x1';
suite.hw.params['picture-size'] = '1x1';
suite.hw.params['video-size'] = '1x1';
suite.hw.params['recording-hint'] = 'false';
suite.hw.params['preferred-preview-size-for-video'] = '200x200';
suite.hw.params['preview-size-values'] = '640x480,320x240,160x120,1x1';
suite.hw.params['picture-size-values'] = '700x700,640x480,320x240,1x1';
suite.hw.params['video-size-values'] = '700x700,640x480,400x400,320x240,1x1';
var setConfig = {
mode: 'video',
recorderProfile: 'qvga',
previewSize: {
width: 320,
height: 240
}
};
var expConfig = {
mode: 'video',
recorderProfile: 'qvga',
previewSize: {
width: 160,
height: 120
},
pictureSize: {
width: 700,
height: 700
}
};
return setAndVerifyConfig(setConfig, expConfig);
});
suite.setup()
.then(suite.run);
</script>
</body>
</html>

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

@ -92,8 +92,93 @@ function compareFace(aFace, expected)
var suite = new CameraTestSuite(); var suite = new CameraTestSuite();
suite.test('face-detection-op', function() {
function start(p) {
return new Promise(function(resolve, reject) {
suite.hw.attach({
startFaceDetection: function() {
ok(true, "startFaceDetection() requested");
resolve();
}
});
try {
suite.camera.startFaceDetection();
ok(true, "startFaceDetection() succeeded");
} catch(e) {
ok(false, "startFaceDetection() failed with: " + e.name);
resolve();
}
});
}
function stop(p) {
return new Promise(function(resolve, reject) {
suite.hw.attach({
stopFaceDetection: function() {
ok(true, "stopFaceDetection() requested");
resolve();
}
});
try {
suite.camera.stopFaceDetection();
ok(true, "stopFaceDetection() succeeded");
} catch(e) {
ok(false, "stopFaceDetection() failed with: " + e.name);
resolve();
}
});
}
function startFailure(p) {
return new Promise(function(resolve, reject) {
suite.hw.attach({
startFaceDetection: function() {
ok(true, "startFaceDetection() requested and failed");
resolve();
throw SpecialPowers.Cr.NS_ERROR_FAILURE;
}
});
try {
suite.camera.startFaceDetection();
ok(true, "startFaceDetection() succeeded and error swallowed");
} catch(e) {
ok(false, "startFaceDetection() failed with: " + e.name);
resolve();
}
});
}
function stopFailure(p) {
return new Promise(function(resolve, reject) {
suite.hw.attach({
stopFaceDetection: function() {
ok(true, "stopFaceDetection() requested and failed");
resolve();
throw SpecialPowers.Cr.NS_ERROR_FAILURE;
}
});
try {
suite.camera.stopFaceDetection();
ok(true, "stopFaceDetection() succeeded and error swallowed");
} catch(e) {
ok(false, "stopFaceDetection() failed with: " + e.name);
resolve();
}
});
}
return suite.getCamera()
.then(start, suite.rejectGetCamera)
.then(stop)
.then(startFailure)
.then(stopFailure);
});
suite.test('face-detection', function() { suite.test('face-detection', function() {
function detectFace(msg, expected) { function detectFace(msg, given, expected) {
if (expected === undefined) {
expected = given;
}
var sync = new Promise(function(resolve, reject) { var sync = new Promise(function(resolve, reject) {
function onEvent(evt) { function onEvent(evt) {
try { try {
@ -108,7 +193,7 @@ suite.test('face-detection', function() {
suite.camera.addEventListener('facesdetected', onEvent); suite.camera.addEventListener('facesdetected', onEvent);
}); });
suite.hw.fireFacesDetected(expected); suite.hw.fireFacesDetected(given);
return sync; return sync;
} }
@ -220,11 +305,47 @@ suite.test('face-detection', function() {
); );
} }
function detectOneFaceExcessScore() {
return detectFace('one-face-excess-score',
{
faces: [ {
id: 1,
score: 120,
bounds: {
left: 3,
top: 4,
right: 5,
bottom: 6
},
leftEye: null,
rightEye: null,
mouth: null
} ]
},
{
faces: [ {
id: 1,
score: 100,
bounds: {
left: 3,
top: 4,
right: 5,
bottom: 6
},
leftEye: null,
rightEye: null,
mouth: null
} ]
}
);
}
return suite.getCamera() return suite.getCamera()
.then(detectOneFace, suite.rejectGetCamera) .then(detectOneFace, suite.rejectGetCamera)
.then(detectTwoFaces) .then(detectTwoFaces)
.then(detectOneFaceNoFeatures) .then(detectOneFaceNoFeatures)
.then(detectNoFaces); .then(detectNoFaces)
.then(detectOneFaceExcessScore);
}); });
suite.setup() suite.setup()

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

@ -132,6 +132,133 @@ suite.test('fake-low-memory-platform', function() {
.then(resolve, suite.rejectGetCamera); .then(resolve, suite.rejectGetCamera);
}); });
suite.test('fake-effects', function() {
var supportedValues = ['none', 'mono', 'negative', 'solarize', 'sepia', 'posterize', 'whiteboard', 'blackboard', 'aqua'];
suite.hw.params['effect'] = 'none';
suite.hw.params['effect-values'] = supportedValues.join(',');
function resolve(p) {
var cap = suite.camera.capabilities;
ok(cap.effects.length == supportedValues.length, "Effects length = " + cap.effects.length);
// make sure expected values are present
supportedValues.forEach(function(val) {
ok(cap.effects.indexOf(val) != -1, "Effect '" + val + "' is present");
});
}
return suite.getCamera()
.then(resolve, suite.rejectGetCamera);
});
suite.test('fake-flash-modes', function() {
var supportedValues = ['off', 'auto', 'on', 'red-eye', 'torch'];
suite.hw.params['flash-mode'] = 'auto';
suite.hw.params['flash-mode-values'] = supportedValues.join(',');
function resolve(p) {
var cam = suite.camera;
var cap = cam.capabilities;
ok(cap.flashModes.length == supportedValues.length, "Flash modes length = " + cap.flashModes.length);
// make sure expected values are present
supportedValues.forEach(function(val) {
ok(cap.flashModes.indexOf(val) != -1, "Flash mode '" + val + "' is present");
});
// test setters/getters
cap.flashModes.forEach(function(val, index) {
cam.flashMode = val;
ok(cam.flashMode === val,
"Flash Mode [" + index + "] = " + val + ", cam.flashMode = " + cam.flashMode);
});
}
return suite.getCamera()
.then(resolve, suite.rejectGetCamera);
});
suite.test('fake-focus-modes', function() {
var supportedValues = ['auto', 'infinity', 'macro', 'fixed', 'edof', 'continuous-video'];
suite.hw.params['focus-mode'] = 'auto';
suite.hw.params['focus-mode-values'] = supportedValues.join(',');
function resolve(p) {
var cam = suite.camera;
var cap = cam.capabilities;
ok(cap.focusModes.length == supportedValues.length, "Focus modes length = " + cap.focusModes.length);
// make sure expected values are present
supportedValues.forEach(function(val) {
ok(cap.focusModes.indexOf(val) != -1, "Focus mode '" + val + "' is present");
});
// test setters/getters
cap.focusModes.forEach(function(val, index) {
cam.focusMode = val;
ok(cam.focusMode === val,
"Focus Mode [" + index + "] = " + val + ", cam.focusMode = " + cam.focusMode);
});
}
return suite.getCamera()
.then(resolve, suite.rejectGetCamera);
});
suite.test('fake-white-balance-modes', function() {
var supportedValues = ['auto', 'incandescent', 'fluorescent', 'warm-fluorescent', 'daylight', 'cloudy-daylight', 'twilight', 'shade'];
suite.hw.params['whitebalance'] = 'auto';
suite.hw.params['whitebalance-values'] = supportedValues.join(',');
function resolve(p) {
var cam = suite.camera;
var cap = cam.capabilities;
ok(cap.whiteBalanceModes.length == supportedValues.length, "White balance modes length = " + cap.whiteBalanceModes.length);
// make sure expected values are present
supportedValues.forEach(function(val) {
ok(cap.whiteBalanceModes.indexOf(val) != -1, "White balance mode '" + val + "' is present");
});
// test setters/getters
cap.whiteBalanceModes.forEach(function(val, index) {
cam.whiteBalanceMode = val;
ok(cam.whiteBalanceMode === val,
"White balance mode [" + index + "] = " + val + ", cam.whiteBalanceMode = " + cam.whiteBalanceMode);
});
}
return suite.getCamera()
.then(resolve, suite.rejectGetCamera);
});
suite.test('fake-video-sizes', function() {
var supportedValues = ['auto', 'incandescent', 'fluorescent', 'warm-fluorescent', 'daylight', 'cloudy-daylight', 'twilight', 'shade'];
suite.hw.params['whitebalance'] = 'auto';
suite.hw.params['whitebalance-values'] = supportedValues.join(',');
function resolve(p) {
var cam = suite.camera;
var cap = cam.capabilities;
ok(cap.whiteBalanceModes.length == supportedValues.length, "White balance modes length = " + cap.whiteBalanceModes.length);
// make sure expected values are present
supportedValues.forEach(function(val) {
ok(cap.whiteBalanceModes.indexOf(val) != -1, "White balance mode '" + val + "' is present");
});
// test setters/getters
cap.whiteBalanceModes.forEach(function(val, index) {
cam.whiteBalanceMode = val;
ok(cam.whiteBalanceMode === val,
"White balance mode [" + index + "] = " + val + ", cam.whiteBalanceMode = " + cam.whiteBalanceMode);
});
}
return suite.getCamera()
.then(resolve, suite.rejectGetCamera);
});
suite.test('fake-iso', function() { suite.test('fake-iso', function() {
suite.hw.params['iso'] = 'auto'; suite.hw.params['iso'] = 'auto';
suite.hw.params['iso-values'] = 'auto,ISO_HJR,ISO100,foo,ISObar,ISO150moz,ISO200,400,ISO800,1600'; suite.hw.params['iso-values'] = 'auto,ISO_HJR,ISO100,foo,ISObar,ISO150moz,ISO200,400,ISO800,1600';
@ -158,9 +285,9 @@ suite.test('fake-iso', function() {
// test setters/getters for individual ISO modes // test setters/getters for individual ISO modes
cap.isoModes.forEach(function(iso, index) { cap.isoModes.forEach(function(iso, index) {
cam.iso = iso; cam.isoMode = iso;
ok(cam.iso === iso, ok(cam.isoMode === iso,
"ISO[" + index + "] = " + iso + ", cam.iso = " + cam.iso); "ISO[" + index + "] = " + iso + ", cam.iso = " + cam.isoMode);
}); });
} }
@ -168,6 +295,19 @@ suite.test('fake-iso', function() {
.then(resolve, suite.rejectGetCamera); .then(resolve, suite.rejectGetCamera);
}); });
suite.test('fake-faces-detected', function() {
suite.hw.params['max-num-detected-faces-hw'] = '5';
function resolve(p) {
var cap = suite.camera.capabilities;
ok(cap.maxDetectedFaces == 5, "maxDetectedFaces = " + cap.maxDetectedFaces);
}
return suite.getCamera()
.then(resolve, suite.rejectGetCamera);
});
suite.test('fake-metering-areas', function() { suite.test('fake-metering-areas', function() {
suite.hw.params['max-num-metering-areas'] = '1'; suite.hw.params['max-num-metering-areas'] = '1';

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

@ -1,73 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=965421
-->
<head>
<title>Bug 965421 - Test camera hardware API for Auto focus moving Callback</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="camera_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=965421">Mozilla Bug 965421</a>
<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 suite = new CameraTestSuite();
suite.test('auto-focus-moving', function() {
function triggerAutoFocusMoving(p) {
var sync = new Promise(function(resolve, reject) {
function onEvent(e) {
suite.camera.removeEventListener('focus', onEvent);
ok(e.newState === 'focusing', 'autofocus event state focusing == ' + e.newState);
resolve();
}
suite.camera.addEventListener('focus', onEvent);
});
suite.hw.fireAutoFocusMoving(true);
return sync;
}
function waitAutoFocusComplete(p) {
var sync = new Promise(function(resolve, reject) {
function onEvent(e) {
suite.camera.removeEventListener('focus', onEvent);
ok(e.newState === 'focused', 'autofocus event state focused == ' + e.newState);
resolve();
}
suite.camera.addEventListener('focus', onEvent);
});
// Missing the fireAutoFocusComplete but it should timeout on its own
suite.hw.fireAutoFocusMoving(false);
return sync;
}
function runAutoFocusCycle(p) {
return triggerAutoFocusMoving(p)
.then(waitAutoFocusComplete);
}
/* If the driver doesn't supply an onAutoFocusComplete notification,
gecko will timeout and provide it. After three times, it will no
longer rely upon a timeout and fire it immediately. */
return suite.getCamera()
.then(runAutoFocusCycle)
.then(runAutoFocusCycle)
.then(runAutoFocusCycle)
.then(runAutoFocusCycle);
});
suite.setup()
.then(suite.run);
</script>
</body>
</html>

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

@ -0,0 +1,75 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test Camera Recording</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="camera_common.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 suite = new CameraTestSuite();
var baseConfig = {
mode: 'video',
};
var storage = navigator.getDeviceStorage("videos");
suite.test('recording', function() {
storage.delete("test.3gp");
function startRecording(p) {
var eventPromise = new Promise(function(resolve, reject) {
function onEvent(evt) {
ok(evt.newState === 'Started', 'recorder state change event = ' + evt.newState);
suite.camera.removeEventListener('recorderstatechange', onEvent);
resolve();
}
suite.camera.addEventListener('recorderstatechange', onEvent);
});
var domPromise = suite.camera.startRecording({}, storage, "test.3gp");
return Promise.all([domPromise, eventPromise]);
}
function stopRecording(p) {
var eventPromise = new Promise(function(resolve, reject) {
function onEvent(evt) {
ok(evt.newState === 'Stopped', 'recorder state change event = ' + evt.newState);
suite.camera.removeEventListener('recorderstatechange', onEvent);
resolve();
}
suite.camera.addEventListener('recorderstatechange', onEvent);
});
var domPromise = new Promise(function(resolve, reject) {
try {
suite.camera.stopRecording();
resolve();
} catch(e) {
reject(e);
}
});
return Promise.all([domPromise, eventPromise]);
}
return suite.getCamera(undefined, baseConfig)
.then(startRecording, suite.rejectGetCamera)
.then(stopRecording, suite.rejectStartRecording)
.catch(suite.rejectStopRecording);
});
suite.setup()
.then(suite.run);
</script>
</body>
</html>

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

@ -18,6 +18,39 @@ function cameraRelease(p) {
return suite.camera.release(); return suite.camera.release();
} }
suite.test('release-close-event', function() {
// bug 1099390
function release(p) {
return new Promise(function(resolve, reject) {
var gotCloseEvent = false;
var gotReleasePromise = false;
var onClosed = function(e) {
suite.camera.removeEventListener('close', onClosed);
ok(!gotCloseEvent, "gotCloseEvent was " + gotCloseEvent);
ok(e.reason === "HardwareReleased", "'close' event reason is: " + e.reason);
gotCloseEvent = true;
if (gotReleasePromise) {
resolve();
}
};
suite.camera.addEventListener('close', onClosed);
suite.camera.release().then(function(p) {
ok(true, "released camera");
gotReleasePromise = true;
if (gotCloseEvent) {
resolve();
}
}).catch(reject);
});
}
return suite.getCamera()
.then(release, suite.rejectGetCamera);
});
suite.test('release-after-release', function() { suite.test('release-after-release', function() {
return suite.getCamera() return suite.getCamera()
.then(cameraRelease, suite.rejectGetCamera) .then(cameraRelease, suite.rejectGetCamera)
@ -157,6 +190,33 @@ suite.test('stop-recording-after-release', function() {
.then(stopRecording, suite.rejectRelease); .then(stopRecording, suite.rejectRelease);
}); });
suite.test('face-detection-after-release', function() {
function startFaceDetection(p) {
try {
suite.camera.startFaceDetection();
ok(false, "startFaceDetection() should have failed");
} catch(e) {
ok(e.result === SpecialPowers.Cr.NS_ERROR_NOT_AVAILABLE,
"startFaceDetection() failed with: " + e.name);
}
}
function stopFaceDetection(p) {
try {
suite.camera.stopFaceDetection();
ok(false, "stopFaceDetection() should have failed");
} catch(e) {
ok(e.result === SpecialPowers.Cr.NS_ERROR_NOT_AVAILABLE,
"stopFaceDetection() failed with: " + e.name);
}
}
return suite.getCamera()
.then(cameraRelease, suite.rejectGetCamera)
.then(startFaceDetection, suite.rejectRelease)
.then(stopFaceDetection);
});
suite.test('set-configuration-after-release', function() { suite.test('set-configuration-after-release', function() {
function configure(p) { function configure(p) {
return suite.camera.setConfiguration(null); return suite.camera.setConfiguration(null);

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

@ -0,0 +1,165 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=940424
-->
<head>
<title>Bug 940424 - Test camera hardware API failure handling</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="camera_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=940424">Mozilla Bug 940424</a>
<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 suite = new CameraTestSuite();
suite.test('take-picture-failures', function() {
function startTakePictureProcessError(p) {
suite.hw.attach({
takePicture: function() {
suite.hw.fireTakePictureError();
}
});
return suite.camera.takePicture();
}
function rejectTakePictureProcessError(e) {
ok(e.name === 'NS_ERROR_FAILURE', 'takePicture() process should fail: ' + e);
}
function startTakePictureError(p) {
suite.hw.attach({
takePicture: function() {
throw SpecialPowers.Cr.NS_ERROR_FAILURE;
}
});
return suite.camera.takePicture();
}
function rejectTakePictureError(e) {
ok(e.name === 'NS_ERROR_FAILURE', 'takePicture() should fail: ' + e);
}
return suite.getCamera()
.catch(suite.rejectGetCamera)
.then(startTakePictureProcessError)
.then(suite.expectedRejectTakePicture, rejectTakePictureProcessError)
.then(startTakePictureError)
.then(suite.expectedRejectTakePicture, rejectTakePictureError)
});
suite.test('shutter', function() {
function shutter(p) {
return new Promise(function(resolve, reject) {
function onShutter(e) {
ok(true, 'received shutter event');
suite.camera.removeEventListener('shutter', onShutter);
resolve();
}
suite.camera.addEventListener('shutter', onShutter);
suite.hw.fireShutter();
});
}
return suite.getCamera()
.then(shutter, suite.rejectGetCamera)
});
suite.test('take-picture', function() {
suite.hw.params['picture-format-values'] = 'jpeg,png';
suite.hw.params['picture-format'] = 'jpeg';
var config = {
fileFormat: 'png',
latitude: 1.0,
longitude: 2.0,
altitude: 3.0,
timestamp: 4
};
var data = 'this is a test';
var eventPromise;
function takePicture(p) {
eventPromise = new Promise(function(resolve, reject) {
function onPicture(evt) {
ok(true, 'got picture event');
try {
verifyPicture(evt.data);
} catch(e) {
reject(e);
}
suite.camera.removeEventListener('picture', onPicture);
resolve();
}
suite.camera.addEventListener('picture', onPicture);
});
suite.hw.attach({
takePicture: function() {
ok(suite.hw.params['picture-format'] === 'png', "requested format is '" + suite.hw.params['picture-format'] + "'");
suite.hw.fireTakePictureComplete(new window.Blob([data], {'type': config.fileFormat}));
}
});
return suite.camera.takePicture(config);
}
function verifyPicture(blob) {
ok(blob.size == data.length, "picture blob is " + blob.size + " bytes");
ok(blob.type === 'image/' + config.fileFormat, "picture blob format is '" + blob.type + "'");
}
function tookPicture(p) {
ok(true, 'got picture promise');
verifyPicture(p);
return eventPromise;
}
return suite.getCamera()
.then(takePicture, suite.rejectGetCamera)
.then(tookPicture, suite.rejectTakePicture);
});
suite.test('take-picture-no-config', function() {
var data = 'this is a test';
var format = 'jpeg';
suite.hw.params['picture-format-values'] = 'jpeg,png';
suite.hw.params['picture-format'] = format;
function takePicture(p) {
suite.hw.attach({
takePicture: function() {
ok(suite.hw.params['picture-format'] === format, "requested format is '" + suite.hw.params['picture-format'] + "'");
suite.hw.fireTakePictureComplete(new window.Blob([data], {'type': format}));
}
});
return suite.camera.takePicture();
}
function verifyPicture(blob) {
ok(blob.size == data.length, "picture blob is " + blob.size + " bytes");
ok(blob.type === 'image/' + format, "picture blob format is '" + blob.type + "'");
}
return suite.getCamera()
.then(takePicture, suite.rejectGetCamera)
.then(verifyPicture, suite.rejectTakePicture);
});
suite.setup()
.then(suite.run);
</script>
</body>
</html>

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

@ -143,7 +143,7 @@ public class TabQueueService extends Service {
tabQueueHandler.postDelayed(stopServiceRunnable, TOAST_TIMEOUT); tabQueueHandler.postDelayed(stopServiceRunnable, TOAST_TIMEOUT);
return START_FLAG_REDELIVERY; return START_REDELIVER_INTENT;
} }
private void removeView() { private void removeView() {