Bug 1569414 - Don't hardcode a too old history visit date in test_Chrome_history.js.

Differential Revision: https://phabricator.services.mozilla.com/D39606

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matthew Noorenberghe 2019-07-27 15:57:53 +00:00
Родитель 44ccf4da4e
Коммит 4501fe3c9e
1 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -78,6 +78,13 @@ async function setVisitTimes(time) {
await dbConn.close();
}
function setExpectedVisitTimes(time) {
for (let urlInfo of TEST_URLS) {
urlInfo.last_visit_time = time;
urlInfo.visits[0].visit_time = time;
}
}
function assertEntryMatches(entry, urlInfo, dateWasInFuture = false) {
info(`Checking url: ${urlInfo.url}`);
Assert.ok(entry, `Should have stored an entry`);
@ -146,6 +153,11 @@ add_task(async function setup() {
add_task(async function test_import() {
setupHistoryFile();
await PlacesUtils.history.clear();
// Update to ~10 days ago since the date can't be too old or Places may expire it.
const pastDate = new Date(new Date().getTime() - 1000 * 60 * 60 * 24 * 10);
const pastChromeTime = ChromeMigrationUtils.dateToChromeTime(pastDate);
await setVisitTimes(pastChromeTime);
setExpectedVisitTimes(pastChromeTime);
let migrator = await MigrationUtils.getMigrator("chrome");
Assert.ok(