1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/tests/unit/test_macwebapputils.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,44 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +//Basic tests to verify that MacWebAppUtils works 1.10 + 1.11 +let Ci = Components.interfaces; 1.12 +let Cc = Components.classes; 1.13 +let Cu = Components.utils; 1.14 +let Cr = Components.results; 1.15 + 1.16 +Cu.import("resource://gre/modules/Services.jsm"); 1.17 +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); 1.18 + 1.19 +function test_find_app() 1.20 +{ 1.21 + var mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"]. 1.22 + createInstance(Ci.nsIMacWebAppUtils); 1.23 + let sig = "com.apple.TextEdit"; 1.24 + 1.25 + let path; 1.26 + path = mwaUtils.pathForAppWithIdentifier(sig); 1.27 + do_print("TextEdit path: " + path + "\n"); 1.28 + do_check_neq(path, ""); 1.29 +} 1.30 + 1.31 +function test_dont_find_fake_app() 1.32 +{ 1.33 + var mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"]. 1.34 + createInstance(Ci.nsIMacWebAppUtils); 1.35 + let sig = "calliope.penitentiary.dramamine"; 1.36 + 1.37 + let path; 1.38 + path = mwaUtils.pathForAppWithIdentifier(sig); 1.39 + do_check_eq(path, ""); 1.40 +} 1.41 + 1.42 + 1.43 +function run_test() 1.44 +{ 1.45 + test_find_app(); 1.46 + test_dont_find_fake_app(); 1.47 +}