commit 4fa1872c817518dce11d7552a64abbf6e0066c0a Author: Ryan VanderMeulen ryanvm@gmail.com Date: Tue May 20 20:57:37 2014 -0400
Backed out changeset ae70b479d2ff (bug 998303) for mochitest-bc failures. --- .../test/browser_urlbar_search_healthreport.js | 50 +++++--------------- 1 file changed, 12 insertions(+), 38 deletions(-)
diff --git a/browser/base/content/test/browser_urlbar_search_healthreport.js b/browser/base/content/test/browser_urlbar_search_healthreport.js index e97cf00..4315a98 100644 --- a/browser/base/content/test/browser_urlbar_search_healthreport.js +++ b/browser/base/content/test/browser_urlbar_search_healthreport.js @@ -42,49 +42,23 @@ function test() { let tab = gBrowser.addTab(); gBrowser.selectedTab = tab;
- let searchStr = "firefox health report"; - let expectedURL = Services.search.currentEngine. - getSubmission(searchStr, "", "keyword").uri.spec; + gURLBar.value = "firefox health report"; + gURLBar.handleCommand();
- // Expect the search URL to load but stop it as soon as it starts. - let loadPromise = waitForDocLoadAndStopIt(expectedURL); + executeSoon(() => executeSoon(() => { + gBrowser.removeTab(tab);
- // Meanwhile, poll for the new measurement. - let count = 0; - let measurementDeferred = Promise.defer(); - function getNewMeasurement() { - if (count++ >= 10) { - ok(false, "Timed out waiting for new measurement"); - measurementDeferred.resolve(); - return; - } m.getValues().then(function onData(data) { - if (data.days.hasDay(now)) { - let day = data.days.getDay(now); - if (day.has(field)) { - let newCount = day.get(field); - if (newCount > oldCount) { - is(newCount, oldCount + 1, - "Exactly one search has been recorded."); - measurementDeferred.resolve(); - return; - } - } - } - executeSoon(getNewMeasurement); - }); - } - executeSoon(getNewMeasurement); + ok(data.days.hasDay(now), "FHR has data for today."); + let day = data.days.getDay(now); + ok(day.has(field), "FHR has url bar count for today.");
- // Trigger the search. - gURLBar.value = searchStr; - gURLBar.handleCommand(); + let newCount = day.get(field);
- // Wait for the page load and new measurement. - Promise.all([loadPromise, measurementDeferred.promise]).then(() => { - gBrowser.removeTab(tab); - finish(); - }); + is(newCount, oldCount + 1, "Exactly one search has been recorded."); + finish(); + }); + })); }); }); }
tbb-commits@lists.torproject.org