tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_osreauthenticator.js (1125B)


      1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
      2 // Any copyright is dedicated to the Public Domain.
      3 // http://creativecommons.org/publicdomain/zero/1.0/
      4 "use strict";
      5 
      6 // Tests nsIOSReauthenticator.asyncReauthenticateUser().
      7 // As this gets implemented on various platforms, running this test
      8 // will result in a prompt from the OS. Consequently, we won't be able
      9 // to run this in automation, but it will help in testing locally.
     10 add_task(async function test_asyncReauthenticateUser() {
     11  const reauthenticator = Cc[
     12    "@mozilla.org/security/osreauthenticator;1"
     13  ].getService(Ci.nsIOSReauthenticator);
     14  ok(reauthenticator, "nsIOSReauthenticator should be available");
     15  const EXPECTED = false; // Change this variable to suit your needs while testing.
     16  Assert.equal(
     17    (
     18      await reauthenticator.asyncReauthenticateUser(
     19        "this is the prompt string",
     20        "this is the caption string",
     21        null
     22      )
     23    )[0],
     24    EXPECTED,
     25    "nsIOSReauthenticator.asyncReauthenticateUser should return a boolean array with the first item being the authentication result of: " +
     26      EXPECTED
     27  );
     28 });