services/sync/tests/unit/fake_login_manager.js

branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
equal deleted inserted replaced
-1:000000000000 0:07793e7d8ac8
1 Cu.import("resource://services-sync/util.js");
2
3 // ----------------------------------------
4 // Fake Sample Data
5 // ----------------------------------------
6
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 ];
17
18 // ----------------------------------------
19 // Fake Login Manager
20 // ----------------------------------------
21
22 function FakeLoginManager(fakeLogins) {
23 this.fakeLogins = fakeLogins;
24
25 let self = this;
26
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