diff --git a/toolkit/webapps/moz.build b/toolkit/webapps/moz.build index a8b7e824e024..69fb0356bba2 100644 --- a/toolkit/webapps/moz.build +++ b/toolkit/webapps/moz.build @@ -9,7 +9,7 @@ EXTRA_PP_JS_MODULES += [ 'WebappOSUtils.jsm', ] -MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini'] +TEST_DIRS += ['tests'] if CONFIG['MOZ_BUILD_APP'] == 'mobile/android': DEFINES['MOZ_FENNEC'] = True diff --git a/toolkit/webapps/tests/Makefile.in b/toolkit/webapps/tests/Makefile.in new file mode 100644 index 000000000000..4cc7f8191209 --- /dev/null +++ b/toolkit/webapps/tests/Makefile.in @@ -0,0 +1,7 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +PROGRAMS_DEST = $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir) + +include $(topsrcdir)/config/rules.mk diff --git a/toolkit/webapps/tests/TestWebappRT.cpp b/toolkit/webapps/tests/TestWebappRT.cpp new file mode 100644 index 000000000000..bc1c0dd768e6 --- /dev/null +++ b/toolkit/webapps/tests/TestWebappRT.cpp @@ -0,0 +1,7 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +int main(int argc, char *argv[]) { + return 42; +} diff --git a/toolkit/webapps/tests/chrome.ini b/toolkit/webapps/tests/chrome.ini index 288dd77c97f4..ba89fca7dcde 100644 --- a/toolkit/webapps/tests/chrome.ini +++ b/toolkit/webapps/tests/chrome.ini @@ -29,3 +29,4 @@ skip-if = asan skip-if = asan [test_hosted_icons.xul] [test_packaged_icons.xul] +[test_webapp_runtime_executable_update.xul] diff --git a/toolkit/webapps/tests/head.js b/toolkit/webapps/tests/head.js index 42296983fabc..4554eba7065b 100644 --- a/toolkit/webapps/tests/head.js +++ b/toolkit/webapps/tests/head.js @@ -155,6 +155,8 @@ function TestAppInfo(aApp, aIsPackaged) { this.iconFile = OS.Path.join(this.installPath, "icon.png"); + this.webappINI = OS.Path.join(this.installPath, "webapp.ini"); + let xdg_data_home = Cc["@mozilla.org/process/environment;1"]. getService(Ci.nsIEnvironment). get("XDG_DATA_HOME"); @@ -167,7 +169,7 @@ function TestAppInfo(aApp, aIsPackaged) { this.installedFiles = [ OS.Path.join(this.installPath, "webapp.json"), - OS.Path.join(this.installPath, "webapp.ini"), + this.webappINI, this.iconFile, this.exePath, desktopINI, @@ -179,7 +181,7 @@ function TestAppInfo(aApp, aIsPackaged) { ]; this.updatedFiles = [ OS.Path.join(this.installPath, "webapp.json"), - OS.Path.join(this.installPath, "webapp.ini"), + this.webappINI, this.iconFile, desktopINI, ]; @@ -215,6 +217,8 @@ function TestAppInfo(aApp, aIsPackaged) { this.iconFile = OS.Path.join(this.installPath, "chrome", "icons", "default", "default.ico"); + this.webappINI = OS.Path.join(this.installPath, "webapp.ini"); + let desktopShortcut = OS.Path.join(OS.Constants.Path.desktopDir, aApp.name + ".lnk"); let startMenuShortcut = OS.Path.join(OS.Constants.Path.winStartMenuProgsDir, @@ -222,7 +226,7 @@ function TestAppInfo(aApp, aIsPackaged) { this.installedFiles = [ OS.Path.join(this.installPath, "webapp.json"), - OS.Path.join(this.installPath, "webapp.ini"), + this.webappINI, OS.Path.join(this.installPath, "uninstall", "shortcuts_log.ini"), OS.Path.join(this.installPath, "uninstall", "uninstall.log"), OS.Path.join(this.installPath, "uninstall", "webapp-uninstaller.exe"), @@ -241,7 +245,7 @@ function TestAppInfo(aApp, aIsPackaged) { ]; this.updatedFiles = [ OS.Path.join(this.installPath, "webapp.json"), - OS.Path.join(this.installPath, "webapp.ini"), + this.webappINI, OS.Path.join(this.installPath, "uninstall", "shortcuts_log.ini"), OS.Path.join(this.installPath, "uninstall", "uninstall.log"), this.iconFile, @@ -312,13 +316,15 @@ function TestAppInfo(aApp, aIsPackaged) { this.iconFile = OS.Path.join(this.installPath, "Contents", "Resources", "appicon.icns"); + this.webappINI = OS.Path.join(this.installPath, "Contents", "MacOS", "webapp.ini"); + let appProfileDir = OS.Path.join(OS.Constants.Path.macUserLibDir, "Application Support", this.uniqueName); this.installedFiles = [ OS.Path.join(this.installPath, "Contents", "Info.plist"), - OS.Path.join(this.installPath, "Contents", "MacOS", "webapp.ini"), + this.webappINI, OS.Path.join(appProfileDir, "webapp.json"), this.iconFile, this.exePath, @@ -331,7 +337,7 @@ function TestAppInfo(aApp, aIsPackaged) { ]; this.updatedFiles = [ OS.Path.join(this.installPath, "Contents", "Info.plist"), - OS.Path.join(this.installPath, "Contents", "MacOS", "webapp.ini"), + this.webappINI, OS.Path.join(appProfileDir, "webapp.json"), this.iconFile, ]; diff --git a/toolkit/webapps/tests/moz.build b/toolkit/webapps/tests/moz.build new file mode 100644 index 000000000000..b39ce28c6f84 --- /dev/null +++ b/toolkit/webapps/tests/moz.build @@ -0,0 +1,9 @@ +# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +MOCHITEST_CHROME_MANIFESTS += ['chrome.ini'] +SOURCES += ['TestWebappRT.cpp' ] +SIMPLE_PROGRAMS += ['TestWebappRT'] diff --git a/toolkit/webapps/tests/test_webapp_runtime_executable_update.xul b/toolkit/webapps/tests/test_webapp_runtime_executable_update.xul new file mode 100644 index 000000000000..9886fc061311 --- /dev/null +++ b/toolkit/webapps/tests/test_webapp_runtime_executable_update.xul @@ -0,0 +1,158 @@ + + + + + + + + +