toolkit/identity/tests/unit/test_identity_utils.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1
michael@0 2 "use strict";
michael@0 3
michael@0 4 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
michael@0 5 Cu.import('resource://gre/modules/Services.jsm');
michael@0 6 Cu.import('resource://gre/modules/identity/IdentityUtils.jsm');
michael@0 7
michael@0 8 function test_check_deprecated() {
michael@0 9 let options = {
michael@0 10 id: 123,
michael@0 11 loggedInEmail: "jed@foo.com",
michael@0 12 pies: 42
michael@0 13 };
michael@0 14
michael@0 15 do_check_true(checkDeprecated(options, "loggedInEmail"));
michael@0 16 do_check_false(checkDeprecated(options, "flans"));
michael@0 17
michael@0 18 run_next_test();
michael@0 19 }
michael@0 20
michael@0 21 function test_check_renamed() {
michael@0 22 let options = {
michael@0 23 id: 123,
michael@0 24 loggedInEmail: "jed@foo.com",
michael@0 25 pies: 42
michael@0 26 };
michael@0 27
michael@0 28 checkRenamed(options, "loggedInEmail", "loggedInUser");
michael@0 29
michael@0 30 // It moves loggedInEmail to loggedInUser
michael@0 31 do_check_false(!!options.loggedInEmail);
michael@0 32 do_check_eq(options.loggedInUser, "jed@foo.com");
michael@0 33
michael@0 34 run_next_test();
michael@0 35 }
michael@0 36
michael@0 37 let TESTS = [
michael@0 38 test_check_deprecated,
michael@0 39 test_check_renamed
michael@0 40 ];
michael@0 41
michael@0 42 TESTS.forEach(add_test);
michael@0 43
michael@0 44 function run_test() {
michael@0 45 run_next_test();
michael@0 46 }

mercurial