Bug 890690 followup: simplify test

This commit is contained in:
Gavin Sharp 2013-07-25 17:48:17 -07:00
parent 8ecbcfc2a9
commit 7df07435cc

View File

@ -282,25 +282,23 @@ let gTests = [
Services.search.defaultEngine = currEngine;
});
let needle = "Search for something awesome.";
// Ready to execute the tests!
promiseBrowserAttributes(gBrowser.selectedTab).then(function() {
let document = gBrowser.selectedTab.linkedBrowser.contentDocument;
let searchText = document.getElementById("searchText");
let needle = "Search for something awesome.";
let document = gBrowser.selectedTab.linkedBrowser.contentDocument;
let searchText = document.getElementById("searchText");
waitForLoad(function() {
let loadedText = gBrowser.contentDocument.body.textContent;
ok(loadedText, "search page loaded");
is(loadedText, "searchterms=" + escape(needle.replace(/\s/g, "+")),
"Search text should arrive correctly");
deferred.resolve();
});
searchText.value = needle;
searchText.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
waitForLoad(function() {
let loadedText = gBrowser.contentDocument.body.textContent;
ok(loadedText, "search page loaded");
is(loadedText, "searchterms=" + escape(needle.replace(/\s/g, "+")),
"Search text should arrive correctly");
deferred.resolve();
});
searchText.value = needle;
searchText.focus();
EventUtils.synthesizeKey("VK_RETURN", {});
};
Services.obs.addObserver(searchObserver, "browser-search-engine-modified", false);
registerCleanupFunction(function () {