widget/tests/unit/test_macwebapputils.js

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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/. */
     6 //Basic tests to verify that MacWebAppUtils works
     8 let Ci = Components.interfaces;
     9 let Cc = Components.classes;
    10 let Cu = Components.utils;
    11 let Cr = Components.results;
    13 Cu.import("resource://gre/modules/Services.jsm");
    14 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
    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";
    22   let path;
    23   path = mwaUtils.pathForAppWithIdentifier(sig);
    24   do_print("TextEdit path: " + path + "\n");
    25   do_check_neq(path, "");
    26 }
    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";
    34   let path;
    35   path = mwaUtils.pathForAppWithIdentifier(sig);
    36   do_check_eq(path, "");
    37 }
    40 function run_test()
    41 {
    42   test_find_app();
    43   test_dont_find_fake_app();
    44 }

mercurial