Bug 874847 - Fix intermittent failure in browser_lastAccessedTab.js by including some fudge in the Date.now comparison. r=ttaubert

This commit is contained in:
Drew Willcoxon 2013-09-27 23:47:18 -07:00
parent 03ca5a1de6
commit b1565a78e6

View File

@ -17,7 +17,9 @@ function test() {
gBrowser.selectedTab = newTab;
let newTabAccessedDate = newTab.lastAccessed;
ok(newTabAccessedDate > 0, "Timestamp on the selected tab is more than 0.");
ok(newTabAccessedDate <= Date.now(), "Timestamp less than or equal current Date.");
// Date.now is not guaranteed to be monotonic, so include one second of fudge.
let now = Date.now() + 1000;
ok(newTabAccessedDate <= now, "Timestamp less than or equal current Date: " + newTabAccessedDate + " <= " + now);
gBrowser.selectedTab = originalTab;
is(newTab.lastAccessed, newTabAccessedDate, "New tab's timestamp remains the same.");
gBrowser.removeTab(newTab);