michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: //Basic tests to verify that MacWebAppUtils works michael@0: michael@0: let Ci = Components.interfaces; michael@0: let Cc = Components.classes; michael@0: let Cu = Components.utils; michael@0: let Cr = Components.results; michael@0: michael@0: Cu.import("resource://gre/modules/Services.jsm"); michael@0: Cu.import("resource://gre/modules/XPCOMUtils.jsm"); michael@0: michael@0: function test_find_app() michael@0: { michael@0: var mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"]. michael@0: createInstance(Ci.nsIMacWebAppUtils); michael@0: let sig = "com.apple.TextEdit"; michael@0: michael@0: let path; michael@0: path = mwaUtils.pathForAppWithIdentifier(sig); michael@0: do_print("TextEdit path: " + path + "\n"); michael@0: do_check_neq(path, ""); michael@0: } michael@0: michael@0: function test_dont_find_fake_app() michael@0: { michael@0: var mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"]. michael@0: createInstance(Ci.nsIMacWebAppUtils); michael@0: let sig = "calliope.penitentiary.dramamine"; michael@0: michael@0: let path; michael@0: path = mwaUtils.pathForAppWithIdentifier(sig); michael@0: do_check_eq(path, ""); michael@0: } michael@0: michael@0: michael@0: function run_test() michael@0: { michael@0: test_find_app(); michael@0: test_dont_find_fake_app(); michael@0: }