michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: Cu.import("resource://services-sync/constants.js"); michael@0: Cu.import("resource://services-sync/status.js"); michael@0: Cu.import("resource://services-sync/util.js"); michael@0: Cu.import("resource://testing-common/services/sync/utils.js"); michael@0: michael@0: function run_test() { michael@0: initTestLogging("Trace"); michael@0: ensureLegacyIdentityManager(); michael@0: michael@0: try { michael@0: _("Ensure fresh config."); michael@0: Status._authManager.deleteSyncCredentials(); michael@0: michael@0: _("Fresh setup, we're not configured."); michael@0: do_check_eq(Status.checkSetup(), CLIENT_NOT_CONFIGURED); michael@0: do_check_eq(Status.login, LOGIN_FAILED_NO_USERNAME); michael@0: Status.resetSync(); michael@0: michael@0: _("Let's provide a username."); michael@0: Status._authManager.username = "johndoe"; michael@0: do_check_eq(Status.checkSetup(), CLIENT_NOT_CONFIGURED); michael@0: do_check_eq(Status.login, LOGIN_FAILED_NO_PASSWORD); michael@0: Status.resetSync(); michael@0: michael@0: do_check_neq(Status._authManager.username, null); michael@0: michael@0: _("Let's provide a password."); michael@0: Status._authManager.basicPassword = "carotsalad"; michael@0: do_check_eq(Status.checkSetup(), CLIENT_NOT_CONFIGURED); michael@0: do_check_eq(Status.login, LOGIN_FAILED_NO_PASSPHRASE); michael@0: Status.resetSync(); michael@0: michael@0: _("Let's provide a passphrase"); michael@0: Status._authManager.syncKey = "a-bcdef-abcde-acbde-acbde-acbde"; michael@0: _("checkSetup()"); michael@0: do_check_eq(Status.checkSetup(), STATUS_OK); michael@0: Status.resetSync(); michael@0: michael@0: } finally { michael@0: Svc.Prefs.resetBranch(""); michael@0: } michael@0: }