[tbb-commits] [tor-browser/esr24] Bug 998303 - browser/base/content/test/browser_urlbar_search_healthreport.js attempts to connect to www.google.com. r=mak, a=test-only
mikeperry at torproject.org
mikeperry at torproject.org
Fri Aug 29 05:26:40 UTC 2014
commit d724ed8688db13a9fa421c6713e4168530f63bb4
Author: Drew Willcoxon <adw at mozilla.com>
Date: Thu May 15 19:04:47 2014 -0700
Bug 998303 - browser/base/content/test/browser_urlbar_search_healthreport.js attempts to connect to www.google.com. r=mak, a=test-only
---
.../test/browser_urlbar_search_healthreport.js | 50 +++++++++++++++-----
1 file changed, 38 insertions(+), 12 deletions(-)
diff --git a/browser/base/content/test/browser_urlbar_search_healthreport.js b/browser/base/content/test/browser_urlbar_search_healthreport.js
index 4315a98..e97cf00 100644
--- a/browser/base/content/test/browser_urlbar_search_healthreport.js
+++ b/browser/base/content/test/browser_urlbar_search_healthreport.js
@@ -42,23 +42,49 @@ function test() {
let tab = gBrowser.addTab();
gBrowser.selectedTab = tab;
- gURLBar.value = "firefox health report";
- gURLBar.handleCommand();
+ let searchStr = "firefox health report";
+ let expectedURL = Services.search.currentEngine.
+ getSubmission(searchStr, "", "keyword").uri.spec;
- executeSoon(() => executeSoon(() => {
- gBrowser.removeTab(tab);
+ // Expect the search URL to load but stop it as soon as it starts.
+ let loadPromise = waitForDocLoadAndStopIt(expectedURL);
+ // 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) {
- 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.");
+ 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);
- let newCount = day.get(field);
+ // Trigger the search.
+ gURLBar.value = searchStr;
+ gURLBar.handleCommand();
- is(newCount, oldCount + 1, "Exactly one search has been recorded.");
- finish();
- });
- }));
+ // Wait for the page load and new measurement.
+ Promise.all([loadPromise, measurementDeferred.promise]).then(() => {
+ gBrowser.removeTab(tab);
+ finish();
+ });
});
});
}
More information about the tbb-commits
mailing list