mobile/android/base/tests/testAccounts.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/base/tests/testAccounts.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,24 @@
     1.4 +// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
     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 file,
     1.7 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +Components.utils.import("resource://gre/modules/Accounts.jsm");
    1.10 +
    1.11 +add_task(function test_Accounts() {
    1.12 +  let syncExists = yield Accounts.syncAccountsExist();
    1.13 +  dump("Sync account exists? " + syncExists + "\n");
    1.14 +  let firefoxExists = yield Accounts.firefoxAccountsExist();
    1.15 +  dump("Firefox account exists? " + firefoxExists + "\n");
    1.16 +  let anyExists = yield Accounts.anySyncAccountsExist();
    1.17 +  dump("Any accounts exist? " + anyExists + "\n");
    1.18 +
    1.19 +  // Only one account should exist.
    1.20 +  do_check_true(!syncExists || !firefoxExists);
    1.21 +  do_check_eq(anyExists, firefoxExists || syncExists);
    1.22 +
    1.23 +  dump("Launching setup.\n");
    1.24 +  Accounts.launchSetup();
    1.25 +});
    1.26 +
    1.27 +run_next_test();

mercurial