mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1006394 - Test installing apps from the webapp runtime. r=myk
This commit is contained in:
parent
db36f79c89
commit
01ca7d0c46
49
webapprt/test/chrome/browser_install-app.js
Normal file
49
webapprt/test/chrome/browser_install-app.js
Normal file
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
10
webapprt/test/chrome/install-app.html
Normal file
10
webapprt/test/chrome/install-app.html
Normal file
@ -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>
|
5
webapprt/test/chrome/install-app.webapp
Normal file
5
webapprt/test/chrome/install-app.webapp
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "Install Test App",
|
||||
"description": "an app for testing installing apps",
|
||||
"launch_path": "/webapprtChrome/webapprt/test/chrome/install-app.html"
|
||||
}
|
1
webapprt/test/chrome/install-app.webapp^headers^
Normal file
1
webapprt/test/chrome/install-app.webapp^headers^
Normal file
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user