diff -r 000000000000 -r 6474c204b198 docshell/test/browser/browser_search_notification.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docshell/test/browser/browser_search_notification.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,30 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +function test() { + waitForExplicitFinish(); + + let tab = gBrowser.addTab(); + gBrowser.selectedTab = tab; + + function observer(subject, topic, data) { + Services.obs.removeObserver(observer, "keyword-search"); + is(topic, "keyword-search", "Got keyword-search notification"); + + let engine = Services.search.defaultEngine; + ok(engine, "Have default search engine."); + is(engine, subject, "Notification subject is engine."); + is("firefox health report", data, "Notification data is search term."); + + executeSoon(function cleanup() { + gBrowser.removeTab(tab); + finish(); + }); + } + + Services.obs.addObserver(observer, "keyword-search", false); + + gURLBar.value = "firefox health report"; + gURLBar.handleCommand(); +} +