Skip to content

Commit

Permalink
Backed out changeset e903ef2fd85a (bug 1387088) for win debug failure…
Browse files Browse the repository at this point in the history
…s like browser_urlbar_keyed_search_reflows.js a=backout CLOSED TREE

MozReview-Commit-ID: 6awooAlq2m4
  • Loading branch information
KWierso committed Aug 23, 2017
1 parent b03d50a commit f398b49
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 242 deletions.
2 changes: 0 additions & 2 deletions browser/base/content/test/performance/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ skip-if = !debug
[browser_tabstrip_overflow_underflow_reflows.js]
[browser_tabswitch_reflows.js]
[browser_toolbariconcolor_restyles.js]
[browser_urlbar_keyed_search_reflows.js]
skip-if = os == 'linux' # Disabled on Linux due to perma failures. Bug 1392320.
[browser_urlbar_search_reflows.js]
skip-if = (os == 'linux') || (os == 'mac' && !debug) # Disabled on Linux and OS X opt due to frequent failures. Bug 1385932 and Bug 1384582
[browser_windowclose_reflows.js]
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
// time. On slower builds, we need to boost our allowed test time.
requestLongerTimeout(5);

XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
"resource://testing-common/PlacesTestUtils.jsm");

/**
* WHOA THERE: We should never be adding new things to EXPECTED_REFLOWS. This
* is a whitelist that should slowly go away as we improve the performance of
Expand Down Expand Up @@ -145,10 +148,59 @@ const EXPECTED_REFLOWS_SECOND_OPEN = [
},
];

/**
* Returns a Promise that resolves once the AwesomeBar popup for a particular
* window has appeared after having done a search for its input text.
*
* @param win (browser window)
* The window to do the search in.
* @returns Promise
*/
async function promiseAutocompleteResultPopup(win) {
let URLBar = win.gURLBar;
URLBar.controller.startSearch(URLBar.value);
await BrowserTestUtils.waitForEvent(URLBar.popup, "popupshown");
await BrowserTestUtils.waitForCondition(() => {
return URLBar.controller.searchStatus >=
Ci.nsIAutoCompleteController.STATUS_COMPLETE_NO_MATCH;
});
let matchCount = URLBar.popup._matchCount;
await BrowserTestUtils.waitForCondition(() => {
return URLBar.popup.richlistbox.childNodes.length == matchCount;
});

URLBar.controller.stopSearch();
// There are several setTimeout(fn, 0); calls inside autocomplete.xml
// that we need to wait for. Since those have higher priority than
// idle callbacks, we can be sure they will have run once this
// idle callback is called. The timeout seems to be required in
// automation - presumably because the machines can be pretty busy
// especially if it's GC'ing from previous tests.
await new Promise(resolve => win.requestIdleCallback(resolve, { timeout: 1000 }));

let hiddenPromise = BrowserTestUtils.waitForEvent(URLBar.popup, "popuphidden");
EventUtils.synthesizeKey("VK_ESCAPE", {}, win);
await hiddenPromise;
}

const SEARCH_TERM = "urlbar-reflows";

add_task(async function setup() {
await addDummyHistoryEntries();
const NUM_VISITS = 10;
let visits = [];

for (let i = 0; i < NUM_VISITS; ++i) {
visits.push({
uri: `http://example.com/urlbar-reflows-${i}`,
title: `Reflow test for URL bar entry #${i}`,
});
}

await PlacesTestUtils.addVisits(visits);

registerCleanupFunction(async function() {
await PlacesTestUtils.clearHistory();
});
});

/**
Expand Down Expand Up @@ -183,29 +235,7 @@ add_task(async function() {
oldResultsAdded();
};

URLBar.controller.startSearch(URLBar.value);
await BrowserTestUtils.waitForEvent(URLBar.popup, "popupshown");
await BrowserTestUtils.waitForCondition(() => {
return URLBar.controller.searchStatus >=
Ci.nsIAutoCompleteController.STATUS_COMPLETE_NO_MATCH;
});
let matchCount = URLBar.popup._matchCount;
await BrowserTestUtils.waitForCondition(() => {
return URLBar.popup.richlistbox.childNodes.length == matchCount;
});

URLBar.controller.stopSearch();
// There are several setTimeout(fn, 0); calls inside autocomplete.xml
// that we need to wait for. Since those have higher priority than
// idle callbacks, we can be sure they will have run once this
// idle callback is called. The timeout seems to be required in
// automation - presumably because the machines can be pretty busy
// especially if it's GC'ing from previous tests.
await new Promise(resolve => win.requestIdleCallback(resolve, { timeout: 1000 }));

let hiddenPromise = BrowserTestUtils.waitForEvent(URLBar.popup, "popuphidden");
EventUtils.synthesizeKey("VK_ESCAPE", {}, win);
await hiddenPromise;
await promiseAutocompleteResultPopup(win);
};

await withReflowObserver(testFn, EXPECTED_REFLOWS_FIRST_OPEN, win);
Expand Down
33 changes: 0 additions & 33 deletions browser/base/content/test/performance/head.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
"use strict";

XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
"resource://testing-common/PlacesTestUtils.jsm");

/**
* Async utility function for ensuring that no unexpected uninterruptible
* reflows occur during some period of time in a window.
Expand Down Expand Up @@ -97,12 +92,6 @@ async function withReflowObserver(testFn, expectedReflows = [], win = window) {
return;
}

// synthesizeKey from EventUtils.js causes us to reflow. That's the test
// harness and we don't care about that, so we'll filter that out.
if (path.startsWith("synthesizeKey@chrome://mochikit/content/tests/SimpleTest/EventUtils.js")) {
return;
}

let index = expectedReflows.findIndex(reflow => path.startsWith(reflow.stack.join("|")));

if (index != -1) {
Expand Down Expand Up @@ -235,25 +224,3 @@ async function removeAllButFirstTab() {
await BrowserTestUtils.waitForCondition(() => gBrowser.tabs.length == 1);
await SpecialPowers.popPrefEnv();
}

/**
* Adds some entries to the Places database so that we can
* do semi-realistic look-ups in the URL bar.
*/
async function addDummyHistoryEntries() {
const NUM_VISITS = 10;
let visits = [];

for (let i = 0; i < NUM_VISITS; ++i) {
visits.push({
uri: `http://example.com/urlbar-reflows-${i}`,
title: `Reflow test for URL bar entry #${i}`,
});
}

await PlacesTestUtils.addVisits(visits);

registerCleanupFunction(async function() {
await PlacesTestUtils.clearHistory();
});
}

0 comments on commit f398b49

Please sign in to comment.