Bug 1384582 - Ensure browser_urlbar_search_reflows.js test runs are isolated. r?mconley
When running these tests with --verify the places results from
previous test runs can effect tests so give each test run a unique
search term to ensure that they do not.
MozReview-Commit-ID: Lp9YCoUdul5
--- a/browser/base/content/test/performance/browser.ini
+++ b/browser/base/content/test/performance/browser.ini
@@ -14,12 +14,12 @@ skip-if = !e10s
[browser_tabopen_reflows.js]
[browser_tabopen_squeeze_reflows.js]
[browser_tabstrip_overflow_underflow_reflows.js]
[browser_tabswitch_reflows.js]
[browser_toolbariconcolor_restyles.js]
[browser_urlbar_keyed_search_reflows.js]
skip-if = (os == 'linux') || (os == 'win' && debug) # Disabled on Linux and Windows debug 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
+skip-if = (os == 'linux') # Disabled on Linux and OS X opt due to frequent failures. Bug 1385932
[browser_windowclose_reflows.js]
[browser_windowopen_reflows.js]
skip-if = os == 'linux' # Disabled due to frequent failures. Bug 1380465.
--- a/browser/base/content/test/performance/browser_urlbar_search_reflows.js
+++ b/browser/base/content/test/performance/browser_urlbar_search_reflows.js
@@ -109,20 +109,20 @@ const EXPECTED_REFLOWS_SECOND_OPEN = [
"_openAutocompletePopup@chrome://browser/content/urlbarBindings.xml",
"openAutocompletePopup@chrome://browser/content/urlbarBindings.xml",
"openPopup@chrome://global/content/bindings/autocomplete.xml",
"set_popupOpen@chrome://global/content/bindings/autocomplete.xml",
],
},
];
-const SEARCH_TERM = "urlbar-reflows";
+const SEARCH_TERM = "urlbar-reflows-" + Date.now();
add_task(async function setup() {
- await addDummyHistoryEntries();
+ await addDummyHistoryEntries(SEARCH_TERM);
});
/**
* This test ensures that there are no unexpected
* uninterruptible reflows when typing into the URL bar
* with the default values in Places.
*/
add_task(async function() {
--- a/browser/base/content/test/performance/head.js
+++ b/browser/base/content/test/performance/head.js
@@ -1,10 +1,12 @@
"use strict";
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
+ "resource://gre/modules/PlacesUtils.jsm");
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.
*
* @param testFn (async function)
@@ -243,27 +245,30 @@ async function removeAllButFirstTab() {
gBrowser.removeAllTabsBut(gBrowser.tabs[0]);
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.
+ *
+ * @param searchStr (string)
+ * Optional text to add to the search history items.
*/
-async function addDummyHistoryEntries() {
- await PlacesTestUtils.clearHistory();
+async function addDummyHistoryEntries(searchStr = "") {
+ await PlacesUtils.history.clear();
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}`,
+ title: `Reflow test for URL bar entry #${i} - ${searchStr}`,
});
}
await PlacesTestUtils.addVisits(visits);
registerCleanupFunction(async function() {
- await PlacesTestUtils.clearHistory();
+ await PlacesUtils.history.clear();
});
}