michael@0: Cu.import("resource://services-sync/util.js"); michael@0: michael@0: // ---------------------------------------- michael@0: // Fake Sample Data michael@0: // ---------------------------------------- michael@0: michael@0: let fakeSampleLogins = [ michael@0: // Fake nsILoginInfo object. michael@0: {hostname: "www.boogle.com", michael@0: formSubmitURL: "http://www.boogle.com/search", michael@0: httpRealm: "", michael@0: username: "", michael@0: password: "", michael@0: usernameField: "test_person", michael@0: passwordField: "test_password"} michael@0: ]; michael@0: michael@0: // ---------------------------------------- michael@0: // Fake Login Manager michael@0: // ---------------------------------------- michael@0: michael@0: function FakeLoginManager(fakeLogins) { michael@0: this.fakeLogins = fakeLogins; michael@0: michael@0: let self = this; michael@0: michael@0: // Use a fake nsILoginManager object. michael@0: delete Services.logins; michael@0: Services.logins = { michael@0: removeAllLogins: function() { self.fakeLogins = []; }, michael@0: getAllLogins: function() { return self.fakeLogins; }, michael@0: addLogin: function(login) { michael@0: getTestLogger().info("nsILoginManager.addLogin() called " + michael@0: "with hostname '" + login.hostname + "'."); michael@0: self.fakeLogins.push(login); michael@0: } michael@0: }; michael@0: }