1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/docshell/test/browser/browser_search_notification.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,30 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +function test() { 1.8 + waitForExplicitFinish(); 1.9 + 1.10 + let tab = gBrowser.addTab(); 1.11 + gBrowser.selectedTab = tab; 1.12 + 1.13 + function observer(subject, topic, data) { 1.14 + Services.obs.removeObserver(observer, "keyword-search"); 1.15 + is(topic, "keyword-search", "Got keyword-search notification"); 1.16 + 1.17 + let engine = Services.search.defaultEngine; 1.18 + ok(engine, "Have default search engine."); 1.19 + is(engine, subject, "Notification subject is engine."); 1.20 + is("firefox health report", data, "Notification data is search term."); 1.21 + 1.22 + executeSoon(function cleanup() { 1.23 + gBrowser.removeTab(tab); 1.24 + finish(); 1.25 + }); 1.26 + } 1.27 + 1.28 + Services.obs.addObserver(observer, "keyword-search", false); 1.29 + 1.30 + gURLBar.value = "firefox health report"; 1.31 + gURLBar.handleCommand(); 1.32 +} 1.33 +