зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1006394 - Test installing apps from the webapp runtime. r=myk
This commit is contained in:
Родитель
db36f79c89
Коммит
01ca7d0c46
|
@ -0,0 +1,49 @@
|
|||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
let { WebappOSUtils } = Cu.import("resource://gre/modules/WebappOSUtils.jsm", {});
|
||||
|
||||
let url = "http://test/webapprtChrome/webapprt/test/chrome/sample.webapp";
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
loadWebapp("install-app.webapp", undefined, function onLoad() {
|
||||
|
||||
let dialogShown = false;
|
||||
|
||||
let winObserver = function(win, topic) {
|
||||
if (topic == "domwindowopened") {
|
||||
win.addEventListener("load", function onLoadWindow() {
|
||||
win.removeEventListener("load", onLoadWindow, false);
|
||||
|
||||
if (win.document.documentURI == "chrome://global/content/commonDialog.xul") {
|
||||
dialogShown = true;
|
||||
|
||||
executeSoon(() => {
|
||||
win.document.documentElement.acceptDialog();
|
||||
});
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
|
||||
Services.ww.registerNotification(winObserver);
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.ww.unregisterNotification(winObserver);
|
||||
});
|
||||
|
||||
let request = navigator.mozApps.install(url);
|
||||
request.onsuccess = function() {
|
||||
ok(dialogShown, "Install app dialog shown");
|
||||
ok(request.result, "App installed");
|
||||
|
||||
navigator.mozApps.mgmt.uninstall(request.result).onsuccess = function() {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
request.onerror = function() {
|
||||
ok(false, "Not installed: " + request.error.name);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Install Test App</title>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Install Test App</h1>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "Install Test App",
|
||||
"description": "an app for testing installing apps",
|
||||
"launch_path": "/webapprtChrome/webapprt/test/chrome/install-app.html"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
Content-Type: application/x-web-app-manifest+json
|
|
@ -46,18 +46,22 @@ support-files =
|
|||
download.webapp
|
||||
download.webapp^headers^
|
||||
download.test
|
||||
install-app.html
|
||||
install-app.webapp
|
||||
install-app.webapp^headers^
|
||||
|
||||
[browser_sample.js]
|
||||
[browser_window-title.js]
|
||||
[browser_webperm.js]
|
||||
[browser_noperm.js]
|
||||
[browser_geolocation-prompt-perm.js]
|
||||
[browser_geolocation-prompt-noperm.js]
|
||||
[browser_alarm.js]
|
||||
[browser_debugger.js]
|
||||
[browser_mozpay.js]
|
||||
[browser_download.js]
|
||||
[browser_geolocation-prompt-noperm.js]
|
||||
[browser_geolocation-prompt-perm.js]
|
||||
[browser_getUserMedia.js]
|
||||
[browser_install-app.js]
|
||||
[browser_mozpay.js]
|
||||
[browser_noperm.js]
|
||||
[browser_sample.js]
|
||||
[browser_webperm.js]
|
||||
[browser_window-open-blank.js]
|
||||
[browser_window-open-self.js]
|
||||
[browser_window-open.js]
|
||||
[browser_window-open-blank.js]
|
||||
[browser_alarm.js]
|
||||
[browser_download.js]
|
||||
[browser_window-title.js]
|
||||
|
|
Загрузка…
Ссылка в новой задаче