summaryrefslogtreecommitdiff
path: root/browser/base/content
diff options
context:
space:
mode:
Diffstat (limited to 'browser/base/content')
-rw-r--r--browser/base/content/test/browser_urlbar_search_healthreport.js50
1 files 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 e97cf00c6..4315a9864 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();
+ });
+ }));
});
});
}