mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 1031855 - Add test that sync password application does the right thing for duplicates. r=markh
MozReview-Commit-ID: HIrWdzAZmkC --HG-- extra : rebase_source : e5e172f0a07716fc569b91fa4ab91ff99aa654a0
This commit is contained in:
parent
88643a509c
commit
e3b03845cc
@ -171,3 +171,50 @@ add_task(async function test_password_engine() {
|
||||
await cleanup(engine, server);
|
||||
}
|
||||
});
|
||||
|
||||
add_task(async function test_password_dupe() {
|
||||
let engine = Service.engineManager.get("passwords");
|
||||
|
||||
let server = await serverForFoo(engine);
|
||||
await SyncTestingInfrastructure(server);
|
||||
let collection = server.user("foo").collection("passwords");
|
||||
|
||||
let guid1 = Utils.makeGUID();
|
||||
let guid2 = Utils.makeGUID();
|
||||
let details = {
|
||||
formSubmitURL: "https://www.example.com",
|
||||
hostname: "https://www.example.com",
|
||||
httpRealm: null,
|
||||
username: "foo",
|
||||
password: "bar",
|
||||
usernameField: "username-field",
|
||||
passwordField: "password-field",
|
||||
timeCreated: Date.now(),
|
||||
timePasswordChanged: Date.now(),
|
||||
};
|
||||
|
||||
|
||||
_("Create remote record with same details and guid1");
|
||||
collection.insertRecord(Object.assign({}, details, { id: guid1 }));
|
||||
|
||||
_("Create remote record with guid2");
|
||||
collection.insertRecord(Object.assign({}, details, { id: guid2 }));
|
||||
|
||||
_("Create local record with same details and guid1");
|
||||
await engine._store.create(Object.assign({}, details, { id: guid1 }));
|
||||
|
||||
try {
|
||||
_("Perform sync");
|
||||
await sync_engine_and_validate_telem(engine, false);
|
||||
|
||||
let logins = Services.logins.findLogins({}, "https://www.example.com", "", "");
|
||||
|
||||
equal(logins.length, 1);
|
||||
equal(logins[0].QueryInterface(Ci.nsILoginMetaInfo).guid, guid2);
|
||||
equal(null, collection.payload(guid1));
|
||||
|
||||
} finally {
|
||||
await cleanup(engine, server);
|
||||
}
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user