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