|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 //Basic tests to verify that MacWebAppUtils works |
|
7 |
|
8 let Ci = Components.interfaces; |
|
9 let Cc = Components.classes; |
|
10 let Cu = Components.utils; |
|
11 let Cr = Components.results; |
|
12 |
|
13 Cu.import("resource://gre/modules/Services.jsm"); |
|
14 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
|
15 |
|
16 function test_find_app() |
|
17 { |
|
18 var mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"]. |
|
19 createInstance(Ci.nsIMacWebAppUtils); |
|
20 let sig = "com.apple.TextEdit"; |
|
21 |
|
22 let path; |
|
23 path = mwaUtils.pathForAppWithIdentifier(sig); |
|
24 do_print("TextEdit path: " + path + "\n"); |
|
25 do_check_neq(path, ""); |
|
26 } |
|
27 |
|
28 function test_dont_find_fake_app() |
|
29 { |
|
30 var mwaUtils = Cc["@mozilla.org/widget/mac-web-app-utils;1"]. |
|
31 createInstance(Ci.nsIMacWebAppUtils); |
|
32 let sig = "calliope.penitentiary.dramamine"; |
|
33 |
|
34 let path; |
|
35 path = mwaUtils.pathForAppWithIdentifier(sig); |
|
36 do_check_eq(path, ""); |
|
37 } |
|
38 |
|
39 |
|
40 function run_test() |
|
41 { |
|
42 test_find_app(); |
|
43 test_dont_find_fake_app(); |
|
44 } |