Bug 1094761 - Fix browser_contextSearchTabPosition.js to not hit the network. r=Florian

MozReview-Commit-ID: 9VrFlhmWaXv
This commit is contained in:
Felipe Gomes 2016-02-16 13:28:40 -02:00
parent 93529db5ca
commit 0deabace67
3 changed files with 13 additions and 8 deletions

View File

@ -290,8 +290,6 @@ skip-if = os == 'win' || e10s # Bug 1159268 - Need a content-process safe versio
skip-if = e10s # Bug 1094510 - test hits the network in e10s mode only
[browser_clipboard.js]
[browser_contentAreaClick.js]
[browser_contextSearchTabPosition.js]
skip-if = os == "mac" || e10s # bug 967013; e10s: bug 1094761 - test hits the network in e10s, causing next test to crash
[browser_ctrlTab.js]
[browser_datachoices_notification.js]
skip-if = !datareporting

View File

@ -21,6 +21,8 @@ support-files =
[browser_bing.js]
[browser_bing_behavior.js]
[browser_contextmenu.js]
[browser_contextSearchTabPosition.js]
skip-if = os == "mac" # bug 967013
[browser_eBay.js]
[browser_eBay_behavior.js]
[browser_google.js]

View File

@ -3,12 +3,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(function* test() {
// Will need to be changed if Google isn't the default search engine.
// Note: geoSpecificDefaults are disabled for mochitests, so this is the
// non-US en-US default.
let histogramKey = "google.contextmenu";
let engine = yield promiseNewEngine("testEngine.xml");
let histogramKey = "other-" + engine.name + ".contextmenu";
let numSearchesBefore = 0;
try {
let hs = Services.telemetry.getKeyedHistogramById("SEARCH_COUNTS").snapshot();
if (histogramKey in hs) {
@ -19,7 +17,7 @@ add_task(function* test() {
}
let tabs = [];
let tabsLoadedDeferred = Promise.defer();
let tabsLoadedDeferred = new Deferred();
function tabAdded(event) {
let tab = event.target;
@ -54,3 +52,10 @@ add_task(function* test() {
Assert.equal(hs[histogramKey].sum, numSearchesBefore + 2,
"The histogram must contain the correct search count");
});
function Deferred() {
this.promise = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
}