Update browser_lastAccessedTab.js for bug 980231
authorDão Gottwald <dao@mozilla.com>
Wed, 26 Nov 2014 15:09:01 +0100
changeset 217682 fd58f9be4a4d5d28a0724da7ec03fc8bea616cd0
parent 217681 e3230aab66da13e550c1904572c46517c5515621
child 217683 2f2f5bddfa605255c0149bcae9e709a29f111b55
push id27887
push userryanvm@gmail.com
push dateThu, 27 Nov 2014 02:08:38 +0000
treeherdermozilla-central@c63e741bca2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs980231
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Update browser_lastAccessedTab.js for bug 980231
browser/base/content/test/general/browser_lastAccessedTab.js
--- a/browser/base/content/test/general/browser_lastAccessedTab.js
+++ b/browser/base/content/test/general/browser_lastAccessedTab.js
@@ -1,24 +1,35 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+let originalTab;
+let newTab;
+
 function test() {
-  let originalTab = gBrowser.selectedTab;
-  isnot(originalTab.lastAccessed, 0, "selectedTab has been selected");
-  ok(originalTab.lastAccessed <= Date.now(), "selectedTab has a valid timestamp");
+  waitForExplicitFinish();
+
+  originalTab = gBrowser.selectedTab;
+  setTimeout(step2, 100);
+}
 
-  let newTab = gBrowser.addTab("about:blank", {skipAnimation: true});
-  is(newTab.lastAccessed, 0, "newTab hasn't been selected so far");
+function step2() {
+  is(originalTab.lastAccessed, Date.now(), "selected tab has the current timestamp");
+  newTab = gBrowser.addTab("about:blank", {skipAnimation: true});
+  setTimeout(step3, 100);
+}
 
+function step3() {
+  ok(newTab.lastAccessed < Date.now(), "new tab hasn't been selected so far");
   gBrowser.selectedTab = newTab;
-
-  isnot(newTab.lastAccessed, 0, "newTab has been selected");
-  ok(newTab.lastAccessed <= Date.now(), "newTab has a valid timestamp");
+  is(newTab.lastAccessed, Date.now(), "new tab has the current timestamp after being selected");
+  setTimeout(step4, 100);
+}
 
-  isnot(originalTab.lastAccessed, 0, "originalTab has been selected");
-  ok(originalTab.lastAccessed <= Date.now(), "originalTab has a valid timestamp");
-
-  ok(originalTab.lastAccessed <= newTab.lastAccessed,
-     "originalTab's timestamp must be lower than newTab's");
+function step4() {
+  ok(originalTab.lastAccessed < Date.now(),
+     "original tab has old timestamp after being deselected");
+  is(newTab.lastAccessed, Date.now(),
+     "new tab has the current timestamp since it's still selected");
 
   gBrowser.removeTab(newTab);
+  finish();
 }