|
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 } |