services/sync/tests/unit/fake_login_manager.js

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     1 Cu.import("resource://services-sync/util.js");
     3 // ----------------------------------------
     4 // Fake Sample Data
     5 // ----------------------------------------
     7 let fakeSampleLogins = [
     8   // Fake nsILoginInfo object.
     9   {hostname: "www.boogle.com",
    10    formSubmitURL: "http://www.boogle.com/search",
    11    httpRealm: "",
    12    username: "",
    13    password: "",
    14    usernameField: "test_person",
    15    passwordField: "test_password"}
    16 ];
    18 // ----------------------------------------
    19 // Fake Login Manager
    20 // ----------------------------------------
    22 function FakeLoginManager(fakeLogins) {
    23   this.fakeLogins = fakeLogins;
    25   let self = this;
    27   // Use a fake nsILoginManager object.
    28   delete Services.logins;
    29   Services.logins = {
    30       removeAllLogins: function() { self.fakeLogins = []; },
    31       getAllLogins: function() { return self.fakeLogins; },
    32       addLogin: function(login) {
    33         getTestLogger().info("nsILoginManager.addLogin() called " +
    34                              "with hostname '" + login.hostname + "'.");
    35         self.fakeLogins.push(login);
    36       }
    37   };
    38 }

mercurial