Skip to content

Commit

Permalink
Bug 1317667 - Use dates further in the future in test_bookmark_duping…
Browse files Browse the repository at this point in the history
…. r=kitcambridge

MozReview-Commit-ID: 3R3tbbzio2I
  • Loading branch information
eoger committed Feb 27, 2017
1 parent 355235b commit c0f2382
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions services/sync/tests/unit/test_bookmark_duping.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ add_task(async function test_dupe_bookmark() {
parentid: folder1_guid,
};

collection.insert(newGUID, encryptPayload(to_apply), Date.now() / 1000 + 10);
collection.insert(newGUID, encryptPayload(to_apply), Date.now() / 1000 + 500);
_("Syncing so new dupe record is processed");
engine.lastSync = engine.lastSync - 0.01;
engine.sync();
Expand Down Expand Up @@ -215,7 +215,7 @@ add_task(async function test_dupe_reparented_bookmark() {
parentid: folder2_guid,
};

collection.insert(newGUID, encryptPayload(to_apply), Date.now() / 1000 + 10);
collection.insert(newGUID, encryptPayload(to_apply), Date.now() / 1000 + 500);

_("Syncing so new dupe record is processed");
engine.lastSync = engine.lastSync - 0.01;
Expand Down Expand Up @@ -281,7 +281,8 @@ add_task(async function test_dupe_reparented_locally_changed_bookmark() {
parentid: folder2_guid,
};

collection.insert(newGUID, encryptPayload(to_apply), Date.now() / 1000 + 10);
let deltaSeconds = 500;
collection.insert(newGUID, encryptPayload(to_apply), Date.now() / 1000 + deltaSeconds);

// Make a change to the bookmark that's a dupe, and set the modification
// time further in the future than the incoming record. This will cause
Expand All @@ -290,7 +291,7 @@ add_task(async function test_dupe_reparented_locally_changed_bookmark() {
await PlacesTestUtils.setBookmarkSyncFields({
guid: bmk1_guid,
syncChangeCounter: 1,
lastModified: Date.now() + 60000,
lastModified: Date.now() + (deltaSeconds + 10) * 1000,
});

_("Syncing so new dupe record is processed");
Expand Down Expand Up @@ -357,7 +358,7 @@ add_task(async function test_dupe_reparented_to_earlier_appearing_parent_bookmar
parentid: folder2_guid,
children: [newGUID],
tags: [],
}), Date.now() / 1000 + 10);
}), Date.now() / 1000 + 500);

// And also the update to "folder 2" that references the new parent.
collection.insert(folder2_guid, encryptPayload({
Expand All @@ -368,7 +369,7 @@ add_task(async function test_dupe_reparented_to_earlier_appearing_parent_bookmar
parentid: "toolbar",
children: [newParentGUID],
tags: [],
}), Date.now() / 1000 + 10);
}), Date.now() / 1000 + 500);

// Now create a new incoming record that looks alot like a dupe of the
// item in folder1_guid, with a record that points to a parent with the
Expand All @@ -381,7 +382,7 @@ add_task(async function test_dupe_reparented_to_earlier_appearing_parent_bookmar
parentName: "Folder 1",
parentid: newParentGUID,
tags: [],
}), Date.now() / 1000 + 10);
}), Date.now() / 1000 + 500);


_("Syncing so new records are processed.");
Expand Down Expand Up @@ -436,7 +437,7 @@ add_task(async function test_dupe_reparented_to_later_appearing_parent_bookmark(
parentName: "Folder 1",
parentid: newParentGUID,
tags: [],
}), Date.now() / 1000 + 10);
}), Date.now() / 1000 + 500);

// Now have the parent appear after (so when the record above is processed
// this is still unknown.)
Expand All @@ -448,7 +449,7 @@ add_task(async function test_dupe_reparented_to_later_appearing_parent_bookmark(
parentid: folder2_guid,
children: [newGUID],
tags: [],
}), Date.now() / 1000 + 10);
}), Date.now() / 1000 + 500);
// And also the update to "folder 2" that references the new parent.
collection.insert(folder2_guid, encryptPayload({
id: folder2_guid,
Expand All @@ -458,7 +459,7 @@ add_task(async function test_dupe_reparented_to_later_appearing_parent_bookmark(
parentid: "toolbar",
children: [newParentGUID],
tags: [],
}), Date.now() / 1000 + 10);
}), Date.now() / 1000 + 500);

_("Syncing so out-of-order records are processed.");
engine.lastSync = engine.lastSync - 0.01;
Expand Down Expand Up @@ -513,7 +514,7 @@ add_task(async function test_dupe_reparented_to_future_arriving_parent_bookmark(
parentName: "Folder 1",
parentid: newParentGUID,
tags: [],
}), Date.now() / 1000 + 10);
}), Date.now() / 1000 + 500);

_("Syncing so new dupe record is processed");
engine.lastSync = engine.lastSync - 0.01;
Expand Down Expand Up @@ -556,7 +557,7 @@ add_task(async function test_dupe_reparented_to_future_arriving_parent_bookmark(
parentid: folder2_guid,
children: [newGUID],
tags: [],
}), Date.now() / 1000 + 10);
}), Date.now() / 1000 + 500);
// We also queue an update to "folder 2" that references the new parent.
collection.insert(folder2_guid, encryptPayload({
id: folder2_guid,
Expand All @@ -566,7 +567,7 @@ add_task(async function test_dupe_reparented_to_future_arriving_parent_bookmark(
parentid: "toolbar",
children: [newParentGUID],
tags: [],
}), Date.now() / 1000 + 10);
}), Date.now() / 1000 + 500);

_("Syncing so missing parent appears");
engine.lastSync = engine.lastSync - 0.01;
Expand Down Expand Up @@ -622,7 +623,7 @@ add_task(async function test_dupe_empty_folder() {
parentName: "Bookmarks Toolbar",
parentid: "toolbar",
children: [],
}), Date.now() / 1000 + 10);
}), Date.now() / 1000 + 500);

_("Syncing so new dupe records are processed");
engine.lastSync = engine.lastSync - 0.01;
Expand Down

0 comments on commit c0f2382

Please sign in to comment.